---
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 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 %}
<thead><tr>
	<th width="20%">Option</th>
	<th width="40%">Kepler, Maxwell & Pascal</th>
	<th width="40%">Turing & Ampere</th>
</tr></thead>
<tr>
	<td>Preset</td>
	<td colspan=2>Quality or Max Quality</td>
</tr>
<tr>
	<td>Profile</td>
	<td colspan=2>high</td>
</tr>
<tr>
	<td>Look-ahead</td>
	<td colspan=2>Enabled/Checked</td>
</tr>
<tr>
	<td>Psycho-Visual Tuning</td>
	<td colspan=2>Enabled/Checked</td>
</tr>
<tr>
	<td>Max B-Frames</td>
	<td colspan=2>2 to 4 <i>(Use less for action packed games)</i></td>
</tr>
{% 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 %}
<thead><tr>
	<th width="20%">Option</th>
	<th width="25%">Kepler, Maxwell</th>
	<th width="25%">Pascal, Volta</th>
	<th width="25%">Turing & Ampere</th>
</tr></thead>
<tr>
	<td>Preset</td>
	<td colspan=3>Medium (P4) <i>or slower</i></td>
</tr>
<tr>
	<td>Tune</td>
	<td colspan=3>High Quality</td>
</tr>
<tr>
	<th colspan=4>H264</th>
</tr>
<tr>
	<td>Profile</td>
	<td colspan=3>High</td>
</tr>
<tr>
	<td>Level</td>
	<td colspan=3>Automatic</td>
</tr>
<tr>
	<th colspan=4>Rate Control Options</th>
</tr>
<tr>
	<td>Mode</td>
	<td colspan=3>Constant Bitrate</td>
</tr>
<tr>
	<td>Multi-Pass</td>
	<td colspan=2>Two Pass at Quarter Resolution</td>
	<td>Two Pass at Quarter Resolution<br><i>or:</i> Two Pass at Full Resolution</td>
</tr>
<tr>
	<td>Look Ahead</td>
	<td colspan=2>8 frames <i>or more</i></td>
	<td>16 frames <i>or more</i></td>
</tr>
<tr>
	<td>Adaptive I-Frames</td>
	<td colspan=3>Enabled</td>
</tr>
<tr>
	<td>Adaptive B-Frames</td>
	<td colspan=3>Enabled</td>
</tr>
<tr>
	<th colspan=4>Limits</th>
</tr>
<tr>
	<td>Target Bitrate</td>
	<td colspan=3><i>Any</i></td>
</tr>
<tr>
	<td>Buffer Size</td>
	<td colspan=3>0 kbit</td>
</tr>
<tr>
	<th colspan=4>Adaptive Quantization</th>
</tr>
<tr>
	<td>Spatial Adaptive Quantization</td>
	<td colspan=3>Enabled</td>
</tr>
<tr>
	<td>Spatial Adaptive Quantization Strength</td>
	<td colspan=3>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.</td>
</tr>
<tr>
	<td>Temporal Adaptive Quantization</td>
	<td colspan=3>Enabled</td>
</tr>
<tr>
	<th colspan=4>Other Options</th>
</tr>
<tr>
	<td>Maximum B-Frames</td>
	<td>1 to 2</td>
	<td>2 to 3</td>
	<td>2 to 4</td>
</tr>
<tr>
	<td>B-Frame Reference Mode</td>
	<td colspan=3><i>Any except Disabled</i></td>
</tr>
<tr>
	<td>Zero Latency</td>
	<td colspan=3>Default</td>
</tr>
<tr>
	<td>Weighted Prediction</td>
	<td colspan=3>Default</td>
</tr>
<tr>
	<td>Non-reference P-Frames</td>
	<td colspan=3>Enabled</td>
</tr>
<tr>
	<td>Reference Frames</td>
	<td colspan=5>-1 frames</td>
</tr>
<tr>
	<td>Low Delay Key-Frame Scale</td>
	<td colspan=5>-1</td>
