Add date metadata to MP4 videos


As ever, notes to myself. I hope you appreciate this future me!

Photographs often contain EXIF metadata - really useful for finding out when a photo was taken. It turns out that you can add similar metadata to MP4 format videos.

Here's how to do it with ffmpeg on Ubuntu Linux. The magic option is -metadata creation_time="2015-12-25T12:34:56" Stick that in when you're encoding your video and it will be added to the new file.

The time should be in ISO8601.

If you have a video that you don't want to re-encode, you can do this.

ffmpeg -i original.mp4 -c copy -map 0 -metadata creation_time="2015-12-25T12:34:56" output.mp4

To check it has worked:

ffprobe -show_streams -show_format output.mp4

Should spit out a whole bunch of metadata, including

TAG:creation_time=2016-12-25T12:34:56.000000Z

2 thoughts on “Add date metadata to MP4 videos

  1. This is also mostly a note to myself ;)

    ISO8601 datetimes are localtime unless an offset is specified. If you need that, here's how to do it (examples for CET):

    2016-12-25T12:34:56+01:00
    or
    2016-12-25T12:34:56+0100
    or
    2016-12-25T12:34:56+01

    Syntax note: If you live on the western hemisphere, the plus becomes a minus.

    And in the metadata that got read out (TAG:creation_time=2016-12-25T12:34:56.000000Z), the "Z" stands for Zulu time, which is an alias for UTC or offset +00:00

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: