Delving into Delusion

Changing mp4 CreationDates with Exiftool

 November 14, 2020      Stardate: 74336.9     Tagged as: Exiftool

I assume there is a tiny cell battery inside my GoPro that keeps the settings and such for a short period while the main battery is removed or charging. I had removed the battery and let the GoPro set for a while and the date setting reset. I hadn’t noticed when I inserted a battery and started filming all the videos had a creation date of 2016-04-23 which was exactly 1600 days before the real date. I don’t know why… I’m sure there is a real-time clock inside and the reset date has to do with some default value.

So the problem is - how do I change a bunch of exif date data-fields in my mp4s? I want to change the date but also I want to keep the time.

Enter Exiftool!

I really like exiftool, it is an amazing utility. Let’s start by looking at all the data fields that contain dates.

exiftool -time:all -a -G0:1 -s filename.mp4

As you would expect there are multiple date fields set by GoPro in the mp4 container.

There are multiple solutions… we could set each field individually and explicitly.

exiftool -CreateDate="2020:08:20 00:46:59" -ModifyDate="2020:08:20 00:46:59" -Track*Date="2020:08:20 00:46:59" -Media*Date="2020:08:20 00:46:59" filename.mp4

Not surprisingly, Phil Harvey (the awesome author of exiftool) has created a magic tag names “time:all”. This makes our command a bit easier.

exiftool -time:all="2020:08:20 00:46:59" filename.mp4

WOW! Check out all these fields. This definitely changes all the time fields.

This would work for a file or two, but I want to change a couple dozen files and the above solution would require me to enter the date and time for each file. The solution is time-shifting. As stated earlier in this post, the files are 1600 days behind the current date. We can time-shift the dates forward by 1600 days.

exiftools -time:all+="00:00:1600 0" filename.mp4

The format for the date/time is YY:MM:DD HH:MM:SS. Note that “0” in the time field is shorthand for 00:00:00 and if you enter a time value then it won’t work.

The final command to shift all MP4 files in a directory forward by 1600 days is:

exiftools -time:all+="00:00:1600 0" *.mp4

Bonus Command

My Android camera names pictures as YYYYMMDD_xxxxxx.jpg and I’ve grown to like this convention. It allows me to sort, filter, find pictures easier by looking at the date in the file name. I’d like my GoPro videos to follow the same convention so that when I combine photos and videos in a directory I have a built-in timeline.

exiftool -r '-FileName<CreateDate' -d '%Y%m%d_%%f.%%e' *.MP4

This was found in the exiftools online forum: https://exiftool.org/forum/index.php?topic=8552.0

Software Versions

This is an automated list of software versions used during the writing of this article.

SoftwareVersion
OS Ubuntu 20.04 LTS
Exiftool 11.88