Bug 347447

Summary: random crash (with debugging)
Product: [Applications] kdenlive Reporter: farid <snd.noise>
Component: User Interface & MiscellaneousAssignee: Jean-Baptiste Mardelle <jb>
Status: RESOLVED FIXED    
Severity: grave CC: arojas, wegwerf-1-2-3
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description farid 2015-05-08 22:17:28 UTC
hope this helps...

so after some crashes i realized that something is wrong so i posted some bugs to archlinux as well. i was adviced to recompile the sources with debug flags, so here goes the backtrace. 

here is the bug report in case it helps as well:
https://bugs.archlinux.org/task/44891

Reproducible: Always

Steps to Reproduce:
1. open kdenlive 
2. try to edit
3.

Actual Results:  
crashes

Expected Results:  
not to crash =)

(gdb) backtrace
#0  new_pes_packet (pes=pes@entry=0x7fffb04c6a00, pkt=0x7fffbf815590) at libavformat/mpegts.c:834
#1  0x00007fffd136c0a1 in mpegts_push_data (filter=<optimized out>, buf=0x7fffb0b06ca0 "\241\327<", buf_size=184, 
    is_start=<optimized out>, pos=69390424) at libavformat/mpegts.c:953
#2  0x00007fffd1369bc8 in handle_packet (ts=ts@entry=0x7fffb0b92480, packet=<optimized out>) at libavformat/mpegts.c:2231
#3  0x00007fffd1369f82 in handle_packets (ts=ts@entry=0x7fffb0b92480, nb_packets=nb_packets@entry=0)
    at libavformat/mpegts.c:2375
#4  0x00007fffd136a032 in mpegts_read_packet (s=<optimized out>, pkt=0x7fff817f9610) at libavformat/mpegts.c:2608
#5  0x00007fffd13e8891 in ff_read_packet (s=0x7fffb04e3f60, pkt=0x7fff817f9610) at libavformat/utils.c:665
#6  0x00007fffd13e95b0 in read_frame_internal (s=0x7fffb04e3f60, pkt=0x7fffb0250808) at libavformat/utils.c:1318
#7  0x00007fffd13ea3fd in av_read_frame (s=0x7fffb04e3f60, pkt=0x7fffb0250808) at libavformat/utils.c:1477
#8  0x00007fffd2b0f54d in producer_get_image (frame=0x7fffbf815590, frame@entry=0x7fffb0b670a0, buffer=0x7fffbf815590, 
    buffer@entry=0x7fff817f9e50, format=0x0, format@entry=0x7fff817f9e4c, width=0x32000, width@entry=0x7fff817f9bcc, 
    height=0x422d058, height@entry=0x7fff817f9bd0, writable=writable@entry=0) at producer_avformat.c:1385
#9  0x00007ffff69f3ce7 in mlt_frame_get_image (self=0x7fffb0b670a0, buffer=0x7fff817f9e50, format=0x7fff817f9e4c, 
    width=0x7fff817f9bcc, height=0x7fff817f9bd0, writable=0) at mlt_frame.c:585
#10 0x00007fffcab3fee1 in filter_get_image (frame=0x7fffb0b670a0, image=0x7fff817f9e50, format=0x0, 
    format@entry=0x7fff817f9e4c, width=0x32000, width@entry=0x7fff817f9bcc, height=0x422d058, height@entry=0x7fff817f9bd0, 
    writable=0) at filter_deinterlace.c:245
#11 0x00007ffff69f3ce7 in mlt_frame_get_image (self=self@entry=0x7fffb0b670a0, buffer=buffer@entry=0x7fff817f9e50, 
    format=format@entry=0x7fff817f9e4c, width=width@entry=0x7fff817f9bcc, height=height@entry=0x7fff817f9bd0, 
    writable=writable@entry=0) at mlt_frame.c:585
#12 0x00007fffd4605837 in get_image (frame=frame@entry=0x7fffb0b670a0, image=image@entry=0x7fff817f9e50, 
    format=format@entry=0x7fff817f9e4c, width=width@entry=0x7fff817f9bcc, height=height@entry=0x7fff817f9bd0, 
    writable=writable@entry=0) at filter_fieldorder.c:33
