https://bugs.kde.org/show_bug.cgi?id=520333

--- Comment #2 from Kristian Karl <[email protected]> ---
According to Claude, the problem is:

 "In dmetadata_fileio.cpp, for video files the load order was ExifTool →
sidecar merge → FFmpeg. The FFmpeg loader reads the GPS location entry from the
video container (+00.000+000.000/) and calls setGPSInfo(), which overwrites the
sidecar GPS that was already merged.

  The fix: Move loadFromSidecarAndMerge() to run after all backends (ExifTool +
FFmpeg), so user edits in the XMP sidecar always take priority over metadata
embedded in the video container."


Below is a patch suggestion that passes the test in draft pr:
https://invent.kde.org/graphics/digikam/-/merge_requests/397

I post is as a help for troubleshooting, hoping to fascilitate troubleshooting
for maintainers.

%> git diff
diff --git a/bootstrap.linux b/bootstrap.linux
index 25fb1d6e7a..3c46e4727c 100755
--- a/bootstrap.linux
+++ b/bootstrap.linux
@@ -15,7 +15,7 @@ trap 'echo "FAILED COMMAND: $PREVIOUS_COMMAND"' ERR
 #export CXX=/usr/bin/clang++

 SOURCEDIR=$PWD
-export BUILD_WITH_QT6=0
+export BUILD_WITH_QT6=1

 if [[ $BUILD_WITH_QT6 == 1 ]] ; then
     QTPATHS="qtpaths6"
diff --git a/core/libs/metadataengine/dmetadata/dmetadata_fileio.cpp
b/core/libs/metadataengine/dmetadata/dmetadata_fileio.cpp
index 3c2a97b50c..8363ae76e9 100644
--- a/core/libs/metadataengine/dmetadata/dmetadata_fileio.cpp
+++ b/core/libs/metadataengine/dmetadata/dmetadata_fileio.cpp
@@ -120,11 +120,6 @@ bool DMetadata::load(const QString& filePath, bool
videoAll, Backend* backend)

         if ((hasLoaded = loadUsingExifTool(filePath, videoAll)))
         {
-            // Load and merge metadata from sidecar first
-            // before adding virtual metadata to XMP.
-
-            sidecarLoaded = loadFromSidecarAndMerge(filePath);
-
             if (videoAll && (hasLoaded = loadUsingFFmpeg(filePath)))
             {
                 usedBackend = VideoMergeBackend;
@@ -136,8 +131,6 @@ bool DMetadata::load(const QString& filePath, bool
videoAll, Backend* backend)
         }
         else
         {
-            sidecarLoaded = loadFromSidecarAndMerge(filePath);
-
             if (videoAll && (hasLoaded = loadUsingFFmpeg(filePath)))
             {
                 usedBackend = FFMpegBackend;
@@ -147,6 +140,11 @@ bool DMetadata::load(const QString& filePath, bool
videoAll, Backend* backend)
                 usedBackend = NoBackend;
             }
         }
+
+        // Merge sidecar after all backends so user edits take priority
+        // over metadata embedded in the video container.
+
+        sidecarLoaded = loadFromSidecarAndMerge(filePath);
     }

     qCDebug(DIGIKAM_METAENGINE_LOG) << "Loading metadata with"

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to