</tr>
{% endcapture %}{% include blocks/table.liquid content=content caption="Ideal settings for StreamFX's NVENC integration." %}

{% capture list %}
<li><i>Adaptive I-Frames</i> may not work well with certain platforms and must be turned off if you encounter issues.</li>
<li>Stronger <i>Spatial Adaptive Quantization</i> will focus more bitrate towards visually complex areas, but may starve smoother areas of the bitrate it needs.</li>
<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>
<li>When <i>Maximum B-Frames</i> is set to 4 and <i>B-Frame Reference Mode</i> is set to Each, it may be necessary to manually increase the <i>Reference Frames</i> or a Driver crash may be observed..</i></li>
<li>Increasing the <i>Reference Frames</i> can improve quality significantly, but will require more powerful decoders, and at times can hurt quality.</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 than H.264/AVC is an outdated codec and that platforms should have paved the way for better codecs a long time ago, but it is the solution that we are stuck with until AV1 is adopted by the masses. So in order to get the best quality out of our stream, we should aim to also set up our stream according to the bitrate and codec we use. Below is the average result of a few hundred thousand tests at various resolutions and bitrates, according to PSNR and VMAF (weighted PSNR 30:70 VMAF):{% endcapture %}{% include blocks/paragraph.liquid content=content %}
{% capture content %}
<thead><tr>
	<th>Resolution</th>
	<th>3.5mbit<br/>30 FPS</th>
	<th>3.5mbit<br/>60 FPS</th>
	<th>6.0mbit<br/>30 FPS</th>
	<th>6.0mbit<br/>60 FPS</th>
	<th>8.5mbit<br/>30 FPS</th>
	<th>8.5mbit<br/>60 FPS</th>
</tr></thead>
<tr>
	<td>640x360</td>
	<td>5</td>
	<td>5</td>
	<td>6</td>
	<td>6</td>
	<td>7</td>
	<td>6</td>
</tr>
<tr>
	<td>960x540</td>
	<td>5</td>
	<td>4</td>
	<td>6</td>
	<td>5</td>
	<td>6</td>
	<td>5</td>
</tr>
<tr>
	<td>1280x720</td>
	<td>4</td>
	<td>3</td>
	<td>5</td>
	<td>4</td>
	<td>5</td>
	<td>4</td>
</tr>
<tr>
	<td>1536x864</td>
	<td>2</td>
	<td>2</td>
	<td>3</td>
	<td>3</td>
	<td>4</td>
	<td>3</td>
</tr>
<tr>
	<td>1600x900</td>
	<td>3</td>
	<td>2</td>
	<td>3</td>
	<td>2</td>
	<td>4</td>
	<td>3</td>
</tr>
<tr>
	<td>1920x1080</td>
	<td>1</td>
	<td>1</td>
	<td>2</td>
	<td>2</td>
	<td>3</td>
	<td>3</td>
</tr>
{% endcapture %}{% include blocks/table.liquid content=content caption="Rating from 1 to 10 based on VMAF and PSNR, weighted towards producing useful ranges. Tests performed with x264 slow.<br/>A 10 is perfect, 9 is near lossless, 8 is indistinguishable, 7 is high quality, 5 is acceptable quality and 3 is watchable." %}
{% capture content %}Please note that watchable in video encoding means that you can decode information within it with reasonable accuracy, instead of it having turned to full garbage. Higher resolutions than 1920×1080 were omitted from the table as the rows would be filled with values between 0 and 1, which just are not very useful to us.{% endcapture %}{% include blocks/paragraph.liquid content=content %}
{% capture content %}This means that at 3.5mbit, the highest resolution and framerate for a variety streamer is 1280×720 at 30 FPS, or 960×540 at 60 FPS. The equation shifts slightly for 6.0mbit, where you can either go for 1536×864 at 30 FPS or 1280×720 at 60 FPS. Finally at 8.5mbit you are looking at a maximum resolution and framerate of 1920×1080 at 30 FPS or 1536×864 at 60 FPS.{% 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 %}
