jniedballa / camtrapR

R package for camera trap data management
https://jniedballa.github.io/camtrapR/
31 stars 5 forks source link

About video tagging in digiKam #27

Open wsyxbcl opened 9 months ago

wsyxbcl commented 9 months ago

An issue about the video tagging workflow, in https://jniedballa.github.io/camtrapR/articles/camtrapr2.html you mentioned

BUT, in contrast to images, digiKam cannot write these tags directly into the video metadata.

Digikam used to have this issue (due to the limit of Exiv2), but since version 8.0 they provide ExifTool as an option for the metadata backend, which enables writing tags into video files (pretty much the same with images). Here is an example of the metadata:

 exiftool ./Downloads/demo.mp4
ExifTool Version Number         : 12.70
File Name                       : demo.mp4
...
XMP Toolkit                     : Image::ExifTool 12.70
Audio Bits Per Sample           : 16
Minor Version                   : 0.2.0
Last Keyword XMP                : Species/Glover's pika
Categories                      : <Categories><Category Assigned="0">Species<Category Assigned="1">Glover's pika</Category></Category></Categories>
Subject                         : Glover's pika
Color Label                     : 0
Pick Label                      : 0
Tags List                       : Species/Glover's pika
Date/Time Original              : 2023:08:28 11:54:52
Exif Image Width                : 2560
Exif Image Height               : 1920
Hierarchical Subject            : Species|Glover's pika
Catalog Sets                    : Species|Glover's pika
...

I'm contemplating whether it's necessary to simplify the existing video workflow, as digiKam db files are no longer needed. Please let me know if there's anything I missed.

jniedballa commented 8 months ago

Thank you, this looks good. And I agree, there may be potential to simplify the inner workings of the functions that read video metadata. At the same time there needs to be compatibility with videos tagged with older versions of digiKam.

Would you please be able to share a short video tagged in this way for testing?

wsyxbcl commented 8 months ago

Sure, here's a demo, where a tagged video file and the xmp sidecar is included. demo_tagged_video.zip

At the same time there needs to be compatibility with videos tagged with older versions of digiKam.

Just for your information, my workaround is using digikam to generate xmp sidecar for both images and videos ( older versions of digikam can also accomplish). In our current workflow design, we extract tags directly from the xmp files (as you call exiftool directly in the camtrapR, it can be easily done with no issue).

jniedballa commented 6 months ago

Ah, you mean this option: image

For me it was off by default and so it didn't work at first.

As you said, this should in principle allow extracting metadata from videos and photos alike, using the same operation. This is great and definitely worth including in camtrapR. I'll add it to the to do list.

I don't think I will officially support working with xmp sidecar files though, at least not at this point.

Thank you for sharing. Will update here when there are news.