[Libav-user] Rate control for mpeg4 encoding

Sergio Basurco sergio.b at coherentsynchro.com
Thu Oct 16 08:52:37 CEST 2014


Hi all,

I have an application that encodes mpeg4 video. The encoder was an 
adaptation of the decoding_encoding_8c-example 
<https://www.ffmpeg.org/doxygen/2.4/decoding_encoding_8c-example.html>. 
It works well, but bitrate fluctuates without much control. Currently, 
these are my AVCodecContext settings:

     c->bit_rate = 5000000;
     c->width = this->m_width;
     c->height = this->m_height;
     c->time_base.den = 25;
     c->time_base.num = 1;
     c->gop_size = 0;
     c->max_b_frames=0;
     c->pix_fmt = this->pix_fmt;

     av_opt_set(c->priv_data, "preset", "ultrafast", 0);
     av_opt_set(c->priv_data, "tune", "zerolatency", 0);

And I get up to 70Mbps depending on the image being encoded. I have also 
tried to set these parameters:

     c->bit_rate = 12e06;
     c->rc_min_rate = c->bit_rate;
     c->rc_max_rate = c->bit_rate;
     c->rc_buffer_size = c->bit_rate * 30;

And it does limit bandwidth, but after a couple minutes of encoding I 
get the error:

[error] ffmpeg error evaluating rc_eq (null)

My guess is that I'm missing some parameters. I don't quite understand 
what the rc_buffer_size value should be either.

Cheers!

-- 
Sergio Basurco,
Coherent Synchro

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20141016/27d98b4b/attachment.html>


More information about the Libav-user mailing list