copy FileModifyDate from avi to mp4 with same name

Started by art2work4, September 26, 2023, 10:25:57 AM

Previous topic - Next topic

art2work4

Hi,

So I have a folder with a lot of DVPal AVI files that i compressed to MP4. The source AVI files have the same name as the resulting MP4 files (only the extension is of course different)
During the conversion to mp4 the FileModifyDate (for example 2004:03:30 08:37:46+02:00 ) was not copied in the resulting mp4 file.
So the MP4 file shows FileModifyDate 2023:09:24 22:16:16+02:00.

Which commands should I use to have Exiftool:
- look up the FileModifyDate in an avi file (*.avi)
- find a mp4 file with a similar name
- insert the FileModifyDate of the avi into the FileModifyDate in the mp4?

I have tried several things, but couldn't figure it out.

thanks for the support !
Ben

StarGeek

Exiftool can't "find" a file with a similar name, you have to provide a template for it to search.  This is done using the percent variables (%d, %f, and %e) that are described in the -w (-TextOut) option.

You use the -TagsFromFile option to copy data from one file to the other.

Assuming the files are in the same directory, your command would be along these lines
exiftool -ext MP4 -TagsFromFile %d%f.avi -FileModifyDate /path/to/files/

If the AVI files are in a different directory than the MP4s, then you can either edit the %d variable as described in the -w option link above, or you can replace the %d with the path to the AVI files.

For example, if the AVI files were on a different drive, then you would use something like
exiftool -ext MP4 -TagsFromFile D:/path/to/AVIs/%f.avi -FileModifyDate E:/path/to/MP4s/

I should mention that the file system time stamps such as FileModifyDate are rather fragile.  A better option would be to also copy the time stamp directly into the MP4 file with a command like
exiftool -ext MP4 -api QuickTimeUTC -TagsFromFile %d%f.avi -FileModifyDate "-AllDates<FileModifyDate" /path/to/files/
"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

art2work4

Well, thanks for this great info. I will try it out tonight !


art2work4

#3
hmm, I still can't get it to work. the files are in this directory: (running WIN10)
C:\TEMP\Test tags\
tape001.avi  (original files with the FileModifyDate)
tape001.mp4 (destination file where tags should be copied to)
tape002.avi 
tape002.mp4
etc. (many original and converted files)

when I run this command (via cmd in directory where the videofiles are stored):
exiftool -ext MP4 -api QuickTimeUTC -TagsFromFile %d%f.avi -FileModifyDate "-AllDates<FileModifyDate" "C:\TEMP\Test tags\"

the result is:
C:\TEMP\Test tags>exiftool -ext MP4 -api QuickTimeUTC -TagsFromFile %d%f.avi -FileModifyDate "-AllDates<FileModifyDate" "C:\TEMP\Test tags\"
    1 directories scanned
    0 image files read

What am I doing wrong?  Btw I'm not a programmer, so this command stuff is new to me ... I hope someone can provide the correct syntax

thanks !

art2work4

#4
I did an additional check by running the following command and this is the result:
C:\TEMP\Test tags>exiftool "C:\TEMP\Test tags\tape 001.avi"
ExifTool Version Number        : 12.67
File Name                      : tape 001.avi
Directory                      : C:/TEMP/Test tags
File Size                      : 195 MB
File Modification Date/Time    : 2004:03:30 08:37:46+02:00
File Access Date/Time          : 2023:09:29 10:29:25+02:00
File Creation Date/Time        : 2023:09:25 17:57:25+02:00
File Permissions                : -rw-rw-rw-
etc.

