--- layout: default category: "OBS" title: "High Quality Streaming with NVIDIA® NVENC (in OBS® Studio)" comments: true redirect_from: - /guides/obs/high-quality-streaming-nvenc/ date: "2022-02-18" --- {% capture content %}Streaming with more than one PC has been the leader in H.264 encoding for years, but NVIDIAs Turing and Ampere generation has put a significant dent into that lead. The new generation of GPUs with the brand new encoder brought comparable quality x264 medium – if you can find a GPU that is. Let’s take a look at what’s needed to set up your stream for massively improved quality.{% endcapture %}{% include blocks/paragraph.liquid content=content %} {% capture content %}The guide has been updated for:
StreamFX v0.11.1 and OBS Studio 27.2{% endcapture %}{% include blocks/paragraph.liquid align="center" content=content %} {% capture content %}Setting up NVENC (for Streaming){% endcapture %}{% include blocks/heading.liquid content=content level=1 %} {% capture content %}Modern OBS Studio has two ways to achieve the expected quality: the built-in NVENC H.264 (new) and the addition from StreamFX called NVIDIA NVENC H.264/AVC (via FFmpeg). Both Options can achieve similar quality to x264 medium, but the latter is able to exceed that and rival x264 medium/slow in various situations. Whichever you pick, both of them support zero-copy encoding, and they’re both valid options for streaming.{% endcapture %}{% include blocks/paragraph.liquid content=content %} {% capture content %}Built-In: OBS Studio NVENC H.264 (new){% endcapture %}{% include blocks/heading.liquid content=content level=2 %} {% capture content %}The built-in NVENC option in OBS Studio is by far the simplest option and will give you almost identical quality on Maxwell, Pascal, Turing and Ampere, though Turing and Ampere will make use of the new improvements of the NVENC chip. Maxwell and Pascal users can expect to reach x264 veryfast/faster-like quality, while Turing and Ampere users can expect to hit fast/medium-like quality. Below are the settings you need to set:{% endcapture %}{% include blocks/paragraph.liquid content=content %} {% capture content %} Option Kepler, Maxwell & Pascal Turing & Ampere Preset Quality or Max Quality Profile high Look-ahead Enabled/Checked Psycho-Visual Tuning Enabled/Checked Max B-Frames 2 to 4 (Use less for action packed games) {% endcapture %}{% include blocks/table.liquid content=content caption="Best built-in NVENC settings." %} {% capture content %}StreamFX: NVIDIA NVENC H.264/AVC (via FFmpeg){% endcapture %}{% include blocks/heading.liquid content=content level=2 %} {% capture content %}If you’re new to StreamFX’s NVENC integration, it will most likely overwhelm you with the settings it offers. But thanks to all those settings, you can actually go above the default quality by quite a significant amount. Note that I will only cover critical settings, as other settings like Bitrate, Buffer Size and Key Frame Interval are explained elsewhere. {% endcapture %}{% include blocks/paragraph.liquid content=content %} {% capture content %} Option Kepler, Maxwell Pascal, Volta Turing & Ampere Preset Medium (P4) or slower Tune High Quality H264 Profile High Level Automatic Rate Control Options Mode Constant Bitrate Multi-Pass Two Pass at Quarter Resolution Two Pass at Quarter Resolution
or: Two Pass at Full Resolution Look Ahead 8 frames or more 16 frames or more Adaptive I-Frames Enabled Adaptive B-Frames Enabled Limits Target Bitrate Any Buffer Size 0 kbit Adaptive Quantization Spatial Adaptive Quantization Enabled Spatial Adaptive Quantization Strength Between 1 (Weakest) and 15 (Strongest). Strong Spatial Adaptive Quantization will allocate more bitrate towards visually complex areas, and starve other areas of necessary bitrate. Temporal Adaptive Quantization Enabled Other Options Maximum B-Frames 1 to 2 2 to 3 2 to 4 B-Frame Reference Mode Any except Disabled Zero Latency Default Weighted Prediction Default Non-reference P-Frames Enabled Reference Frames -1 frames Low Delay Key-Frame Scale -1 {% endcapture %}{% include blocks/table.liquid content=content caption="Ideal settings for StreamFX's NVENC integration." %} {% capture list %}
  • Adaptive I-Frames may not work well with certain platforms and must be turned off if you encounter issues.
  • Stronger Spatial Adaptive Quantization will focus more bitrate towards visually complex areas, but may starve smoother areas of the bitrate it needs.
  • The old presets were deprecated by NVIDIA and now map to the new P1-P7 presets, which come with massive performance or quality boosts. High Quality is now Medium (P4), while High Performance is closer to Faster (P2).
  • When Maximum B-Frames is set to 4 and B-Frame Reference Mode is set to Each, it may be necessary to manually increase the Reference Frames or a Driver crash may be observed..
  • Increasing the Reference Frames can improve quality significantly, but will require more powerful decoders, and at times can hurt quality.
  • {% endcapture %}{% include blocks/list.liquid content=list %} {% capture content %}Matching your Resolution and FPS with your Bitrate{% endcapture %}{% include blocks/heading.liquid content=content level=1 %} {% capture content %}It is no secret that H.264/AVC is now an outdated codec which should have been replaced long ago. Still we can do something to achieve more quality from NVENC, through the careful choice of resolution, framerate and bitrate. Below are quality metrics based on VMAF for a Canvas Resolution of 2560x1440 with 60 FPS scaled to different Output Resolutions:{% endcapture %}{% include blocks/paragraph.liquid content=content %} {% capture content %} Output Resolution 3.5mbit 6.0mbit 8.5mbit 640x360 77.9258 84.1078 87.0414 960x540 77.9592 84.1083 87.0381 1280x720 77.9541 84.1095 87.0325 1920x1080 77.9323 84.0764 87.0543 {% endcapture %}{% include blocks/table.liquid content=content caption="Average VMAF scores with no enhancement gain over many different files at NVENCs best configuration.
    For desktop viewing, a score of 70+ is 'Acceptable Quality', 80+ is 'High Quality', 90+ is 'Indistinguishable', 95+ is 'Effectively Lossless'.
    For mobile viewing a score of 60+ is 'Acceptable Quality', 75+ is 'High Quality', 85+ is 'Indistinguishable'." %} {% capture content %}We can made an okay educated guess at the maximum resolution for each bitrate with the above table. For 3.5mbit the maximum resolution is 960x540, for 6.0mbit the maximum resolution is 1280x720, and for 8.5mbit the maximum resolution is 1920x1080. For some more action packed content it is best to reduce the resolution slightly in order to maintain decent quality, while slower or rarely moving content can sometimes increase the resolution slightly. {% endcapture %}{% include blocks/paragraph.liquid content=content %} {% capture content %}Final Words{% endcapture %}{% include blocks/heading.liquid content=content level=3 %} {% capture content %}In the past few years NVIDIA has made massive improvements to their encoder, which has evened the playing field far beyond what was expected. With no need to transfer frames from the GPU to the CPU, and quality comparable to x264 medium (or better), NVIDIAs Turing NVENC is pushing the boundaries of what is possible in a single consumer PC.{% endcapture %}{% include blocks/paragraph.liquid content=content %} {% capture content %}Whether you use it or not is entirely up to you however. If you already have a working Dual-PC setup that can achieve x264 medium (or better) quality, then you don’t gain much from moving to Turing NVENC. But if you’re currently stuck on anything below x264 medium, or have a Turing GPU ready to test it out – why not give it a shot?{% endcapture %}{% include blocks/paragraph.liquid content=content %}