Change FileModifyDate to DateTimeOriginal for video file

Started by thumperstrauss, January 22, 2023, 11:05:26 PM

Previous topic - Next topic

thumperstrauss

I would like to update the meta data info in dozens of video files, by changing the Date modified value (which is when I saved the video to my computer, I think) with the Media created value (which is when the video was recorded).  FWIW, the photos are from a Canon camera, circa 2007, MJPEG codec.

I ran this code to check the dates on my video file:

K:\Date>exiftool -time:all -a -G0:1 -s a.avi
[File:System]  FileModifyDate                  : 2007:07:20 22:50:43-04:00
[File:System]  FileAccessDate                  : 2023:01:22 22:58:47-05:00
[File:System]  FileCreateDate                  : 2023:01:22 22:47:08-05:00
[RIFF]          DateTimeOriginal                : 2007:07:08 11:30:44
Then using the names, I ran this code (based on the advice here):


K:\Date>exiftool "-TO_DateTimeOriginal<FROM_FileModifyDate" k:/Date
    1 directories scanned
    0 image files read
It didn't seem to work, so I supposed I wrote the code incorrectly. What should it be?


StarGeek

I'm not sure where you got the "TO_" and "FROM_", as those aren't part of any tag names.

To copy from the file's DateTimeOriginal into the FileModifyDate, you would use
exiftool -ext+ avi "-FileModifyDate<DateTimeOriginal" /path/to/files/
The -ext+ avi (-extension+ avi) option is needed because AVI files are normally skipped for writing operations.  See FAQ #16.

If instead, you are trying to write the DateTimeOriginal tag in the AVI file, then exiftool cannot do this, as writing AVI files isn't supported. See Supported File Types table
"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

thumperstrauss

The code you provide worked. For the record, here are the steps I wrote down for myself on my workflow.

Canon video files have an EXIF value called Media Created. One can see it in video properties (right click). But that value cannot be used in common rename apps like Advanced Renamer or Better File Rename 5. Here is the workaround.

1. Copy exiftool.exe and a bat file into the folder with the avi files

2. The bat file should have this inside if the folder is at K:\Date

exiftool -ext+ avi "-FileModifyDate<DateTimeOriginal" K:\Date
cmd /k

3. Now that the FileModifyDate has been changed to the correct meta data, one can mass rename it.

4. For an unknown reason Better File Rename creates a file name  one hour earlier than the time in the meta info.

5. Therefore, we need to use the app Advanced Renamer instead. Here are the steps.

6. Press Clear

7. Press Add Method

8. Press New Name

9. Paste into box the following: <Year Modified>-<Month Modified>-<Day Modified>-<Hour Modified>-<Min Modified>-<Sec Modified>

10. Press Start batch

Note: There is a way to do the rename to date part of this process in Exiftool but I don't know the code to use.

StarGeek

Quote from: thumperstrauss on January 23, 2023, 11:00:04 PM4. For an unknown reason Better File Rename creates a file name  one hour earlier than the time in the meta info.

It might be a Standard/Daylight time thing. I recall that some programs have a problem with this, especially if the file system is FAT and not NTFS.

QuoteNote: There is a way to do the rename to date part of this process in Exiftool but I don't know the code to use.

Using exiftool, your command would be something like
exiftool -d "%Y-%m-%d-%H-%M-%S%%-c.%%e" "-Filename<DateTimeOriginal" /path/to/files/

I added %%-c to add a copy number if there was a naming collision.
"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