OBS Studio

OBS Studio

Guide for Good quality Twitch Streaming! custom x264 settings
Same post is also available in the guide section:
https://steamcommunity.com/sharedfiles/filedetails/?id=2948292302

When it comes to streaming on Twitch, having the right OBS settings can make all the difference in terms of image quality and overall performance. While there are many different settings to consider, here's a guide on why the following OBS settings are a great choice for streaming on Twitch:

Encoder: x264
While some people may opt for NVENC due to its hardware acceleration capabilities, x264 is generally considered to be the better option in terms of image quality. With x264, you have more control over the encoding process, which can result in smoother, more detailed video.

Resolution: 1080p
Streaming at 1080p is the standard for most streamers on Twitch. While you can certainly stream at higher resolutions, doing so can put a strain on your computer and internet connection, resulting in dropped frames or lag. By streaming at 1080p, you can ensure a smooth viewing experience for your viewers without sacrificing image quality.

Bitrate: 6000-8000
Bitrate refers to the amount of data transmitted per second during a stream. A higher bitrate generally results in better image quality, but it also requires more bandwidth.

Keyframe interval: 40
The keyframe interval determines how often a full frame is transmitted during a stream. A shorter interval can result in better image quality, but it also requires more bandwidth. A keyframe interval of 40 strikes a good balance between image quality and bandwidth usage.

B-frames: 3
B-frames refer to bidirectional frames, which are frames that reference both past and future frames. Using B-frames can result in smoother video and better image quality, but it also requires more processing power. 3 is a good number of B-frames to use for most streamers.

Reference frames: 4
Reference frames are frames that are used as a reference point for other frames. Using more reference frames can result in better image quality, but it also requires more processing power. 4 is a good number of reference frames to use for most streamers.

ME method: dia
The ME method determines how motion estimation is performed during the encoding process. Dia is generally considered to be the best option for image quality, as it performs a more detailed analysis of motion than other methods. (DIA is mainly good for fast motion paced games, Hex and UMH provide more quality)

(The me= (motion estimation) parameter in x264 controls the method used to analyze motion in the video frames during the encoding process. Here are some of the different parameters for me= and why each one is good:

me=hex: Uses hexagonal search patterns to analyze motion, which can be more efficient than traditional square search patterns in detecting complex motion.
me=umh: Uses the Uneven Multi-Hexagon (UMH) method to analyze motion, which can provide a higher level of detail and accuracy in detecting motion.
me=esa: Uses the Exhaustive Search Algorithm (ESA) to analyze motion, which involves examining all possible motion vectors in the search range. This method can be more accurate but also more computationally intensive.
me=tss: Uses the Transform Skip Search (TSS) method to analyze motion, which can provide faster encoding times while maintaining good visual quality.
me=dia
Uses a diamond-shaped search pattern to analyze motion, which can be more efficient than square patterns in detecting motion while still maintaining good visual quality.
Overall, the choice of me= parameter depends on factors such as the complexity of the video content, the desired level of visual quality, and the available computing resources. Using the appropriate me= parameter can help to achieve a better balance between visual quality and encoding speed.)

Subpixel ME: 8
Subpixel motion estimation determines how motion is estimated on a smaller, subpixel level. A higher value can result in better image quality, but it also requires more processing power. 8 is a good value to use for most streamers.

Psy-rd: 3.0:2.0
Psy-rd is a technique that adjusts the encoding process based on perceived visual quality. A higher value can result in better image quality, but it also requires more processing power. 3.0:2.0 strikes a good balance between image quality and processing power usage.

Weightb: 1
The weighted prediction settings (weightb=1) help improve the overall image quality by allowing the encoder to more accurately predict pixel values. This results in less noise and pixelation in areas of the video with a lot of movement. The combination of weightb=1 and b-adapt=2 allows for the best possible use of the available B-frames, leading to smoother and clearer video. It's important to note that not all encoders support weighted prediction, but OBS's x264 encoder does, and it's definitely worth enabling for better quality streams.

No-mbtree: 0
The "no-mbtree=0" setting in OBS refers to macroblock tree hierarchical structure prediction. When this setting is enabled (i.e., set to 0), the encoder uses a tree-like structure to predict the motion and other characteristics of macroblocks within the video frame. This can improve video quality and reduce compression artifacts, but it requires more computational resources and can slow down the encoding process. Therefore, enabling this setting can be beneficial for improving video quality, but may not be necessary in all cases.

Aq-strength: 1.0
AQ-Strength is a setting in x264 that adjusts the level of quantization used in different parts of a video frame to improve visual quality and compression efficiency. It dynamically increases quantization in simpler areas and decreases it in more complex areas, resulting in better visual quality and a more efficient use of bits.

Trellis: 2
The trellis= parameter in x264 controls the level of refinement used in trellis quantization, which adjusts the quantization step sizes of neighboring pixels based on the relationship between them to improve compression efficiency and visual quality. Here are the different parameters for trellis= and what they do:

