Bug 442880 - crash when enabling movit acceleration playback
Summary: crash when enabling movit acceleration playback
Status: REPORTED
Alias: None
Product: kdenlive
Classification: Applications
Component: User Interface (show other bugs)
Version: 21.08.1
Platform: Ubuntu Linux
: NOR crash
Target Milestone: ---
Assignee: Jean-Baptiste Mardelle
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-09-24 08:41 UTC by aug
Modified: 2022-10-25 16:02 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
fritzibaby: MOVIT+


Attachments
gdb bug (57.94 KB, text/plain)
2021-09-24 08:41 UTC, aug
Details
Debugging result for 442880 (12.73 KB, text/plain)
2021-10-07 12:36 UTC, cropinghigh
Details

Note You need to log in before you can comment on or make changes to this bug.
Description aug 2021-09-24 08:41:57 UTC
Created attachment 141857 [details]
gdb bug

Kdenlive 21.08.1 MLT 7.0.0.
Ubuntu 20.04.3 and 21.04.

When enabling movit plyback acceleration crash when starting kdenlive not being possible use it.
Kdenlive only start if movit is disabled.
Comment 1 cropinghigh 2021-10-07 12:36:14 UTC
Created attachment 142237 [details]
Debugging result for 442880
Comment 2 cropinghigh 2021-10-07 12:39:11 UTC
Having same problem on Manjaro
KDE 5.22.5
Kdenlive latest from git
MLT latest from git
Movit library latest from git
In log, i tried to debug it with GDB. It looks like event_data passed to mlt_events_fire somewhere contains pointer to zero, instead of GLWidget object, it's trying to read some class variable(when "this" is 0x0 pointer), and SEGFAULT happens.
Comment 3 aug 2021-10-19 11:43:15 UTC
Continue crashing in KDEnlive 21.08.2.
The OS is Ubuntu 20.04 Geforce GT 640 using driver 465 CUDA 11.3.
Comment 4 aug 2021-10-26 03:02:49 UTC
That bug is recent.
Another detail is in .xsession-errors logs is displayed the lines below when trying start kdenlive with enabled gpu processing movit.

