Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: read & write metadata from/to video files #1034

Open
kha84 opened this issue Sep 25, 2022 · 24 comments
Open

Feature request: read & write metadata from/to video files #1034

kha84 opened this issue Sep 25, 2022 · 24 comments

Comments

@kha84
Copy link

kha84 commented Sep 25, 2022

Exiftool is fully capable to read&write GPS, dates, tags from/to lot of video file formats. With smartphones in our pockets, I don't believe everyone is just shooting still photos and they don't care how their video footage is taken care later at home with Geequi.

Ideally, with videofiles Geequie should do pretty much the same, what it does with still photos:

  • to consider EXIF dates from them to sort them properly
  • to get GPS information and show that on map
  • to write GPS back to file, if you dragged videofile on map
  • to make video file "keywords" (like "Subject" EXIF tag) to be displayed in a right-hand-side pane / written back to file if changed - the same how it's done for photos
@caclark
Copy link
Collaborator

caclark commented Sep 26, 2022

Geeqie uses exiv2 for exif metadata. If Exiv2 handles it, so should Geeqie.
Do you have a sample clip with GPS and date data?

Geeqie can use sidecars to store metadata for any file, if you set that up on edit/preferences/file filters

@kha84
Copy link
Author

kha84 commented Sep 26, 2022

Sure, I'll check that with exiv2. Before, I was checking everything with exiftool, and it was capturing everything / writing back just perfectly fine.

Why don't you use exiftool?

I don't like sidecar files. To me, they're useless garbage, whose sole purpose if creation was to bloat your system and be forgotten :) if the very same meta information can be read from / written to media files, why would one use them?

@kha84
Copy link
Author

kha84 commented Sep 26, 2022

Yeah just checked that. Exiv2 is unable to read the tags with GPS from my mp4 videos, while exiftool does that just perfectly fine. You know, you gave me an idea - I might need to check the most recent version of that exiv2 lib

@kha84
Copy link
Author

kha84 commented Sep 26, 2022

Nah it's the same thing with the most recent exiv2.

@kha84
Copy link
Author

kha84 commented Oct 1, 2022

The bad thing is, a lot of apps are still using exiv2, and exiv2 is kind of dying one. It lacks support of so many photo and video formats. You should really consider to switch from it to exiftool, even though it brings perl as a dependency, it's a fair price to pay to get all these additional support. And nowdays, bringing perl as a dependency is not a big deal - it's like bringing bash as a dependency - everyone should have it.

@caclark
Copy link
Collaborator

caclark commented Oct 3, 2022

exiv2 seems to be significantly dependent on one person, but the same is true of exiftool and geeqie.
However, exiftool does have a c++ interface - https://exiftool.org/cpp_exiftool/

@tomaszg7
Copy link
Contributor

tomaszg7 commented Oct 3, 2022

There is some work going on to support video in exiv2: Exiv2/exiv2#1748. Apparently in the past there was some support for video files but it was removed. Now apparently they try to restore some of it.

Exiv2 is no longer dependent on one person from my observation - the guy retired from the project and other people are now handling the library.

Exiv2 also has other problems, for example it doesn't handle writing to BMFF tags: Exiv2/exiv2#2349. It affects e.g. AVIF and HEIF formats.

@kha84
Copy link
Author

kha84 commented Oct 3, 2022

Sure. The past is dark, the future is bright, just need to wait for it. I get that. But even Digikam is migrating to exiftool.

Anyways thanks for your efforts. I'd really love to see proper metadata support for videos in this app, so ppl like me who do care not only about their photos but videos as well, would have more options to choose from.

@caclark
Copy link
Collaborator

caclark commented Oct 3, 2022

even Digikam is migrating to exiftool.

Thanks, @kha84, there are a couple of Digikam release notes covering this - I did not see this before.

@Massimo-B
Copy link

After setting exiftool -Artist="Mo" -overwrite_original_in_place -preserve VID_20240526_112118.mp4 I can see the tag like this:

exiftool -Artist VID_20240526_112118.mp4
Artist                          : Mo

Usually on picture files I can see the Exif tag when adding Exif.Image.Artist, but not on MP4 video files.
Looking at View->Exif Window I can't see the tag either.

@caclark
Copy link
Collaborator

caclark commented Sep 23, 2024

I downloaded this file:
https://file-examples.com/wp-content/storage/2017/04/file_example_MP4_480_1_5MG.mp4

Executed:
exiftool -Artist="Mo" -overwrite_original_in_place -preserve file_example_MP4_480_1_5MG.mp4

Renamed $HOME/.config/geeqie/geeqierc.xml (to start with a default configuration).

Running Geeqie, the Exif Window shows the correct data in the tag Xmp.tiff.Artist

It looks like exiftool is not using Exif.Image.Artist when writing.

@Massimo-B
Copy link

I've added the Key Xmp.tiff.Artist but still can't see the entry. Can you see it in View->Exif Window?

@caclark
Copy link
Collaborator

caclark commented Sep 23, 2024

