[Libav-user] Setting libx264 bitrate via API

jettoblack jettoblack at gmail.com
Mon Jul 23 23:12:39 CEST 2012

rsg wrote
> Hi,
> I am also facing a similar issue. 
> When I set the bit rate using 
> 	out_vcodec->bit_rate = 200000;
> the quality of the video goes very bad. But when I set qmin and qmax, the
> bitrate setting is ignored.
> Only when i set a high value (approx 100MB) for the bit rate, the quality
> of the video improves.

Yes that is the same thing I'm seeing.  If qmin/qmax are left at -1
(default), then no matter what bitrate is specified, quality is very bad
(and the bitrate is not honored).

The upper half/third of the image looks good and the lower area looks really
bad.  The dividing line also changes every couple of frames. For example see
this screenshot: https://dl.dropbox.com/u/7730988/encode_prob.png

The only way I found to avoid this problem is to set qmin/qmax but then the
resulting video is not ABR/CBR.  Here is the same frame compressed with all
settings the same as before, except set qmin=1, qmax=31:

Obviously ffmpeg can do it right so I'm sure we are doing something wrong,
but I haven't yet found the difference in how ffmpeg is setting the libx264
options such as bitrate differently than what we are doing here.

Hope someone else has an idea...  Thanks.

View this message in context: http://libav-users.943685.n4.nabble.com/Setting-libx264-bitrate-via-API-tp4655453p4655479.html
Sent from the libav-users mailing list archive at Nabble.com.

More information about the Libav-user mailing list