========================
Invalid metadata for "avcolour_space"
Failed to parse "avcolour_space"
Invalid metadata for "avcolor_space"
Failed to parse "avcolor_space"
Invalid metadata for "avdeinterlace"
Failed to parse "avdeinterlace"
Invalid metadata for "swscale"
Failed to parse "swscale"
Invalid metadata for "swresample"
Failed to parse "swresample"
Invalid metadata for "audiochannels"
Failed to parse "audiochannels"
Invalid metadata for "audioconvert"
Failed to parse "audioconvert"
Invalid metadata for "imageconvert"
Failed to parse "imageconvert"
Invalid metadata for "jack"
Failed to parse "jack"
Invalid metadata for "glsl.manager"
Failed to parse "glsl.manager"
Invalid metadata for "movit.convert"
Failed to parse "movit.convert"
Invalid metadata for "movit.crop"
Failed to parse "movit.crop"
Invalid metadata for "movit.resample"
Failed to parse "movit.resample"
Invalid metadata for "movit.resize"
Failed to parse "movit.resize"
Invalid metadata for "telecide"
Failed to parse "telecide"
Invalid metadata for "deinterlace"
Failed to parse "deinterlace"
Unknown asset "avfilter.acompressor"
==== PARSING ABORTED FOR: "/usr/share/kdenlive/effects/acompressor.xml"
Unknown asset "avfilter.aecho"
==== PARSING ABORTED FOR: "/usr/share/kdenlive/effects/aecho.xml"
Unknown asset "avfilter.agate"
==== PARSING ABORTED FOR: "/usr/share/kdenlive/effects/agate.xml"
Unknown asset "avfilter.atadenoise"
==== PARSING ABORTED FOR: "/usr/share/kdenlive/effects/avfilter_atadenoise.xml"
Unknown asset "avfilter.bwdif"
==== PARSING ABORTED FOR: "/usr/share/kdenlive/effects/avfilter_bwdif.xml"
Unknown asset "avfilter.deblock"
==== PARSING ABORTED FOR: "/usr/share/kdenlive/effects/avfilter_deblock.xml"
Unknown asset "avfilter.dedot"
==== PARSING ABORTED FOR: "/usr/share/kdenlive/effects/avfilter_dedot.xml"
Unknown asset "avfilter.deflate"
==== PARSING ABORTED FOR: "/usr/share/kdenlive/effects/avfilter_deflate.xml"
Unknown asset "avfilter.derain"
==== PARSING ABORTED FOR: "/usr/share/kdenlive/effects/avfilter_derain.xml"
Unknown asset "avfilter.doubleweave"
==== PARSING ABORTED FOR: "/usr/share/kdenlive/effects/avfilter_doubleweave.xml"
Unknown asset "avfilter.field"
==== PARSING ABORTED FOR: "/usr/share/kdenlive/effects/avfilter_field.xml"
Unknown asset "avfilter.framestep"
==== PARSING ABORTED FOR: "/usr/share/kdenlive/effects/avfilter_framestep.xml"
Unknown asset "avfilter.fspp"
==== PARSING ABORTED FOR: "/usr/share/kdenlive/effects/avfilter_fspp.xml"
Unknown asset "avfilter.graphmonitor"
==== PARSING ABORTED FOR: "/usr/share/kdenlive/effects/avfilter_graphmonitor.xml"
Unknown asset "avfilter.hqdn3d"
==== PARSING ABORTED FOR: "/usr/share/kdenlive/effects/avfilter_hqdn3d.xml"
Unknown asset "avfilter.inflate"
==== PARSING ABORTED FOR: "/usr/share/kdenlive/effects/avfilter_inflate.xml"
Unknown asset "avfilter.lagfun"
==== PARSING ABORTED FOR: "/usr/share/kdenlive/effects/avfilter_lagfun.xml"
Unknown asset "avfilter.random"
==== PARSING ABORTED FOR: "/usr/share/kdenlive/effects/avfilter_random.xml"
Unknown asset "avfilter.removegrain"
==== PARSING ABORTED FOR: "/usr/share/kdenlive/effects/avfilter_removegrain.xml"
Unknown asset "avfilter.separatefields"
==== PARSING ABORTED FOR: "/usr/share/kdenlive/effects/avfilter_separatefields.xml"
Unknown asset "avfilter.shuffleplanes"
==== PARSING ABORTED FOR: "/usr/share/kdenlive/effects/avfilter_shuffleplanes.xml"
Unknown asset "avfilter.sr"
==== PARSING ABORTED FOR: "/usr/share/kdenlive/effects/avfilter_sr.xml"
Unknown asset "avfilter.tmix"
==== PARSING ABORTED FOR: "/usr/share/kdenlive/effects/avfilter_tmix.xml"
Unknown asset "avfilter.w3fdif"
==== PARSING ABORTED FOR: "/usr/share/kdenlive/effects/avfilter_w3fdif.xml"
Unknown asset "avfilter.weave"
==== PARSING ABORTED FOR: "/usr/share/kdenlive/effects/avfilter_weave.xml"
Unknown asset "avfilter.yadif"
==== PARSING ABORTED FOR: "/usr/share/kdenlive/effects/avfilter_yadif.xml"
Unknown asset "gpstext"
==== PARSING ABORTED FOR: "/usr/share/kdenlive/effects/gpstext.xml"
Unknown asset "movit.unsharp_mask"
==== PARSING ABORTED FOR: "/usr/share/kdenlive/effects/movit_unsharp_mask.xml"
Unknown asset "region"
==== PARSING ABORTED FOR: "/usr/share/kdenlive/effects/region.xml"
Unknown asset "timewarp"
==== PARSING ABORTED FOR: "/usr/share/kdenlive/effects/speed.xml"
Unknown asset "opencv.tracker"
==== PARSING ABORTED FOR: "/usr/share/kdenlive/effects/tracker.xml"
Unknown asset "opencv.tracker"
==== PARSING ABORTED FOR: "/usr/share/kdenlive/effects/tracker.xml"
Unknown asset "typewriter"
==== PARSING ABORTED FOR: "/usr/share/kdenlive/effects/typewriter.xml"
Unknown asset "region"
defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.audiosource"
QQmlEngine::setContextForObject(): Object already has a QQmlContext
kdeinit5: Got EXEC_NEW '/usr/lib/x86_64-linux-gnu/qt5/plugins/kf5/kio/file.so' from launcher.
kdeinit5: preparing to launch '/usr/lib/x86_64-linux-gnu/qt5/plugins/kf5/kio/file.so'
kdeinit5: Got EXEC_NEW '/usr/lib/x86_64-linux-gnu/qt5/plugins/kf5/kio/file.so' from launcher.
kdeinit5: preparing to launch '/usr/lib/x86_64-linux-gnu/qt5/plugins/kf5/kio/file.so'
kf5.kservice.services: KServiceTypeTrader: serviceType "ThumbCreator" not found
kf5.kservice.services: KServiceTypeTrader: serviceType "ThumbCreator" not found
QObject::disconnect: Unexpected null parameter
QObject::disconnect: Unexpected null parameter
QObject::disconnect: Unexpected null parameter
QQmlEngine::setContextForObject(): Object already has a QQmlContext
Período: Transição (0.01% day)
kf5.kservice.services: KServiceTypeTrader: serviceType "ThumbCreator" not found
kf5.kservice.services: KServiceTypeTrader: serviceType "ThumbCreator" not found
=== REG FOCUS: false
Período: Transição (0.22% day)
defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.audiosource"
Comment 5 cropinghigh 2021-11-15 20:14:51 UTC
I have found where issue was. One commit in mlt library 8 months ago changed API, but kdenlive not.
Fix:
Replace
"
  static void onThreadCreate(mlt_properties owner, GLWidget *self, RenderThread **thread, int *priority, thread_function_t function, void *data)
{
    Q_UNUSED(owner)
    Q_UNUSED(priority)
    // self->clearFrameRenderer();
    self->createThread(thread, function, data);
    self->lockMonitor();
}
" 
in file src/monitor/glwidget.cpp
to
"
static void onThreadCreate(mlt_properties owner, void* listener_data, mlt_event_data event_data)
{
    Q_UNUSED(owner)
    mlt_event_data_thread thread_data = *((mlt_event_data_thread*)mlt_event_data_to_object(event_data));
    // self->clearFrameRenderer();
    GLWidget* self = ((GLWidget*)(listener_data));
    self->createThread((RenderThread**)thread_data.thread, thread_data.function, thread_data.data);
    self->lockMonitor();
}
".
Now i'm experiencing another bug, i can't import any clip, segfault happening in movit library, because gl context not initialized somewhere.
Comment 6 Jean-Baptiste Mardelle 2021-11-16 14:16:49 UTC
Thanks a lot for investigating this issue. There was indeed a change that I didn't spot. I will push a change to update our usage of MLT. With my change, Kdenlive now starts with movit and can open a clip but crashes when switching from one bin clip to another...
Comment 7 Jean-Baptiste Mardelle 2021-11-16 14:30:06 UTC
Git commit b24148d53ec26651f48f4bf6fe368d9861eea155 by Jean-Baptiste Mardelle.
Committed on 16/11/2021 at 14:29.
Pushed by mardelle into branch 'release/21.12'.

