View Full Version : x264 presets, profiles, and tuning system
Dark Shikari
2nd July 2009, 04:56
Presets will be used as follows:
--preset name
and apply before all other options. In other words, they override the x264 defaults, which, with the default changes (http://forum.doom9.org/showthread.php?t=148148), will be:
--subme 7 --bframes 3 --weightb --8x8dct --ref 3 --mixed-refs --trellis 1 --crf 23 --threads auto
As such, all options that you set will act on top of the preset you choose, regardless of the option order.
ultrafast:
--ref 1 --scenecut 0 --nf --no-cabac --bframes 0 --partitions none --no-8x8dct --me dia --subme 0 --aq-mode 0
veryfast:
--partitions i8x8,i4x4 --subme 1 --me dia --ref 1 --trellis 0
fast:
--mixed-refs 0 --ref 2 --subme 5
medium:
<defaults>
slow:
--me umh --subme 8 --ref 5 --b-adapt 2 --direct auto
slower:
--me umh --subme 9 --ref 8 --b-adapt 2 --direct auto --partitions all --trellis 2
placebo:
--me tesa --subme 9 --merange 24 --ref 16 --b-adapt 2 --direct auto --partitions all --no-fast-pskip --trellis 2 --bframes 16
For all encodes, regardless of preset or not, using --pass 1 will automatically trigger "turbo" settings, which are as follows and override all commandline options:
--trellis 0 --no-8x8dct --partitions none --me dia --ref 1 --subme MIN(2, previous subme)
This can be disabled using --slow-firstpass.
For all encodes, if you don't set your own --ref option and instead use the default or a preset, x264 will automatically lower --ref if the --level you set conflicts with it. If you set --ref explicitly, it will not override what you set.
Profiles will be used as follows:
--profile name
The options will be baseline, main, and high, which do what you think they do. Note that these override all other options no matter what, with two exceptions.. Because interlaced and lossless coding are options with very explicit meanings, the encoder will terminate with an error if you attempt to use them with an incompatible profile.
Tunings will be used as follows:
--tune name
The options will be "film" and "animation", and will tweak AQ strength, psy-rd/trellis strength, deblock, refs, and so forth:
film:
--deblock -1:-1 --psy-rd 1.0:0.15
animation:
--ref (previousref==1?1:MIN(previousref*2,16)) --deblock 1:1 --psy-rd 0.4:0 --aq-strength 0.6 --bframes 5
All of this is subject to change before final release, and suggestions are welcome.
If you don't use any of the new presets, the only changes for you will be the new defaults, and the automatic fast first pass.
Kurtnoise
2nd July 2009, 06:16
That's cool...:)
May I suggest to add several devices presets (basically for PMPs & SAPs) ?
Dark Shikari
2nd July 2009, 06:18
That's cool...:)
May I suggest to add several devices presets (basically for PMPs & SAPs) ?Maybe later.
juGGaKNot
2nd July 2009, 06:29
Presets will be used as follows:
--me umh --subme 9 --ref 8 --b-adapt 2 --direct auto --partitions all --trellis 2
placebo:
--me tesa --subme 9 --merange 24 --ref 16 --b-adapt 2 --direct auto --partitions all --no-fast-pskip --trellis 2 --bframes 16
Slower should have merange 24, placebo 32.
Profiles will be used as follows:
--tune name
The options will be "film" and "animation", and will tweak AQ strength, psy-rd/trellis strength, deblock, refs, and so forth:
film:
--deblock -1:-1 --psy-rd 1.0:0.15
animation:
--ref (previousref==1?1:MIN(previousref*2,16)) --deblock 1:1 --psy-rd 0.4:0 --aq-strength 0.6 --bframes 5
The film tune looks actually better to me for animation ( cs 1.6 )
I will not be able to tweek psy-rd and vaq/autovaq on my own ?
These new option seem k for gui but not for cmd users.
Kurtnoise
2nd July 2009, 06:38
Slower should have merange 24, placebo 32.
:rolleyes:
These new option seem k for gui but not for cmd users.
cmd users use more or less all switches, not presets. Period...
juGGaKNot
2nd July 2009, 06:45
cmd users use more or less all switches, not presets. Period...
Ahh i was thinking that all cvars will be replaced, than good, so lets go.
Selur
2nd July 2009, 09:08
Thanks for the update. :)
Little question regarding, profile:
Note that these override all other options no matter what, ...
with what ?
juGGaKNot
2nd July 2009, 09:14
Thanks for the update. :)
Little question regarding, profile:
with what ?
"x264.exe --profile placebo --tune film" replaces any following cvar with "--me tesa --subme 9 --merange 24 --ref 16 --b-adapt 2 --direct auto --partitions all --no-fast-pskip --trellis 2 --bframes 16 --deblock -1:-1 --psy-rd 1.0:0.15" i guess.
Dark Shikari
2nd July 2009, 09:27
Thanks for the update. :)
Little question regarding, profile:
with what ?profile baseline will disable CABAC, B-frames, CQMs, 8x8dct no matter what. It will error out on interlaced video.
profile main will disable 8x8dct and CQMs no matter what.
profile high will do nothing as that's default.
All will error out on lossless.
LoRd_MuldeR
2nd July 2009, 10:39
For all encodes, regardless of preset or not, using --pass 1 will automatically trigger "turbo" settings, which are as follows and override all commandline options:
--trellis 0 --no-8x8dct --partitions none --me dia --ref 1 --subme MIN(2, previous subme)
Is this done in the CLI interface or will it be enforced in the library?
I hope for the latter...
Dark Shikari
2nd July 2009, 10:42
Is this done in the CLI interface or will it be enforced in the library?
I hope for the latter...Former.
LoRd_MuldeR
2nd July 2009, 10:52
Former.
d'oh! (http://upload.wikimedia.org/wikipedia/en/3/3d/Homer_D'oh.png)
roozhou
2nd July 2009, 11:01
animation:
--ref (previousref==1?1:MIN(previousref*2,16)) --deblock 1:1 --psy-rd 0.4:0 --aq-strength 0.6 --bframes 5
IMHO default 0:0 should be OK.
Selur
2nd July 2009, 14:11
Why does '--presets' will only change the defaults?
Will '--tune' also only change the defaults?
Wouldn't it be better to replace all the settings which are defined through the preset with the preset?
Cu Selur
Ps.: Sorry, but personally I don't like the idea to have 'presets&tune' in the cl interface, but I think that is mainly because the cl interface for me is something that's far more connected to the library itself, for me they belong into a gui.
Audionut
2nd July 2009, 14:17
for me they belong into a gui.
I agree. However, I tend to see a lot of people thinking that megui is x264.
And so these same people complain to the x264 devs when megui does something stupid in a profile.
I see this as the x264 devs trying to minimize time wasted.
LoRd_MuldeR
2nd July 2009, 14:20
Wouldn't it be better to replace all the settings which are defined through the preset with the preset?
I don't think so. The way it is planned you can easily pick a preset as your basic configuration and still adjust a few settings here and there.
If the preset would overwrite your custom options, you couldn't make use of presets anymore, as soon as you need to adjust one single parameter!
Also it would be very confusing to have parameters in the command-line that are valid, but will be ignored by x264...
Keiyakusha
2nd July 2009, 14:38
--ref (previousref==1?1:MIN(previousref*2,16)) --deblock 1:1 --psy-rd 0.4:0 --aq-strength 0.6 --bframes 5IMHO default 0:0 should be OK.
Deblock 1:1 usually better for anime than 0:0 but IMHO psy-rd should be 0.0:0 and no AQ until AutoVAQ patch will be added...
Selur
2nd July 2009, 14:39
Also it would be very confusing to have parameters in the command-line that are valid, but will be ignored by x264...
Like when you would use '--profile' ?
Also when the options just override the defaults it's always a pain to look up the presets to know which of my options would not be changed.
I would prefer them to override not just the defaults and throw an error if some one added a parameter which tries to change them. This would also notify one if one presets changes in a manner that it covers a new variable.
Cu Selur
LoRd_MuldeR
2nd July 2009, 14:44
Also when the options just override the defaults it's always a pain to look up the presets to know which of my options would not be changed.
The opposite is the case: With your suggestion, we would have a mixture of command-line parameter that are effective and parameters that will be ignored (because of the preset).
With the method that is planned, all command-line parameters that a specified explicitly will work as expected. Only parameters that are left out will default to the selected preset/profile.
Why should it be possible to specify valid parameters that will be ignored? Why should it be forbidden to select a preset and adjust single parameters ???
Selur
2nd July 2009, 14:54
Did you miss:
"I would prefer them to override not just the defaults and throw an error if some one added a parameter which tries to change them. This would also notify one if one presets changes in a manner that it covers a new variable."
or did you ignore it on purpose?
Only parameters that are left out will default to the selected preset/profile.
did you miss:
Profiles will be used as follows:.... Note that these override all other options no matter what,...
Why should it be forbidden to select a preset and adjust single parameters ???
I my option:
- I think it is a bad idea to have 'changing' defaults.
- I think such syntactic sugar should not be included in the cl interface
Cu Selur
Audionut
2nd July 2009, 14:59
- I think it is a bad idea to have 'changing' defaults.
There's a difference between changing defaults. ie: being changed on a regular basis, and, changed, ie: being changed after how many years?
Logic behind this change: x264 should be by default High Profile and generate relatively high quality, but not entirely max itself out; it should be a reasonable speed/quality tradeoff.
Selur
2nd July 2009, 15:06
with 'changing' defaults like when you would use the presets to just overwrite the defaults, which would be possible on a regular basis; think you misunderstood me there, or I'm not getting you here :)
LoRd_MuldeR
2nd July 2009, 15:14
Did you miss:
"I would prefer them to override not just the defaults and throw an error if some one added a parameter which tries to change them. This would also notify one if one presets changes in a manner that it covers a new variable."
or did you ignore it on purpose?
I think I made quite clear that it should be possible to select a preset and still customize single parameters.
Whether x264 simply ignores all parameters that are already covered by the preset or whether it throws an error when I try to explicitly change a parameter that is already covered by the preset, I just don't like the idea that the preset doesn't allow me to customize any parameters. It would lead to the situation where I would like to use preset X, but there's one parameter I need to adjust. Then I would have to completely drop the preset and specify ALL parameters explicitly. That's really not very convenient...
I my option:
- I think it is a bad idea to have 'changing' defaults.
- I think such syntactic sugar should not be included in the cl interface
I you like it better, you can think of it the following way:
First of all we start with the x264 defaults (always). Then we apply a preset (optionally). Finally we apply all custom parameters.
That's basically how any x264 GUI works. For example: In MeGUI you can select a preset first and then you can adjust single options in the configuration window ;)
So we basically don't change the default, but we provide "shortcuts" for popular parameter combination. You can call it however you like.
Still we should give the user the opportunity to change single parameters when needed, even when a preset was selected...
Selur
2nd July 2009, 15:53
That's basically how any x264 GUI works.
and that's probably why I don't like it in a CL(I)
So we basically don't change the default, but we provide "shortcuts" for popular parameter combination. You can call it however you like.
I leave that job to you. :)
I think I made quite clear that it should be possible to select a preset and still customize single parameters.
No, you just made clear that you like it to be possible and like I mentioned int the part that you didn't take into account was that I don't. :)
I wanted to suggest that, in my opinion, --presets should like --profiles "override all other options no matter what,.." and/or complain then one changes an option that is already specified by the preset.
I got it that you don't share that opinion and we both have different ways we think about it, plain and simple. :D
Cu Selur
elguaxo
2nd July 2009, 16:06
How about a "slowest" preset? Something between slower and placebo. Thanks :)
How about a "slowest" preset? Something between slower and placebo. Thanks :)
"Slowest" would imply the slowest settings possible, i.e. even worse than placebo, otherwise it wouldn't be slowest.
popper
2nd July 2009, 16:26
Quote:
Originally Posted by Kurtnoise
That's cool...
May I suggest to add several devices presets (basically for PMPs & SAPs) ?
Maybe later.
that being the case, can we finally have a 360 device preset ASAP too?.
that currently stands at, and plays without stutter is a max of 10Mbit/s H@L4.1, ref 3 for 1920×1080 at 30 fps (confirmed as the max for 25fps PAL 360 playability too, 11Mbit,ref3 was bad on beetlejuice dvd , as was 10Mbit,ref4) in a generic mp4 container.
http://support.xbox.com/support/en/us/xbox360/gamesandmedia/movies/videofaq/viewvideoplaybackfaq.aspx
"...
Q: What does the Xbox 360 console support for H.264?
A: The Xbox 360 console supports the following for H.264:
File extensions: .mp4, .m4v, mp4v, .mov, .avi
Containers: MPEG-4, QuickTime
Video profiles: Baseline, main, and high (up to level 4.1)
Video bit rate: 10 Mbps with resolutions of 1920 × 1080 at 30 fps. See the question about max bit rate, resolution, and frames per second.
Audio profiles: AAC, 2-channel, Low Complexity
Audio max bit rate: No restrictions. See the question about max bit rate, resolution, and frames per second.
..."
Selur
2nd July 2009, 19:54
here's a suggestion for
ultrafast:
--ref 1 --scenecut 0 --partitions none --me dia --mvrange 64 --merange 4 --subme 0 --no-mixed-refs --no-chroma-me --no-8x8dct --aq-mode 0 --trellis 0 --threads auto --no-cabac --no-deblock --no-psnr --no-ssim --non-deterministic
buzzqw
2nd July 2009, 21:18
X264;1;Ultra Fast;--keyint 250 --bframes 1 --trellis 0 --ref 1 --deblock 0,0 --subme 2 --direct spatial --me hex --no-ssim --merange 8 --b-adapt 0 --no-chroma-me --aud
X264;2;Very Fast;--keyint 250 --bframes 2 --trellis 0 --ref 2 --deblock 0,0 --subme 3 --direct spatial --me hex --no-ssim --merange 10 --b-adapt 0 --no-chroma-me --aud
X264;3;Fast;--keyint 250 --bframes 3 --trellis 0 --ref 3 --deblock -1,-1 --subme 4 --direct auto --me hex --no-ssim --merange 12 --weightb --b-adapt 2 --b-pyramid --partitions p8x8,i8x8 --8x8dct --aud --aq-mode 1 --aq-strength 1 --psy-rd 1.0:0.0
X264;4;High Performance;--keyint 250 --bframes 3 --trellis 0 --ref 3 --deblock -1,-1 --subme 5 --direct auto --me dia --no-ssim --merange 14 --weightb --b-adapt 2 --b-pyramid --partitions p8x8,i8x8 --8x8dct --aud --aq-mode 1 --aq-strength 1 --psy-rd 1.0:0.0
X264;5;Balanced;--keyint 250 --bframes 3 --trellis 0 --ref 3 --deblock -1,-1 --subme 5 --direct auto --me dia --no-ssim --weightb --b-adapt 1 --partitions p8x8,b8x8,i8x8 --8x8dct --aud --aq-mode 0 --aq-strength 0
X264;6;Better Quality;--keyint 250 --bframes 5 --mixed-refs --trellis 1 --ref 4 --deblock -1,-1 --subme 6 --direct auto --me umh --no-ssim --weightb --b-adapt 2 --b-pyramid --partitions p8x8,b8x8,i8x8 --8x8dct --aud --aq-mode 1 --aq-strength 1 --psy-rd 1.0:0.0
X264;7;Extreme Quality;--keyint 250 --bframes 4 --mixed-refs --trellis 0 --ref 4 --deblock -1,-1 --subme 9 --direct auto --me umh --no-ssim --weightb --b-adapt 2 --no-chroma-me --8x8dct --aud --aq-mode 1 --aq-strength 1 --psy-rd 1.1:0.0
X264;8;Insane Quality;--keyint 250 --bframes 6 --mixed-refs --trellis 2 --ref 6 --deblock -1,-1 --subme 7 --direct auto --me umh --no-ssim --merange 20 --weightb --b-adapt 2 --b-pyramid --partitions p8x8,b8x8,i4x4,i8x8 --8x8dct --aud --aq-mode 1 --aq-strength 1 --psy-rd 1.0:1.0
X264;9;Slug;--keyint 250 --bframes 8 --mixed-refs --trellis 2 --ref 8 --deblock -2,-1 --subme 8 --direct auto --me esa --no-ssim --merange 24 --weightb --b-adapt 2 --b-pyramid --partitions p8x8,b8x8,i4x4,i8x8,p4x4 --8x8dct --aud --aq-mode 1 --aq-strength 1 --psy-rd 1.1:1.0
X264;10;Placebo;--keyint 250 --bframes 16 --mixed-refs --trellis 2 --ref 16 --deblock -2,-1 --subme 9 --direct auto --me tesa --no-ssim --merange 24 --weightb --b-adapt 2 --b-pyramid --partitions all --8x8dct --aud --aq-mode 1 --aq-strength 1 --psy-rd 1.1:1.0
that's my 0.02€
BHH
Thanks Dark Shikari.
How about a new DV preset? In most of the prosumer camera footage I've seen, --deblock -1:-1 is too weak (0:0 works better for me). That makes me wonder if the other film preset parameters such as psy-rd are also in need of adjustment for DV. I'm no expert, so I can't say.
nakTT
3rd July 2009, 05:33
slower:
--me umh --subme 9 --ref 8 --b-adapt 2 --direct auto --partitions all --trellis 2
placebo:
--me tesa --subme 9 --merange 24 --ref 16 --b-adapt 2 --direct auto --partitions all --no-fast-pskip --trellis 2 --bframes 16
Forgive me for this noob question,
Is that mean for "Slower" profile I should turn the "merange" from 24 (as in Placebo profile) to 0 (Zero) ?
:thanks:
kemuri-_9
3rd July 2009, 05:47
Is that mean for "Slower" profile I should turn the "merange" from 24 (as in Placebo profile) to 0 (Zero) ?
No, if the preset doesn't mention the particular parameter, then it remains the default, in merange's case that is 16
nakTT
3rd July 2009, 05:58
No, if the preset doesn't mention the particular parameter, then it remains the default, in merange's case that is 16
Many thanks for clear things up.
:thanks:
10L23r
4th July 2009, 06:38
cool, this sounds great
i think we should do something similar to msu's x264 preset comparison thing to find optimal combinations of options
@buzzqw- "high performance" is kinda ambiguous... and why does the 7th preset have subme9??
i think threads=1 should be added to the placebo preset
Forteen88
4th July 2009, 08:56
Slower should have merange 24, placebo 32.I think that x264 should set recommended merange automatically (but it should be possible to change), the higher resolution the higher merange. Around merange 28 for 1080p video.
Yoshiyuki Blade
4th July 2009, 09:39
I'm curious about the absence of b-pyramid anywhere in the settings. Is it insignificant, or problematic?
Audionut
4th July 2009, 11:01
I'm curious about the absence of b-pyramid anywhere in the settings. Is it insignificant, or problematic?
B-pyramid has a small enough benefit and large enough number of problems with some hardware devices that I don't want to deal with the bug reports.
http://forum.doom9.org/showthread.php?p=1301846#post1301846
Yoshiyuki Blade
4th July 2009, 11:14
http://forum.doom9.org/showthread.php?p=1301846#post1301846
D'oh! I can't believe I missed that. Thanks :)
juGGaKNot
4th July 2009, 11:23
I think that x264 should set recommended merange automatically (but it should be possible to change), the higher resolution the higher merange. Around merange 28 for 1080p video.
What about
64 for slow
128 for placebo
at 1920.
24 for slow
32 for placebo
at 720p.
LE : what about auto --keyint and --min-keyint aproximated for the fps ?
Now i use ffmpeg to get the fps and this script for 24-60 FPS :
set kint=240
set mint=24
if %myfps% GEQ 25 GOTO A1
:A1
if %myfps% LEQ 26 GOTO set1
if %myfps% GEQ 29 GOTO A2
:A2
if %myfps% LEQ 31 GOTO set2
if %myfps% GEQ 34 GOTO A3
:A3
if %myfps% LEQ 36 GOTO set3
if %myfps% GEQ 39 GOTO A4
:A4
if %myfps% LEQ 41 GOTO set4
if %myfps% GEQ 44 GOTO A5
:A5
if %myfps% LEQ 46 GOTO set5
if %myfps% GEQ 49 GOTO A6
:A6
if %myfps% LEQ 51 GOTO set6
if %myfps% GEQ 54 GOTO A7
:A7
if %myfps% LEQ 56 GOTO set7
if %myfps% GEQ 59 GOTO A8
:A8
if %myfps% LEQ 61 GOTO set8
:set1
set kint=250
set mint=25
GOTO END
:set2
set kint=300
set mint=30
GOTO END
:set3
set kint=350
set mint=35
GOTO END
:set4
set kint=400
set mint=40
GOTO END
:set5
set kint=450
set mint=45
GOTO END
:set6
set kint=500
set mint=50
GOTO END
:set7
set kint=550
set mint=55
GOTO END
:set8
set kint=600
set mint=60
GOTO END
:END
x264.exe --keyint %kint% --min-keyint %mint% blah blah blah
Forteen88
4th July 2009, 13:23
What about
64 for slow
128 for placebo
at 1920.What I've read, there's no reason/gain to have a merange over ~32 for 1080p, and IIRC, having a too high merange-value can be bad.
juGGaKNot
4th July 2009, 13:36
What I've read, there's no reason/gain to have a merange over ~32 for 1080p, and IIRC, having a too high merange-value can be bad.
ds sais "in theory full hd needs 128 merange" in theory ....
burfadel
4th July 2009, 15:47
Full HD needs a higher merange simply because the same spatial image is represented by a higher number of pixels, such that the higher the resolution the more pixels a block transverses between frames.
Dark Shikari
4th July 2009, 18:08
merange is the distance to search from the best predictor, not the maximum motion vector range.
Despite HD video having longer motion vectors, it also generally has smoother motion fields due to objects being of larger size, so it isn't necessarily guaranteed that you "need more merange" on an HD video.
juGGaKNot
4th July 2009, 18:16
merange is the distance to search from the best predictor, not the maximum motion vector range.
Despite HD video having longer motion vectors, it also generally has smoother motion fields due to objects being of larger size, so it isn't necessarily guaranteed that you "need more merange" on an HD video.
I see
what about the
--keyint and --min-keyint aproximated for the fps ?
Stuff ? this should be automated to the fps right ? if someone needs lower values ( like for blu-ray ) thay can overwrite it but the default should be fps x 10 / fps
But now its the 250/25 default.
Manao
4th July 2009, 20:48
Despite HD video having longer motion vectors, it also generally has smoother motion fields due to objects being of larger size, so it isn't necessarily guaranteed that you "need more merange" on an HD videoMotion vectors are larger, so whenever motion vectors differ, the difference is larger too. Motion vectors field isn't smooth on edges, and indeed the proportion of edges in HD (relatively to the number of macroblock) is lower, but on those edges, a higher ME range may make the difference.
Selur
4th July 2009, 21:13
Any news when the new options are going to be available, at least the default changes and the '--profile' was 'okay' for everyone. (aside from the point if bool/int values for the parameters would be better than parameter names with no-... at the beginning);)
Dark Shikari
4th July 2009, 21:20
Any news when the new options are going to be available, at least the default changes and the '--profile' was 'okay' for everyone. (aside from the point if bool/int values for the parameters would be better than parameter names with no-... at the beginning);)Assuming no new objections by akupenguin, I will commit the new defaults, and the profile/tune/preset system on Monday. Since the profile/tune/preset system is completely optional, GUIs don't need to update to use them just yet; they can do so at their leisure. The only thing that they will need to adapt to now is the new defaults.
Selur
5th July 2009, 08:09
Thanks for the info :)
juGGaKNot
5th July 2009, 12:18
Assuming no new objections by akupenguin, I will commit the new defaults, and the profile/tune/preset system on Monday. Since the profile/tune/preset system is completely optional, GUIs don't need to update to use them just yet; they can do so at their leisure. The only thing that they will need to adapt to now is the new defaults.
How about a way for the user to write custom profiles
--setting > xxx.profile
x264.exe xxx.profile.
Useless?
and the
--keyint and --min-keyint aproximated for the fps ?
Stuff ? this should be automated to the fps right ? if someone needs lower values ( like for blu-ray ) thay can overwrite it but the default should be fps x 10 / fps
But now its the 250/25 default.
Or the 250/25 is k for all range of fps values ?
Kurtnoise
5th July 2009, 15:46
How about a way for the user to write custom profiles
--setting > xxx.profile
x264.exe xxx.profile.
Useless?
yes...:rolleyes:
1/ you should first try to understand presets vs profiles meaning.
2/ if you want to customize something, use the current switches instead.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.