Set creation date & DTO from date created in mp4

Started by jgoossen, March 05, 2024, 05:59:27 PM

Previous topic - Next topic

jgoossen

Hello :)
I couldn't find an answer to this by searching the forum: how do I set "creation date" and "DateTimeOriginal" from "date created" in an mp4 file?
Annoyingly, it shows up in my timeline under 1904 rather than 2012. And there's a number of other mp4s that have the same issue.
Your help would be greatly appreciated!

StarGeek Edit: Moved date/time tags to top
>exiftool "20120310_193728.mp4"
ExifTool Version Number        : 12.73
File Name                      : 20120310_193728.mp4
Directory                      : .
File Size                      : 21 MB
File Modification Date/Time    : 2024:02:04 19:27:33+01:00
File Access Date/Time          : 2024:03:05 23:08:48+01:00
File Creation Date/Time        : 2012:05:21 22:42:43+02:00
File Permissions               : -rw-rw-rw-
File Type                      : 3GP
File Type Extension            : 3gp
Create Date                    : 0000:00:00 00:00:00
Modify Date                    : 0000:00:00 00:00:00
Track Create Date              : 0000:00:00 00:00:00
Track Modify Date              : 0000:00:00 00:00:00
Media Create Date              : 0000:00:00 00:00:00
Media Modify Date              : 0000:00:00 00:00:00
Date/Time Original             : 1904:01:01 01:00:00+01:00
Creation Date                  : 1904:01:01 01:00:00+01:00
Date Created                   : 2012:03:10 19:37:28

...

MIME Type                      : video/3gpp
Major Brand                    : 3GPP Media (.3GP) Release 4
Minor Version                  : 0.3.0
Compatible Brands              : 3gp4, 3gp6
Movie Header Version           : 0
Time Scale                     : 1000
Duration                       : 0:03:37
Preferred Rate                 : 1
Preferred Volume               : 100.00%
Preview Time                   : 0 s
Preview Duration               : 0 s
Poster Time                    : 0 s
Selection Time                 : 0 s
Selection Duration             : 0 s
Current Time                   : 0 s
Next Track ID                  : 3
Track Header Version           : 0
Track ID                       : 1
Track Duration                 : 0:03:37
Track Layer                    : 0
Track Volume                   : 0.00%
Image Width                    : 320
Image Height                   : 240
Graphics Mode                  : srcCopy
Op Color                       : 0 0 0
Compressor ID                  : avc1
Source Image Width             : 320
Source Image Height            : 240
X Resolution                   : 72
Y Resolution                   : 72
Bit Depth                      : 24
Video Frame Rate               : 29.927
Matrix Structure               : 1 0 0 0 1 0 0 0 1
Media Header Version           : 0
Media Time Scale               : 44100
Media Duration                 : 0:03:37
Handler Description            : SoundHandler
Balance                        : 0
Audio Format                   : mp4a
Audio Channels                 : 1
Audio Bits Per Sample          : 16
Audio Sample Rate              : 44100
Play Mode                      : SEQ_PLAY
Handler Type                   : Metadata Tags
XMP Toolkit                    : Image::ExifTool 12.71
Media Data Size                : 20768722
Media Data Offset              : 145216
Image Size                     : 320x240
Megapixels                     : 0.077
Avg Bitrate                    : 766 kbps
Rotation                       : 90

StarGeek

"Date Created" would be unusual in an MP4.  I'm guessing it will be the XMP:DateCreated but use the command in FAQ #3 to verify it is the correct tag.

To copy a tag to another, your command would be
exiftool "-TAGTarget<TAGSource" /path/to/files/
The main problem is figuring out what the tags are, as the same tag name can appear multiple times in different groups

Odds are your command would be something like
exiftool "-CreationDate<DateCreated" "-DateTimeOriginal<DateCreated" /path/to/files/
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

jgoossen

Thank you StarGeek!
In fact it turns out that it's not in "XMP:DateCreated" but in "UserData" and "Keys"
What command do I run to modify that?