So Exiftool is able to locate the file and read the tag data.
I also tried this command (with added " in the tagname, since there are spaces), but that didn't work either:
C:\TEMP\Test tags>exiftool -ext MP4 -api QuickTimeUTC -TagsFromFile %d%f.avi -"File Modification Date/Time" "-AllDates<FileModifyDate" "C:\TEMP\Test tags\"
    1 directories scanned
    0 image files read

and I also tried:

C:\TEMP\Test tags>exiftool -ext MP4 -api QuickTimeUTC -TagsFromFile %d%f.avi "-File Modification Date/Time" "-AllDates<FileModifyDate" "C:\TEMP\Test tags\"
    1 directories scanned
    0 image files read
And finally I tried:

C:\TEMP\Test tags>exiftool -ext MP4 -api QuickTimeUTC -TagsFromFile %d%f.avi "-File Modification Date/Time" "-AllDates<FileModifyDateTime" "C:\TEMP\Test tags\
Warning: No writable tags set from C:/TEMP/Test tags/tape 001.avi
Warning: No writable tags set from C:/TEMP/Test tags/tape 002.avi
    1 directories scanned
    0 image files updated
    2 image files unchanged

So I'm stuck .....

StarGeek

Remove the trailing \ (or double it) from the directory path.  Either
"C:\TEMP\Test tags"
or
"C:\TEMP\Test tags\\"

Windows sees \" as an attempt to escape the double quote, so the result is that you're looking for a directory called
C:\TEMP\Test tags"
which includes the trailing double quote.

Also, the tag name is FileModifyDate. "File Modification Date/Time" is a tag description, not a name (see FAQ #2), as tag descriptions will change depending upon the language settings.  Use the command in FAQ #3 to see tag names, as well as tags with duplicated names and the groups they belong to.
"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

art2work4

#6
Dear StarGeek,

T H A N K S a million times !!!Now it works ! I just added an additional command to prevent the creation of a _original file, SO :

exiftool -ext MP4 -api QuickTimeUTC -TagsFromFile %d%f.avi "-File Modification Date/Time" "-AllDates<FileModifyDate" -overwrite_original "C:\TEMP\Test tags\\"

Again, Thanks so much for your support and patience !

art2work4

#7
I hope I'm not stretching it, this is the date data in the resulting mp4 file:
C:\TEMP\Test tags>exiftool -time:all -G1 -a -s "tape 001.mp4"
[System]        FileModifyDate                  : 2004:03:30 08:37:46+02:00
[System]        FileAccessDate                  : 2023:09:29 22:24:47+02:00
[System]        FileCreateDate                  : 2023:09:25 17:57:35+02:00
[QuickTime]     CreateDate                      : 2004:03:30 06:37:46
[QuickTime]     ModifyDate                      : 2004:03:30 06:37:46
[Track1]        TrackCreateDate                 : 0000:00:00 00:00:00
[Track1]        TrackModifyDate                 : 0000:00:00 00:00:00
[Track1]        MediaCreateDate                 : 0000:00:00 00:00:00
[Track1]        MediaModifyDate                 : 0000:00:00 00:00:00
[Track2]        TrackCreateDate                 : 0000:00:00 00:00:00
[Track2]        TrackModifyDate                 : 0000:00:00 00:00:00
[Track2]        MediaCreateDate                 : 0000:00:00 00:00:00
[Track2]        MediaModifyDate                 : 0000:00:00 00:00:00
[UserData]      DateTimeOriginal                : 2004:03:30 08:37:46+02:00
[XMP-exif]      DateTimeOriginal                : 2004:03:30 08:37:46+02:00
[XMP-xmp]       CreateDate                      : 2004:03:30 08:37:46+02:00
[XMP-xmp]       ModifyDate                      : 2004:03:30 08:37:46+02:00

So the Quicktime date is correctly copied, but what would I need to change in the syntax, to copy the FileModifyDate ALSO to the [System]        FileCreateDate    (since this is still showing 2023:09:25 17:57:35+02:00, rather than  2004:03:30 08:37:46+02:00 )

StarGeek

There's no tag called "File Modification Date/Time".  That is a description, not a tag name.  Tag names never have spaces in them.

To copy the FileModifyDate into the FileCreateDate, you would use the same format as copying into AllDates

exiftool -ext MP4 -api QuickTimeUTC -TagsFromFile %d%f.avi "-FileModifyDate" "-FileCreateDate<FileModifyDate" "-AllDates<FileModifyDate" -overwrite_original "C:\TEMP\Test tags\\"
"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

art2work4

Fantastic, this worked !! I am really happy with your support !