Fix MLT api change causing startup crash on movit (Movit still not usable)

M  +24   -16   src/monitor/glwidget.cpp
M  +1    -1    src/monitor/glwidget.h

https://invent.kde.org/multimedia/kdenlive/commit/b24148d53ec26651f48f4bf6fe368d9861eea155
Comment 8 cropinghigh 2021-11-16 16:55:44 UTC
(In reply to Jean-Baptiste Mardelle from comment #6)
> Thanks a lot for investigating this issue. There was indeed a change that I
> didn't spot. I will push a change to update our usage of MLT. With my
> change, Kdenlive now starts with movit and can open a clip but crashes when
> switching from one bin clip to another...

Thanks for fixing this! Bug with clip import/switch i have fixed by providing openGL context to every task, you can look at merge request !261
Comment 9 aug 2021-11-19 05:06:20 UTC
The fixes was added in Kdenlive 21.12 beta or will be in next release ?
Comment 10 aug 2021-12-20 09:13:38 UTC
Kdenlive 21.12 enabling movit not crash when starting Kdenlive.
Comment 11 Andreas 2022-02-06 12:30:28 UTC
Kdenlive crashes when I try to open a video with movit enabled.
If I open a video with movit disabled and save the project, then turn on movit and load the saved project, everything works.

I opened a bug report, but I think it's the same problem.
https://bugs.kde.org/show_bug.cgi?id=449692
Comment 12 aug 2022-10-24 18:59:30 UTC
That bug have returned in some previous versions.
22.08.2 appimage if enabling movit crash kdenlive startup .. not is possible start kdenlive