[Libav-user] how to configure rc_buffer_size and muxrate?

Li Zhang lizhang at utelisys.com
Fri Jun 22 12:37:14 CEST 2012

Hi everyone,

Can anybody tell me what the relationship between rc_buffer_size and muxrate or output video stream bit rate?

I want to get a CRB output when I using ffmpeg to perform H.264 encoding.

oVcc is AVCodecContext pointer, and output_context is the AVFormatContext pointer. v_bitrate is the the output video stream bit rate which I wanted.
        oVcc->rc_min_rate = v_bitrate;
        oVcc->rc_max_rate = v_bitrate;
        oVcc->bit_rate_tolerance = v_bitrate;
        oVcc->rc_buffer_size = ?????????;
        oVcc->rc_initial_cplx = 0.5;
        oVcc->rc_initial_buffer_occupancy = oVcc->rc_buffer_size*3/4;
        oVcc->rc_buffer_aggressivity = (float)1.0;
        oVcc->qcompress = 0.0f;

And how to configure the muxrate further? Should it be the sum of video bit rate and audio bit rate?

Here is a sample output information of H.264 from FFmpeg. Is this all right?

Output #0, mpegts, to 'udp://':
    Stream #0:0, 0, 1/90000: Video: h264 (hq), yuv420p, 704x576 [SAR 16:11 DAR 16:9], 1/25, q=10-51, 1300 kb/s, 90k tbn, 25 tbc
    Stream #0:1, 0, 1/90000: Audio: aac (LC), 48000 Hz, stereo, s16, 96 kb/s
err{or,}_recognition separate: 1; 1
err{or,}_recognition combined: 1; 10001
using SAR=16/11
using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX
profile High, level 3.0
264 - core 122 - H.264/MPEG-4 AVC codec - Copyleft 2003-2012 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=30 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=cbr mbtree=1 bitrate=1300 ratetol=1.0 qcomp=0.00 qpmin=10 qpmax=51 qpstep=4 vbv_maxrate=1300 vbv_bufsize=52 nal_hrd=none ip_ratio=1.40 aq=1:1.00
err{or,}_recognition separate: 1; 1
err{or,}_recognition combined: 1; 10001
muxrate 1396000, pcr every 18 pkts, sdt every 464, pat/pmt every 92 pkts.

Best regards,

Li Zhang

More information about the Libav-user mailing list