Batch conversion - need to copy over original dates

Started by batch, July 21, 2019, 12:45:14 PM

Previous topic - Next topic

batch

Hi,

I was looking at syntax examples and then came across the TagNames.pdf and I am a little overwhelmed. I am trying to perform a very simple task on a large number of files.

I have the following video files: A.mpg, B.mpg, C.mpg, etc which I have converted to mp4.

I would like to copy part of the original metadata from the mpg files to the new video files: A.mp4, B.mp4, C.mp4, etc

For each new video file I would like to copy across the original:
File Modification Date/Time
File Creation Date/Time

This is not the full output as it was very long, but enough to see the relevant data for each file:

ExifTool Version Number         : 11.57
File Name                       : A.mpg
Directory                       : C:/Exiftool/mpg
File Size                       : 148 MB
File Modification Date/Time     : 2016:01:07 11:13:45+00:00
File Access Date/Time           : 2016:01:09 19:12:25+00:00
File Creation Date/Time         : 2016:01:07 11:10:01+00:00
-- press RETURN --



ExifTool Version Number         : 11.57
File Name                       : A.mp4
Directory                       : C:/Exiftool/mp4
File Size                       : 79 MB
File Modification Date/Time     : 2019:07:20 22:32:21+01:00
File Access Date/Time           : 2019:07:20 22:32:21+01:00
File Creation Date/Time         : 2019:07:20 22:32:18+01:00
-- press RETURN --


I would like the new A.mp4 file to read as follows:

ExifTool Version Number         : 11.57
File Name                       : A.mp4
Directory                       : C:/Exiftool/mp4
File Size                       : 79 MB
File Modification Date/Time     : 2016:01:07 11:13:45+00:00
File Access Date/Time           : 2019:07:20 22:32:21+01:00
File Creation Date/Time         : 2016:01:07 11:10:01+00:00


The folder location of my files:
c:\exiftool  -  exiftool.exe
c:\exiftool\mpg  - all the original mpg files
c:\exiftool\mp4  - all the new mp4 files


Is it possible to write a command which will copy the relevant data from the original mpg files in the mpg folder to the corresponding mp4 files in the mp4 folder? Would someone be able to help me with this please?


Thanks in advance.

StarGeek

Your command would be something like
exiftool -TagsFromFile c:\exiftool\mpg\%f.mpg -FileCreateDate -FileModifyDate c:\exiftool\mp4

To break it down, as this can get confusing with the TagsFromFile option.
c:\exiftool\mp4 is the directory with the files you want to edit.  This would be the FILE part mentioned at the very beginning of the docs.
The -TagsFromFile option is used to copy data from one file to another (or to a different place in the same file, but don't worry about that here).  The TagsFromFile option needs a source to copy from.  The next parameter tells exiftool where to look for the source file to copy data from.  In this case it looks in the c:\exiftool\mpg directory.  The %f tells exiftool to use the same name as the current target file without the extension, and .mpg is the extension for the source file.  So when exiftool finds the file c:\exiftool\mp4\a.mp4, it now knows to go looking for c:\exiftool\mpg\a.mpg as the source

Finally, FileModifyDate and FileCreateDate are the tag names of the data you want to copy.  You want to always use the -s (short) option to find out the actual name of the tags you want to copy, because otherwise exiftool will give you the description, e.g. FileModifyDate vs "File Modification Date/Time".
* 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).

batch

Thank you so much for your comprehensive reply, it's much appreciated.
I will have a go this weekend, this is going to save me so much time and hassle.
Thanks StarGeek.