0

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.

6
  • It would be useful to know the actual location of that tag. By default, exiftool only lists descriptions (see FAQ #2). Try this command on the file to see the groups the tags belong to as well as tags will duplicate names exiftool -time:all -G -a -s file.m2ts
    – StarGeek
    Apr 28 '21 at 15:42
  • @StarGeek I have updated the question with the info you asked for. All those quicktime tags, no idea where they come from, and why the DateTimeOriginal tag isn't copied over, which is what I was hoping for.
    – D. Joe
    May 1 '21 at 15:36
  • The Quicktime tags are all part of the MP4 format. In this case they're all unset, which is why they're all 0s. The 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 with exiftool -TagsFromFile %d%f.m2ts "-AllDates<DateTimeOriginal" -api QuickTimeUTC /path/to/files/ That command assumes the m2ts and mp4s are in the same folder.
    – StarGeek
    May 1 '21 at 19:52
  • ffmpeg didn't seem to be able to copy over the DateTimeOriginal tag, and Google Photos didn't seem to read it anyway from m2ts files, so I ended up having to turn all m2ts files to mp4, even those who had all the metadata I wanted. I wrote my own bit of software to call ffmpeg because I wanted to do some more stuff and needed a UI. Thanks for your answers !!
    – D. Joe
    May 3 '21 at 1:28
  • @StarGeek you can post a reply so I can mark it as the correct one.
    – D. Joe
    May 3 '21 at 1:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.