Can you see it in View->Exif Window?

Yes, I can.

Also:
strings file_example_MP4_480_1_5MG.mp4 | grep Mo
returns:
<tiff:Artist>Mo</tiff:Artist>

@Massimo-B
Copy link

Massimo-B commented Sep 23, 2024

I see, I guess I know what it is:
Installed versions: 2.4, build on Gentoo with (exif ffmpegthumbnailer heif jpeg lcms map pdf spell tiff zip -debug -djvu -jpeg2k -jpegxl -lua -raw -webp -xmp LUA_SINGLE_TARGET="-lua5-3 -lua5-4")

So xmp isn't built in, I guess I'll need that.

Now I've rebuilt with (exif ffmpegthumbnailer heif jpeg lcms map pdf spell tiff xmp zip -debug -djvu -jpeg2k -jpegxl -lua -raw -webp LUA_SINGLE_TARGET="-lua5-3 -lua5-4")
Still not displayed. Any other dependency I need?

@caclark
Copy link
Collaborator

caclark commented Sep 24, 2024

Do you have exiv2 installed?

@Massimo-B
Copy link

I'm not sure. these are the installed packages:

eix -Ic exif
[I] media-libs/exiftool (12.76@30.08.2024): Read and write meta information in image, audio and video files
[I] media-libs/libexif (0.6.24@17.04.2024): Library for parsing, editing, and saving EXIF data

Moreover about other available but not installed packages, beside perl, python and ruby libs, I only see:

[N] media-gfx/exif (0.6.22-r1): Small CLI util to show EXIF infos hidden in JPEG files

@tomaszg7
Copy link
Contributor

tomaszg7 commented Sep 24, 2024

It should be media-gfx/exiv2 - however since you have +exif on your geeqie package, it would be pulled it automatically.

@tomaszg7
Copy link
Contributor

I just checked @caclark procedure on my machine and it doesn't work. geeqie is not showing anything in exif window. Moreover exiv2 binary also fails to find a tag:

exiv2 file_example_MP4_480_1_5MG.mp4 
Exiv2 exception in print action for file file_example_MP4_480_1_5MG.mp4:
file_example_MP4_480_1_5MG.mp4: The file contains data of an unknown image type

I have exiv2-0.28.3 which is the most recent as far as I can tell and all relevant options seem to be compiled in.

@caclark
Copy link
Collaborator

caclark commented Sep 24, 2024

This is the data I see:

exiv2 -V
exiv2 0.27.6

exiv2 ~/downloads/file_example_MP4_480_1_5MG.mp4
File name : /home/cclark/downloads/file_example_MP4_480_1_5MG.mp4
File size : 1572920 Bytes
MIME type : image/generic
Image size : 0 x 0
/home/cclark/downloads/file_example_MP4_480_1_5MG.mp4: No Exif data found in the file

exiftool result is as above.

@tomaszg7
Copy link
Contributor

That's quite surprising as it was 0.28 which was supposed to re-introduce video support to exiv2 according to the changelog https://exiv2.org/whatsnew.html Maybe some filetypes got broken in the process, were more or less correctly processed as image/generic but fail with the video code path. Seems like an issue to report there.

@caclark
Copy link
Collaborator

caclark commented Sep 24, 2024

Sorry..... to add:

exiv2 -p x ~/downloads/file_example_MP4_480_1_5MG.mp4
Xmp.tiff.Artist XmpText 2 Mo

@tomaszg7
Copy link
Contributor

Please disregard my previous comments, I was stupid enough to grab the file you linked with wget and didn't check the result. In effect I only got some html nonsense in the file. Now I have the correct file and the situation is as follows:

  1. With exiv2 0.27 I see
bin/exiv2 -p x /tmp/file_example_MP4_480_1_5MG.mp4
 
Xmp.tiff.Artist                              XmpText     2  Mo
  1. with exiv2 0.28 I see:
exiv2 -p x /tmp/file_example_MP4_480_1_5MG.mp4 
Xmp.video.FileSize                           XmpText     7  1.50005
Xmp.video.MimeType                           XmpText    15  video/quicktime
Xmp.video.MajorBrand                         XmpText    21  MP4 v2 [ISO 14496-14]
Xmp.video.MinorVersion                       XmpText     1  0
Xmp.video.CompatibleBrands                   XmpSeq      4  MP4 v2 [ISO 14496-14], MP4 v1 [ISO 14496-1:ch13], MP4 Base Media v1 [IS0 14496-12:2003], MP4 Base w/ AVC ext [ISO 14496-12:2005]
...

and a lot more, but no Artist tag.

So, I don't know if it is a regression in exiv2 or if exiftool puts the tag incorrectly. Exiv2 somehow reads this tag assuming it is an image, not a video.

@Massimo-B
Copy link

Thanks for investigating, so this would rather be an upstream bug for https://github.com/exiv2/exiv2 or https://exiftool.org ?

@tomaszg7
Copy link
Contributor

My guess without looking at the code is that it is regression in Exiv2 and should be reported there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants