Crash when rendering from kdenlive
Melt binary crashes when rendering a small project (1080p, 6 clips, 4 mins total length) from kdenlive. The crash always occurs around the point when melt's actualy memory usage reaches the 2Gb mark. So for bigger/more complex projects or e.g. a lossless render target the crash happens sooner than for simpler projects and low quality, compressed output formats. The only kind of rendering that actually works is audio-only, because the melt binary will never reach 2Gb memory usage.
GPU processing via movit is enabled in kdenlive but the problem persists with movit support disabled. Playback through kdenlive works fine, running melt $project.kdenlive in a shell runs without errors but does not show video (don't know if that's intended)
The only output that kdenlive supplies on the crash is
[webm @ 0x7fc4c4000f00] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
[webm @ 0x7fc4c4000f00] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
It's always these two lines, no matter the preset I pick. I read some suggestions to try different values for the -acodec parameters, but those suggestions (a) were years old and (b) did not work.
When rendering video-only (default WebM preset, but with -an in this example) there's a bit more output, although I doubt that'll be helpful either:
[libopus @ 0x7f258c0043c0] Value 0,000000 for parameter 'frame_duration' out of range [2,5 - 120]
[libopus @ 0x7f258c004c00] Value 0,000000 for parameter 'frame_duration' out of range [2,5 - 120]
[libopus @ 0x7f258c0043c0] No bit rate set. Defaulting to 96000 bps.
Just let me know what more information you need. If someone explains to me how to increase the verbosity of the melt binary spawned from kdenlive or where the logs are stored (if any), I'll be happy to supply more details about the crash.
--version: linux 5.2.1 (Arch, x86_64) melt 6.16.0 kdenlive 19.04.3 movit 1.6.3
perhaps it would help if you provide a backtrace? https://userbase.kde.org/Kdenlive/Manual/BugReporting#How_to_get_useful_crash_information_.28backtrace.29
Could you give us any more feedback? Is this still happening? Can you reproduce with a smaller proejct? If so, share it and I can try to debug...
Since you mentioned Movit, do note that it has been removed from Kdenlive due to instability, Could that be the cause?
Since you mentioned Movit, do note that it has been removed from Kdenlive due to instability, Could that be the cause?
He wrote that it happens both with and without Movit.
And movit should in theory be more stable now, I added a lot of checks so that movit doesn't assert() and crash the whole application if passed invalid data, and should be more robust towards bugs in kdenlive. In theory at least.
Since you mentioned Movit, do note that it has been removed from Kdenlive due to instability, Could that be the cause?
He wrote that it happens both with and without Movit.
And movit should in theory be more stable now, I added a lot of checks so that movit doesn't assert() and crash the whole application if passed invalid data, and should be more robust towards bugs in kdenlive. In theory at least.
Definitely sice your last commits it worked really well although I had to stop using it due to the chroma rendering issues I was getting as reported.
chroma rendering issues I was getting as reported
I guess that might actually be because of my fixes (just rendering errors instead of crashing). do you get any error/warning messages printed to the terminal when it happens?
chroma rendering issues I was getting as reported
I guess that might actually be because of my fixes (just rendering errors instead of crashing). do you get any error/warning messages printed to the terminal when it happens?
hmm, just got a crash trying to open that project:
Thread 1739 (Thread 0x7ffea0638640 (LWP 73909)):
#0 0x00007fffd0c1eed8 in () at /usr/lib/libavcodec.so.58
#1 0x00007fffd0c233e9 in () at /usr/lib/libavcodec.so.58
#2 0x00007fffd0eb9da6 in () at /usr/lib/libavcodec.so.58
#3 0x00007fffd0b18d96 in () at /usr/lib/libavcodec.so.58
#4 0x00007fffd0b19a78 in avcodec_send_packet () at /usr/lib/libavcodec.so.58
#5 0x00007fffd0b19f0c in () at /usr/lib/libavcodec.so.58
#6 0x00007fffe40dcb25 in producer_get_image (frame=frame@entry=0x608000789fa0, buffer=buffer@entry=0x7ffea0637990, format=format@entry=0x6140000b4e4c, width=width@entry=0x7ffea0637178, height=height@entry=0x7ffea063717c, writable=writable@entry=1) at producer_avformat.c:1833
pts = <optimized out>
ret = <optimized out>
int_position = <optimized out>
decode_errors = <optimized out>
_mlt_log_timings_begin = <optimized out>
_mlt_log_timings_end = <optimized out>
source_fps = <optimized out>
descriptor = <optimized out>
must_decode = <optimized out>
speed = <optimized out>
paused = <optimized out>
req_position = <optimized out>
delay = <optimized out>
preseek = <optimized out>
self = 0x61b000274b80
producer = <optimized out>
frame_properties = 0x608000789fa0
position = <optimized out>
properties = <optimized out>
alpha = 0x0
got_picture = 0
image_size = <optimized out>
context = <optimized out>
stream = <optimized out>
codec_context = <optimized out>
__FUNCTION__ = "producer_get_image"
#7 0x00007ffff71144f2 in mlt_frame_get_image (self=self@entry=0x608000789fa0, buffer=buffer@entry=0x7ffea0637990, format=format@entry=0x6140000b4e4c, width=width@entry=0x7ffea0637178, height=height@entry=0x7ffea063717c, writable=writable@entry=1) at mlt_frame.c:620
properties = 0x608000789fa0
get_image = 0x7fffe40dbc20 <producer_get_image>
requested_format = <optimized out>
error = 0
#8 0x00007fffe47e5053 in filter_get_image (frame=frame@entry=0x608000789fa0, image=image@entry=0x7ffea0637990, format=format@entry=0x6140000b4e4c, width=width@entry=0x7ffea0637178, height=height@entry=0x7ffea063717c, writable=writable@entry=1) at filter_deinterlace.c:251
service = 0x60b0045e2ea0
error2 = <optimized out>
method_str = 0x60200135aeb0 "onefield"
method = <optimized out>
frame_method_str = <optimized out>
error = <optimized out>
filter = 0x6080006d7920
properties = 0x608000789fa0
deinterlace = 1
progressive = 0
#9 0x00007ffff71144f2 in mlt_frame_get_image (self=self@entry=0x608000789fa0, buffer=buffer@entry=0x7ffea0637990, format=format@entry=0x6140000b4e4c, width=width@entry=0x7ffea0637178, height=height@entry=0x7ffea063717c, writable=writable@entry=1) at mlt_frame.c:620
properties = 0x608000789fa0
get_image = 0x7fffe47e4db0 <filter_get_image>
requested_format = <optimized out>
error = 0
#10 0x00007fffe3942a3e in get_image (frame=frame@entry=0x608000789fa0, image=image@entry=0x7ffea0637990, format=format@entry=0x6140000b4e4c, width=width@entry=0x7ffea0637178, height=height@entry=0x7ffea063717c, writable=writable@entry=1) at filter_fieldorder.c:33
properties = 0x608000789fa0
error = <optimized out>
#11 0x00007ffff71144f2 in mlt_frame_get_image (self=self@entry=0x608000789fa0, buffer=buffer@entry=0x7ffea0637990, format=format@entry=0x6140000b4e4c, width=width@entry=0x7ffea0637178, height=height@entry=0x7ffea063717c, writable=writable@entry=1) at mlt_frame.c:620
properties = 0x608000789fa0
get_image = 0x7fffe3942a00 <get_image>
requested_format = <optimized out>
error = 0
#12 0x00007fffd1e70d81 in get_image(mlt_frame, uint8_t**, mlt_image_format*, int*, int*, int) (frame=frame@entry=0x608000789fa0, image=image@entry=0x7ffea0637990, format=format@entry=0x6140000b4e4c, width=width@entry=0x7ffea0637178, height=height@entry=0x7ffea063717c, writable=writable@entry=1) at filter_movit_crop.cpp:68
error = 0
properties = 0x608000789fa0
profile = 0x6060002a1700
requested_format = mlt_image_glsl
effect = <optimized out>
__PRETTY_FUNCTION__ = "int get_image(mlt_frame, uint8_t**, mlt_image_format*, int*, int*, int)"
border_color = {r = 2.63387073e-37, g = 3.49764097e-41, b = 1.10775222e-38, a = 3.46176773e-41}
ok = <optimized out>
#13 0x00007ffff71144f2 in mlt_frame_get_image (self=self@entry=0x608000789fa0, buffer=buffer@entry=0x7ffea0637990, format=format@entry=0x6140000b4e4c, width=width@entry=0x7ffea0637178, height=height@entry=0x7ffea063717c, writable=writable@entry=1) at mlt_frame.c:620
properties = 0x608000789fa0
get_image = 0x7fffd1e70cb0 <get_image(mlt_frame, uint8_t**, mlt_image_format*, int*, int*, int)>
requested_format = <optimized out>
error = 0
#14 0x00007fffd1e72cb8 in get_image(mlt_frame, uint8_t**, mlt_image_format*, int*, int*, int) (frame=frame@entry=0x608000789fa0, image=image@entry=0x7ffea0637990, format=format@entry=0x6140000b4e4c, width=width@entry=0x7ffea06372b8, height=height@entry=0x7ffea06372bc, writable=writable@entry=1) at filter_movit_resample.cpp:80
properties = 0x608000789fa0
filter_properties = 0x6080006d77a0
profile = <optimized out>
iwidth = 1920
iheight = 1080
factor = <optimized out>
owidth = 480
oheight = 270
disable = <optimized out>
error = <optimized out>
effect = <optimized out>
ok = <optimized out>
__PRETTY_FUNCTION__ = "int get_image(mlt_frame, uint8_t**, mlt_image_format*, int*, int*, int)"
#15 0x00007ffff71144f2 in mlt_frame_get_image (self=self@entry=0x608000789fa0, buffer=buffer@entry=0x7ffea0637990, format=format@entry=0x6140000b4e4c, width=width@entry=0x7ffea06372b8, height=height@entry=0x7ffea06372bc, writable=writable@entry=1) at mlt_frame.c:620
properties = 0x608000789fa0
get_image = 0x7fffd1e72b10 <get_image(mlt_frame, uint8_t**, mlt_image_format*, int*, int*, int)>
requested_format = <optimized out>
error = 0
#16 0x00007fffd1e736bd in get_image(mlt_frame, uint8_t**, mlt_image_format*, int*, int*, int) (frame=frame@entry=0x608000789fa0, image=image@entry=0x7ffea0637990, format=format@entry=0x6140000b4e4c, width=width@entry=0x7ffea0637b44, height=height@entry=0x7ffea0637b48, writable=writable@entry=1) at filter_movit_resize.cpp:154
error = 0
properties = 0x608000789fa0
filter = 0x6080006d7720
profile = <optimized out>
aspect_ratio = 1
consumer_aspect = 1
owidth = 480
oheight = 270
rect = {x = 0, y = 0, w = 1, h = 1, o = <optimized out>}
rescale = <optimized out>
#17 0x00007ffff71144f2 in mlt_frame_get_image (self=self@entry=0x608000789fa0, buffer=buffer@entry=0x7ffea0637990, format=format@entry=0x6140000b4e4c, width=width@entry=0x7ffea0637b44, height=height@entry=0x7ffea0637b48, writable=writable@entry=1) at mlt_frame.c:620
properties = 0x608000789fa0
get_image = 0x7fffd1e733d0 <get_image(mlt_frame, uint8_t**, mlt_image_format*, int*, int*, int)>
requested_format = <optimized out>
error = 0
#18 0x00007ffff712d30e in producer_get_image (self=self@entry=0x60800068e320, buffer=buffer@entry=0x7ffea0637990, format=format@entry=0x6140000b4e4c, width=width@entry=0x7ffea0637b44, height=height@entry=0x7ffea0637b48, writable=writable@entry=1) at mlt_tractor.c:371
data = 0x0
size = 0
properties = 0x60800068e320
frame = 0x608000789fa0
frame_properties = 0x608000789fa0
i = <optimized out>
#19 0x00007ffff71144f2 in mlt_frame_get_image (self=0x60800068e320, buffer=0x7ffea0637990, format=0x6140000b4e4c, width=0x7ffea0637b44, height=0x7ffea0637b48, writable=1) at mlt_frame.c:620
properties = 0x60800068e320
get_image = 0x7ffff712d190 <producer_get_image>
requested_format = <optimized out>
error = 0
#20 0x00007ffff71144f2 in mlt_frame_get_image (self=self@entry=0x60800068e320, buffer=buffer@entry=0x7ffea0637990, format=format@entry=0x6140000b4e4c, width=width@entry=0x7ffea0637b44, height=height@entry=0x7ffea0637b48, writable=writable@entry=1) at mlt_frame.c:620
properties = 0x60800068e320
get_image = 0x7ffff712c430 <get_image_a>
requested_format = <optimized out>
error = 0
#21 0x00007fffe394a7a8 in transition_get_image (a_frame=a_frame@entry=0x60800068e320, image=image@entry=0x7ffea0637990, format=format@entry=0x6140000b4e4c, width=width@entry=0x7ffea0637b44, height=height@entry=0x7ffea0637b48, writable=writable@entry=0) at transition_composite.c:1177
b_props = 0x60800078ca20
delta = 0.021739130434782594
image_b = 0x0
width_b = 480
alpha_a = 0x0
profile = <optimized out>
alpha_b = 0x0
a_props = 0x60800068e320
result = {item = {key = 0, frame = 11, distort = 0, x = 0, y = 0, w = 1920, h = 1080, mix = 50, f = {1323600, 24816, 43652224, 24960, -149723396}}, nw = 1920, nh = 1080, sw = 0, sh = 0, halign = 0, valign = 0, x_src = 0, y_src = 0}
length = 23
height_b = 270
b_frame = 0x60800078ca20
self = 0x60c0056cd4c0
position = 11
out = <optimized out>
in = <optimized out>
properties = 0x60c0056cd4c0
#22 0x00007ffff71144f2 in mlt_frame_get_image (self=0x60800068e320, buffer=0x7ffea0637990, format=0x6140000b4e4c, width=0x7ffea0637b44, height=0x7ffea0637b48, writable=0) at mlt_frame.c:620
properties = 0x60800068e320
get_image = 0x7fffe394a5a0 <transition_get_image>
requested_format = <optimized out>
error = 0
#23 0x00007ffff71144f2 in mlt_frame_get_image (self=self@entry=0x60800068e320, buffer=buffer@entry=0x7ffea0637990, format=format@entry=0x6140000b4e4c, width=width@entry=0x7ffea0637b44, height=height@entry=0x7ffea0637b48, writable=writable@entry=0) at mlt_frame.c:620
properties = 0x60800068e320
get_image = 0x7ffff712c300 <get_image_b>
requested_format = <optimized out>
error = 0
#24 0x00007fffd1e75451 in get_image(mlt_frame, uint8_t**, mlt_image_format*, int*, int*, int) (a_frame=a_frame@entry=0x60800068e3a0, image=image@entry=0x7ffea0637b58, format=format@entry=0x6140000b4e4c, width=width@entry=0x7ffea0637b44, height=height@entry=0x7ffea0637b48, writable=writable@entry=0) at transition_movit_overlay.cpp:50
error = <optimized out>
b_frame = 0x60800068e320
service = 0x60c0056fb0c0
a_image = 0x608000990220 " \002\231"
b_image = 0x60c004207cc0 "\001"
#25 0x00007ffff71144f2 in mlt_frame_get_image (self=self@entry=0x60800068e3a0, buffer=buffer@entry=0x7ffea0637b58, format=format@entry=0x6140000b4e4c, width=width@entry=0x7ffea0637b44, height=height@entry=0x7ffea0637b48, writable=writable@entry=0) at mlt_frame.c:620
properties = 0x60800068e3a0
get_image = 0x7fffd1e753c0 <get_image(mlt_frame, uint8_t**, mlt_image_format*, int*, int*, int)>
requested_format = <optimized out>
error = 0
#26 0x00007ffff712d30e in producer_get_image (self=self@entry=0x608000789ea0, buffer=buffer@entry=0x7ffea0637b58, format=format@entry=0x6140000b4e4c, width=width@entry=0x7ffea0637b44, height=height@entry=0x7ffea0637b48, writable=writable@entry=0) at mlt_tractor.c:371
data = 0x0
size = 0
properties = 0x608000789ea0
frame = 0x60800068e3a0
frame_properties = 0x60800068e3a0
i = <optimized out>
#27 0x00007ffff71144f2 in mlt_frame_get_image (self=self@entry=0x608000789ea0, buffer=buffer@entry=0x7ffea0637b58, format=format@entry=0x6140000b4e4c, width=width@entry=0x7ffea0637b44, height=height@entry=0x7ffea0637b48, writable=writable@entry=0) at mlt_frame.c:620
properties = 0x608000789ea0
get_image = 0x7ffff712d190 <producer_get_image>
requested_format = <optimized out>
error = 0
#28 0x00007ffff712a50c in consumer_read_ahead_thread (arg=<optimized out>) at mlt_consumer.c:911
_mlt_log_timings_begin = 1598905979084323
_mlt_log_timings_end = <optimized out>
buffer = 1
time_current = <optimized out>
self = <optimized out>
priv = 0x6140000b4e40
properties = <optimized out>
width = 480
height = 270
video_off = <optimized out>
preview_off = <optimized out>
preview_format = <optimized out>
samples = 2002
audio = 0x62500088b910
audio_off = <optimized out>
frame = 0x608000789ea0
image = 0x6030018ebc94 "\036"
ante = {tv_sec = 1598905979, tv_usec = 76851}
count = <optimized out>
skipped = <optimized out>
time_process = <optimized out>
skip_next = <optimized out>
pos = <optimized out>
start_pos = 369
last_pos = <optimized out>
frame_duration = <optimized out>
drop_max = <optimized out>
#29 0x000055555656e5a1 in RenderThread::run() (this=0x604000110150) at /home/farid/kdenlive/src/monitor/glwidget.cpp:1446
#30 0x00007ffff21f5e0f in () at /usr/lib/libQt5Core.so.5
#31 0x00007ffff1ddb3e9 in start_thread () at /usr/lib/libpthread.so.0
#32 0x00007ffff1ce4293 in clone () at /usr/lib/libc.so.6
That doesn't look like it is in movit (or at least movit's fault), though it happens in the movit filter.
I suspect it might be because the movit filters request mlt_image_glsl, which I don't think any other filters request so the code isn't as well tested. I haven't looked a lot at the code, but the code paths for mlt_image_glsl are a bit weird (setting bpp to 0, and stuff).
edit: ok, couldn't stop myself, so looked a bit deeper. I suspect producer_avformat doesn't consider this requirement from the ffmpeg doc: The input buffer must be AV_INPUT_BUFFER_PADDING_SIZE larger than the actual read bytes because some optimized bitstream readers read 32 or 64 bits at once and could read over the end. (and it might be related to the memory pool in mlt because it only happens when you pass 2GB, and again only when the project has a movit filter because that requests a less common format with different size requirements).
Can you please test again with the latest version?