8

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 2

14

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 exiftool to check that it worked; exiftool test.mov and exiftool test-nometadata.mov should show you the difference.

  • Here are my sample outputs from an old Nikon .mov with tons of metadata (pastebin'd):

    1. before - 80 metadata lines
    2. 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)

9
  • I get this when I try to do as you've suggested. Commented May 20, 2012 at 15:56
  • That's because you're using a non-standard ffmpeg git-2012-05-13-a927641, not the standard libav one from the official repos. My version is 0.8.1-4:0.8.1-0ubuntu1 and works fine.
    – ish
    Commented May 21, 2012 at 3:41
  • Ach. That's because I was following these instructions which required the latest ffmpeg. I'll ask on meta if this question should be removed from askubuntu since it's not possible with ubuntu's ffmpeg. Commented May 21, 2012 at 14:14
  • -1, izx, what kind of order is that?! FFmpeg clearly assumes every codec stated before -i as the codec to parse input with. You can't parse input with copy. "Copy" is not a valid decoder, so naturally, the command will fail. You just have to move -i test.mov before the vcodec/acodec and it'll work. You might want to replace vcodec with c:v and acodec with c:a as well, since they've been deprecated for like… forever. This is not a deficiency of a "non-standard" version. It's just the latest version.
    – slhck
    Commented May 21, 2012 at 14:36
  • you know, then you might want to lobby Ubuntu to switch to ffmpeg instead of libav. I am well aware of the issues you point out BUT this syntax is the only one that works with the (deprecated) ffmpeg included in Ubuntu's libav. Our purpose at AskUbuntu is to work with whatever tools Ubuntu makes available by default, not help out with unofficial forks or even self-compiled bleeding edge git pulls or third-party PPAs.
    – ish
    Commented May 21, 2012 at 14:44
3

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .