BestImageViewer / geeqie

claiming to be the best image viewer / photo collection browser
http://www.geeqie.org/
GNU General Public License v2.0
482 stars 79 forks source link

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

Open kha84 opened 2 years ago

kha84 commented 2 years ago

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:

caclark commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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

kha84 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

There is some work going on to support video in exiv2: https://github.com/Exiv2/exiv2/issues/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: https://github.com/Exiv2/exiv2/issues/2349. It affects e.g. AVIF and HEIF formats.

kha84 commented 2 years ago

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 commented 2 years ago

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 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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

caclark commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

Do you have exiv2 installed?

Massimo-B commented 1 month ago

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 commented 1 month ago

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

tomaszg7 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

Sorry..... to add:

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

tomaszg7 commented 1 month ago

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


2. 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 commented 1 month ago

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

tomaszg7 commented 1 month ago

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