My camera takes .mov files as movies. How can I remove all metadata from them so I can feel confident sharing them on youtube without accidentally sharing when/where they were filmed, what type of camera I have, etc. A command line one-liner is nice, but if it's too confusing, a GUI program would be better.
2 Answers
Well, I have a command-line answer:
Note: This only works with the ffmpeg included in Ubuntu by default: it will have a version similar to 0.8.1-4:0.8.1-0ubuntu1; it WILL NOT work with any ffmpeg binaries you have installed from a third-party PPA or compiled yourself. Your mileage may vary.
- Install these:
sudo apt-get install ffmpeg libimage-exiftool-perl - Then navigate to where your source .mov file is, we'll call it
test.mov And run:
ffmpeg -i test.mov -map_metadata -1 -vcodec copy -acodec copy test-nometadata.mov
You can then use
exiftoolto check that it worked;exiftool test.movandexiftool test-nometadata.movshould show you the difference.Here are my sample outputs from an old Nikon .mov with tons of metadata (pastebin'd):
- before - 80 metadata lines
- after - 52 metadata lines (even the create, modify etc.times have been nulled)
(note that the order in ffmpeg above is essential -- the input and output files must be specified at the very end)
- 143
- 6
- 141,990
NOTE: with a recent version of ffmpeg (and presumably avconv, but I haven't tested that), you can simply use:
ffmpeg -i input.mp4 -map 0 -map_metadata -1 -c copy output.mp4
Using -map_metadata -1 creates an empty 'dummy' metadata source. For the version of avconv in the repos, or other outdated versions, use the method described below.
Using avconv (or ffmpeg if that's your weapon of choice, the syntax is the same):
The easiest way to do this is to set -map_metadata to use one of the input streams, rather than using global metadata. 99% of the time this should work.
avconv -i input.mp4 -map 0 -map_metadata 0:s:0 -c copy output.mp4
This will take the metadata from the first data stream (normally the video stream) and use that to replace the global metadata of the container file. This works because most of the time, the data streams have no meaningful metadata written to them; however, sometimes they do, and you want to completely get rid of that metadata. Unfortunately, the only way I can think of to do this used a pipe and two avconv processes.
avconv -i input.mp4 -f wav - | avconv -i - -i input.mp4 -map 1 -map_metadata 0 -c copy output.mp4
This takes advantage of the fact that WAV files can't contain metadata (since the format was created before metadata tags existed).
Both of these methods blanked all metadata on a file I just tested them on - all that exiftool reported on was the codec information, and avprobe reported no metadata to me. Using a pipe for this is pretty ugly, and the first method will work in 99% of cases, so that should be preferred.
BONUS: to create a blanked version of every MP4 in a directory, and then replace the metadata versions with the blanked versions (warning - pretty much irreversible):
for f in *.mp4; do avconv -i "$f" -map 0 -map_metadata 0:s:0 -c copy "out.$f"; mv "out.$f" "$f"; done
- 4,625