Remove All Metadata with FFmpeg map_metadata
When sharing or publishing media files, removing personal or
unnecessary metadata is crucial for privacy and file size optimization.
This article provides a quick, straight-to-the-point guide on how to
strip all metadata from any audio or video file using the FFmpeg
command-line tool, specifically utilizing the powerful
-map_metadata -1 option.
The Basic Command
To clear all global metadata from an input file without re-encoding the video or audio streams, use the following command structure:
ffmpeg -i input.mp4 -map_metadata -1 -c copy output.mp4How the Command Works
-i input.mp4: Specifies the path to your source file.-map_metadata -1: This is the key option. The value-1tells FFmpeg to map none of the metadata from the input file to the output file, effectively stripping all global metadata tags (such as creation time, encoder details, and title).-c copy: Copies both the video and audio streams directly without re-encoding them. This ensures the process is nearly instantaneous and does not cause any loss in quality.output.mp4: The name of your new, metadata-free file.
Advanced: Removing Stream-Specific Metadata and Chapters
While -map_metadata -1 clears global metadata, some
files may contain metadata embedded within individual streams (like
specific audio track titles) or chapter information. To ensure an
absolutely clean file, you can expand the command:
ffmpeg -i input.mp4 -map_metadata -1 -map_metadata:s:v -1 -map_metadata:s:a -1 -map_chapters -1 -c copy output.mp4-map_metadata:s:v -1: Clears metadata from the video stream.-map_metadata:s:a -1: Clears metadata from the audio stream.-map_chapters -1: Removes all chapter markers and chapter-related metadata.