Bug 503530 - Background removal (SAM2 based) fails
Summary: Background removal (SAM2 based) fails
Status: RESOLVED NOT A BUG
Alias: None
Product: kdenlive
Classification: Applications
Component: Video Effects & Transitions (other bugs)
Version First Reported In: unspecified
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Jean-Baptiste Mardelle
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-04-29 14:54 UTC by Holger
Modified: 2025-05-06 06:39 UTC (History)
0 users

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


Attachments
sam config (63.62 KB, image/png)
2025-05-03 04:20 UTC, Jean-Baptiste Mardelle
Details
sam config on failing system (51.55 KB, image/png)
2025-05-03 09:46 UTC, Holger
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Holger 2025-04-29 14:54:30 UTC
Reporting this bug for kdenlive 25.04.0


SUMMARY
Installed the new Background removal feature. Installation worked fine. Chose a short clip and clicked on "Remove Background". It shows a small progress slider, and then wants to start Mask creation. But obviously, this never happens. In the process list I see no busy process working on anything. The UI stays active and I can abort the process.

On the terminal I get this output:

SETTING AUDIO DATA IN MONITOR NOT EMPTY!!!
::::: SEEKING WHILE MONITOR NOT READY!!!
====== OPENING CLIP:  "GX014223.MP4"
TRACK NOT IN TARGET :  8  =  QList(8)
ACTION:  "&My Custom job"  =  "custom;"
:::: COMPARING ACTIONTYPE:  ""  =  ClipType::AV
ACTION:  "&Automatisches Aufteilen der Szene ..."  =  "scenesplit;v"
:::: COMPARING ACTIONTYPE:  "v"  =  ClipType::AV
ACTION:  "&Stabilisieren"  =  "stabilize;v"
:::: COMPARING ACTIONTYPE:  "v"  =  ClipType::AV
ACTION:  "&Clip mit Geschwindigkeitsänderung duplizieren ..."  =  "timewarp;av"
:::: COMPARING ACTIONTYPE:  "av"  =  ClipType::AV
ACTION:  "Clip-&Vorgänge einrichten ..."  =  ""
:::: COMPARING ACTIONTYPE:  ""  =  ClipType::AV
::: ADJUSTED RULER HEHGIT:  0 
9999999999999999999999999999999999

qrc:/qml/kdenlivemonitorautomask.qml:297:13: QML Image: Cannot open: file:///home/holgerpriv/.cache/kdenlive/1745267577621/masks/source-frames/preview--0769.png
TRACK NOT IN TARGET :  8  =  QList(8)
qml: item not found


STEPS TO REPRODUCE
1. Install background removal tools
2. choose a short clip
3. Click "remove Background"

OBSERVED RESULT
Nothing happens

EXPECTED RESULT
Background removed

SOFTWARE/OS VERSIONS
Running kdenlive under GNOME in opensuse tumbleweed

ADDITIONAL INFORMATION
Comment 1 Holger 2025-04-29 14:58:06 UTC
It seems to create source frames, but with the wrong filename as it seems:

holgerpriv@linux:~/.cache/kdenlive/1745267577621/masks/source-frames> ls
00000.jpg  00006.jpg  00012.jpg  00018.jpg  00024.jpg  00030.jpg  00036.jpg
00001.jpg  00007.jpg  00013.jpg  00019.jpg  00025.jpg  00031.jpg  00037.jpg
00002.jpg  00008.jpg  00014.jpg  00020.jpg  00026.jpg  00032.jpg  00038.jpg
00003.jpg  00009.jpg  00015.jpg  00021.jpg  00027.jpg  00033.jpg  00039.jpg
00004.jpg  00010.jpg  00016.jpg  00022.jpg  00028.jpg  00034.jpg  00040.jpg
00005.jpg  00011.jpg  00017.jpg  00023.jpg  00029.jpg  00035.jpg



qrc:/qml/kdenlivemonitorautomask.qml:297:13: QML Image: Cannot open: file:///home/holgerpriv/.cache/kdenlive/1745267577621/masks/source-frames/preview--0769.png
Comment 2 Jean-Baptiste Mardelle 2025-05-02 14:31:23 UTC
Thanks for your report. Just to be sure, after clicking on "Remove Background", you should effectively see a progress bar indicating the export of the original frames of your clip. When this is finished, you should see a message saying "Click on an object.." in the clip monitor.

After you click on the monitor, it should show you a mask around the object you clicked on.

