How to Remove Metadata From MP4 Files
Many tools, including ffmpeg
, write rather useless metadata into the files
they create. In most files I use personally, I have no need for this data to be
there in the first place.
Researching how to accomplish this lead me down a couple of rabbit holes. I found it surprising that none of the usual MPEG-4 editing tools like the MP4v2 Library and MP4Box are up to the task. The only tool working as expected is ExifTool, a Perl library and command-line script. In most Unix-like operating systems it can be found in the default package manager.
Its name is misleading, as it does not only remove EXIF metadata from image files but rather all kinds of metadata from all kinds of media files.
Just deleting all the metadata from a media file is done like this:
exiftool -all= /path/to/file
By default, the application creates backups with an _original
suffix before
modifying the given file. If you don’t want this and are confident that it
works as expected, you can skip this:
exiftool -overwrite_original_in_place -all= /path/to/file
If you are fine with rewriting (not recompressing) a file, you can use ffmpeg
to do it:
ffmpeg -i /path/to/input.mp4 -map 0 -map_metadata -1 -c copy /path/to/output.mp4