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

sean darcy seandarcy2 at gmail.com
Wed Apr 20 00:51:26 CEST 2011


Hi,

On 04/19/2011 06:09 PM, Baptiste Coudurier wrote:
> Hi Sean,
>
> On 04/19/2011 03:05 PM, sean darcy wrote:
>> 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.
>
> I don't understand what you mean. fastfirstpass is activated by default
> like x264, if you want to disable it use: -fastfirstpass 0.
>


I misunderstood you. I thought you meant check ffmpeg parameters v. x264 
parameters. I now understand you meant to check if the parameters for 
ffmpeg were the same with -vpre and -preset. And the answer is yes - 
they were the same: I was using the identical script.

I'm still puzzled by the new behavior. I'm not sure fastfirstpass is 
enabled, or maybe something else is slowing the first pass.  With ffmpeg 
and the old presets, as I remember it, pass 1 was 80-100 fps. pass 2 was 
30-40 fps. So pass 1 was about twice as fast as pass 2.

With the new settings (bearing in mind I've gone from slow -> slower) 
pass 1 is 2 fps _slower_ than pass 2!

Pass 1:

frame=91961 fps= 37 q=-1.0 Lsize=       0kB time=3068.37 bitrate= 
0.0kbits/s    /s

Pass 2:

frame=91961 fps= 39 q=-1.0 Lsize=  450992kB time=3068.37 
bitrate=1204.1kbits/s

 >> BTW, notice "-level 30" on ffmpeg command line becomes Level 3.1 in 
x264.
 >
 > -level has not effect when -preset is used.
 >

I'm trying to encode so that it can be played on android/iphone. Some 
models require 3.0 (others are ok with 3.1). I assume some of this will 
be fixed with -profile, but even within a profile, the levels can be 
important. But I guess this is an x264 issue, not ffmpeg.

sean



More information about the ffmpeg-user mailing list