mltframework / mlt

MLT Multimedia Framework
https://www.mltframework.org
GNU Lesser General Public License v2.1
1.5k stars 321 forks source link

kdenlive: filter_movit_convert.cpp:204: void build_fingerprint(mlt_service, mlt_frame, std::string*): Assertion `effect' failed. #576

Open donbowman opened 4 years ago

donbowman commented 4 years ago

(reproduction steps and materiall in the attachment along with system setup, libraries, etc).

Whenever GPU acceleration is enabled in kdenlive master + libmlt master, if I do composite transform of an image onto a video, it crashes with this assertion (kdenlive crashes on load). I can't generate the mlt script, kdenlive crashes immediately.

libmlt 6.21+git202005312040-1~ubuntu20.04.1 kdenlive 4:20.07+git202006011026~ubuntu20.04.1

this happens all the time, regardless of source material.

It also happens w/ just melt command line.

kdenlive: filter_movit_convert.cpp:204: void build_fingerprint(mlt_service, mlt_frame, std::string*): Assertion `effect' failed.
--Type <RET> for more, q to quit, c to continue without paging--

Thread 95 "RenderThread" received signal SIGABRT, Aborted.
[Switching to Thread 0x7ffe98d8e700 (LWP 1404659)]
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50  ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007ffff4be5859 in __GI_abort () at abort.c:79
#2  0x00007ffff4be5729 in __assert_fail_base
    (fmt=0x7ffff4d7b588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x7fff30e9d524 "effect", file=0x7fff30e9d71b "filter_movit_convert.cpp", line=204, function=<optimized out>) at assert.c:92
#3  0x00007ffff4bf6f36 in __GI___assert_fail
    (assertion=assertion@entry=0x7fff30e9d524 "effect", file=file@entry=0x7fff30e9d71b "filter_movit_convert.cpp", line=line@entry=204, function=function@entry=0x7fff30e9d9e0 "void build_fingerprint(mlt_service, mlt_frame, std::string*)") at assert.c:101
#4  0x00007fff30e95862 in build_fingerprint(mlt_service, mlt_frame, std::string*)
    (service=service@entry=0x5555584fac00, frame=frame@entry=0x7ffe6c0e69d0, fingerprint=fingerprint@entry=0x7ffe98d8daa0) at filter_movit_convert.cpp:200
#5  0x00007fff30e95275 in build_fingerprint(mlt_service, mlt_frame, std::string*)
    (service=service@entry=0x55555c973280, frame=frame@entry=0x7ffe6c0e69d0, fingerprint=fingerprint@entry=0x7ffe98d8daa0) at filter_movit_convert.cpp:207
#6  0x00007fff30e9705b in finalize_movit_chain (frame=0x7ffe6c0e69d0, leaf_service=0x55555c973280) at filter_movit_convert.cpp:312
#7  convert_image(mlt_frame, uint8_t**, mlt_image_format*, mlt_image_format)
    (frame=<optimized out>, image=0x7ffe98d8dc78, format=0x5555593f3b3c, output_format=mlt_image_glsl_texture) at filter_movit_convert.cpp:602
#8  0x00007ffff71e7403 in mlt_frame_get_image (self=0x7ffe6c0e69d0, buffer=0x7ffe98d8dc78, format=0x5555593f3b3c, width=0x7ffe98d8dc64, height=<optimized out>, writable=0)
    at mlt_frame.c:626
#9  0x00007ffff71fdd00 in producer_get_image
    (self=self@entry=0x7ffe6c01cc90, buffer=buffer@entry=0x7ffe98d8dc78, format=format@entry=0x5555593f3b3c, width=width@entry=0x7ffe98d8dc64, height=height@entry=0x7ffe98d8dc68, writable=writable@entry=0) at mlt_tractor.c:371
#10 0x00007ffff71e73a3 in mlt_frame_get_image (self=0x7ffe6c01cc90, buffer=0x7ffe98d8dc78, format=0x5555593f3b3c, width=0x7ffe98d8dc64, height=0x7ffe98d8dc68, writable=0)
    at mlt_frame.c:620
#11 0x00007ffff71fb0e8 in consumer_read_ahead_thread (arg=<optimized out>) at mlt_consumer.c:828
#12 0x00005555558f8cf1 in RenderThread::run() (this=0x7ffe74000b80) at ./src/monitor/glwidget.cpp:1459
#13 0x00007ffff51a09d2 in  () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#14 0x00007ffff43e6609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#15 0x00007ffff4ce2103 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