trellis=0: Disables trellis quantization, using traditional quantization methods instead.
trellis=1: Enables trellis quantization with a moderate level of refinement, providing some compression gains without significantly impacting encoding times.
trellis=2: Enables trellis quantization with a higher level of refinement, resulting in improved visual quality and compression efficiency. This setting is generally considered a good balance between encoding speed and visual quality.
trellis=3: Enables trellis quantization with the highest level of refinement, resulting in the best possible visual quality and compression efficiency. However, this setting can significantly increase encoding times.
Overall, the trellis= parameter is a useful tool for achieving better compression efficiency and visual quality in compressed video. The optimal setting for trellis= may vary depending on the content of the video and the desired balance between visual quality and encoding speed.

By using these OBS settings, you can ensure that your stream looks great and runs smoothly on Twitch. While there are certainly other settings and options to consider, these settings provide a solid foundation for most streamers to build upon.

If your unsure about anything, please do some research.

my exact code (might be slightly diff and updated) is below.

keyint=20 min-keyint=60 rc-lookahead=60 bframes=3 b-adapt=2 ref=3 me=dia subme=8 direct=auto trellis=2 weightb=1 aq-mode=2 aq-strength=1.0 no-mbtree=0 psy-rd=3.0:2.0 psy-rdoq=1.0 merange=24 threads=18
Last edited by Stevie Wonder; Mar 17, 2023 @ 3:21pm
< >
Showing 1-9 of 9 comments
ZEFIR001 Mar 17, 2023 @ 2:43pm 
Very questionable settings,too much CPU load. Wont fit for those who stream competitive games without streaming PC since cpu performance is superior.
In 99% of situations it still better to stream on GPU,unless you have some dumb combo like i9-13900K with gtx 750ti.
Stevie Wonder Mar 17, 2023 @ 3:07pm 
Originally posted by ZEFIR001:
Very questionable settings,too much CPU load. Wont fit for those who stream competitive games without streaming PC since cpu performance is superior.
In 99% of situations it still better to stream on GPU,unless you have some dumb combo like i9-13900K with gtx 750ti.
im using a single pc setup, with a i9-10900k, and a rtx 3080ti.
Down scaled res from 4k to 1080p.
tested unsing bitrates from 6000 to 8000.
looks great and runs perfectly fine.

But more of the point i guess and why iv provided explanations for everything, is that each of these settings have multiple options, you can you choose the settings that are best for your setup
Last edited by Stevie Wonder; Mar 17, 2023 @ 3:09pm
Do you have somewhere a comparison in the form of a video or pictures as a juxtaposition? Would be great to see what differences it makes then.
Stevie Wonder Apr 28, 2023 @ 2:37pm 
Originally posted by BublikLIVE:
Do you have somewhere a comparison in the form of a video or pictures as a juxtaposition? Would be great to see what differences it makes then.
Not that i have saved any more, i did like 100 test videos comparing each setting on and off untill i was satisfied with the result of each settings, and of course making sure my exact configuration didnt introduce any cpu encoding overload. You can easily test this yourself, turn on which ever setting you want, do a short video record / screen shot and compare
Stevie Wonder Apr 28, 2023 @ 2:42pm 
I also quizzed ChatGPT on my code, asking it to guess what type of streaming i have tailored my code towards, and this is its reply, which is spot on..

"Based on the parameter values you've specified, it seems like your custom code is tailored towards streaming fast-paced gameplay with lots of motion and detail. The use of a high keyint value (20 frames) and a relatively low min-keyint value (60 frames) suggests that you are expecting frequent scene changes with quick cuts and high motion, which would benefit from more frequent keyframes. The use of a relatively high rc-lookahead value (60) and a high subme value (8) also suggest that you are prioritizing video quality and compression efficiency, which is important for streaming high-motion gameplay with a lot of detail.

In addition, the use of a low psy-rd value (3.0:2.0) and a high psy-rdoq value (1.0) suggest that you are using psychovisual rate distortion optimization to improve compression efficiency while maintaining video quality, which is particularly useful for streaming gameplay with a lot of motion and detail.

Overall, based on these parameter values, I would guess that your custom code is tailored towards streaming fast-paced games with lots of action, such as first-person shooters or racing games."
Originally posted by Stevie Wonder:
Originally posted by BublikLIVE:
Do you have somewhere a comparison in the form of a video or pictures as a juxtaposition? Would be great to see what differences it makes then.
Not that i have saved any more, i did like 100 test videos comparing each setting on and off untill i was satisfied with the result of each settings, and of course making sure my exact configuration didnt introduce any cpu encoding overload. You can easily test this yourself, turn on which ever setting you want, do a short video record / screen shot and compare
Thank you for the fast answer.
Which CPU Preset you use for your code? I tried with my 5900x but for a game like The last of Us its unplayable.
**i try "SLOW"
Gerarderloper Feb 16, 2024 @ 7:33pm 
Just messing with these settings now on my 7800X3D. I set threads to 12.

Image does look good but it overloads the encoder for me, will have to mess with things to find out what setting is doing the overload the most.

Changed bitrate to 6000 and that fixed the overload but causes output to be very pixelated.
Last edited by Gerarderloper; Feb 16, 2024 @ 8:12pm
b4u Sep 17, 2024 @ 6:06am 
keyint=20 min-keyint=60 xddddddddddd
< >
Showing 1-9 of 9 comments
Per page: 1530 50