[FFmpeg-user] New options -preset and -tune for x264 encoding

sean darcy seandarcy2 at gmail.com
Wed Apr 20 00:05:07 CEST 2011


On 04/19/2011 03:27 PM, Baptiste Coudurier wrote:
> Hi,
>
> On 04/19/2011 08:56 AM, sean darcy wrote:
>> On 04/16/2011 08:10 PM, Baptiste Coudurier wrote:
>>> Hi everyone,
>>>
>>> Latest git has now added 2 new options for libx264 encoding:
>>> -preset<preset>
>>> -tune<tune>
>>>
>>> These options are directly mapped to internal tune and presets within
>>> libx264. The old presets files have been removed, please use the new
>>> options.
>>>
>>> Best regards.
>>>
>> How do these new presets work with 2 passes?
>>
>> For instance, I have a script that used:
>>
>> -pass 1 -vpre slow_firstpass
>>
>> -pass 2 -vpre slow
>>
>> I've changed it to:
>>
>> -pass 1 -preset slow
>>
>> -pass 2 -preset slow
>>
>> I used to get 100 fps on the 1st pass, now about 70. Is this to be
>> expected? Or do I need to do something else on the 1st pass?
>>
>> Here's the full script:
>>
>> ffmpeg -i $INPUT -an -pass 1  -vcodec libx264 -level 30 -preset slow     \
>>         -bufsize 10000000 -maxrate 10000000 -b 1200k -threads 0 -f mp4 -y
>> /dev/null
>> ffmpeg -i $INPUT -an -pass 2  -vcodec libx264 -level 30 -preset slow
>> -timestamp now \
>>         -bufsize 10000000 -maxrate 10000000 -b 1200k -threads 0 $1.m4v
>
> fastfirstpass should be enabled by default.
> Can you please double check that the parameters printed are the same ?
>

I've changed the script a little: slow -> slower, and added -tune film. 
But on pass 1 there's no fastfirstpass.

BTW, notice "-level 30" on ffmpeg command line becomes Level 3.1 in x264.

ffmpeg -i total.play.2005 -an -pass 1 -vcodec libx264 -level 30 -preset 
slower -tune film -bufsize 10000000 -maxrate 10000000 -b 1200k -threads 
0 -f mp4 -y /dev/null
FFmpeg version git-N-29196-ge61b83d, Copyright (c) 2000-2011 the FFmpeg 
developers
   built on Apr 19 2011 11:08:14 with gcc 4.6.0 20110413 (Red Hat 4.6.0-4)
   configuration: --prefix=/usr --bindir=/usr/bin 
--datadir=/usr/share/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man 
--shlibdir=/usr/lib64 --extra-cflags='-O2 -march=native -mtune=native 
-fopenmp -fomit-frame-pointer -pipe' --enable-static --enable-shared 
--enable-gpl --enable-nonfree --enable-version3 --enable-postproc 
--enable-avfilter --enable-pthreads --enable-x11grab --enable-gray 
--enable-vaapi --enable-hardcoded-tables --enable-frei0r 
--enable-libdirac --disable-decoder=libdirac --enable-libgsm 
--enable-libmp3lame --enable-libopenjpeg --enable-librtmp 
--enable-libschroedinger --disable-encoder=libschroedinger 
--enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx 
--enable-libx264 --enable-libxvid --enable-zlib --disable-debug 
--cpu=amdfam10 --arch=x86_64 --enable-libopencv --enable-pic
   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. 79. 1 /  1. 79. 1
   libswscale    0. 13. 0 /  0. 13. 0
   libpostproc  51.  2. 0 / 51.  2. 0
[dv @ 0x102d870] Estimating duration from bitrate, this may be inaccurate
Input #0, dv, from 'total.play.2005':
   Duration: 00:51:08.43, start: 0.000000, bitrate: 28771 kb/s
     Stream #0.0: Video: dvvideo, yuv411p, 720x480, 28771 kb/s, PAR 8:9 
DAR 4:3, 29.97 tbr, 29.97 tbn, 29.97 tbc
     Stream #0.1: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