#13 0x00007ffff69f3ce7 in mlt_frame_get_image (self=0x7fffb0b670a0, buffer=0x7fff817f9e50, format=0x7fff817f9e4c, 
    width=0x7fff817f9bcc, height=0x7fff817f9bd0, writable=0) at mlt_frame.c:585
#14 0x00007fffd460444e in filter_get_image (frame=0x7fffb0b670a0, image=0x7fffbf815590, image@entry=0x7fff817f9e50, 
    format=0x7fff817f9e4c, width=0x7fff817f9bcc, height=0x7fff817f9bd0, writable=0) at filter_crop.c:76
#15 0x00007ffff69f3ce7 in mlt_frame_get_image (self=0x7fffb0b670a0, buffer=0x7fff817f9e50, format=0x7fff817f9e4c, 
    width=0x7fff817f9bcc, height=0x7fff817f9bd0, writable=0) at mlt_frame.c:585
#16 0x00007fffd4609af2 in filter_get_image (frame=0x7fffb0b670a0, image=0x7fff817f9e50, format=0x0, 
    format@entry=0x7fff817f9e4c, width=0x7fff817f9cb8, height=0x7fff817f9cbc, writable=0) at filter_rescale.c:216
#17 0x00007ffff69f3ce7 in mlt_frame_get_image (self=self@entry=0x7fffb0b670a0, buffer=buffer@entry=0x7fff817f9e50, 
    format=format@entry=0x7fff817f9e4c, width=width@entry=0x7fff817f9cb8, height=height@entry=0x7fff817f9cbc, 
    writable=writable@entry=0) at mlt_frame.c:585
#18 0x00007fffd460a037 in filter_get_image (frame=frame@entry=0x7fffb0b670a0, image=image@entry=0x7fff817f9e50, 
    format=format@entry=0x7fff817f9e4c, width=width@entry=0x7fff817f9e44, height=height@entry=0x7fff817f9e48, 
    writable=writable@entry=0) at filter_resize.c:270
#19 0x00007ffff69f3ce7 in mlt_frame_get_image (self=self@entry=0x7fffb0b670a0, buffer=buffer@entry=0x7fff817f9e50, 
    format=format@entry=0x7fff817f9e4c, width=width@entry=0x7fff817f9e44, height=height@entry=0x7fff817f9e48, 
    writable=writable@entry=0) at mlt_frame.c:585
#20 0x00007ffff6a0955e in producer_get_image (self=self@entry=0x7fffb0a158d0, buffer=buffer@entry=0x7fff817f9e50, 
    format=format@entry=0x7fff817f9e4c, width=width@entry=0x7fff817f9e44, height=height@entry=0x7fff817f9e48, 
    writable=writable@entry=0) at mlt_tractor.c:273
#21 0x00007ffff69f3ce7 in mlt_frame_get_image (self=self@entry=0x7fffb0a158d0, buffer=buffer@entry=0x7fff817f9e50, 
---Type <return> to continue, or q <return> to quit---
    format=format@entry=0x7fff817f9e4c, width=width@entry=0x7fff817f9e44, height=height@entry=0x7fff817f9e48, 
    writable=writable@entry=0) at mlt_frame.c:585
#22 0x00007ffff6a0615a in consumer_worker_thread (arg=0x20ce060) at mlt_consumer.c:1078
#23 0x00007fffece7d374 in start_thread () from /usr/lib/libpthread.so.0
#24 0x00007ffff18f527d in clone () from /usr/lib/libc.so.6
Comment 1 Jean-Baptiste Mardelle 2015-05-08 22:41:22 UTC
At first sight, seems like an incompatibility between MLT and FFmpeg. Can you check if MLT works correctly:

from a terminal, type:

melt myclip.mpg

