Confused on Steam Play and Proton? Be sure to check out our guide.
We do often include affiliate links to earn us some pennies. See more here.
I had been meaning to try out Nvidia's NVENC for a while, but I never really bothered as I didn't think it would make such a drastic difference in recording gaming videos, but wow does it ever!

I was trying to record a game recently and all other methods I tried made the game performance utterly dive, making it impossible to record it. So I asked for advice and eventually came to this way.

What is NVENC?
It essentially takes away video encoding from the CPU and does it on the GPU instead, and it's supported on Nvidia Kepler (600) and above.

Pairing up the awesome open source OBS Studio [Official Site] and compiling FFMPEG with support for Nvidia's NVENC is actually pretty amazing.

Note: While I have fully tested it myself, I am not responsible if you manage to break anything doing it.

After following this guide (copied below in case it vanishes, thanks Dan).

I've done a minor edit to the start, as the filename wget downloads is different to what the guide said.
Spoiler, click me
# Download and unzip the NVIDIA Video Codec SDK from https://developer.nvidia.com/nvidia-video-codec-sdk
wget https://developer.nvidia.com/video-sdk-601
unzip unzip video-sdk-601

# Copy the headers files from the SDK so FFmpeg can find them
sudo cp nvidia_video_sdk_6.0.1/Samples/common/inc/*.h /usr/local/include/

image
# Make sure "Source code" is enabled in System Settings... -> Software & Updates
# Download the build dependencies for FFmpeg
sudo apt-get build-dep ffmpeg

# Install libfdk_aac
sudo apt-get install libfdk-aac-dev

# Download the source for the exact version of FFmpeg you already have installed (not as root)
apt-get source ffmpeg

# Go into the ffmpeg source you just downloaded
cd ffmpeg-2.8.6

# Find out the exact command the ffmpeg was originally built with
ffmpeg -buildconf

# Copy the single line "configuration:" and pass it to ".configure" but add "--enable-nonfree --enable-nvenc --enable-libfdk-aac" on the end
# Mine looks like this:
./configure --prefix=/usr --extra-version=1ubuntu2 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv --enable-nonfree --enable-nvenc --enable-libfdk-aac

# Now build it
make

# And finally install it over the original
sudo make install
It will take a few minutes to compile, but once that's done, you're pretty much set.

I was able to quite easily get FFMPEG sorted with NVENC and hook it into OBS Studio. I'm sure there's probably better guides (share them in the comments!), but I have yet to find one that makes it so damn simple to do. You don't even need to do much with OBS Studio, other than change the "Encoder" dropdown once this is sorted:
image

Note: You shouldn't need to re-compile OBS Studio, as the guide above uses the same version of FFMPEG as you have already.

What I love about OBS Studio, is it also has custom hotkeys you can set yourself like so:
image
I have it set so pressing "=" will start or stop recording, which is damn handy as practically no games use that button, if they do, i can simply go back and quickly change the key again.

OBS Studio also has profile support, so you can have one profile for recording and one for livestreaming, which is really useful. They ideally need to roll more of the settings into profiles, as currently the amount that's stored per-profile is limited.

I hope this will help some of you when recording or livestreaming games on Linux. Article taken from GamingOnLinux.com.
Tags: Editorial, HOWTO
3 Likes
About the author -
author picture
I am the owner of GamingOnLinux. After discovering Linux back in the days of Mandrake in 2003, I constantly came back to check on the progress of Linux until Ubuntu appeared on the scene and it helped me to really love it. You can reach me easily by emailing GamingOnLinux directly. Find me on Mastodon.
See more from me
The comments on this article are closed.
44 comments
Page: «5/5
  Go to:

qchto Nov 1, 2016
Yes! I was finally able to use nvenc under OBS and it was totally worth the effort..

Seriously, I never though it would be possible to get this footage from an i5, but this article made it possible

View video on youtube.com

Thank you very much for this!


Last edited by qchto on 1 November 2016 at 6:35 pm UTC
14 Nov 3, 2016
View PC info
  • Supporter Plus
Quoting: HoriNice and all but I really can't believe there's no other way to get this other than put lots of commands in the terminal...
I have no problem with that as I am a technical user, but for other people, this is a real put-off.
Aren't you on Arch? I didn't compile locally, and I have the NVENC option.
https://www.archlinux.org/packages/community/x86_64/obs-studio/

I am very grateful to get more options, however my preference is QuickSync. It uses the unused IGP of my CPU. When I capture with that method in Windows, you really don't feel it. It doesn't affect your game's framerate, whereas x264 and NVENC can.
Very cool that NVENC is an option now since quite a few Linux games don't have intense graphics.
cprn Dec 8, 2016
I know this article is kind of dated but some people had problems on Arch... I just installed it with no issues whatsoever on Manjaro using yaourt - can't you use it on vanilla?:
yaourt -S ffmpeg-nvenc-manjaro
cRaZy-bisCuiT Dec 12, 2016
Hey Guys :)

I read nouveau also has nvenc support nowadays, it's just not advertised. Is that true? Is it possible to game with a RX 480 (amdgpu + Mesa) and use a nVidia GT 630 (nouveau + Mesa) for recording in OBS? How would I manage to configure this?
While you're here, please consider supporting GamingOnLinux on:

Reward Tiers: Patreon. Plain Donations: PayPal.

This ensures all of our main content remains totally free for everyone! Patreon supporters can also remove all adverts and sponsors! Supporting us helps bring good, fresh content. Without your continued support, we simply could not continue!

You can find even more ways to support us on this dedicated page any time. If you already are, thank you!
The comments on this article are closed.