<p>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</p>
<pre><code>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
</code></pre>
<p>Here's the exiftool info of the source m2ts (with grep for Date):</p>
<pre><code>[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
</code></pre>
<p>And here it is for the destination mp4 file:</p>
<pre><code>[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
</code></pre>
<p>These fields with 0's are a problem for me (Google Photos will think the file was created in 2021 instead of 2010).</p>
<p>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.</p>
<p>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 ?</p>
<p>Thank you.</p>

CC BY-SA 4.0
2021-04-28T15:42:08.923Z
It would be useful to know the actual location of that tag. By default, exiftool only lists descriptions (see [FAQ #2](https://exiftool.org/faq.html#Q2)).  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
CC BY-SA 4.0
2021-05-01T15:36:34.933Z
@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
CC BY-SA 4.0
2021-05-01T19:52:33.580Z
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](https://exiftool.org/TagNames/H264.html).  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
CC BY-SA 4.0
2021-05-03T01:28:53.737Z
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
CC BY-SA 4.0
2021-05-03T01:29:31.847Z
@StarGeek you can post a reply so I can mark it as the correct one.
D. Joe
CC BY-SA 4.0
2021-05-03T15:13:31.133Z
I don't really know what answer you pulled out of that.  You can write up what you came up with and mark your own answer as the correct one.  See [Can I answer my own question?](https://stackoverflow.com/help/self-answer)
StarGeek
<ffmpeg><mp4><metadata>
Converting m2ts to mp4 with ffmpeg I get empty date fields
D. Joe
# Converting m2ts to mp4 with ffmpeg I get empty date fields

(Asked by: username_0 on 2021-04-28)

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.

**Tags:** ffmpeg, mp4, metadata

> **Comments:**
> **username_1**: It would be useful to know the actual location of that tag. By default, exiftool only lists descriptions (see [FAQ #2](https://exiftool.org/faq.html#Q2)).  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`  
> **username_0**: @username_1 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.  
> **username_1**: 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](https://exiftool.org/TagNames/H264.html).  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.  
> **username_0**: 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 !!  
> **username_0**: @username_1 you can post a reply so I can mark it as the correct one.  
> **username_1**: I don't really know what answer you pulled out of that.  You can write up what you came up with and mark your own answer as the correct one.  See [Can I answer my own question?](https://stackoverflow.com/help/self-answer)  

---

## 0 answers

