I am trying to turn an m2ts to an mp4 and add geotagging metadata to it in the process. I am using the following command
ffmpeg -i input.m2ts -movflags use_metadata_tags -map_metadata 0 -metadata location=41.380+2.180 -metadata location-eng=41.380+2.180 -vcodec libx264 -crf 20 -acodec ac3 output.mp4
Here's the exiftool info of the source m2ts (with grep for Date):
[File] FileModifyDate : 2011:10:09 20:39:52+02:00
[File] FileAccessDate : 2021:05:01 17:00:35+02:00
[File] FileInodeChangeDate : 2021:05:01 17:00:35+02:00
[H264] DateTimeOriginal : 2010:05:10 17:08:03+02:00
And here it is for the destination mp4 file:
[File] FileModifyDate : 2021:05:01 17:29:21+02:00
[File] FileAccessDate : 2021:05:01 17:28:59+02:00
[File] FileInodeChangeDate : 2021:05:01 17:29:21+02:00
[QuickTime] CreateDate : 0000:00:00 00:00:00
[QuickTime] ModifyDate : 0000:00:00 00:00:00
[QuickTime] TrackCreateDate : 0000:00:00 00:00:00
[QuickTime] TrackModifyDate : 0000:00:00 00:00:00
[QuickTime] MediaCreateDate : 0000:00:00 00:00:00
[QuickTime] MediaModifyDate : 0000:00:00 00:00:00
[QuickTime] TrackCreateDate : 0000:00:00 00:00:00
[QuickTime] TrackModifyDate : 0000:00:00 00:00:00
[QuickTime] MediaCreateDate : 0000:00:00 00:00:00
[QuickTime] MediaModifyDate : 0000:00:00 00:00:00
These fields with 0's are a problem for me (Google Photos will think the file was created in 2021 instead of 2010).
I expected the Date/Time Original field to be copied over either as it is, or its value to go into the Create Date field of the mp4.
Any idea of how to get the value of Date/Time Original into the Create Date, keeping in mind that I am trying to automate a process and use this process to, umm, process tens of thousands of files ?
Thank you.
exiftool -time:all -G -a -s file.m2ts
DateTimeOriginal
in the original is part of the Modified Digital Video Pack Metadata. You'll have to check to see if it's supported by FFMpeg. I wouldn't know how to deal with it in FFMpeg but you could batch copy it with exiftool withexiftool -TagsFromFile %d%f.m2ts "-AllDates<DateTimeOriginal" -api QuickTimeUTC /path/to/files/
That command assumes the m2ts and mp4s are in the same folder.