[Libav-user] H264 encoding

Gonzalo Garramuno ggarra13 at gmail.com
Wed May 14 16:06:03 CEST 2014

I have an application that saves an .avi using the default mpeg4 encoder.
Since my application is GPL, I wanted to add H264 encoding.  I compiled 
libx264 and linked without any problem.
When I try to save with the h264 codec changing the code that works for 
AV_CODEC_ID_MPEG4 (to AV_CODEC_ID_H264), all frames are parsed, however 
only half of the frames are saved in the avi file.  I wonder if this is 
because h264 expects a two pass compression or some other setting is wrong.
I would appreciate it if someone could provide some code of saving in h264.
This is the output of h264 I get:

       [save] Open encoder h264
        [ffmpeg] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle 
SSE4.1 Cache64
        [ffmpeg] profile High, level 3.1
        [ffmpeg] 264 - core 120 r2151 a3f4407 - H.264/MPEG-4 AVC codec - 
Copyleft 2003-2011 - http://www.videolan.org/x264.html - options: 
cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 
psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 
cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=3 
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=12 keyint_min=1 scenecut=40 
intra_refresh=0 rc_lookahead=12 rc=abr mbtree=1 bitrate=1555 ratetol=1.0 
qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00

I tried modifying muxing.c and that works without problems.
Any help or ideas are welcome.

More information about the Libav-user mailing list