[Libav-user] H264 encoding: set target average bitrate

Michael Niedermayer michaelni at gmx.at
Mon Oct 17 19:44:54 CEST 2011


On Mon, Oct 17, 2011 at 07:12:54PM +0300, Andrey Utkin wrote:
> Hi.
> I do encoding h264 video in my app that uses libavcodec (git almost
> HEAD (f22bc68 Oct, 7), x264 git almost HEAD too(8a62835 Sep, 14)). I
> set to output AVCodecContext options bit_rate, rc_buffer_size,
> rc_max_rate, rc_min_rate (see line 142), but they seem to be not
> affecting the process - i get output video bitrate too much highter.
> Additionally, i set qmin=qmax=-1 (without setting them libx264 rejects
> to work lamenting about broken defaults). When i set them to
> positives, the bitrate changes. Seems i can control bitrate by
> qmin,qmax setting only, what is certainly not acceptable.
> My sources: https://github.com/krieger-od/transcoder/blob/master/transcoder.c .
> Any comments are appreciated.

have you tried reproducing the issue you see with the command line
ffmpeg tool and the command line x264 tool?

also you should generally not use the libavcodec defaults but set some
x264 preset or something.
you can set private x264 options (like the preset) with
av_opt_set(c->priv_data, key, value, 0);


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many things microsoft did are stupid, but not doing something just because
microsoft did it is even more stupid. If everything ms did were stupid they
would be bankrupt already.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20111017/b8dda8f4/attachment.asc>


More information about the Libav-user mailing list