Good x264 settings (May 2020 update 2)

  • In VP, when I select any profile and click Apply I see the option opencl=1 (with "Show advanced option" checkbox ticked).

    Just curious, how can I remove/disable it?

    Thanks.

    P.S. In profiles created with earlier versions of connector do not have the option.

  • Goodmorning, sorry i'm new. Amazing post, thanks for posting this.

    I'm a twitch streamer, whats the best commands for help high motion games? maybe i have to work on Motion search Adaptive Quantization and Loop Filter?

    If u have any advice would be amazing


    edit: are the commands in order of cpu hungry from the top to the bottom or are they random? whats the lightest? I have a 1800x dedicated streaming pc 8core 16 thread, streaming 1080p60 8000k bitrate. Thanks again and sorry for my english

    Einmal editiert, zuletzt von ciommi (18. September 2020 um 12:31)

  • Goodmorning, sorry i'm new. Amazing post, thanks for posting this.

    I'm a twitch streamer, whats the best commands for help high motion games? maybe i have to work on Motion search Adaptive Quantization and Loop Filter?

    If u have any advice would be amazing


    edit: are the commands in order of cpu hungry from the top to the bottom or are they random? whats the lightest? I have a 1800x dedicated streaming pc 8core 16 thread, streaming 1080p60 8000k bitrate. Thanks again and sorry for my english

    That depends on your CPU, because adding more stuff to compute could blow up your 1800x usage, you can do average bitrate mode so your CPU usage is a lot lower, or crf+vbr mode with best quality when you are not going over 8000k as you wanted, both modes are for streaming.

    1800x is not good enough for crf+vbr mode, so you need a lot of free performance boost with these steps:

    1. record in 1920x1032 57fps (assume you stream with OBS)

    2. limit game fps to 60 maximum, this will free up a lot of CPU usage as GPU wil call CPU send frames to render, and then reduces GPU temperature which gives more heating room for CPU

    3. enable vertical sync because this will output cleaner frames to encode, resulting better quality, this does reduce fps but gives CPU more heating room as the GPU gets cooler

    4. use strong anti aliasing unless it has resulted a crash, because a smooth picture is much easier to compress, and frees up CPU compute power for referencing frames, etc

    5. if you save your streaming as recording, make sure recording, game and OS are on 3 different drives

    R1. If your streaming video/audio bitrate is tied together, reduce audio bitrate to 160kbps

    X1. In OBS, you can set your streaming method as ABR or VBR (in the advanced menu if I remember it right), select x264, and try,the following setting, but make sure you test in recording mode before stream, because I suspect the CPU usage would just blow up in high motion and complexity scenes, I'll try make an ABR mode setting if it doesn't record smoothly

    Rate Control: VBR

    Keyint: 5

    Bitrate: 7666kbps

    CPU Preset: veryfast

    Buffer: 3500

    Profile: none

    CRF: 23

    tune: film

    Parameters: me=hex subme=4 me_range=12 chroma_me=0 bframes=3 b-adapt=1 ref=3 aq-mode=2 aq-strength=0.9 deblock=1:0 trellis=1 deadzone-inter=8 deadzone-intra=5 direct=temporal cabac=1

    Einmal editiert, zuletzt von iAvoe (19. September 2020 um 08:10)

  • Thanks a lot for your help. I dont need any fps limiter cause the cpu is on a full streaming dedicated rig, means i have a capture card and the game running on another pc.

    Anyway i always try the stream recording locally, using the "use streaming encoder" for recording.

    I just dont get the "1920x1032 57fps" if i capture in 1080p. Pls tell me more. For now I'll try that in 1080p cause twitch standards are 16:9

    I usually use CBR, but now i'm going to test your settings in vbr. I'm exited, thank so much!

    EDIT:

    Ok i tried the parameters and runs ok, the bitrate fluctuate from 7k to 8k on fast scenes using veryfast, cpu hit max 40% max. Then i tried medium and still 0 lose frames with max 50% cpu, the bitrate fluctuate from 6k to 7k on fast scenes. Then i tried slow, but i started lose frames. The quality look meh, a lot of blocks probably worse than standard normal medium preset, maybe the high profile it's worth a lot?

    Maybe I can leave veryfast and pump other settings? waiting ur thoughts, sempai, thanks so much

    Einmal editiert, zuletzt von ciommi (19. September 2020 um 15:04)

  • Wow you actually have a dedicated rig, in that case because encoding used much more CPU than any game I know, if you have a better CPU in the gaming rig, swap it with your streaming PC.

    The reason for 1920x1032 resolution is to discard a portion of graphics to compute, so get less quality drop in some very high motion scenes, and because most people watch videos on their 18:9 mobile phone (I assume?), they won't notice that border at all

    However since Twitch don't like non 16:9 videos, you might still can cheat with 1888x1062 with no resize, just record in a smaller centered window, this is a tiny bit smaller than 1080p and still in 16:9 but I doubt this one would look as good as full 1080p :)

    I've left a pretty low setting above, you can try this set of options (leave the unspecified settings as the previous), but I doubt this would be smooth enough:

    CPU Preset: medium

    Profile: none

    CRF: 22

    Bitrate: 7777kbps

    Keyint: Auto

    Options:

    me=umh subme=6 chroma_me=0 bframes=5 b-adapt=1 ref=3 aq-mode=1 aq-strength=1.1
    deblock=0:0 trellis=2 direct=temporal cabac=1

    If above settings doesn't work well, change from medium to fast

    Just saying you probably looked over some things like profile none, use strong AA, make sure you apply those ;)

    Can you also tell me about the game you records? I can actually take a note as I need that to improve my tutorial

    Einmal editiert, zuletzt von iAvoe (20. September 2020 um 19:12)

  • Ok, i'm here after a lot of testing.

    Last preset you gave me hit a lot on cpu, losing frames. I had to go on veryfast, and even go down on subme 5 to give me a window for hard foliage scene.

    I'm using this for my 1080p60 stream

    CPU Preset: veryfast

    Profile: none

    CRF: 22

    Bitrate: 7777kbps

    Buffer: 3500kbps

    Keyint: 0 "Auto"

    film

    Options:

    me=umh subme=5 chroma_me=0 bframes=5 b-adapt=1 ref=3 aq-mode=1 aq-strength=1.1

    deblock=0:0 trellis=2 direct=temporal cabac=1

    Stream looks really fine, still not perfect but the 8k bitrate should be better for something like 1600x800 resolution. I wanna keep 1080p for better youtube editing.

    The bitrate control seems perfect and my cpu hit max 90% on high foliage intensive scenes. With veryfast and subme=6 i was fine but sometimes the cpu hit 100% losing some frame, and i cant risk.

    Tell me if there is a better compromise instead subme to decrease for get some perfomance room.

    No luck on fast, even faster, unlucky :( But maybe i can overclock a bit in the future.

    Btw i'm streaming Call of duty warzone right now, and if i can help, you are welcome.

    Thanks for u help, lovely forum <3

    Einmal editiert, zuletzt von ciommi (21. September 2020 um 14:55)

  • There are other settings can do, try add/change “ me_range=14 trellis=1 deadzone-inter=8 deadzone-intra=4 bframes=3 aq-mode=0 nr=25 ” “ Bitrate: 7850kbps ”

    Also you may need to turn off “ tune: film ” as “ tune: none ” that could turn off some functions that boosts foliage scene quality, which might have caused you to drop frames

    and there is a setting can free a lot of CPU usage and boosts quality, but it might generate too much bitrate that actually downs quality, test with caution XD “ mbtree=0 ”

    and yeah, definitely overclock your CPU, it should be more stable because there's no graphic card dragging the PSU and generating hot air in the case:whistling:

    5 Mal editiert, zuletzt von iAvoe (21. September 2020 um 21:54)

  • Ok i'm gonna try that. Maybe leaving the "mbtree" part. 8k bitrate is already too low for 1080p60fps, what's the best commands for best quality generating the lowest bitrate? Thanks iAvoe <3

    edit1:

    btw i need to put "2" in keyframe, as twitch need that.

    edit2: ABR or VBR?

    2 Mal editiert, zuletzt von ciommi (22. September 2020 um 21:18)

  • Ok i'm gonna try that. Maybe leaving the "mbtree" part. 8k bitrate is already too low for 1080p60fps, what's the best commands for best quality generating the lowest bitrate? Thanks iAvoe <3

    edit1:

    btw i need to put "2" in keyframe, as twitch need that.

    edit2: ABR or VBR?

    That question actually lies in a triangle, like fast, goodquality and smallfile, you can only pick 2 points at a time and the 3rd point would become the opposite, if you pick in the middle then it would be the default quality, speed and filesize, which is also meh, so the best option is actually to upgrade your CPU, so you can unlock the 3rd dimension (a tetrahydron lol), the new point would be the computing power, which allow you to use extensive compressions, so more quality can be packed within the same bitrate

    also, x264 can easily eat off 90% of a 9900k or a 3900x and still give a 10fps speed, and I disabled lots of options in the parameters for you just to keep a 60fps speed:whistling:

    ABR does give a much faster speed (designed for fast encode in 90s' hardware), but the quality it gives might not match with a RTX 2000 series card's hardware encoder in the same bitrate, and VBR focus on quality as long as you are in the bitrate line, and it's too slow on a 4 core CPU, until thanks to AMD made 8 core CPUs as a performance standard

    4 Mal editiert, zuletzt von iAvoe (23. September 2020 um 05:15)

  • Oh yea, amd rocks and Intel money grab start end finally.

    BTW, actually I have no money to spend on a new cpu ? so is there a way to beat new nvenc chip with my 8 core 16 thread or do I have to wait to upgrade the gpu on my stream rig with a nvenc card? The good thing is that new 3000 series doesn't have a better nvenc quality but still the same, then I could put a 1650 super (soon cheaper) on my stream rig and be fine.

    Anyway I'm still mad, I can run 8k medium high profile cbr and probably really close to nvenc quality, but I was dreaming about a secret command that can beat nvenc, abuse vbr to win this war ? but u telling me that for beat that fu**ing nvidia need a 24+ core cpu and for me it's not worth anymore, nvidia won this time Feelsbadman

    For now, at least until I'll have money to spare, I'll try to go in 900p, where as I know, nvenc shine less or atlest 8k bitrate will look good and smooth, at least on smartphones ?

  • Oh yea, amd rocks and Intel money grab start end finally.

    BTW, actually I have no money to spend on a new cpu ? so is there a way to beat new nvenc chip with my 8 core 16 thread or do I have to wait to upgrade the gpu on my stream rig with a nvenc card? The good thing is that new 3000 series doesn't have a better nvenc quality but still the same, then I could put a 1650 super (soon cheaper) on my stream rig and be fine.

    Anyway I'm still mad, I can run 8k medium high profile cbr and probably really close to nvenc quality, but I was dreaming about a secret command that can beat nvenc, abuse vbr to win this war ? but u telling me that for beat that fu**ing nvidia need a 24+ core cpu and for me it's not worth anymore, nvidia won this time Feelsbadman

    For now, at least until I'll have money to spare, I'll try to go in 900p, where as I know, nvenc shine less or atlest 8k bitrate will look good and smooth, at least on smartphones ?

    Nope, Nvidia didn't win this, the quality roughly lies down here:

    Lossless > Apple Prores 422 > CRF > CRF+VBR > RTX Nvidia GPU > ABR > GTX Nvidia GPU > CBR > ...

    Right now you are using CRF+VBR right?

  • Yes and I love the fact that on non-movement scenes the bitrate is lower, without losing quality. But on hard scenes don't know if the quality beat nvenc.

    edit: I'll test 900p with your preset today, maybe I can go higher then veryfast.

    edit2: why not profile high? just asking

    3 Mal editiert, zuletzt von ciommi (24. September 2020 um 20:39)

  • Yes and I love the fact that on non-movement scenes the bitrate is lower, without losing quality. But on hard scenes don't know if the quality beat nvenc.

    edit: I'll test 900p with your preset today, maybe I can go higher then veryfast.

    edit2: why not profile high? just asking

    profile is just a limiter of how much value can be used for most parameters, default not set

    CPU profile is actually called 'preset' in encoder include x264, it's just a set of parameter that can be override by manual input parameters, default is medium

    I went full custom, so they basically are not set, but you definitely can try if it benefits

  • Oh ok, I'll stick with none then, do you think subme is really important and pump down other settings instead?

    Right now I'm using this:

    "1080p59.94 fps

    Bicubic filter

    Color 709 partial

    Preset: veryfast

    Profile: none

    CRF: 22

    Bitrate: 7777kbps

    Buffer: 3500kbps

    Keyint: 2 (twitch want this)

    tune:none

    Options:

    me=umh subme=5 chroma_me=0 bframes=5 b-adapt=1 ref=3 aq-mode=1 aq-strength=1.1

    deblock=0:0 trellis=2 direct=temporal cabac=1"


    done like 10 hours stream with this right now with no losing frames, stream looks good and I'm pretty happy with it, but if u think I can pump up subme and turn down other things for better result, then better.

    At the end, I don't know how to thank you, you replied to everything I asked ❤️ and even if I'm not an expert, I'm in love with this forum, thanks to you.. Thanks for all the time you dedicated to me and (plot twist) I love your avatar, even if I don't know the anime. Have a good day,

    Ciommi

  • try to remove bicubic filter (not sure why you are having a filter) and make color depth to full instead of partial, that will improve your quality

    my avatar in a touhou project character in a IOSYS flash music video:whistling:

    Later when you upgraded encoding CPU to 2700 in 4Ghz or 3800x default with RAM under CL16 latency in 3200mhz, I guess you can boost subme to 7~10 range, and use other parameters like no-fast-pskip=1, after all these you can bump bitrate from 7777 to 7800, this should give a much better quality at hard scenes