How to use NVENC encoding with OBS on Linux – recording smooth videos at 60fps


So, you want to record smooth videos, at 60 frames per second, but OBS is gobbling up half your CPU power ? You need NVENC ! This specific encoding software only works on Nvidia graphics cards, but enables less than 10% CPU usage while recording or streaming, since it uses the GPU instead of the CPU !

Enabling it on Linux is not simple, even though it’s not that hard. All we need to do is:

1 – Download the Nvidia SDK:
sudo apt install unzip
unzip video-sdk-601
sudo cp nvidia_video_sdk_6.0.1/Samples/common/inc/*.h /usr/local/include/

2 – Getting ready to compile FFMPEG
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
sudo nano /etc/apt/sources.list
sudo apt update
sudo apt build-dep ffmpeg
sudo apt install libfdk-aac-dev

3 – Compiling ffmpeg
apt-get source ffmpeg
ffmpeg buildconf

This will give us a long line of parameters. You need to copy this, and paste it in a text editor, such as Scratch on elementary OS.
We need to add the required paramters at the end of this text to make sure FFMPEG will take NVENC into account.
At the end of the line, add these lines:
–enable-nonfree –enable-nvenc –enable-libfdk-aac
Don’t forget to leave a space between the last parameter and the ones we just added !

Copy everything you have in your text file.
In your terminal, type: ./configure
then paste everything you copied.
You should have something that looks like that

Now, we build FFMPEG, by typing:

sudo make install

Follow me on Twitter :
Follow me on Mastodon:

Music courtesy of Kevin MacLeod

Also Watch my Experience with Manjaro Budgie on a Full AMD Linux Build:



15 thoughts on “How to use NVENC encoding with OBS on Linux – recording smooth videos at 60fps

  1. I started down this route to enable nvenc on Kubuntu 18.10 and then realized I should try the snap and flatpak versions of OBS first to see if they included it. Snap does not but the version on Flathub does. So rather than going through all this you can simply type 'flatpak install com.obsproject.Studio' and be done with it.

  2. This guide is not working with Ubuntu 18.10, error: libopencv not found. There is currently no solution anywhere on the web, and ffmpeg will not compile correctly without fixing the issue.

  3. Please, do NOT follow these instructions. If you are on a Debian based system like this one is, or one that has a package manager (so all distros, basically), you do not want to do this under any circumstances. You can severely damage your system by doing this! If you want to recompile a package to enable a feature you need, the correct steps are:

    1. apt source ffmpeg
    2. apt build-dep ffmpeg
    3. Now you can change your directory to the ffmpeg-x.y.z folder you just downloaded. In there you'll find a folder called "debian", inside of it is a file called "rules", you edit this one to change the configure parameters. (please don't ever type ./configure when rebuilding a package!) You'll easily be able to find where to append the –enable-x parameters to.
    4. After this is done, go back to the ffmpeg-x.y.z folder and type dch –local <something> , where <something> will be what's appended to the version string, For something like this you could type dch –local nvenc , you will then be asked to describe your changes using nano, just type whatever you want, but I recommend something like: "Enabled support for NVENC."
    5. Now, we're all ready to build, assuming you have all the dependencies installed for enabling NVENC (sudo apt install nvidia-cuda-toolkit if you don't, don't do the weird copying of the include files that he did), so it is time to type: debuild -us -uc -i -rfakeroot . This will recompile the software using the new rules in debian/rules. Once it's done, you can find your debian packages in the folder beneath ffmpeg-x.y.z.
    6. If you are running 64-bit Linux and you're using multiarch (you probably are), you will now also need to build the i386 variant of the package. You should do this using a chroot environment. That's beyond the scope of this, sorry. Please note that CUDA and NVENC are not supported on i386, but you will still need to recompile the i386 variant so it matches your version. Note that if you do NOT do this on a multiarch system, you will be unable to install the i386 packages, which will make it impossible to install things like Wine.
    7. At this point you should set up a local repository, which is easily done with aptly, just look up a tutorial for this.
    8. Type sudo apt update after setting up your local repository. It'll notify you that upgrades are available!
    9. Type sudo apt upgrade to upgrade FFmpeg to your custom compiled version.
    10. Enjoy NVENC support on OBS.

    This sounds harder than it is. Depending on your hardware, it'll take about 10 minutes to 20 minutes. Be aware that you will need to do this everytime FFmpeg is updated to a new version. You can consider locking FFmpeg to your custom compiled version. That'll probably be fine, unless you install a package that needs a more recent version, but apt will notify you of that anyway.

  4. Thank you so much man! Compiles great on Zorin 12.04. I was baffled by how out of date some of those guides were, back when I tried compiling this 6 months ago. They were hard to follow, and eventually fruitless after 3 days of trial and error combining guides. This worked out well and presumably would work on Ubuntu 16.04 as well. I'd just recommend you change your description from apt-get install build-dep to apt-get build-dep, otherwise other people watching this video are going to think that's a package, not a command. 😉 Thanks again.

  5. If I check the available codecs in terminal, the NVENC codecs are already set up inside FFMPEG, though just in case I followed these directions anyways. It didn't do jack shit. OBS still can't see the option for NVENC.

Comments are closed.