with one of the clip you are usually using. It should open a window with your video. Click in the terminal again and try seeking in the video with the 'h' and 'l' keys. Does the video display correctly, can you seek ?
Comment 2 Antonio Rojas 2015-05-09 08:09:43 UTC
Melt segfaults when trying to open an mpg file. Backtrace:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7711ac2 in __memcpy_avx_unaligned () from /usr/lib/libc.so.6
(gdb) bt
#0  0x00007ffff7711ac2 in __memcpy_avx_unaligned () from /usr/lib/libc.so.6
#1  0x00007fffdcf693de in memcpy (__len=702, __src=0x948d4c, __dest=<optimized out>) at /usr/include/bits/string3.h:53
#2  resize_image (bpp=<optimized out>, iheight=77, iwidth=702, input=<optimized out>, oheight=576, owidth=720, output=0x7fffe975e020 "")
    at filter_resize.c:111
#3  frame_resize_image (bpp=<optimized out>, oheight=576, owidth=720, frame=0x7e8d10) at filter_resize.c:148
#4  filter_get_image (frame=frame@entry=0x7e8d10, image=image@entry=0x7fffffffe420, format=format@entry=0x7fffffffe40c, 
    width=width@entry=0x7fffffffe410, height=height@entry=0x7fffffffe414, writable=writable@entry=0) at filter_resize.c:276
#5  0x00007ffff7bb5ce7 in mlt_frame_get_image (self=self@entry=0x7e8d10, buffer=buffer@entry=0x7fffffffe420, format=format@entry=0x7fffffffe40c, 
    width=width@entry=0x7fffffffe410, height=height@entry=0x7fffffffe414, writable=writable@entry=0) at mlt_frame.c:585
#6  0x00007ffff7bcb55e in producer_get_image (self=self@entry=0x7e8600, buffer=buffer@entry=0x7fffffffe420, format=format@entry=0x7fffffffe40c, 
    width=width@entry=0x7fffffffe410, height=height@entry=0x7fffffffe414, writable=writable@entry=0) at mlt_tractor.c:273
#7  0x00007ffff7bb5ce7 in mlt_frame_get_image (self=0x7e8600, buffer=buffer@entry=0x7fffffffe420, format=format@entry=0x7fffffffe40c, 
    width=width@entry=0x7fffffffe410, height=height@entry=0x7fffffffe414, writable=writable@entry=0) at mlt_frame.c:585
#8  0x00007ffff7bce892 in mlt_profile_from_producer (profile=profile@entry=0x619600, producer=0x7a3cb0) at mlt_profile.c:411
#9  0x0000000000402962 in main (argc=2, argv=0x7fffffffe5c8) at melt.c:854
Comment 3 Jean-Baptiste Mardelle 2015-05-09 08:37:21 UTC
Ok, then there is something wrong between ffmpeg and mlt.
Can you first check thant you don't have several concurrent ffmpeg/libav installs ?
I don't know a lot about arch, but check in the usual library install folders like:

ls -la /usr/lib/libav*
ls -la /usr/local/lib/libav*

Also, try this:

ldd /usr/local/lib/mlt/libmltavformat.so
(Adjust the path to where you installed Mlt), it will tell you which ffmpeg libraries are linked in Mlt.
Comment 4 Antonio Rojas 2015-05-09 08:41:03 UTC
No multiple installs, simply using ffmpeg 2.6.2
Comment 5 Jean-Baptiste Mardelle 2015-05-09 08:47:45 UTC
I guess the video clip plays fine with ffmpeg, but can you test?
ffplay myclip.mpg
Comment 6 Antonio Rojas 2015-05-09 08:49:21 UTC
(In reply to Jean-Baptiste Mardelle from comment #5)
> I guess the video clip plays fine with ffmpeg, but can you test?
> ffplay myclip.mpg

Yes
Comment 7 Jean-Baptiste Mardelle 2015-05-09 08:50:48 UTC
Can you paste here the output of the configure command that you use to compile mlt?
Comment 8 Antonio Rojas 2015-05-09 08:52:01 UTC
  ./configure --prefix=/usr \
        --avformat-swscale \
        --enable-gpl --enable-gpl3 \
        --qt-libdir=/usr/lib --qt-includedir=/usr/include/qt
Comment 9 Jean-Baptiste Mardelle 2015-05-09 09:08:41 UTC
The --avformat-swscale option should be removed, but can you paste the result of this command?
Comment 10 Antonio Rojas 2015-05-09 09:25:29 UTC
Configuring framework:
Configuring modules:
Configuring modules/avformat:
Configuring modules/core:
Configuring modules/decklink:
Configuring modules/feeds:
Configuring modules/frei0r:
Configuring modules/gtk2:
- Libexif found, enabling auto rotate
Configuring modules/jackrack:
Configuring modules/kdenlive:
Configuring modules/linsys:
Configuring modules/lumas:
Configuring modules/motion_est:
Configuring modules/normalize:
Configuring modules/oldfilm:
Configuring modules/opengl:
- movit not found: disabling
Configuring modules/plus:
Configuring modules/plusgpl:
Configuring modules/qt:
- Libexif found, enabling auto rotate
- Qt version 5.x detected
- Include directory:  /usr/include/qt
Configuring modules/resample:
Configuring modules/rtaudio:
Configuring modules/sdl:
Configuring modules/sox:
Configuring modules/swfdec:
- swfdec not found: disabling
Configuring modules/videostab:
Configuring modules/vid.stab:
Configuring modules/vmfx:
Configuring modules/xine:
Configuring modules/xml:
Configuring mlt++:
Configuring swig:
GPLv3 license used
list='src/framework src/mlt++ src/melt src/modules src/swig profiles'; \
for subdir in $list; do \
        make -s -C $subdir depend || exit 1; \
        make -C $subdir all || exit 1; \
done
Comment 11 farid 2015-05-09 16:59:51 UTC
(In reply to Jean-Baptiste Mardelle from comment #1)
> At first sight, seems like an incompatibility between MLT and FFmpeg. Can
> you check if MLT works correctly:
> 
> from a terminal, type:
> 
> melt myclip.mpg
> 
> with one of the clip you are usually using. It should open a window with
> your video. Click in the terminal again and try seeking in the video with
> the 'h' and 'l' keys. Does the video display correctly, can you seek ?

yes it seeks correctly. the clips are in .ts format though.
Comment 12 farid 2015-05-09 17:04:03 UTC
don't know if this helps but the mpg clips are actually .ts proxy clips generated from a previous kdenlive version (0.9.10).

disabling the proxy clips kdenlive doesn't crash.
Comment 13 Jean-Baptiste Mardelle 2015-05-10 19:05:11 UTC
@Antonio:
I just read reports about applications crashing on Arch because they were compiled with a newer GCC version (5.1.0) while the libraries where compiled with an older GCC version (4.9.x). 

Can you check which GCC version was used to compile FFmpeg (typing "ffmpeg" in a terminal gives out the gcc version) and check if you are using the same version to compile MLT ? Somehow this bug is triggered by something specific to your configuration.

@farid:
You replied to the wrong bug, you meant to answer bug #347341, I will answer separately there.
Comment 14 Antonio Rojas 2015-05-10 19:24:32 UTC
Both mlt and ffmpeg are built with GCC 4.9 (just rebuilt them to be sure)
Comment 15 Jean-Baptiste Mardelle 2015-05-10 19:46:13 UTC
Which options did you pass to configure ffmpeg ?
Mine is:
./configure --prefix=/usr/local --enable-shared --enable-libmp3lame --enable-gpl --enable-libfaac --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-x11grab --enable-libgsm --enable-libx264 --enable-libtheora --enable-libdc1394 --enable-nonfree --disable-stripping --enable-avfilter --enable-libschroedinger --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-version3 --enable-libvpx
Comment 16 Antonio Rojas 2015-05-10 20:06:21 UTC
Tried your options, doesn't make any difference. This is the script used to build ffmpeg in Arch:
https://projects.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/ffmpeg
Comment 17 Wegwerf 2016-07-28 12:49:56 UTC
Farid, is this bug reports still active? If not, please be so kind as to close it. Thank you very much!
Comment 18 farid 2016-07-28 14:21:12 UTC
gonna mark it as fixed for now.