>"exiftool -a -G1 -s "20120310_193728.mp4"
[ExifTool]      ExifToolVersion                 : 12.73
[System]        FileName                        : 20120310_193728.mp4
[System]        Directory                       : .
[System]        FileSize                        : 21 MB
[System]        FileModifyDate                  : 2024:02:04 19:27:33+01:00
[System]        FileAccessDate                  : 2024:03:05 23:08:48+01:00
[System]        FileCreateDate                  : 2012:05:21 22:42:43+02:00
[System]        FilePermissions                 : -rw-rw-rw-
[File]          FileType                        : 3GP
[File]          FileTypeExtension               : 3gp
[File]          MIMEType                        : video/3gpp
[QuickTime]     MajorBrand                      : 3GPP Media (.3GP) Release 4
[QuickTime]     MinorVersion                    : 0.3.0
[QuickTime]     CompatibleBrands                : 3gp4, 3gp6
[QuickTime]     MovieHeaderVersion              : 0
[QuickTime]     CreateDate                      : 0000:00:00 00:00:00
[QuickTime]     ModifyDate                      : 0000:00:00 00:00:00
[QuickTime]     TimeScale                       : 1000
[QuickTime]     Duration                        : 0:03:37
[QuickTime]     PreferredRate                   : 1
[QuickTime]     PreferredVolume                 : 100.00%
[QuickTime]     MatrixStructure                 : 1 0 0 0 1 0 0 0 1
[QuickTime]     PreviewTime                     : 0 s
[QuickTime]     PreviewDuration                 : 0 s
[QuickTime]     PosterTime                      : 0 s
[QuickTime]     SelectionTime                   : 0 s
[QuickTime]     SelectionDuration               : 0 s
[QuickTime]     CurrentTime                     : 0 s
[QuickTime]     NextTrackID                     : 3
[QuickTime]     HandlerType                     : Metadata Tags
[QuickTime]     MediaDataSize                   : 20768722
[QuickTime]     MediaDataOffset                 : 145216
[Track1]        TrackHeaderVersion              : 0
[Track1]        TrackCreateDate                 : 0000:00:00 00:00:00
[Track1]        TrackModifyDate                 : 0000:00:00 00:00:00
[Track1]        TrackID                         : 1
[Track1]        TrackDuration                   : 0:03:37
[Track1]        TrackLayer                      : 0
[Track1]        TrackVolume                     : 0.00%
[Track1]        MatrixStructure                 : 0 1 0 -1 0 0 0 0 1
[Track1]        ImageWidth                      : 320
[Track1]        ImageHeight                     : 240
[Track1]        MediaHeaderVersion              : 0
[Track1]        MediaCreateDate                 : 0000:00:00 00:00:00
[Track1]        MediaModifyDate                 : 0000:00:00 00:00:00
[Track1]        MediaTimeScale                  : 30000
[Track1]        MediaDuration                   : 0:03:37
[Track1]        HandlerType                     : Video Track
[Track1]        HandlerDescription              : VideoHandler
[Track1]        GraphicsMode                    : srcCopy
[Track1]        OpColor                         : 0 0 0
[Track1]        CompressorID                    : avc1
[Track1]        SourceImageWidth                : 320
[Track1]        SourceImageHeight               : 240
[Track1]        XResolution                     : 72
[Track1]        YResolution                     : 72
[Track1]        BitDepth                        : 24
[Track1]        VideoFrameRate                  : 29.927
[Track2]        TrackHeaderVersion              : 0
[Track2]        TrackCreateDate                 : 0000:00:00 00:00:00
[Track2]        TrackModifyDate                 : 0000:00:00 00:00:00
[Track2]        TrackID                         : 2
[Track2]        TrackDuration                   : 0:03:37
[Track2]        TrackLayer                      : 0
[Track2]        TrackVolume                     : 100.00%
[Track2]        MatrixStructure                 : 1 0 0 0 1 0 0 0 1
[Track2]        MediaHeaderVersion              : 0
[Track2]        MediaCreateDate                 : 0000:00:00 00:00:00
[Track2]        MediaModifyDate                 : 0000:00:00 00:00:00
[Track2]        MediaTimeScale                  : 44100
[Track2]        MediaDuration                   : 0:03:37
[Track2]        HandlerType                     : Audio Track
[Track2]        HandlerDescription              : SoundHandler
[Track2]        Balance                         : 0
[Track2]        AudioFormat                     : mp4a
[Track2]        AudioChannels                   : 1
[Track2]        AudioBitsPerSample              : 16
[Track2]        AudioSampleRate                 : 44100
[UserData]      PlayMode                        : SEQ_PLAY
[UserData]      DateTimeOriginal                : 1904:01:01 01:00:00+01:00
[Keys]          CreationDate                    : 1904:01:01 01:00:00+01:00

[XMP-x]         XMPToolkit                      : Image::ExifTool 12.71
[XMP-photoshop] DateCreated                     : 2012:03:10 19:37:28
[Composite]     ImageSize                       : 320x240
[Composite]     Megapixels                      : 0.077
[Composite]     AvgBitrate                      : 766 kbps
[Composite]     Rotation                        : 90

wywh

It seems the correct date is in the filename, right? So try this (if you are using Windows change single quotes ' to double quotes ''):

exiftool -m -overwrite_original -wm w -api LargeFileSupport=1 -api QuickTimeUTC=1 '-AllDates<FileName' '-Track*Date<FileName' '-Media*Date<FileName' '-Keys:CreationDate<FileName' '-FileCreateDate<FileName' '-FileModifyDate<FileName' 20120310_193728.mp4
- Matti

StarGeek

Quote from: jgoossen on March 06, 2024, 01:52:02 AMIn fact it turns out that it's not in "XMP:DateCreated" but in "UserData" and "Keys"
What command do I run to modify that?

From your original post, you said you wanted to copy the DateCreated value, which was in XMP-photoshop:DateCreated tag as I suspected.

But as I missed and @wywh pointed out, the filename is set to the correct time. So you can copy the filename directly into any date/time tag and exiftool will parse and add the date correctly.  See FAQ #5, "How do I format date and time information for writing?", paragraph starting "Having said this".

All that is required for this to work is that the filename needs all 14 numbers that represent the full date/time.

To break down @wywh's command
  • The -wm w (-writeMode w) option is used to only write existing tags and will not create any new tags.
  • The -api LargeFileSupport option is used to allow processing of large files, usually for video files over 4gigs (I think that's the break point).
  • Some video date/time tags are supposed to be set to UTC.  The -api QuickTimeUTC option will automatically adjust the date/time to UTC for those tags that need it.

The rest of the command are the tag copies to all the most common date/time tags in a video file.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

jgoossen

Quote from: wywh on March 06, 2024, 02:31:19 AMIt seems the correct date is in the filename, right? So try this (if you are using Windows change single quotes ' to double quotes ''):

exiftool -m -overwrite_original -wm w -api LargeFileSupport=1 -api QuickTimeUTC=1 '-AllDates<FileName' '-Track*Date<FileName' '-Media*Date<FileName' '-Keys:CreationDate<FileName' '-FileCreateDate<FileName' '-FileModifyDate<FileName' 20120310_193728.mp4
- Matti

That worked great! I could have never figured that out.
Thank you so much!

jgoossen

Quote from: StarGeek on March 06, 2024, 10:31:35 AMTo break down @wywh's command

Many thanks for your explanation, that's very helpful.