[FFmpeg-devel] Assert failing in libavcodec - ratecontrol.c

Neil Brown neilb
Sun Jul 15 08:27:15 CEST 2007


Hi,
 I have been exploring kdenlive (which uses the MLT framework with
 uses the ffmpeg libraries) and I have experienced a problem with
 assertions failing which kills the video rendering process.

 When I assemble some clips together in kdenlive and ask it to render
 the final product as an mpeg2 file, it starts rendering OK, but will
 often crash at the point where one clip ends and the next starts.

 The crash is due to an assertion failing in ff_rate_estimate_qscale
 in ratecontrol.c

 There are 4 places in this code where it says:

   assert(q>0.0);

 The second and third of these can both fail. i.e. those that are
 commented out here:


        assert(q>0.0);
//printf("%f ", q);
        q= get_diff_limited_q(s, rce, q);
//printf("%f ", q);
        //assert(q>0.0);

        if(pict_type==P_TYPE || s->intra_only){ //FIXME type dependent blur like in 2-pass
            rcc->short_term_qsum*=a->qblur;
            rcc->short_term_qcount*=a->qblur;

            rcc->short_term_qsum+= q;
            rcc->short_term_qcount++;
//printf("%f ", q);
            q= short_term_q= rcc->short_term_qsum/rcc->short_term_qcount;
//printf("%f ", q);
        }
        //assert(q>0.0);

        q= modify_qscale(s, rce, q, picture_number);

        rcc->pass1_wanted_bits+= s->bit_rate/fps;

        assert(q>0.0);
    }


 If I comment those two lines out, the rendering program runs perfectly and
 appears to produce the correct result (though I haven't checked that
 the bitrate is always correct).

 Does this suggest that the MLT framework is calling libavcodec
 incorrectly in some way, or are these asserts a little over-zealous?

 Any help in understanding this problem and getting it fixed would be
 greatly appreciated.

Thanks,
NeilBrown




More information about the ffmpeg-devel mailing list