Bug 419801

Summary: XMP-digiKam:TagsList not read from video files with ExiV2 - Use ExifTool instead
Product: [Applications] digikam Reporter: Dries Hoet <dries.hoet+kde>
Component: Metadata-ExifToolAssignee: Digikam Developers <digikam-bugs-null>
Severity: normal CC: caulier.gilles, metzpinguin
Priority: NOR    
Version: 6.4.0   
Target Milestone: ---   
Platform: Mint (Ubuntu based)   
OS: Linux   
Latest Commit: Version Fixed In: 8.0.0
Sentry Crash Report:
Attachments: Example video with TagsList

Description Dries Hoet 2020-04-07 16:20:07 UTC

The "Reread metadata from file" function seems not to read the XMP-digiKam:TagsList tag for video files. Seems it also does not work for normal imports.
It works fine for images.

1. Import a video file with some data in the "XMP-digiKam:TagsList" tag in DigiKam

The tags are not shown in DigiKam.

The tags are visible in DigiKam

Linux/KDE Plasma: Linux Mint 19.3 Cinnamon
KDE Frameworks Version: 5.61.0
Qt Version: 5.13.1 (built against 5.13.1)

This is what exiftool shows about the tags in the file:

-XMP-x:XMPToolkit=Image::ExifTool 11.92
-XMP-dc:Rights=Copyright © 2020 xyz, all rights reserved.
-XMP-digiKam:TagsList=Subjects/Animals/Fish, Categories/Underwater, Places/Asia/Philippines
-XMP-exif:DateTimeOriginal=2020:01:19 17:42:19+08:00
-XMP-tiff:Copyright=Copyright © 2020 xyz, all rights reserved.
Comment 1 Maik Qualmann 2020-04-07 17:12:25 UTC
DigiKam does not write a tag list in video files and does not read them. Exiv2 is not stable enough for video files to read metadata. We use FFmpeg to read metadata from video files written by camera devices. For video files you have to use sidecars.

Comment 2 Maik Qualmann 2020-04-12 21:08:19 UTC
Another question, which program wrote the "XMP-digiKam:TagsList" in the video? Can you provide a test video?

Comment 3 Dries Hoet 2020-04-19 19:02:17 UTC
Created attachment 127693 [details]
Example video with TagsList
Comment 4 Dries Hoet 2020-04-19 19:03:22 UTC
I added the tags with exiftool, with this command:
exiftool '-XMP-digiKam:TagsList=Subjects/Animals/Fish, Categories/Underwater, Places/Asia/Philippines' '-XMP-exif:DateTimeOriginal=2020:01:19 17:42:19+08:00' '-XMP-tiff:Artist=xyz' '-XMP-tiff:Copyright=Copyright © 2020 xyz, all rights reserved.' file_example_MP4_480_1_5MG.mp4

I attached the example to the ticket.
Comment 5 caulier.gilles 2022-04-06 20:54:33 UTC
Git commit febc26188fe4e6037e5c8a9b1840f65729972a47 by Gilles Caulier.
Committed on 06/04/2022 at 20:38.
Pushed by cgilles into branch 'master'.

Add ExifTool backend to load metadata for image or video.
Exiv2 is always used in priority. If it fail, ExifTool is used instead.
ExifTool has the capability to create an EXV container for Exiv2. All metadata extracted with ExifTool
are concatened to the EXV container with all possible translations with Exif, Iptc, and Xmp tags.
Of course tags supported by ExifTool but not supported by Exiv2 are lost.
Related: bug 385726, bug 416516, bug 360714, bug 264210, bug 426938, bug 419375, bug 103247

M  +1    -0    core/libs/metadataengine/CMakeLists.txt
M  +7    -0    core/libs/metadataengine/dmetadata/dmetadata.h
A  +94   -0    core/libs/metadataengine/dmetadata/dmetadata_exiftool.cpp     [License: GPL (v2+)]
M  +42   -17   core/libs/metadataengine/dmetadata/dmetadata_fileio.cpp
M  +7    -6    core/libs/metadataengine/engine/metaengine.h
M  +5    -0    core/libs/metadataengine/engine/metaengine_fileio.cpp
M  +4    -2    core/libs/metadataengine/exiftool/exiftoolparser_command.cpp

Comment 6 caulier.gilles 2022-04-08 03:37:30 UTC
Git commit 80ecdd9980c6cf14789606455bf9d367c1ffef51 by Gilles Caulier.
Committed on 08/04/2022 at 03:25.
Pushed by cgilles into branch 'master'.

Use only ExifTool backend to write metadata to RAW files, as Exiv2 is fully unsafe with these kind of operations.
Reading and Writing metadata to video files is now delegate to ExifTool Backend too.
Related: bug 406540, bug 416516, bug 237504, bug 384092, bug 264210, bug 326408, bug 134486, bug 309341, bug 377622, bug 170693, bug 338075, bug 366348
FIXED-IN: 8.0.0

M  +1    -0    NEWS
M  +13   -0    core/libs/metadataengine/dmetadata/dmetadata_exiftool.cpp
M  +6    -52   core/libs/metadataengine/engine/metaengine_p.cpp
M  +4    -20   core/utilities/setup/metadata/setupmetadata.cpp
M  +3    -4    core/utilities/setup/metadata/setupmetadata_behavior.cpp