Question / Help 5 Good Custom x264 Encoder Settings

Status
Not open for further replies.

Tim885885

New Member
(Jim Note: Always be wary of someone's custom settings. It doesn't hurt to try them but it's almost never necessary to use custom settings. Often, such as in this case most likely, the person recommending the settings does not understand exactly what those settings do.)

by me, guys u can test have some difference. :D

a <-------------> e
a: need low cpu
e: need high cpu


a
8x8dct=1 aq-mode=2 bframes=1 chroma-qp-offset=1 colormatrix=smpte170m deblock=0:0 direct=auto ipratio=1.41 keyint=240 level=3.1 me=hex merange=16 min-keyint=auto mixed-refs=1 no-mbtree=0 partitions=i4x4,p8x8,b8x8 profile=main psy-rd=0.5:0.0 qcomp=0.6 qpmax=51 qpmin=10 qpstep=4 ratetol=10 rc-lookahead=30 ref=1 scenecut=40 subme=5 threads=0 trellis=2 weightb=1 weightp=2

b
8x8dct=1 aq-mode=2 bframes=1 chroma-qp-offset=1 colormatrix=smpte170m deblock=0:0 direct=auto ipratio=1.41 keyint=240 level=3.1 me=hex merange=16 min-keyint=auto mixed-refs=1 no-mbtree=0 partitions=i4x4,p8x8,b8x8 profile=main psy-rd=0.5:0.0 qcomp=0.6 qpmax=51 qpmin=10 qpstep=4 ratetol=10 rc-lookahead=30 ref=1 scenecut=40 subme=6 threads=0 trellis=2 weightb=1 weightp=2

c
8x8dct=1 aq-mode=2 bframes=1 chroma-qp-offset=2 colormatrix=smpte170m deblock=0:0 direct=auto ipratio=1.41 keyint=240 level=3.1 me=hex merange=16 min-keyint=auto mixed-refs=1 no-mbtree=0 partitions=i4x4,p8x8,b8x8 profile=main psy-rd=0.5:0.0 qcomp=0.6 qpmax=51 qpmin=10 qpstep=4 ratetol=10 rc-lookahead=30 ref=1 scenecut=40 subme=7 threads=0 trellis=2 weightb=1 weightp=2

d
8x8dct=1 aq-mode=2 b-adapt=2 bframes=1 chroma-qp-offset=2 colormatrix=smpte170m deblock=0:0 direct=auto ipratio=1.41 keyint=240 level=3.1 me=umh merange=16 min-keyint=auto mixed-refs=1 no-mbtree=0 partitions=all profile=high psy-rd=0.5:0.0 qcomp=0.6 qpmax=51 qpmin=10 qpstep=4 ratetol=10 rc-lookahead=30 ref=1 scenecut=40 subme=8 threads=0 trellis=2 weightb=1 weightp=2

e
8x8dct=1 aq-mode=2 b-adapt=2 bframes=1 chroma-qp-offset=2 colormatrix=smpte170m deblock=0:0 direct=auto ipratio=1.41 keyint=240 level=3.1 me=umh merange=16 min-keyint=auto mixed-refs=1 no-mbtree=0 partitions=all profile=high psy-rd=0.5:0.0 qcomp=0.6 qpmax=51 qpmin=10 qpstep=4 ratetol=10 rc-lookahead=30 ref=1 scenecut=40 subme=10 threads=0 trellis=2 weightb=1 weightp=2
 

dehixem

Member
That's a lot of h264 settings, does this really improve a lot more quality ? Any information about what each param does ? Cheers
 

Tim885885

New Member
dehixem said:
That's a lot of h264 settings, does this really improve a lot more quality ? Any information about what each param does ? Cheers

really can improve a lot more quality.
i post the setting on chinese forums, i get 100+ likes.

the code, u can see on here
 
Thanks i shall give these a go, can they be used for local recordings as well?

What are you regarding as a high CPU???, i have a Bloomfield (1st gen i7) i7 920 @ 4Ghz.
 

dodgepong

Administrator
Forum Admin
Yes: don't use custom x264 settings if you don't know exactly what it does and what you are doing, even if some random person on the internet says "just do it, it will work great". Spend time on this page and learn how x264 works, and experiment around until you find what works best for you. The default settings should be fine for most people.
 

Krazy

Town drunk
dodgepong said:
Yes: don't use custom x264 settings if you don't know exactly what it does and what you are doing, even if some random person on the internet says "just do it, it will work great". Spend time on this page and learn how x264 works, and experiment around until you find what works best for you. The default settings should be fine for most people.

What's funny is most of those settings are the default.
 

Lain

Forum Admin
Lain
Forum Moderator
Developer
Here's what I can tell you about custom custom x264 commands: it's generally not needed to use them. You can almost always just use the presets (and tune command) to automatically adjust settings.

That being said, it's fine to try them all you want, custom settings typically can't really "hurt" anything, worst case scenario is that they make your stream look horrible and/or make the encoder take up all your CPU and lag your system. So if you really want to try some setting go ahead, but just know that there's rarely any reason to use custom x264 commands.

Generally I wouldn't trust some regular joe on the forums with x264 settings unless the settings were tried and true by many others and people know what the settings do and why they're using those settings in the first place. Saying "use these settings, they're great" isn't a good enough reason to really use those settings, you need way more details and the reasoning behind each specific setting. Saying "I got them off a website somewhere" isn't really a good reason either. (Unless maybe it's like doom9/10 or something)
 

mkdr

New Member
Krazy said:
dodgepong said:
Yes: don't use custom x264 settings if you don't know exactly what it does and what you are doing, even if some random person on the internet says "just do it, it will work great". Spend time on this page and learn how x264 works, and experiment around until you find what works best for you. The default settings should be fine for most people.

What's funny is most of those settings are the default.

What's funny is, his presets helped to improve my stream damatically. Maybe it's because my upload is not that high (2mbit). Fact is, your "default" settings results in fragmented and laggy stream for me, his settings results in perfectly fragment fee and constant lag free stream. His custom settings on => working, off (default settings) => not working. But maybe Im just imagining things ^_^
 

Boildown

Active Member
Its helpful to know how the x264 encoder works.

Here's a web page I reference when tweaking my settings: http://web.archive.org/web/201208140410 ... rence.html

By default, medium settings are used. OBS overrides this by setting a preset. Once a preset is set, then that preset's settings are used by default. Anything you set after that overrides what's in the preset. This guy's "custom" settings are just making it so that every setting is overriding the preset. That's just a bad way to go about your business. Setting the preset does all this work for you.

The thing about the presets are that they've been tweaked over years and years by video compression experts to use the best available tradeoffs between CPU usage, compression, and quality. Unless you seriously know what your doing, you're not going to get better results than changing the preset up or down a notch.

The only thing you MIGHT want to do is tweak things in between preset notches. That's some real fine tuning though, and I've found that I can't notice the difference (I did try), but I can make it so that its too heavy on my CPU and mess up my stream and capture.

The only thing I use now are the threads=x command, where x is a number between 1 and (1.5 times my number of CPU cores). This way I can reserve some CPU time for other applications other than OBS. Its generally more effective than hoping the OS will do it for me, or by setting OBS' process priority. I found that OBS runs better at (1.5 x CPU cores - 2) than at the x264 default of (1.5 x CPU cores). Of course I have a hyperthreading CPU, so x264 thinks I have more cores than I really do, so if you don't have hyperthreading, this might not work for you.

And the only other thing I do is turn on OpenCL, which I'm not sure does anything. I need to test that some day.
 

vaesauce

Member
Actually, I do not use these custom settings specifically but I have realized that manually setting some custom settings seems to be or feel smoother than using the actual presets. Which is quite awkward. My assumption is that there's more to than meets the eye on Presets and the command lines they use.

For example, If i use the FAST preset with my i7 3770K. My game becomes choppy and it blows my mind.

The FAST preset uses what? a subme of 6? and Rc-lookahead of 30? Ref of 2?

I'll set my custom settings to Subme=6 and Rc-lookahead=60 along with my Ref=3 and I don't know the exact % but it feels like it's 2x smoother than using the actual preset. This is with the Preset set to "VeryFast" and overriding with Custom Settings. This is just an example though, my custom settings technically set my Preset to "Fast/Medium".

Perhaps it's all speculation but the original poster's custom settings are "Almost" all defaults of the slower presets.
 

Boildown

Active Member
vaesauce said:
For example, If i use the FAST preset with my i7 3770K. My game becomes choppy and it blows my mind.

The FAST preset uses what? a subme of 6? and Rc-lookahead of 30? Ref of 2?

I'll set my custom settings to Subme=6 and Rc-lookahead=60 along with my Ref=3 and I don't know the exact % but it feels like it's 2x smoother than using the actual preset. This is with the Preset set to "VeryFast" and overriding with Custom Settings. This is just an example though, my custom settings technically set my Preset to "Fast/Medium".

Perhaps it's all speculation but the original poster's custom settings are "Almost" all defaults of the slower presets.

If you look at the Beandog chart, Fast also changes the Trellis and the NoMixedRefs settings vs. Very Fast. Either one of those could be reason your performance is improved vs. just setting Fast with no alterations.

Try this, set "Faster" and put the Trellis as it is in Very Fast, and no other changes. See if its better. If yes, set to Fast and set mixed_ref=0. See if its still better. If not, then we have our answer.

The thing is, the x264 guys changed the settings in the right order for best compression/performance tradeoffs. You're skipping steps so you're not getting potentially as good quality as you could. Also report back here with log files as you experiment, if you actually want help tweaking your settings.
 

vaesauce

Member
What i was using was only examples as it wasn't my complete custom settings parameters. However, I will mention that even with the Very Fast preset, my custom settings i still include in Trellis and the mixed refs changes to make it essentially "FAST" Preset.

Thus, as i was saying, my custom settings technically put me in right between Fast and Medium and for some odd reason it runs faster than the regular Fast preset, even with higher compression settings.
 

Boildown

Active Member
vaesauce said:
What i was using was only examples as it wasn't my complete custom settings parameters. However, I will mention that even with the Very Fast preset, my custom settings i still include in Trellis and the mixed refs changes to make it essentially "FAST" Preset.

Thus, as i was saying, my custom settings technically put me in right between Fast and Medium and for some odd reason it runs faster than the regular Fast preset, even with higher compression settings.

Try capturing to disk and then posting the settings from the MediaInfo in the .mp4 files and comparing them, from using your custom setting vs. setting the preset in OBS with nothing else. There must be differences which you can then sniff out.

The Media Info information is easy to find in Media Player Classic, I think VLC Player, or this: http://mediaarea.net/en/MediaInfo
 

Lain

Forum Admin
Lain
Forum Moderator
Developer
Getting educated about the encoder is always useful to improving your own stream, I agree. Learning certain settings can be very useful. There are some settings out there that give a real good sweet spot for certain computers. Krazy for example has his own settings tweaks that work quite nicely for him, and he spent time to get educated on what he was doing with each setting. He doesn't necessarily -need- them to get a good stream though. It's just more for what he streams and his own computer.
 

vaesauce

Member
Learning about the Encoder is definitely a plus. I use the custom settings to fine tune really. For example if "Faster" still has a lot of CPU headroom but "FAST" cuts it very close, you can use the custom settings to override a few settings to put you in the sweet spot to find the better balance of Quality/Performance.

Ever since I joined this forum and started streaming about 3 months ago, I've spent a lot of time... A LOT of time studying how each Parameter works for x264. How it affects your stream and how much CPU/RAM or resources in general it eats up. It's good information and as said, I think Custom settings is more for fine tuning if you know what you're doing.
 

D4rKiTo

New Member
I got really nice config for 1,5mbit upload, 1080p@30fps no lag no shuttering.

With the option A for x264: 8x8dct=1 aq-mode=2 bframes=1 chroma-qp-offset=1 colormatrix=smpte170m deblock=0:0 direct=auto ipratio=1.41 keyint=240 level=3.1 me=hex merange=16 min-keyint=auto mixed-refs=1 no-mbtree=0 partitions=i4x4,p8x8,b8x8 profile=main psy-rd=0.5:0.0 qcomp=0.6 qpmax=51 qpmin=10 qpstep=4 ratetol=10 rc-lookahead=30 ref=1 scenecut=40 subme=5 threads=0 trellis=2 weightb=1 weightp=2

Vídeo 1000 bitrate, cbr, fill cbr, no custom buffer, udio aac 48khz 96bitrate. Resolution 1080p 30 fps.

Thanks!

PD: TEST http://www.twitch.tv/worstshacoever/b/472308985 (skip first 18 min).
I've 2550k@4'6ghz, 8gb ram and ati 5850@1000/1125
 

Attachments

  • 2013-10-22-0054-01.log
    9 KB · Views: 1,462
Status
Not open for further replies.
Top