Incompatible pixel format 'yuv411p' for codec 'libx264', auto-selecting 
format 'yuv420p'
[buffer @ 0x1034a90] w:720 h:480 pixfmt:yuv411p
[ffsink @ 0x1034d40] auto-inserting filter 'auto-inserted scaler 0' 
between the filter 'src' and the filter 'out'
[scale @ 0x1035050] w:720 h:480 fmt:yuv411p -> w:720 h:480 fmt:yuv420p 
flags:0xa0000004
[libx264 @ 0x10340b0] using SAR=8/9
[libx264 @ 0x10340b0] using cpu capabilities: MMX2 SSE2Fast FastShuffle 
SSEMisalign LZCNT
[libx264 @ 0x10340b0] profile High, level 3.1
[libx264 @ 0x10340b0] 264 - core 115 r1937+22 337ca0a - H.264/MPEG-4 AVC 
codec - Copyleft 2003-2011 - http://www.videolan.org/x264.html - 
options: cabac=1 ref=8 deblock=1:-1:-1 analyse=0x3:0x133 me=umh subme=9 
psy=1 psy_rd=1.00:0.15 mixed_ref=1 me_range=16 chroma_me=1 trellis=2 
8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-3 threads=9 
sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 
constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=2 b_bias=0 direct=3 
weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 
intra_refresh=0 rc_lookahead=60 rc=abr mbtree=1 bitrate=1200 ratetol=1.0 
qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=10000 vbv_bufsize=10000 
nal_hrd=none ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to '/dev/null':
   Metadata:
     encoder         : Lavf52.108.0
     Stream #0.0: Video: libx264, yuv420p, 720x480 [PAR 8:9 DAR 4:3], 
q=2-31, pass 1, 1200 kb/s, 30k tbn, 29.97 tbc
Stream mapping:
   Stream #0.0 -> #0.0
Press [q] to stop encoding
frame=91961 fps= 37 q=-1.0 Lsize=       0kB time=3068.37 bitrate= 
0.0kbits/s    /s
video:451863kB audio:0kB global headers:0kB muxing overhead -100.000000%
frame I:397   Avg QP:21.13  size: 49992
[libx264 @ 0x10340b0] frame P:24406 Avg QP:23.88  size: 12822
[libx264 @ 0x10340b0] frame B:67158 Avg QP:28.25  size:  1935
[libx264 @ 0x10340b0] consecutive B-frames:  0.8%  1.6% 11.3% 86.3%
[libx264 @ 0x10340b0] mb I  I16..4:  7.7% 76.8% 15.5%
[libx264 @ 0x10340b0] mb P  I16..4:  0.7%  2.2%  0.5%  P16..4: 47.7% 
15.8%  8.5%  0.7%  0.7%    skip:23.1%
[libx264 @ 0x10340b0] mb B  I16..4:  0.1%  0.1%  0.0%  B16..8: 34.4% 
3.1%  0.9%  direct: 3.0%  skip:58.4%  L0:45.6% L1:44.3% BI:10.1%
[libx264 @ 0x10340b0] final ratefactor: 22.71
[libx264 @ 0x10340b0] 8x8 transform intra:65.4% inter:53.8%
[libx264 @ 0x10340b0] direct mvs  spatial:100.0% temporal:0.0%
[libx264 @ 0x10340b0] coded y,uvDC,uvAC intra: 73.6% 65.0% 34.7% inter: 
14.3% 12.3% 0.6%
[libx264 @ 0x10340b0] i16 v,h,dc,p: 37% 37% 13% 13%
[libx264 @ 0x10340b0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 14% 14%  6%  9% 
10%  9%  9% 12%
[libx264 @ 0x10340b0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu:  7% 46%  4%  5%  7% 
  7%  8%  6% 10%
[libx264 @ 0x10340b0] i8c dc,h,v,p: 39% 29% 20% 12%
[libx264 @ 0x10340b0] Weighted P-Frames: Y:8.7% UV:3.2%
[libx264 @ 0x10340b0] ref P L0: 37.6% 11.7% 24.4%  5.5%  7.8%  3.8% 
6.2%  2.3%  0.6%  0.0%
[libx264 @ 0x10340b0] ref B L0: 64.7% 18.1%  7.3%  4.1%  2.6%  2.3%  0.9%
[libx264 @ 0x10340b0] ref B L1: 93.3%  6.7%
[libx264 @ 0x10340b0] kb/s:1206.37


sean



More information about the ffmpeg-user mailing list