ExifTool Forum

General => Metadata => Topic started by: DKutkevicius on October 16, 2023, 06:04:52 AM

Title: Metadata from video by frames
Post by: DKutkevicius on October 16, 2023, 06:04:52 AM
Hello everyone,

I am a new user of this tool and had a great success using it on different kind of images. I have tried to use it on video (mp4) and would like to know if there is a way to get metadata by frame and not for the whole video?

I have tried to use ffmpeg to convert video frames to jpegs and then run exif, but jpegs lost metadata.

Any input or recommendation would be really good! Thanks
Title: Re: Metadata from video by frames
Post by: Fodoh on October 16, 2023, 07:06:36 AM
Hi DKutkevicius,
JPEG tags are explained here:
https://exiftool.org/TagNames/JPEG.html

As you can see, most of the tags are not writeable. An exception is the "'COM'    Comment" Tag

- Fodoh
Title: Re: Metadata from video by frames
Post by: wywh on October 16, 2023, 08:22:11 AM
Movie and image metadata tags are different. So check which tags you want to copy from the movie and use exiftool's TagsFromFile command to copy them to the corresponding image tags.
Title: Re: Metadata from video by frames
Post by: Phil Harvey on October 16, 2023, 09:11:17 AM
Videos don't have metadata for each frame, but there is sometimes "timed metadata" which changes with time (for example, GPS may be recorded once per second).  ExifTool has the ability to read many types of timed metadata, but can't yet write it to videos.  Add the exiftool -ee3 option to extract as much timed metadata as possible.

- Phil
Title: Re: Metadata from video by frames
Post by: wywh on October 16, 2023, 09:40:01 AM
If you just want to copy .mp4 metadata as a whole to an extracted .jpg try something like:

exiftool -m -overwrite_original -api QuickTimeUTC=1 -api LargeFileSupport=1 -TagsFromFile a.mp4 '-AllDates<QuickTime:CreateDate' '-FileCreateDate<QuickTime:CreateDate' '-FileModifyDate<QuickTime:CreateDate' '-Composite:GPSPosition<Composite:GPSPosition' '-GPSAltitude<GPSAltitude' '-XMP-photoshop:Headline<Keys:DisplayName' '-XMP-dc:Title<Keys:Title' '-XMP-photoshop:CaptionWriter<Keys:Author' '-XMP-xmp:Rating<Keys:UserRating' '-XMP-dc:Subject<Keys:Keywords' '-XMP-dc:Description<Keys:Description' '-IFD0:Make<Keys:Make' '-IFD0:Model<Keys:Model' '-IFD0:Software<Keys:Software' '-ExifIFD:LensMake<XMP-exifEX:LensMake' '-ExifIFD:LensModel<XMP-exifEX:LensModel' '-ExifIFD:LensInfo<XMP-exifEX:LensInfo' a.jpg
But check what tags the movie has because it varies wildly. Instead Keys, the tags might be in UserData or ItemList, Lens info might be in XMP-aux instead XMP-exifEX etc.

- Matti
Title: Re: Metadata from video by frames
Post by: StarGeek on October 16, 2023, 11:25:18 AM
Quote from: wywh on October 16, 2023, 09:40:01 AMIf you just want to copy .mp4 metadata as a whole to an extracted .jpg try something like:

One thing to watch for is that Keys:Keywords is a string, not a list, so copying it directly will create one long keyword.  The -sep option (https://exiftool.org/exiftool_pod.html#sep-STR--separator) would be needed.  I don't know what it separates on (I'm guessing the usual CommaSpace), you would probably know what to separate on better than me.
Title: Re: Metadata from video by frames
Post by: wywh on October 16, 2023, 12:29:11 PM
Quote from: StarGeek on October 16, 2023, 11:25:18 AMKeys:Keywords is a string, not a list, so copying it directly will create one long keyword.  The -sep option (https://exiftool.org/exiftool_pod.html#sep-STR--separator) would be needed

Good catch. I had previously done this only in the opposite direction from an image to a movie and did not notice that detail when reversing the command.

So the command above would indeed combine movie Keywords into one in a .jpg:

exiftool -a -G1 -s -v a.jpg
  | Subject = Keyword 1,Keyword 2

But adding...

-sep ','

...to the command correctly splits Keywords and does not seem to harm other tags with commas:

exiftool -a -G1 -s -v a.jpg
  | Subject = Keyword 1
  | Subject = Keyword 2
  | Description = Description 1,Description 2
  | Title = Title 1,Title 2
  | CaptionWriter = Author 1,Author 2
  | Headline = Headline 1,Headline 2

- Matti
Title: Re: Metadata from video by frames
Post by: DKutkevicius on October 17, 2023, 02:26:22 AM
Hello,

Thankyou all for you input, its really useful. I will definitely try out your suggestions and provide feedback after.

-Deividas