238 lines
11 KiB
HTML
238 lines
11 KiB
HTML
---
|
||
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 %}<b>The guide has been updated for:</b><br/>
|
||
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 simplest option is the built-in NVENC encoders which offer less flexibility, but gets you started on the path of quality quicker. Depending on which GPU generation you own, you will be able to reach different peak quality levels: Kepler may reach up to x264 superfast, Maxwell and Pascal may reach up to x264 veryfast, Volta may reach up to x264 faster, and Turing and Ampere may reach up to x264 fast.{% endcapture %}{% include blocks/paragraph.liquid content=content %}
|
||
{% capture content %}
|
||
<thead><tr>
|
||
<th width="20%">Option</th>
|
||
<th>Kepler, Maxwell, Pascal, Volta, Turing, Ampere</th>
|
||
</tr></thead>
|
||
<tr>
|
||
<td>Preset</td>
|
||
<td>Quality or Max Quality</td>
|
||
</tr>
|
||
<tr>
|
||
<td>Profile</td>
|
||
<td>high</td>
|
||
</tr>
|
||
<tr>
|
||
<td>Look-ahead</td>
|
||
<td>Enabled/Checked</td>
|
||
</tr>
|
||
<tr>
|
||
<td>Psycho-Visual Tuning</td>
|
||
<td>Enabled/Checked</td>
|
||
</tr>
|
||
<tr>
|
||
<td>Max B-Frames</td>
|
||
<td>2 to 4 <i>(Use less for action packed games)</i></td>
|
||
</tr>
|
||
{% endcapture %}{% include blocks/table.liquid content=content caption="For empty columns, look at the columns left of it." %}
|
||
|
||
{% capture content %}StreamFX: NVIDIA NVENC H.264/AVC (via FFmpeg){% endcapture %}{% include blocks/heading.liquid content=content level=2 %}
|
||
{% capture content %}With StreamFX's NVENC integration it is possible to edge out a lot of additional quality out of NVIDIA NVENC in many situations. This however comes with a hefty cost in complexity, and requires much deeper understanding of both the H.264 specification and NVIDIA NVENC. Most GPU generations can expect to reach a peak quality two x264 presets higher than with the built-in NVIDIA NVENC encoder. As this option is aimed at people with deeper knowledge of both the standard and NVIDIA NVENC, non-critical settings are omitted.{% endcapture %}{% include blocks/paragraph.liquid content=content %}
|
||
{% capture content %}
|
||
<thead><tr>
|
||
<th width="22%">Option</th>
|
||
<th width="13%">Kepler</th>
|
||
<th width="13%">Maxwell</th>
|
||
<th width="13%">Pascal</th>
|
||
<th width="13%">Volta</th>
|
||
<th width="13%">Turing</th>
|
||
<th width="13%">Ampere</th>
|
||
</tr></thead>
|
||
<tr>
|
||
<td>Preset</td>
|
||
<td colspan=6>
|
||
Medium (P4) <small><i>up to</i></small> Slowest (P7)<br/>
|
||
<small><i>As with all encoders, higher presets have diminishing returns for much harsher performance impact.</i></small>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>Tune</td>
|
||
<td colspan=6>
|
||
High Quality <small><i>or</i></small> Low Latency <small><i>or</i></small> Ultra Low Latency<br/>
|
||
<small><i>Choose between focusing Quality or (much) lower encoding Latency.</i></small>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<th colspan=7>H264</th>
|
||
</tr>
|
||
<tr>
|
||
<td>Profile</td>
|
||
<td colspan=6>
|
||
High <small><i>or</i></small> Main<br/>
|
||
<small><i>High enables additional codec features that improve quality.</i></small>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>Level</td>
|
||
<td colspan=6>
|
||
Automatic<br/>
|
||
<small><i>Some problematic Driver versions require you to manually set the H.264 Profile Level.</i></small>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<th colspan=7>Rate Control Options</th>
|
||
</tr>
|
||
<tr>
|
||
<td>Mode</td>
|
||
<td colspan=6>Constant Bitrate</td>
|
||
</tr>
|
||
<tr>
|
||
<td>Multi-Pass</td>
|
||
<td colspan=6>
|
||
Quarter Resolution <small><i>or</i></small> Full Resolution<br/>
|
||
<small><i>May improve spatial quality. In some cases full resolution multi-pass can improve quality further.</i></small>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>Look Ahead</td>
|
||
<td colspan=6>
|
||
<small><i>at least</i></small> 8 frames<br/>
|
||
<small><i>Enables adaptive functionality and may improve temporal quality. Has diminishing returns.</i></small>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>Adaptive I-Frames</td>
|
||
<td colspan=6>
|
||
Enabled <small><i>or</i></small> Disabled<br/>
|
||
<small><i>Improves quality in many games, but may not work with all streaming services. Requires at least 2 frames of Look Ahead.</i></small>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>Adaptive B-Frames</td>
|
||
<td colspan=6>
|
||
Enabled<br>
|
||
<small><i>Requires at least (1 + Number of B-Frames) frames of Look Ahead.</i></small>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<th colspan=7>Adaptive Quantization</th>
|
||
</tr>
|
||
<tr>
|
||
<td>Spatial Adaptive Quantization</td>
|
||
<td colspan=6>
|
||
Enabled<br/>
|
||
<small><i>May improve perceptual quality in some situations with the correct strength setting.</i></small>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>Spatial Adaptive Quantization Strength</td>
|
||
<td colspan=6>
|
||
1 (favor Smooth) <small><i>between</i></small> 15 (favor Textured)<br/>
|
||
<small><i>Adjusts the strength of adaptive quantization to either favor smooth or textured surfaces.</i></small>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>Temporal Adaptive Quantization</td>
|
||
<td colspan=6>Enabled</td>
|
||
</tr>
|
||
<tr>
|
||
<th colspan=7>Other Options</th>
|
||
</tr>
|
||
<tr>
|
||
<td>Maximum B-Frames</td>
|
||
<td colspan=6>
|
||
0 <small><i>to</i></small> 4<br/>
|
||
<small><i>May improve quality or reduce quality, depending on the situation. Most gaming content only uses up to 2, while most real world content can use much more. Adaptive B-Frames should always be enabled for more intelligent B-Frame placement.</i></small>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>B-Frame Reference Mode</td>
|
||
<td colspan=6>
|
||
"Each B-Frame" <small><i>or</i></small> "Only B-Frames/2"<br/>
|
||
<small><i>Situational, more references may actually reduce quality significantly as more reference slots are used.</i></small>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>Zero Latency</td>
|
||
<td colspan=6>Default</td>
|
||
</tr>
|
||
<tr>
|
||
<td>Weighted Prediction</td>
|
||
<td colspan=6>Default</td>
|
||
</tr>
|
||
<tr>
|
||
<td>Non-reference P-Frames</td>
|
||
<td colspan=6>Enabled</td>
|
||
</tr>
|
||
<tr>
|
||
<td>Reference Frames</td>
|
||
<td colspan=6>
|
||
-1 frames<br/>
|
||
<small><i>May improve quality at higher values, but also drastically reduces device compatibility.</i></small>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>Low Delay Key-Frame Scale</td>
|
||
<td colspan=6>
|
||
-1<br/>
|
||
<small><i>When Low Latency or Ultra Low Latency tune is used, should either be left at -1 or manually adjusted. Can drastically affect quality and latency.</i></small>
|
||
</td>
|
||
</tr>
|
||
{% endcapture %}{% include blocks/table.liquid content=content caption="For empty columns, look at the columns left of it." %}
|
||
|
||
{% capture list %}
|
||
<li>The old presets were deprecated by NVIDIA and now map to the new P1-P7 presets, which come with massive performance or quality boosts. <i>High Quality</i> is now <i>Medium (P4)</i>, while <i>High Performance</i> is closer to <i>Faster (P2)</i>.</li>
|
||
{% 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 %}
|
||
<thead><tr>
|
||
<th>Output Resolution</th>
|
||
<th>3.5mbit</th>
|
||
<th>6.0mbit</th>
|
||
<th>8.5mbit</th>
|
||
</tr></thead>
|
||
<tr>
|
||
<td>640x360</td>
|
||
<td>77.9258</td>
|
||
<td>84.1078</td>
|
||
<td>87.0414</td>
|
||
</tr>
|
||
<tr>
|
||
<td>960x540</td>
|
||
<td>77.9592</td>
|
||
<td>84.1083</td>
|
||
<td>87.0381</td>
|
||
</tr>
|
||
<tr>
|
||
<td>1280x720</td>
|
||
<td>77.9541</td>
|
||
<td>84.1095</td>
|
||
<td>87.0325</td>
|
||
</tr>
|
||
<tr>
|
||
<td>1920x1080</td>
|
||
<td>77.9323</td>
|
||
<td>84.0764</td>
|
||
<td>87.0543</td>
|
||
</tr>
|
||
{% endcapture %}{% include blocks/table.liquid content=content caption="Average VMAF scores with no enhancement gain over many different files at NVENCs best configuration.<br/>For desktop viewing, a score of 70+ is 'Acceptable Quality', 80+ is 'High Quality', 90+ is 'Indistinguishable', 95+ is 'Effectively Lossless'.<br/>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 %}
|