Remove metadata from a video with FFmpeg
Metadata lives in the container, so it can be dropped while copying the streams. The test file was tagged with a title, a comment, a GPS location, two chapters and a 90 degree rotation to see exactly what each command removes.
Verified with FFmpeg 9.0.1 on 26 August 2026. Search intent: ffmpeg remove metadata.
ffmpeg -i input.mp4 -map 0:v -map 0:a -map_metadata -1 -map_chapters -1 -c copy output.mp4Copies the video and audio streams and drops the global tags, the stream tags and the chapters. On the test file the title, comment, location and chapter names were gone and the output was the same size as the untagged original.
Flags, explained
- -map_metadata -1
- Do not copy any metadata from any input into the output.
- -map_chapters -1
- Drop the chapter list.
- -map 0:v -map 0:a
- Copy only the video and audio streams, leaving data and subtitle tracks behind.
- -c copy
- No decoding or encoding; the operation took 0.1 s on the test file.
- -fflags +bitexact
- Stop FFmpeg from writing its version into the encoder tag.
- -display_rotation 0
- Input option that replaces the display matrix, removing the rotation flag.
Variants
Keep the chapters, drop the rest
ffmpeg -i input.mp4 -map 0 -map_metadata -1 -c copy output.mp4Chapter markers survive but lose their titles, since titles are metadata. -map 0 copies every stream, see the pitfall about the chapter text track.
Also remove the encoder tag
ffmpeg -i input.mp4 -map 0:v -map 0:a -map_metadata -1 -map_chapters -1 -c copy -fflags +bitexact -flags:v +bitexact -flags:a +bitexact output.mp4FFmpeg normally writes its own encoder tag (Lavf63...) into the file it creates. The bitexact flags stop that. Rotation and handler names remain.
Clear the rotation as well
ffmpeg -display_rotation 0 -i input.mp4 -map 0:v -map 0:a -map_metadata -1 -map_chapters -1 -c copy output.mp4Rotation is stored as a display matrix in stream side data, not as a tag, so -map_metadata leaves it alone. -display_rotation 0 before -i overrides it, and the copied output had no rotation entry.
Pitfalls we hit
- With -map 0 the chapter text track of an MP4 is copied as a stray data stream even after -map_chapters -1: the output gained a bin_data stream labelled GoPro MET. -map 0:v -map 0:a avoids it.
- The encoder tag comes back: FFmpeg writes Lavf63.1.101 into every file it muxes unless the bitexact flags are set.
- Rotation survives. -map_metadata -1 left rotation: 90 in the stream side data, and the old -metadata:s:v rotate=0 trick did nothing. Use -display_rotation 0.
- handler_name is reset to VideoHandler and SoundHandler rather than removed, and the language tag stays und. That is how the MP4 muxer writes streams, not leftover metadata.
- Metadata inside the codec bitstream (x264 settings in SEI messages, for example) is not metadata to the container and is kept by -c copy.
How we verified it
Run with FFmpeg 9.0.1 on 26 August 2026 against a 12 s H.264/AAC file tagged with title, comment, location, a custom handler_name, two named chapters and a 90 degree display rotation (4,896,877 bytes). Primary command: no format or stream tags left except major_brand, minor_version, compatible_brands and encoder, no chapters, rotation 90 kept, 4,896,094 bytes, identical to the untagged original. -map 0 variant: chapters kept without titles plus an extra bin_data stream. bitexact variant: encoder tags gone, rotation kept. -display_rotation 0 variant: no rotation side data.
The same edit as a typed operation
strip_video_metadata copies the streams without re-encoding, drops tags and chapters and keeps the orientation so the picture still displays the right way up. The cleaned MP4 comes back as a signed URL.
{
"inputs": [{ "id": "main", "url": "https://example.com/video.mp4" }]
}FAQ
Does removing metadata re-encode the video?
No. With -c copy the compressed streams are written as they are; only the container is rewritten, so the file keeps its quality and the command runs in a fraction of a second.
Why does the output still contain an encoder tag?
FFmpeg adds its own Lavf tag to every file it creates. It is not copied from the input. Add -fflags +bitexact with the per-stream bitexact flags to suppress it.
Does this remove GPS coordinates?
Yes for the location tags in the MP4 container, which is where phones store them. On the test file location and location-eng were gone after -map_metadata -1.
Why is my video still rotated after stripping metadata?
Rotation is a display matrix in the stream side data, not a tag, so it is preserved on purpose. Use -display_rotation 0 before -i if you really want to drop it, and expect a sideways picture.
Related commands
- ffmpeg mov to mp4Convert MOV to MP4 with FFmpegRead
- ffmpeg compress videoCompress a video with FFmpegRead
- ffmpeg trim videoTrim a video with FFmpegRead