bug.zip

donbowman commented 4 years ago

it appears this happens with "composite and transform" (e.g. insert this as a composition).

sandsmark commented 4 years ago

there's no assert on line 200 in filter_movit_convert.cpp in master (and hasn't been since at least early 2019, that's as far back as I bothered checking if the line numbers have changed).

do you have any local changes?

donbowman commented 4 years ago

https://github.com/mltframework/mlt/blob/master/src/modules/opengl/filter_movit_convert.cpp#L204

is the line number. it has an assert.

i have no local changes, i've tried this both with pre-packaged build and local build from git master.

sandsmark commented 4 years ago

ok, now I have no idea what I was looking at when I didn't find it...

do you get any warning messages printed before it happens? the issue seems to be that there's no _movit effect property attached to the frame, fwiw., so something doesn't attach that property when there's still images, I guess (not sure if mlt or kdenlive is supposed to be doing it)

donbowman commented 4 years ago

it crashes instantly. No warning, just instant death due to assert.

sandsmark commented 4 years ago

I don't understand the code (it looks a bit weird), but it seems like for some reason a convert filter is inserted, and that assumes there's another movit effect in front of it. This patch should in theory make it work, if you want to test:

diff --git a/src/modules/opengl/filter_movit_convert.cpp b/src/modules/opengl/filter_movit_convert.cpp
  index 3d06d618..6c7089b7 100644
  --- a/src/modules/opengl/filter_movit_convert.cpp
  +++ b/src/modules/opengl/filter_movit_convert.cpp
  @@ -201,7 +201,11 @@ static void build_fingerprint( mlt_service service, mlt_frame frame, std::string
          }

          Effect* effect = GlslManager::get_effect( service, frame );
  -       assert( effect );
  +       if ( !effect ) {
  +               fingerprint->append( "NO EFFECTS" );
  +               return;
  +       }
  +
          mlt_service input_a = GlslManager::get_effect_input( service, frame );
          fingerprint->push_back( '(' );
          build_fingerprint( input_a, frame, fingerprint );
  @@ -242,7 +246,7 @@ static void build_fingerprint( mlt_service service, mlt_frame frame, std::string

   static Effect* build_movit_chain( mlt_service service, mlt_frame frame, GlslChain *chain )
   {
  -       if ( service == (mlt_service) -1 ) {
  +       if ( service == (mlt_service) -1 || GlslManager::get_effect( service, frame ) == nullptr ) {
                  mlt_producer producer = mlt_producer_cut_parent( mlt_frame_get_original_producer( frame ) );
                  MltInput* input = GlslManager::get_input( producer, frame );
                  GlslManager::set_input( producer, frame, NULL );
faridosc commented 4 years ago

Hmmm, still crashes and has artifacts.: gdb-patch.txt

`Thread 1211 (Thread 0x7ffe77780640 (LWP 113997)):
#0  0x00000000400aff31 in  ()
#1  0x00007fff3cb59710 in  ()
#2  0x00007ffe13745c10 in  ()
#3  0x00007ffe7777f050 in  ()
#4  0x0000000000000337 in  ()
#5  0x00007fffe7a1c3f6 in  () at /usr/lib/libnvidia-glcore.so.455.23.04
#6  0x00007fffe7a26ffa in  () at /usr/lib/libnvidia-glcore.so.455.23.04
#7  0x00007fffe7b9aa9b in  () at /usr/lib/libnvidia-glcore.so.455.23.04
#8  0x00007fffe7b676de in  () at /usr/lib/libnvidia-glcore.so.455.23.04
#9  0x00007fffe7b69016 in  () at /usr/lib/libnvidia-glcore.so.455.23.04
#10 0x00007fffe7b81514 in  () at /usr/lib/libnvidia-glcore.so.455.23.04
#11 0x00007fffcbf8c3df in movit::FlatInput::set_gl_state(unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int*) (this=0x617000aa3b00, glsl_program_num=<optimized out>, prefix=..., sampler_num=0x7ffe7777f5d0) at flat_input.cpp:149
        internal_format = <optimized out>
        format = 6407
        __PRETTY_FUNCTION__ = "virtual void movit::FlatInput::set_gl_state(GLuint, const string&, unsigned int*)"
#12 0x00007fffcbf7a717 in movit::EffectChain::execute_phase(movit::Phase*, std::map<movit::Phase*, unsigned int, std::less<movit::Phase*>, std::allocator<std::pair<movit::Phase* const, unsigned int> > > const&, std::vector<movit::EffectChain::DestinationTexture, std::allocator<movit::EffectChain::DestinationTexture> > const&, std::set<movit::Phase*, std::less<movit::Phase*>, std::allocator<movit::Phase*> >*) (this=this@entry=0x612000e14cc0, phase=phase@entry=0x616004128c80, output_textures=std::map with 0 elements, destinations=std::vector of length 0, capacity 0, generated_mipmaps=generated_mipmaps@entry=0x7ffe7777f6f0) at /usr/include/c++/10.1.0/bits/stl_tree.h:350
        node = 0x60d000992b80
        old_sampler_num = <optimized out>
        i = 2
        __PRETTY_FUNCTION__ = "void movit::EffectChain::execute_phase(movit::Phase*, const std::map<movit::Phase*, unsigned int>&, const std::vector<movit::EffectChain::DestinationTexture>&, std::set<movit::Phase*>*)"
        instance_program_num = 54
        fbo = 0
        sampler_num = 1
#13 0x00007fffcbf7b266 in movit::EffectChain::render(unsigned int, std::vector<movit::EffectChain::DestinationTexture, std::allocator<movit::EffectChain::DestinationTexture> > const&, unsigned int, unsigned int, unsigned int, unsigned int) (this=0x612000e14cc0, dest_fbo=13, destinations=std::vector of length 0, capacity 0, x=0, y=0, width=1920, height=1080) at effect_chain.cpp:2109
        phase = 0x616004128c80
        last_phase = <optimized out>
        needs_srgb = <optimized out>
        phase_destinations = std::vector of length 0, capacity 0
        phase_num = 0
        __PRETTY_FUNCTION__ = "void movit::EffectChain::render(GLuint, const std::vector<movit::EffectChain::DestinationTexture>&, unsigned int, unsigned int, unsigned int, unsigned int)"
        final_srgb = <optimized out>
        current_srgb = false
        generated_mipmaps = std::set with 0 elements
        output_textures = std::map with 0 elements
        ref_counts = std::map with 0 elements
        num_phases = 1
#14 0x00007fffcbf7c075 in movit::EffectChain::render_to_fbo(unsigned int, unsigned int, unsigned int) (this=this@entry=0x612000e14cc0, dest_fbo=13, width=<optimized out>, width@entry=1920, height=<optimized out>, height@entry=1080) at /usr/include/c++/10.1.0/bits/stl_vector.h:97
        x = <optimized out>
        y = <optimized out>
#15 0x00007fffd113e0bb in GlslManager::render_frame_texture(movit::EffectChain*, mlt_frame_s*, int, int, unsigned char**) (this=0x6080000ee9a0, chain=chain@entry=0x612000e14cc0, frame=frame@entry=0x608000df6920, width=width@entry=1920, height=height@entry=1080, image=image@entry=0x7ffe7777fb58) at filter_glsl_manager.cpp:434
        texture = 0x60300441d1e0
        fbo = 13
        sync = <optimized out>
#16 0x00007fffd11418bf in movit_render (image=0x7ffe7777fb58, height=1080, width=1920, output_format=mlt_image_glsl_texture, format=0x61400198d64c, frame=0x608000df6920, chain=0x612000e14cc0) at filter_movit_convert.cpp:458
        glsl = <optimized out>
        error = <optimized out>
        leaf_service = 0x60c00592fb40
        chain = 0x60d000ec0910
        properties = 0x608000df6920
        glsl = <optimized out>
        error = 0
        width = 1920
        height = 1080
#17 movit_render (image=0x7ffe7777fb58, height=1080, width=1920, output_format=mlt_image_glsl_texture, format=0x61400198d64c, frame=0x608000df6920, chain=0x612000e14cc0) at filter_movit_convert.cpp:448
        leaf_service = 0x60c00592fb40
        chain = 0x60d000ec0910
        properties = 0x608000df6920
        glsl = <optimized out>
        error = 0
        width = 1920
        height = 1080
#18 convert_image(mlt_frame, uint8_t**, mlt_image_format*, mlt_image_format) (frame=0x608000df6920, image=0x7ffe7777fb58, format=0x61400198d64c, output_format=mlt_image_glsl_texture) at filter_movit_convert.cpp:609
        leaf_service = 0x60c00592fb40
        chain = 0x60d000ec0910
        properties = 0x608000df6920
        glsl = <optimized out>
        error = 0
        width = 1920
        height = 1080
#19 0x00007ffff70fc554 in mlt_frame_get_image (self=self@entry=0x608000df6920, buffer=buffer@entry=0x7ffe7777fb58, format=format@entry=0x61400198d64c, width=width@entry=0x7ffe7777fb44, height=height@entry=0x7ffe7777fb48, writable=writable@entry=0) at mlt_frame.c:626
        properties = 0x608000df6920
        get_image = 0x7fffd11473c0 <get_image(mlt_frame, uint8_t**, mlt_image_format*, int*, int*, int)>
        requested_format = <optimized out>
        error = <optimized out>
#20 0x00007ffff711537e in producer_get_image (self=self@entry=0x608000df31a0, buffer=buffer@entry=0x7ffe7777fb58, format=format@entry=0x61400198d64c, width=width@entry=0x7ffe7777fb44, height=height@entry=0x7ffe7777fb48, writable=writable@entry=0) at mlt_tractor.c:371
        data = 0x0
        size = 0
        properties = 0x608000df31a0
        frame = 0x608000df6920
        frame_properties = 0x608000df6920
        i = <optimized out>
#21 0x00007ffff70fc4f2 in mlt_frame_get_image (self=self@entry=0x608000df31a0, buffer=buffer@entry=0x7ffe7777fb58, format=format@entry=0x61400198d64c, width=width@entry=0x7ffe7777fb44, height=height@entry=0x7ffe7777fb48, writable=writable@entry=0) at mlt_frame.c:620
        properties = 0x608000df31a0
        get_image = 0x7ffff7115200 <producer_get_image>
        requested_format = <optimized out>
        error = 0
#22 0x00007ffff711255c in consumer_read_ahead_thread (arg=<optimized out>) at mlt_consumer.c:911
        _mlt_log_timings_begin = 1600987042436677
        _mlt_log_timings_end = <optimized out>
        buffer = 1
        time_current = <optimized out>
        self = <optimized out>
        priv = 0x61400198d640
        properties = <optimized out>
        width = 1920
        height = 1080
        video_off = <optimized out>
        preview_off = <optimized out>
        preview_format = <optimized out>
        samples = 2002
        audio = 0x625001d80910
        audio_off = <optimized out>
        frame = 0x608000df31a0
        image = 0x60c00592fb40 "@\373\222\005\300`"
        ante = {tv_sec = 1600987042, tv_usec = 430851}
        count = <optimized out>
        skipped = <optimized out>
        time_process = <optimized out>
        skip_next = <optimized out>
        pos = <optimized out>
        start_pos = 394
        last_pos = <optimized out>
        frame_duration = <optimized out>
        drop_max = <optimized out>
#23 0x000055555655a1c1 in RenderThread::run() (this=0x604000af4f10) at /home/farid/kdenlive/src/monitor/glwidget.cpp:1448
#24 0x00007ffff21d2e8f in  () at /usr/lib/libQt5Core.so.5
#25 0x00007ffff1db73e9 in start_thread () at /usr/lib/libpthread.so.0
#26 0x00007ffff1cc0293 in clone () at /usr/lib/libc.so.6`
sandsmark commented 4 years ago

patch try number 2 (it deleted the input instance, but didn't clear it):

diff --git a/src/modules/opengl/filter_movit_convert.cpp b/src/modules/opengl/filter_movit_convert.cpp
  index 3d06d618..10405787 100644
  --- a/src/modules/opengl/filter_movit_convert.cpp
  +++ b/src/modules/opengl/filter_movit_convert.cpp
  @@ -594,6 +594,7 @@ static int convert_image( mlt_frame frame, uint8_t **image, mlt_image_format *fo
                          *image = GlslManager::get_input_pixel_pointer( producer, frame );
                          *format = input->get_format();
                          delete input;
  +                       GlslManager::set_input( producer, frame, nullptr );
                          GlslManager::get_instance()->unlock_service( frame );
                          return convert_on_cpu( frame, image, format, output_format );
                  }

there's more code there I don't trust, but it's probably correct..

for fun, valgrind gives up when trying to run mlt: More than 1000 different errors detected. I'm not reporting any more. (lots of unitialized reads)

faridosc commented 4 years ago

Still crashing: gdb-patch2.txt

I left your other patch applied as well as this one, did I do it right?

Thanks :)

Thread 995 (LWP 19444):
#0  0x00000000400aff31 in  ()
#1  0x00007fff152cba90 in  ()
#2  0x00007ffe93dde610 in  ()
#3  0x00007fff432a7050 in  ()
#4  0x00000000000002da in  ()
#5  0x00007fffe7a1c3f6 in  () at /usr/lib/libnvidia-glcore.so.455.23.04
#6  0x00007fffe7a26ffa in  () at /usr/lib/libnvidia-glcore.so.455.23.04
#7  0x00007fffe7b9aa9b in  () at /usr/lib/libnvidia-glcore.so.455.23.04
#8  0x00007fffe7b676de in  () at /usr/lib/libnvidia-glcore.so.455.23.04
#9  0x00007fffe7b69016 in  () at /usr/lib/libnvidia-glcore.so.455.23.04
#10 0x00007fffe7b81514 in  () at /usr/lib/libnvidia-glcore.so.455.23.04
#11 0x00007fffcbf8c3df in movit::FlatInput::set_gl_state(unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int*) (this=0x617002ac4b00, glsl_program_num=<optimized out>, prefix=..., sampler_num=0x7fff432a75d0) at flat_input.cpp:149
        internal_format = <optimized out>
        format = 6407
        __PRETTY_FUNCTION__ = "virtual void movit::FlatInput::set_gl_state(GLuint, const string&, unsigned int*)"
#12 0x00007fffcbf7a717 in movit::EffectChain::execute_phase(movit::Phase*, std::map<movit::Phase*, unsigned int, std::less<movit::Phase*>, std::allocator<std::pair<movit::Phase* const, unsigned int> > > const&, std::vector<movit::EffectChain::DestinationTexture, std::allocator<movit::EffectChain::DestinationTexture> > const&, std::set<movit::Phase*, std::less<movit::Phase*>, std::allocator<movit::Phase*> >*) (this=this@entry=0x612000119740, phase=phase@entry=0x616003abff80, output_textures=std::map with 0 elements, destinations=std::vector of length 0, capacity 0, generated_mipmaps=generated_mipmaps@entry=0x7fff432a76f0) at /usr/include/c++/10.1.0/bits/stl_tree.h:350
        node = 0x60d000930f70
        old_sampler_num = <optimized out>
        i = 5
        __PRETTY_FUNCTION__ = "void movit::EffectChain::execute_phase(movit::Phase*, const std::map<movit::Phase*, unsigned int>&, const std::vector<movit::EffectChain::DestinationTexture>&, std::set<movit::Phase*>*)"
        instance_program_num = 77
        fbo = 0
        sampler_num = 4
#13 0x00007fffcbf7b266 in movit::EffectChain::render(unsigned int, std::vector<movit::EffectChain::DestinationTexture, std::allocator<movit::EffectChain::DestinationTexture> > const&, unsigned int, unsigned int, unsigned int, unsigned int) (this=0x612000119740, dest_fbo=13, destinations=std::vector of length 0, capacity 0, x=0, y=0, width=1920, height=1080) at effect_chain.cpp:2109
        phase = 0x616003abff80
        last_phase = <optimized out>
        needs_srgb = <optimized out>
        phase_destinations = std::vector of length 0, capacity 0
        phase_num = 0
        __PRETTY_FUNCTION__ = "void movit::EffectChain::render(GLuint, const std::vector<movit::EffectChain::DestinationTexture>&, unsigned int, unsigned int, unsigned int, unsigned int)"
        final_srgb = <optimized out>
        current_srgb = false
        generated_mipmaps = std::set with 0 elements
        output_textures = std::map with 0 elements
        ref_counts = std::map with 0 elements
        num_phases = 1
#14 0x00007fffcbf7c075 in movit::EffectChain::render_to_fbo(unsigned int, unsigned int, unsigned int) (this=this@entry=0x612000119740, dest_fbo=13, width=<optimized out>, width@entry=1920, height=<optimized out>, height@entry=1080) at /usr/include/c++/10.1.0/bits/stl_vector.h:97
        x = <optimized out>
        y = <optimized out>
#15 0x00007fffd113e0bb in GlslManager::render_frame_texture(movit::EffectChain*, mlt_frame_s*, int, int, unsigned char**) (this=0x6080000eeaa0, chain=chain@entry=0x612000119740, frame=frame@entry=0x608000a94d20, width=width@entry=1920, height=height@entry=1080, image=image@entry=0x7fff432a7b58) at filter_glsl_manager.cpp:434
        texture = 0x603001ae6ed0
        fbo = 13
        sync = <optimized out>
#16 0x00007fffd11418bf in movit_render (image=0x7fff432a7b58, height=1080, width=1920, output_format=mlt_image_glsl_texture, format=0x614001b00e4c, frame=0x608000a94d20, chain=0x612000119740) at filter_movit_convert.cpp:458
        glsl = <optimized out>
        error = <optimized out>
        leaf_service = 0x60c0066af840
        chain = 0x60d001a393f0
        properties = 0x608000a94d20
        glsl = <optimized out>
        error = 0
        width = 1920
        height = 1080
#17 movit_render (image=0x7fff432a7b58, height=1080, width=1920, output_format=mlt_image_glsl_texture, format=0x614001b00e4c, frame=0x608000a94d20, chain=0x612000119740) at filter_movit_convert.cpp:448
        leaf_service = 0x60c0066af840
        chain = 0x60d001a393f0
        properties = 0x608000a94d20
        glsl = <optimized out>
        error = 0
        width = 1920
        height = 1080
#18 convert_image(mlt_frame, uint8_t**, mlt_image_format*, mlt_image_format) (frame=0x608000a94d20, image=0x7fff432a7b58, format=0x614001b00e4c, output_format=mlt_image_glsl_texture) at filter_movit_convert.cpp:609
        leaf_service = 0x60c0066af840
        chain = 0x60d001a393f0
        properties = 0x608000a94d20
        glsl = <optimized out>
        error = 0
        width = 1920
        height = 1080
#19 0x00007ffff70fc554 in mlt_frame_get_image (self=self@entry=0x608000a94d20, buffer=buffer@entry=0x7fff432a7b58, format=format@entry=0x614001b00e4c, width=width@entry=0x7fff432a7b44, height=height@entry=0x7fff432a7b48, writable=writable@entry=0) at mlt_frame.c:626
        properties = 0x608000a94d20
        get_image = 0x7fffd11473c0 <get_image(mlt_frame, uint8_t**, mlt_image_format*, int*, int*, int)>
        requested_format = <optimized out>
        error = <optimized out>
#20 0x00007ffff711537e in producer_get_image (self=self@entry=0x6080004fb7a0, buffer=buffer@entry=0x7fff432a7b58, format=format@entry=0x614001b00e4c, width=width@entry=0x7fff432a7b44, height=height@entry=0x7fff432a7b48, writable=writable@entry=0) at mlt_tractor.c:371
        data = 0x0
        size = 0
        properties = 0x6080004fb7a0
        frame = 0x608000a94d20
        frame_properties = 0x608000a94d20
        i = <optimized out>
#21 0x00007ffff70fc4f2 in mlt_frame_get_image (self=self@entry=0x6080004fb7a0, buffer=buffer@entry=0x7fff432a7b58, format=format@entry=0x614001b00e4c, width=width@entry=0x7fff432a7b44, height=height@entry=0x7fff432a7b48, writable=writable@entry=0) at mlt_frame.c:620
        properties = 0x6080004fb7a0
        get_image = 0x7ffff7115200 <producer_get_image>
        requested_format = <optimized out>
        error = 0
#22 0x00007ffff711255c in consumer_read_ahead_thread (arg=<optimized out>) at mlt_consumer.c:911
        _mlt_log_timings_begin = 1601058839765672
        _mlt_log_timings_end = <optimized out>
        buffer = 1
        time_current = <optimized out>
        self = <optimized out>
        priv = 0x614001b00e40
        properties = <optimized out>
        width = 1920
        height = 1080
        video_off = <optimized out>
        preview_off = <optimized out>
        preview_format = <optimized out>
        samples = 2002
        audio = 0x625000d45910
        audio_off = <optimized out>
        frame = 0x6080004fb7a0
        image = 0x60c0066af840 "@\370j\006\300`"
        ante = {tv_sec = 1601058839, tv_usec = 760081}
        count = <optimized out>
        skipped = <optimized out>
        time_process = <optimized out>
        skip_next = <optimized out>
        pos = <optimized out>
        start_pos = 1309
        last_pos = <optimized out>
        frame_duration = <optimized out>
        drop_max = <optimized out>
#23 0x000055555655d911 in RenderThread::run() (this=0x604001996010) at /home/farid/kdenlive/src/monitor/glwidget.cpp:1448
#24 0x00007ffff21d2e8f in  () at /usr/lib/libQt5Core.so.5
#25 0x00007ffff1db73e9 in start_thread () at /usr/lib/libpthread.so.0
#26 0x00007ffff1cc0293 in clone () at /usr/lib/libc.so.6
sandsmark commented 4 years ago

yup

donbowman commented 4 years ago

any update? anything i can do to help?

sandsmark commented 4 years ago

tldr: I'm a bit stuck, things point to mlt not handling RGB input correctly, valgrind is useless, but trying with asan and ubsan might point out something.

I'm a bit stuck, I don't know the mlt code well enough (you can also see some more progress here: https://github.com/mltframework/mlt/issues/608).

The issue seems to be something related to when mlt tries to use RGB input. And since the crash always seem to happen in when movit tries to upload the texture I'm fairly sure it's because MLT sends in some invalid memory (e. g.either an old buffer it has freed, it sets the type of data wrong so Movit thinks the buffer it gets passed is bigger than it is, or something similar).

So the crash isn't really in movit at all, movit is just telling the graphics driver to upload the buffer it has gotten from MLT with glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, format, type, pixel_data);.

And as I indicated above, there's so much use of uninitialized memory in MLT that valgrind gives up (More than 1000 different errors detected. I'm not reporting any more.), which I hope are false positives, but it makes it useless to use valgrind to see if MLT is trying to use uninitialized or freed memory.

One possible next step would be to use -fsanitize=address -fsanitize=undefined when building mlt, but that doesn't always catch everything (valgrind is a bit better there). In addition it might trigger too early on the same issues that valgrind detects, but it isn't as good as valgrind wrt. continuing execution with invalid memory usage.

faridosc commented 4 years ago

Yikes. Godspeed! :)

faridosc commented 4 years ago

Hi @sesse sorry to bother you with this, I am trying to compile everything from clean and building movit with enable debug flag is not working anymore (I am on arch so using latest release):

configure: WARNING: unrecognized options: --enable-debug
make: *** No rule to make target '/usr/src/gtest/src/gtest-all.cc', needed by 'gtest-all.o'.  Stop.

I did install gtest but still get the same message... Any clue?

Thanks <3

Btw,are you still maintaining movit?

sesse commented 4 years ago

On Tue, Oct 06, 2020 at 05:56:10AM -0700, faridosc wrote:

Hi @sesse sorry to bother you with this, I am trying to compile everything from clean and building movit with enable debug flag is not working anymore (I am on arch so using latest release):

Hi,


configure: WARNING: unrecognized options: --enable-debug

I don't think --enable-debug has ever done anything in Movit's configure.

make: *** No rule to make target '/usr/src/gtest/src/gtest-all.cc', needed by 'gtest-all.o'. Stop.



I did install gtest but still get the same message... Any clue?

I believe Arch Linux has a gtest package with a precompiled .so, which is not recommended by Google Test upstream since 2010 (see http://groups.google.com/group/googletestframework/browse_thread/thread/668eff1cebf5309d). Movit does not support this; you'll need to point GTEST_DIR to wherever one can find gtest-all.cc, so it can compile it itself.

Btw,are you still maintaining movit?

I still respond to bugs and such if needed, but I don't add a whole not of new filters and such these days, no.

/ Steinar / -- Homepage: https://www.sesse.net/

donbowman commented 4 years ago

./configure --enable-debug --enable-gpl3 --enable-gpl worked for me, followed by make -j128

files have -g:

cc -I../../ -DARCH_X86_64 -Wall -DPIC    -DUSE_MMX -mmmx -DUSE_SSE -msse -DUSE_SSE2 -msse2 -g -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC -pthread -DARCH_X86   -c -o cpu_accel.o cpu_accel.c

in configure, --enable-debug causes removal of -O2 -pipe -fno-tree-pre -fno-tree-dominator-opts

sandsmark commented 3 years ago
configure: WARNING: unrecognized options: --enable-debug
make: *** No rule to make target '/usr/src/gtest/src/gtest-all.cc', needed by 'gtest-all.o'.  Stop.

gtest-all.cc is at /usr/src/googletest/src/gtest-all.cc in archlinux (according to https://www.archlinux.org/packages/community/x86_64/gtest/).

TheCompGeek commented 3 years ago

Kdenlive 20.12.0, instant death upon encountering a Composite and Transform transition with GPU rendering enabled.