Segmentation fault with motion tracker
Describe the bug The motion tracker analysis started from Kdenlive segfaults melt. I catched the command started by Kdenlive with ```ps``, and run it by myself, and there is a segmation fault in mlt. Tried to get a backtrace from the core dump, but only that is available:
Thread 15 "melt-7" received signal SIGSEGV, Segmentation fault.
...
#0 0x00007fffe8bcb234 in ??? ()
#1 0x00007fffb11f5e28 in ??? ()
#2 0x00007fffb11f5e28 in ??? ()
#3 0x00007fffb11f6ce4 in ??? ()
#4 0x00007fffe8bd1873 in ??? ()
#5 0x00007fffe799bf00 in ??? ()
#6 0x00007fffe8b7660f in rml::internal::internalPoolFree (size=0, memPool=0x1, object=0x0) at src/tbbmalloc/frontend.cpp:2634
#7 rml::internal::internalPoolFree (size=0, memPool=0x1, object=0x0) at src/tbbmalloc/frontend.cpp:2634
#8 rml::internal::internalFree (object=0x0) at src/tbbmalloc/frontend.cpp:2670
#9 scalable_aligned_free (ptr=0x0) at src/tbbmalloc/frontend.cpp:3194
#10 0x00007fffe79ebe00 in ??? ()
#11 0x00007fffe79ebf00 in ??? ()
#12 0x00007fffe79ebf80 in ??? ()
#13 0x00007fffb19f7cd6 in ??? ()
#14 0x00007fffb11f6ce4 in ??? ()
#15 0x00007fffb0df6000 in ??? ()
#16 0x00007fffe8bce515 in ??? ()
#17 0x00007fffb11f66c0 in ??? ()
#18 0x0000000000000000 in ??? ()
To Reproduce
- Put the motion tracker effect on a clip in Kdenlive.
- Align the rectangle on the first frame.
- Click on Analyse to Apply Effect button.
- A
Failed to filter source.message appears.
Nearly all my attempts from Kdenlive goes like this. Sometimes it works after a lot of trial.
Expected behavior A working motion tracker analysis.
Desktop (please complete the following information):
- OS: OpenSuSE Tumbleweed
- OS Version: Most recent update
- MLT/melt version: melt-7 7.32.0
- OpenCV: 4.12.0
I did a quick check: the function in your callstack is not part of MLT. It appears to be a function from the Intel Threading Building Block library which is not used by MLT. TBB is used by OpenCV, however.
I do not develop for KDENLIVE. As such, I don't have a working environment to test your steps to reproduce. As a test, I tried to recreate your steps in Shotcut (using the latest master of MLT and OpenCV 4.11.0), and everything worked fine.
Maybe it would be best to start by posting your issue with KDENLIVE. Or, if possible, provide steps to recreate the problem using the MLT command line.
I attached a sample project with the files created by Kdenlive when the Analyse to Apply Effect button is clicked. It looks like MLT does its job with creating kdenlive-tFjuYb.mlt with coordinates in it, but dies at the end, and that's why Kdenlive doesn't uses the results most probably because of the exit code of the melt-7 process. If you extract the attached archive to /tmp it should work.
/tmp/mlt> /usr/bin/melt-7 -loglevel error progress=1 /tmp/mlt/kdenlive-LYgfwZ.mlt
+-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+
|1=-10| |2= -5| |3= -2| |4= -1| |5= 0| |6= 1| |7= 2| |8= 5| |9= 10|
+-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+
+---------------------------------------------------------------------+
| H = back 1 minute, L = forward 1 minute |
| h = previous frame, l = next frame |
| g = start of clip, j = next clip, k = previous clip |
| 0 = restart, q = quit, space = play |
+---------------------------------------------------------------------+
Current Position: 123
Segmentation fault (core dumped) /usr/bin/melt-7 -loglevel error progress=1 /tmp/mlt/kdenlive-LYgfwZ.mlt
It works as should from Kdenlive with the following wrapper (to make the exit code 0).
#!/bin/bash
/usr/bin/melt-7.bak "$@"
Unfortunately I don't have an Intel processor to test.
I compiled OpenCV 4.12.0 with support for TBB enabled (version 2022.2), but no crash using your command when launched on an AMD system:
melt -loglevel error progress=1 /tmp/mlt/kdenlive-LYgfwZ.mlt
Can you maybe add the TBB version you have? Did you compile OpenCV? Can you try disabling TBB?
Everything is installed from the OpenSuSE Tumbleweed factory repositories. TBB package version: 2022.2.0-2.1
Now I compiled OpenCV 4.12.0 with -DWITH_TBB=OFF, installed it to /usr/local, set LD_LIBRARY_PATH=/usr/local/lib64, run the sample project I attached above: there was no segfault.