How to Remove Specific Metadata in FFmpeg
This article explains how to delete specific metadata keys from a media file using FFmpeg without re-encoding the original streams. You will learn the exact commands to target and clear individual global tags, strip metadata from specific audio or video streams, and remove multiple selected tags simultaneously in a single command.
Clearing a Specific Global Metadata Key
To remove a specific metadata key (such as title,
artist, or comment) from a file, you set that
key to an empty value using the -metadata option. By
pairing this with -c copy, FFmpeg will modify the metadata
instantly without re-encoding the video or audio streams.
Use the following command structure:
ffmpeg -i input.mp4 -metadata title="" -c copy output.mp4In this example, the title metadata key is cleared,
while all other metadata and stream data remain intact.
Clearing Multiple Specific Metadata Keys
You can clear multiple metadata keys at the same time by repeating
the -metadata flag for each key you want to remove.
ffmpeg -i input.mp4 -metadata title="" -metadata artist="" -metadata date="" -c copy output.mp4This command removes the title, artist, and
date tags from the output file in a single pass.
Clearing Metadata from Specific Streams
Metadata can exist globally or within specific streams (such as a
specific audio track or subtitle track). To clear a metadata key from a
specific stream, use a stream specifier with the -metadata
option:
:s:atargets audio streams.:s:vtargets video streams.
For example, to remove the title tag from only the first
audio stream:
ffmpeg -i input.mkv -metadata:s:a:0 title="" -c copy output.mkvTo remove the language tag from the first subtitle
stream:
ffmpeg -i input.mkv -metadata:s:s:0 language="" -c copy output.mkvNote: Clearing Specific vs. All Metadata
If your goal is to delete all metadata rather than specific
keys, you should use the -map_metadata -1 flag instead:
ffmpeg -i input.mp4 -map_metadata -1 -c copy output.mp4However, to keep most of your metadata and only target specific
unwanted fields, sticking to the -metadata key="" method is
the correct approach.