[Libav-user] How to have constant encoded file's size ?

Emmanuel HOUITTE ehouitte at yacast.fr
Wed Mar 6 14:48:43 CET 2013


I would like to do CBR H264/AAC with libav like the following command line, is it possible? I need file with constant size.
To set the bitrate seems not to work.
pAVCodecContext->bit_rate = video_bitrate;

ffmpeg.exe -i D:\test\conv256\20130211_043000.ts -acodec libfaac -vcodec libx264 -s 360x288 -vb 256k -ab 32k D:\test\conv256\20130211_043000_3.mp4

ffmpeg version 0.7-rc1, Copyright (c) 2000-2011 the FFmpeg developers
  built on May 30 2012 16:33:26 with gcc 4.6.2
  configuration: --enable-shared --disable-static --enable-memalign-hack --enable-nonfree --enable-l
ibmp3lame --disable-debug --enable-libfaac --enable-libx264 --enable-librtmp --build-suffix=20120530
--enable-gpl --prefix=/2012-05-30 --extra-cflags=-I/local/include --extra-ldflags=-L/local/lib --ta
rget-os=mingw32
  libavutil    50. 40. 1 / 50. 40. 1
  libavcodec   52.120. 0 / 52.120. 0
  libavformat  52.108. 0 / 52.108. 0
  libavdevice  52.  4. 0 / 52.  4. 0
  libavfilter   1. 77. 0 /  1. 77. 0
  libswscale    0. 13. 0 /  0. 13. 0
[mpeg2video @ 01f564c0] mpeg_decode_postinit() failure
    Last message repeated 1 times
[mpegts @ 0098abd0] max_analyze_duration reached
Input #0, mpegts, from 'D:\test\conv256\20130211_043000.ts':
  Duration: 00:05:00.04, start: 55627.633700, bitrate: 6128 kb/s
  Program 1537
    Stream #0.0[0x78]: Video: mpeg2video (Main), yuv420p, 720x576 [PAR 64:45 DAR 16:9], 15000 kb/s,
25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0.1[0x82](fra): Audio: mp2, 48000 Hz, stereo, s16, 192 kb/s
[buffer @ 0261b310] w:720 h:576 pixfmt:yuv420p
[scale @ 02433a60] w:720 h:576 fmt:yuv420p -> w:360 h:288 fmt:yuv420p flags:0xa0000004
[libx264 @ 01f55890] broken ffmpeg default settings detected
[libx264 @ 01f55890] use an encoding preset (e.g. -vpre medium)
[libx264 @ 01f55890] preset usage: -vpre <speed> -vpre <profile>
[libx264 @ 01f55890] speed presets are listed in x264 --help
[libx264 @ 01f55890] profile is optional; x264 defaults to high
[libx264 @ 01f55890] 264 - core 114 - H.264/MPEG-4 AVC codec - Copyleft 2003-2011 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0x1:0 me=dia subme=8 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=4 chroma_me=0 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 constrained_intra=0 bframes=0 weightp=0 keyint=12 keyint_min=7 scenecut=0 intra_refresh=0 rc_lookahead=12 rc=abr mbtree=1 bitrate=256 ratetol=1.0 qcomp=0.50 qpmin=2 qpmax=31 qpstep=3 ip_ratio=1.25 aq=1:1.00

Output #0, mp4, to 'D:\test\conv256\20130211_043000_3.mp4':
  Metadata:
    encoder         : Lavf52.108.0
    Stream #0.0: Video: libx264, yuv420p, 360x288 [PAR 64:45 DAR 16:9], q=2-31, 256 kb/s, 25 tbn, 25
tbc
    Stream #0.1(fra): Audio: libfaac, 48000 Hz, stereo, s16, 32 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.1 -> #0.1
Press [q] to stop encoding
frame=  370 fps= 97 q=31.0 Lsize=    1487kB time=14.72 bitrate= 827.6kbits/s dup=6 drop=0
video:1362kB audio:115kB global headers:0kB muxing overhead 0.647599%
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130306/18fc10cc/attachment.html>


More information about the Libav-user mailing list