[Libav-user] Dramaticaly increased latency of avcodec_encode_video with x264 switching from avcodec-52.dll to avcodec-53.dll

Oleg Zhuravel oleg.zhuravel at gmail.com
Wed Jul 18 01:59:48 CEST 2012


Hello.
Need help as I am stuck.
As is said in subject I have updated the version of ffmpeg in my
application from dated around 2009-01 to the version dated around
2011-10 . But avcodec_encode_video (avcodec_encode_video2)  started to
give a huge latency. It outputs any data after like more than 100
frames fed. And before that it was only 1 frame. I have tried all the
options like "tune zerolatency" but nothing helps. Tried the latest
version as of today but still the same huge latency.

Here is the code I use:

CodecOutContexts[i] = avcodec_alloc_context();
CodecOutPictures[i] = avcodec_alloc_frame();

/* frames per second */
CodecOutContexts[i]->time_base.num = 1;
CodecOutContexts[i]->time_base.den = 25;

/* resolution must be a multiple of two */
CodecOutContexts[i]->width = DevsOut[nCurDevOut].Width;
if (i < ThreadCount - 1)
    CodecOutContexts[i]->height = DevsOut[nCurDevOut].Height / ThreadCount;
else
    CodecOutContexts[i]->height = DevsOut[nCurDevOut].Height /
ThreadCount + DevsOut[nCurDevOut].Height % ThreadCount;

CodecOutContexts[i]->gop_size = 25; /* emit one intra frame every ten frames */
CodecOutContexts[i]->max_b_frames = 0;
CodecOutContexts[i]->pix_fmt = PIX_FMT_YUV420P;
CodecOutContexts[i]->qmin = 15;
CodecOutContexts[i]->qmax = 31;
CodecOutContexts[i]->bit_rate = 2000000 / ThreadCount ;
CodecOutContexts[i]->bit_rate_tolerance = 1000000 / ThreadCount;


/* open it */
if (avcodec_open(CodecOutContexts[i], CodecOut) < 0)
{
        _ASSERT(FALSE);
        WriteToLog(LOGSCREEN,"Could not open codec");
}

Thank you.


More information about the Libav-user mailing list