Change media creation date in bulk

Started by Fireblazr, October 13, 2024, 01:07:35 PM

Previous topic - Next topic

Fireblazr

How to use ExifTool to change the media creation date and date created of multiple MP4 files in a folder and increment the time for each file by 10 seconds?


This was the answer given by ChatGPT :

exiftool "-CreateDate+=<30" "-MediaCreateDate+=<30" "-TrackCreateDate+=<30" "-FileCreateDate+=<30" -r -FileOrder FileName "-CreateDate=2012:07:10 00:00:00" "-MediaCreateDate=2012:07:10 00:00:00" "-TrackCreateDate=2012:07:10 00:00:00" "-FileCreateDate=2012:07:10 00:00:00" -overwrite_original .

But this does not work properly for some reason. Could anyone help?

StarGeek

Quote from: Fireblazr on October 13, 2024, 01:07:35 PMBut this does not work properly for some reason.

While ChatGPT does really well with some things, like ffmpeg, it usually fails miserably with exiftool. The whole +=< makes absolutely no sense with exiftool.

This is a two-step procedure as shown on this PhotoStackExchange question. First, you have to set it to a base value
exiftool -CreateDate="2012:07:10 00:00:00" "-Media*Date=2012:07:10 00:00:00" -"Track*Date=2012:07:10 00:00:00" -FileCreateDate="2012:07:10 00:00:00" -FileOrder4 FileName /path/to/files/

Then you would increment the time stamps in each file
exiftool "-CreateDate+<0:0:${FileSequence}0" "-Media*Date+<0:0:${FileSequence}0" "-Track*Date+<0:0:${FileSequence}0" "-FileCreateDate+<0:0:${FileSequence}0" -FileOrder4 FileName /path/to/files/

Note that these commands (mostly the second one) are written for Windows CMD. If you are on Mac/Linux, change the double quotes into single quotes.

The -FileOrder option usually isn't necessary, as most file systems return a sorted filename list. But not all do, usually drive pools or network shares. I changed it here to -FileOrder4 which would speed things up since exiftool won't extract all the date from every file during the sorting phase.

I added the Track*Date tags as well as the Media ones and used a wildcard to get all of them.

One thing to take note of is that all of these other than the file system time stamp are supposed to be set to UTC. Using the example time, if "2012:07:10 00:00:00" is the local time, it would need to be shifted by the time zone to UTC. You can do this automatically by adding the -api QuickTimeUTC option to the first command.

These commands creates backup files.  Add -Overwrite_Original to suppress the creation of backup files.  Add -r to recurse into subdirectories.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Fireblazr

Thank you for your reply. Your first command works, but the second command does not work.

Could you please look into that?

Also if I were to implement this commands for image files like jpg, how would the create date change?

StarGeek

Quote from: Fireblazr on November 20, 2024, 04:39:01 PMbut the second command does not work.

How doesn't it work?

It works correctly here
C:\>exiftool -P -overwrite_original -CreateDate="2012:07:10 00:00:00" "-Media*Date=2012:07:10 00:00:00" -"Track*Date=2012:07:10 00:00:00" -FileCreateDate="2012:07:10 00:00:00" -FileOrder4 FileName Y:\!temp\x\y
    1 directories scanned
    4 image files updated

C:\>exiftool -P -overwrite_original "-CreateDate+<0:0:${FileSequence}0" "-Media*Date+<0:0:${FileSequence}0" "-Track*Date+<0:0:${FileSequence}0" "-FileCreateDate+<0:0:${FileSequence}0" -FileOrder4 FileName Y:\!temp\x\y
    1 directories scanned
    4 image files updated

C:\>exiftool -ext mp4 -CreateDate -Media*Date -Track*Date -G1 -a -s Y:\!temp\x\y
======== Y:/!temp/x/y/Test1.mp4
[QuickTime]     CreateDate                      : 2012:07:10 00:00:00
[Track1]        MediaCreateDate                 : 2012:07:10 00:00:00
[Track1]        MediaModifyDate                 : 2012:07:10 00:00:00
[Track2]        MediaCreateDate                 : 2012:07:10 00:00:00
[Track2]        MediaModifyDate                 : 2012:07:10 00:00:00
[Track1]        TrackCreateDate                 : 2012:07:10 00:00:00
[Track1]        TrackModifyDate                 : 2012:07:10 00:00:00
[Track2]        TrackCreateDate                 : 2012:07:10 00:00:00
[Track2]        TrackModifyDate                 : 2012:07:10 00:00:00
======== Y:/!temp/x/y/Test2.mp4
[QuickTime]     CreateDate                      : 2012:07:10 00:00:10
[Track1]        MediaCreateDate                 : 2012:07:10 00:00:10
[Track1]        MediaModifyDate                 : 2012:07:10 00:00:10
[Track2]        MediaCreateDate                 : 2012:07:10 00:00:10
[Track2]        MediaModifyDate                 : 2012:07:10 00:00:10
[Track1]        TrackCreateDate                 : 2012:07:10 00:00:10
[Track1]        TrackModifyDate                 : 2012:07:10 00:00:10
[Track2]        TrackCreateDate                 : 2012:07:10 00:00:10
[Track2]        TrackModifyDate                 : 2012:07:10 00:00:10
======== Y:/!temp/x/y/Test3.mp4
[QuickTime]     CreateDate                      : 2012:07:10 00:00:20
[Track1]        MediaCreateDate                 : 2012:07:10 00:00:20
[Track1]        MediaModifyDate                 : 2012:07:10 00:00:20
[Track2]        MediaCreateDate                 : 2012:07:10 00:00:20
[Track2]        MediaModifyDate                 : 2012:07:10 00:00:20
[Track1]        TrackCreateDate                 : 2012:07:10 00:00:20
[Track1]        TrackModifyDate                 : 2012:07:10 00:00:20
[Track2]        TrackCreateDate                 : 2012:07:10 00:00:20
[Track2]        TrackModifyDate                 : 2012:07:10 00:00:20
======== Y:/!temp/x/y/Test4.mp4
[QuickTime]     CreateDate                      : 2012:07:10 00:00:30
[Track1]        MediaCreateDate                 : 2012:07:10 00:00:30
[Track1]        MediaModifyDate                 : 2012:07:10 00:00:30
[Track2]        MediaCreateDate                 : 2012:07:10 00:00:30
[Track2]        MediaModifyDate                 : 2012:07:10 00:00:30
[Track1]        TrackCreateDate                 : 2012:07:10 00:00:30
[Track1]        TrackModifyDate                 : 2012:07:10 00:00:30
[Track2]        TrackCreateDate                 : 2012:07:10 00:00:30
[Track2]        TrackModifyDate                 : 2012:07:10 00:00:30
    1 directories scanned
    4 image files read
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype