# Adding NVENC to OBS-Studio via ffmpeg.



## sudopluto (May 25, 2015)

So I recently installed OBS on my desktop, and I was surprised to find that there was no NVENC option. After some quick googling, I found out that ffmpeg has had support for NVENC for a while now, and that other video software like the open-source Avidemux have recently added it. Installing OBS on Linux already requires the user to install ffmpeg, so maybe the devs can make another ppa w/ a version of ffmpeg that has NVENC enabled?


----------



## Champion_The (May 26, 2015)

I would love to see this feature too.


----------



## Jim (May 27, 2015)

Yea, I don't mind putting it in for people who compile it in to their FFmpeg build.  I'll see about putting FFmpeg h264 encoders in, but it probably won't be next patch (0.11.0)


----------



## Osiris (May 27, 2015)

If you are comfortable with compiling your own build of ffmpeg and obs-studio, you can already use NVENC with the ffmpeg output option in OBS-mp.


----------



## sudopluto (Jun 4, 2015)

@Osiris @Jim My current problem is that currently for an Ubuntu install, you ask users to install FFMPEG from a launchpad repo if they are on 14.04.X. If the OBS team can provide a similar repo that has builds of FFMPEG with NVENC enabled, it would add the NVENC support without changing the current install process.


----------



## lorddrachenblut (Jun 7, 2015)

Osiris said:


> If you are comfortable with compiling your own build of ffmpeg and obs-studio, you can already use NVENC with the ffmpeg output option in OBS-mp.



Could you give an example of how to do this?


----------



## AbacusDaemon (Oct 23, 2015)

I'd also like to know how to do this.  I've seen guides but they are vague.


----------



## Kithop (Jan 3, 2016)

I managed to get a build of ffmpeg working with NVENC on my Xubuntu 15.10 system a while back, but yeah - no option in OBS to pick it from the list of encoders, even with 'custom' settings.

You have to grab the SDK from https://developer.nvidia.com/nvidia-video-codec-sdk - it required a specific video driver version as well that was one or two back from 'current' (aptitude seemed to figure it out, however and let me downgrade safely).  Then compile ffmpeg from source with the --enable-nvenc option as per http://trac.ffmpeg.org/wiki/HWAccelIntro

I actually tried to get the equivalent Intel SDK installed and compiled with the same build, and it's *there* but not working on my end for some reason.. still have to dig into it, but when I run 'ffmpeg -encoders':


```
V..... h264_qsv             H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (Intel Quick Sync Video acceleration) (codec h264)
V..... nvenc                NVIDIA NVENC h264 encoder (codec h264)
V..... nvenc_h264           NVIDIA NVENC h264 encoder (codec h264)
V..... nvenc_hevc           NVIDIA NVENC hevc encoder (codec hevc)
```

So it would be awesome if there were a way to do the following in the OBS Multiplatform builds for Linux:

Check 'ffmpeg -encoders' for the availability of those options above and expose them in the UI (obviously needs testing); I did a command line NVENC H.264 transcode of a 1080p movie at some ungodly ~400fps on my GTX 980 - this would be amazing for offloading streaming or even local recording.
Optionally, expose some way for us to change the default ffmpeg binary search path?  We might have e.g. the one you guys ask for in /usr/bin/ffmpeg and then play around with custom compiles with these features (non-redistributable, it seems) in /usr/local/bin/ffmpeg - being able to toggle back and forth for testing would be awesome.  (and maybe we can do this already and I'm just dumb?)


----------



## ka0skontrol (Apr 21, 2016)

For building ffmpeg in Ubuntu 15.10 (and possibly other deb based distros) with NVENC support, see the link posted below. It gives step-by-step instructions. Please note that you may have to edit a few of the steps pertaining to the NVENC SDK part...but it's essentially the same other than a few folder and file names.

https://www.sandmage.de/building-ffmpeg-with-nvidia-hardware-encoding/


----------



## Kithop (Apr 26, 2016)

For those on Ubuntu 16.04, I've managed to figure it out with the new 0.14 builds of OBS that include the support.  You have to compile _both_ ffmpeg and OBS from source, but this will get you nicely built *.deb files (that you're not allowed to legally redistribute, hence no PPAs ;( )

Over in https://obsproject.com/forum/threads/nvenc-support-for-linux.47023/#post-210593


----------