It is not clear from your report if you clicked in the monitor..
Comment 3 Holger 2025-05-02 17:26:36 UTC
(In reply to Jean-Baptiste Mardelle from comment #2)
> Thanks for your report. Just to be sure, after clicking on "Remove
> Background", you should effectively see a progress bar indicating the export
> of the original frames of your clip. When this is finished, you should see a
> message saying "Click on an object.." in the clip monitor.
> 
> After you click on the monitor, it should show you a mask around the object
> you clicked on.
> 
> It is not clear from your report if you clicked in the monitor..

I click on "Remove Background", it then shows the progress bar for the export of the original frames as you describe. But then there is no message "Click on an object". If I click into the monitor, the clip is just continued playing. The button "Remove Background" changes to "Abort Mask creation". Nothing happens if I click that.
Comment 4 Jean-Baptiste Mardelle 2025-05-03 04:20:05 UTC
Created attachment 180899 [details]
sam config

And if you go to Kdenlive Settings > Plugins > Object detection, it looks like my screenshot ? No error message ?
Comment 5 Holger 2025-05-03 06:12:02 UTC
(In reply to Jean-Baptiste Mardelle from comment #4)
> Created attachment 180899 [details]
> sam config
> 
> And if you go to Kdenlive Settings > Plugins > Object detection, it looks
> like my screenshot ? No error message ?

wanted to upload a screenshot, but that doesn't make sense, because it is exactly the same, no error message at all, 
and the very same text, just in German.

What can I do on my side to further debug this?
Comment 6 Jean-Baptiste Mardelle 2025-05-03 09:14:32 UTC
In the plugin settings, which device is selected ? CPU or a GPU ?
Where did you get Kdenlive ? Is it a distro package, Flatpak, AppImage ? 
Can you paste her the infos in Help > About Kdenlive > Components
Comment 7 Holger 2025-05-03 09:46:58 UTC
Created attachment 180905 [details]
sam config on failing system
Comment 8 Holger 2025-05-03 09:49:55 UTC
(In reply to Jean-Baptiste Mardelle from comment #6)
> In the plugin settings, which device is selected ? CPU or a GPU ?
> Where did you get Kdenlive ? Is it a distro package, Flatpak, AppImage ? 
> Can you paste her the infos in Help > About Kdenlive > Components

CPU is selected, it's an ARM system with integrated graphics
It's opensuse's RPM version, trying a flatpacked version is an option I can try, although I would like to avoid that.

Kdenlive: 25.04.0
MLT: 7.30.0
FFmpeg
KDE Frameworks: 6.13.0
Qt: 6.9.0 wird verwendet und gebaut wurde mit 6.9.0
openSUSE Tumbleweed (Wayland)
Build ABI: x86_64-little_endian-lp64
Kernel: linux 6.14.4-1-default
Comment 9 Holger 2025-05-03 11:25:28 UTC
I deinstalled the RPM and will now try the flatpack version...
Comment 10 Holger 2025-05-03 12:14:08 UTC
(In reply to Holger from comment #9)
> I deinstalled the RPM and will now try the flatpack version...

did not help. In the Flatpak version I installed sam the very same way, but the button "Background removal" does not appear at all. Everything else is unchanged, just like my former configuration. checking further if I am doing something wrong...
Comment 11 Holger 2025-05-03 13:00:46 UTC
(In reply to Holger from comment #8)
> (In reply to Jean-Baptiste Mardelle from comment #6)
> > In the plugin settings, which device is selected ? CPU or a GPU ?
> > Where did you get Kdenlive ? Is it a distro package, Flatpak, AppImage ? 
> > Can you paste her the infos in Help > About Kdenlive > Components
> 
> CPU is selected, it's an ARM system with integrated graphics

AMD system is what I mean, sorry :D
Comment 12 Jean-Baptiste Mardelle 2025-05-04 12:46:26 UTC
Regarding your flatpak version, to have the "Remove Background" button, you need to enable the built-in effects from the Kdenlive Settings > Misc page. I just tested the Flatpak and it works for me.
Comment 13 Holger 2025-05-05 09:21:34 UTC
(In reply to Jean-Baptiste Mardelle from comment #12)
> Regarding your flatpak version, to have the "Remove Background" button, you
> need to enable the built-in effects from the Kdenlive Settings > Misc page.
> I just tested the Flatpak and it works for me.

So many thanks for this advice Jean, I knew I somehow forgot something :) Will test as soon as possible!
Comment 14 Holger 2025-05-06 06:39:09 UTC
(In reply to Jean-Baptiste Mardelle from comment #12)
> Regarding your flatpak version, to have the "Remove Background" button, you
> need to enable the built-in effects from the Kdenlive Settings > Misc page.
> I just tested the Flatpak and it works for me.

Tested the flatpak and it works! Thanks Jean. I will re-test the tumbleweed version soon. If it still exists, it's not a kdenlive bug whatsoever, so I am setting this to NOT A BUG.