Bug 484959 - Inconsistent metadata behavior between photo and video after adding a caption
Summary: Inconsistent metadata behavior between photo and video after adding a caption
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Metadata-Xmp (show other bugs)
Version: 8.4.0
Platform: Manjaro Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-03 08:30 UTC by mahikeulbody
Modified: 2024-04-04 12:51 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 8.4.0
Sentry Crash Report:


Attachments
bug report (2.29 KB, text/plain)
2024-04-03 08:30 UTC, mahikeulbody
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mahikeulbody 2024-04-03 08:30:40 UTC
Created attachment 168079 [details]
bug report

See attached file since my report is blocked as spam (???).
Comment 1 Maik Qualmann 2024-04-03 10:47:33 UTC
We've already talked about the video metadata being "virtual" that we display in Exif, Iptc and Xmp. If you now add captions, these "virtual" ones will also be written back as real ones.

I see that we must fundamentally change this behavior.

@Gilles, we are also no longer allowed to use Xmp.audio* and Xmp.video*, these private Exiv2 metadata were added in GSoC-2012. There is a thread about this in the ExifTool forum and they are not supported by ExifTool either.

Furthermore, the FFMpeg parser must send the metadata of the database entries relevant to the video directly to the database. The Exif, (Iptc) and Xmp metadata views must represent the real video metadata.

