ExifTool Forum

ExifTool => Newbies => Topic started by: peho on July 27, 2019, 02:41:06 PM

Title: Copying metadata, one to many, that starts with the same filename
Post by: peho on July 27, 2019, 02:41:06 PM
I've tried a lot of options but failed.
Is it possible to copy from a file that starts with for '2019-07-01-12-12-12.mp4' to all JPG that starts with that filename.
For instance:
From:
'2019-07-01-12-12-12.mp4'
To:
'2019-07-19 12-07-54.MP4-00.00.08.741.jpeg'
'2019-07-19 12-07-54.MP4-00.00.09.741.jpeg'
'2019-07-19 12-07-54.MP4-00.00.11.741.jpeg'
'2019-07-19 12-07-54.MP4-00.00.12.741.jpeg'

OR

'2019-07-01-12-12-12.mp4'
To:
'2019-07-19 12-07-54-aaa.jpeg'
'2019-07-19 12-07-54-bbb.jpeg'
'2019-07-19 12-07-54-ccc.jpeg'
'2019-07-19 12-07-54-ddddd.jpeg'
Title: Re: Copying metadata, one to many, that starts with the same filename
Post by: StarGeek on July 27, 2019, 03:09:39 PM
Is there a mistake in your example?  You are copying from 2019-07-01-12-12-12.mp4 to 2019-07-19 12-07-54.MP4-00.00.08.741.jpeg.  Different day, minute and second, as well as replacing a dash with a space in the jpg name.

This can be done with the -TagsFromFile option (https://exiftool.org/exiftool_pod.html#tagsFromFile-SRCFILE-or-FMT), but it's hard to give you more help without verifying that your example is correct or not.
Title: Re: Copying metadata, one to many, that starts with the same filename
Post by: peho on July 27, 2019, 04:06:21 PM
Sorry, yes, there was a mistake.


From:
'2019-07-19 12-07-54.mp4'
To:
'2019-07-19 12-07-54.MP4-00.00.08.741.jpeg'
'2019-07-19 12-07-54.MP4-00.00.09.741.jpeg'
'2019-07-19 12-07-54.MP4-00.00.11.741.jpeg'
'2019-07-19 12-07-54.MP4-00.00.12.741.jpeg'

OR

'2019-07-19 12-07-54.mp4'
To:
'2019-07-19 12-07-54-aaa.jpeg'
'2019-07-19 12-07-54-bbb.jpeg'
'2019-07-19 12-07-54-ccc.jpeg'
'2019-07-19 12-07-54-ddddd.jpeg'
Title: Re: Copying metadata, one to many, that starts with the same filename
Post by: StarGeek on July 27, 2019, 04:34:25 PM
Assuming that the jpegs are in the same directory as the MP4, your command would be something like
exfitool -ext jpeg -TagsFromFile %d%19f.mp4 -TAG1 -TAG2 /path/to/jpegs

The %19f part takes the first 19 characters from the jpg currently being processed to be used as the source filename for the MP4.

If the MP4 is in a different directory, replace %d with the path to that directory.  Replace TAG1, TAG2 with the actual tag names you wish to copy.  If you just what exiftool to copy what it can, then remove that part.  Understand though that there usually isn't a direct correlation between video tags and image tags.  You may have to redirect the specific video tags into specific image tags, e.g. "-IMAGETAG<VIDEOTAG"
Title: Re: Copying metadata, one to many, that starts with the same filename
Post by: peho on July 27, 2019, 05:31:59 PM
Great, thanks.
%19f was new to me.