Maik
Comment 2 mahikeulbody 2024-04-03 10:59:20 UTC
(In reply to Maik Qualmann from comment #1)
> We've already talked about the video metadata being "virtual" that we
> display in Exif, Iptc and Xmp. If you now add captions, these "virtual" ones
> will also be written back as real ones.

There are not only virtual video metadata written back in video and not in photo : [XMP-photoshop] Date Created, for exemple, is not a specific video metadata.
Comment 3 Maik Qualmann 2024-04-03 11:17:20 UTC
[XMP-photoshop] Date Created is also virtual and created by us.

Maik
Comment 4 caulier.gilles 2024-04-03 11:21:49 UTC
@Gilles, we are also no longer allowed to use Xmp.audio* and Xmp.video*, these private Exiv2 metadata were added in GSoC-2012. There is a thread about this in the ExifTool forum and they are not supported by ExifTool either.

Not allowed why ? We can technical create the namespace that we want...

I all cases, if audo and video are missing in another namespace, we can just create tags in digiKam namespace, at least to be sure to register information in files.

Gilles
Comment 5 mahikeulbody 2024-04-03 11:32:23 UTC
You are right. But what I am trying to say is that [XMP-photoshop] Date Created is not specific to videos, it appears also for photos but it is not written back to file for photos. So it is not just "about the VIDEO metadata being "virtual" as you said in your first comment, it is also for some/all virtual virtual metadata, whatever they come from video or photo.
Comment 6 Maik Qualmann 2024-04-03 17:10:38 UTC
The metadata entry [XMP-photoshop] is also written for video files by ExifTool. However, this is not displayed with the "-G1" option, it also requires the "-a" option.

Maik
Comment 7 mahikeulbody 2024-04-03 17:23:32 UTC
I think my poor english does not help... Please see again the attached file (both made with -a option). My concern is not what is written back when a caption is added. My concern is why it is not the same set of metadatas for photos and videos at least for those common to photos and videos, such as XMP-photoshop:Date Created and many others, which are written back to file for videos ans NOT for photos.
Comment 8 Maik Qualmann 2024-04-03 18:06:35 UTC
Well, just by the way, you disabled writing some captions metadata, Exif user comment, XPComment, ACDSee...

But it doesn't matter. Videos generally do not have Exif, Iptc or Xmp metadata.
They often have a QuickTime container or manufacturer-specific Makernotes.

Our metadata display would probably be completely empty for most video files.
That's why we interpret the metadata found as Exif or Iptc and Xmp. This happens partly through our FFmpeg parser and through ExifTool itself.

So we then have a filled metadata container that is written back when there is a change (captions added). Hence the large number of changes.

My idea now is that before we write video metadata we read the metadata again, but only the Exif, Iptc or Xmp metadata that is actually present.

Maik
Comment 9 mahikeulbody 2024-04-03 18:35:51 UTC
Ok.

It was not the initial topic of this report but since we're talking about that, I have to say I am in favor to write back to the file ONLY the metadata(s) modified. If an user modifies 'Caption",  why on earth Digikam would modify also another metadata(s) not linked to 'Caption' by the metadata advanced configuration settings ?

I understand (or at least, I think so ;-) the technical problem with quicktime but you seems to have find a way, don't you ?
Comment 10 mahikeulbody 2024-04-03 18:52:13 UTC
(In reply to Maik Qualmann from comment #8)
> Well, just by the way, you disabled writing some captions metadata, Exif user comment, XPComment, ACDSee...
> But it doesn't matter. Videos generally do not have Exif, Iptc or Xmp metadata.

I set Caption --> Xmp.dc.description, which is a metadata digikam is able to write back to the video file. Why do you say it doesn't matter disabling writing Exif user comment, XPComment, ACDSee... for Caption ??? I'm lost here.
Comment 11 Maik Qualmann 2024-04-03 19:16:00 UTC
Ignore it ((:-))
I was referring to your bug report attachment, where only 3 metadata entries were changed when writing a caption for an image.
In the basic settings, many more metadata entries would actually be written.

Maik
Comment 12 Maik Qualmann 2024-04-03 19:37:01 UTC
Git commit 717c0d5272e92ec28e304c6d35ec2cbbacdeb4a0 by Maik Qualmann.
Committed on 03/04/2024 at 19:35.
Pushed by mqualmann into branch 'master'.

write only real (xmp) metadata to video files
FIXED-IN: 8.4.0

M  +1    -1    NEWS
M  +1    -1    core/libs/database/item/scanner/itemscanner.cpp
M  +2    -2    core/libs/metadataengine/dmetadata/dmetadata.h
M  +4    -5    core/libs/metadataengine/dmetadata/dmetadata_exiftool.cpp
M  +22   -8    core/libs/metadataengine/dmetadata/dmetadata_fileio.cpp
M  +1    -1    core/libs/properties/itempropertiesmetadatatab.cpp

https://invent.kde.org/graphics/digikam/-/commit/717c0d5272e92ec28e304c6d35ec2cbbacdeb4a0
Comment 13 Maik Qualmann 2024-04-03 19:47:06 UTC
@Gilles, we should update ExifTool in the bundles.

Maik
Comment 14 caulier.gilles 2024-04-03 19:51:55 UTC
Right, i do it tomorrow morning.

Gilles
Comment 15 caulier.gilles 2024-04-04 07:25:01 UTC
Git commit b140a91867e66371794c345aeafa20082e10169b by Gilles Caulier.
Committed on 04/04/2024 at 07:21.
Pushed by cgilles into branch 'master'.

Add script to update ExifTool in files.kde.org/digikam/exiftool/ download area
Official Exiftool version must be passed as argument in command line.
A valid account withh ssh key to access in R/W to files.kde.org must be available before to use this script.

A  +52   -0    project/scripts/update_exiftool.sh [INFRASTRUCTURE]

https://invent.kde.org/graphics/digikam/-/commit/b140a91867e66371794c345aeafa20082e10169b
Comment 16 caulier.gilles 2024-04-04 07:28:33 UTC
Maik,

ExifTool is now updated in download area with the 12.87 release. I add a script to automatize this job. 
This cache version online, with archive files renamed is used by bundle build scripts, as the official Exiftool site do not provide a list of all previous releases, which can break the build script when a new version is push online.   

Gilles
Comment 17 mahikeulbody 2024-04-04 11:51:55 UTC
Since your commit was previous to the date of the last appimage bundle, I suppose the fix is present into the last bundle. Forget this comment if the fix is not yet in the build.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------

It is not fixed in the digiKam-8.4.0-20240404T094657-x86-64.appimage bundle (the one from this morning).
Digikam adds ever a lot of xmp metadata non related to the modified field (Caption in this case) for a video.

On the other hand, exiftool -caption='test caption' video.mp4 add only the expected lines
[XMP-x]         XMP Toolkit                     : Image::ExifTool 12.76
[XMP-dc]        Description                     : caption test

So that should be possible for Digikam since it uses exiftool (when set in the configuration).
Comment 18 mahikeulbody 2024-04-04 12:14:36 UTC
Forget my comment, I was using a wrong bundle...
Comment 19 mahikeulbody 2024-04-04 12:51:07 UTC
It is fixed, sorry again (and thanks).