I recently updated my nVidia drivers to 375.26 and recompiled FFmpeg N-83180-gcf3affa and OBS 17.0.2-5-g43e4a2e (sorry if these numbers don't mean anything, I'm not quite sure what version numbers are significant) on my Debian machine. Doing a suspend to RAM will cause OBS to stop working with its only fix to reboot the machine.

How to reproduce

  1. Run OBS
  2. Output Configuration:

    • Set output to NVENC H.264 and .mp4
    • Use CBR
    • Bitrate = 200K
    • Kf interval = 0
    • Low latency, High quality preset, main, auto
    • 2 pass encoding enabled
    • GPU = 0
    • B-frames = 0
  3. Start recording and stop to confirm that it works

  4. Go to login actions and click suspend
  5. Turn on and login again
  6. Start recording, OBS fails with this error:

    [h264_nvenc @ 0x3fdd1e0] Failed creating CUDA context for NVENC: 0x3e7
    [h264_nvenc @ 0x3fdd1e0] No NVENC capable devices found

System info

  • Drivers/Software versions listed above
  • GPU: MSI GTX 970
  • uname -a: Linux version 3.16.0-4-amd64, #1 SMP Debian 3.16.39-1 (2016-12-30)
  • OS: Debian 8.7 Jessie

I use XFCE 4.10 if that makes a difference to how the action buttons work.


Is there any way to short of rebooting every time to avoid getting this error after waking the computer?

Edit 1

I know for a fact that OBS is the source of this problem.

Test case 1:

  1. Start computer, use ffmpeg's h264_nvenc encoder to output a video file
  2. Suspend to RAM
  3. Login, successfully repeat step 1

Test case 2:

  1. Start computer, use OBS to record a video with h264_nvenc
  2. Quit OBS
  3. Suspend to RAM
  4. Login, successfully repeat step 2

Test case 3:

  1. Start computer, use OBS to record video with h264_nvenc
  2. Suspend to RAM
  3. Login, fails with Cannot init CUDA

My guess is that OBS does not close its streams when a recording is stopped, it probably is persisted for performance (?) reasons until you exit the program? I have no clue how to fix this. Restarting OBS has no effect once the error shows up, you must reboot the system.

It appears that the GPU is completely fine at handling everything else nonetheless, glxinfo, nvidia-smi, nvidia-settings all confirm that the GPU is indeed being utilized to process other tasks. It seems the NVENC is the only thing that has trouble after the suspend to RAM.

Edit 2

Here are the dmesg logs: https://www.diffchecker.com/wto7KPJZ

Tabbed "original" were what changed after doing the suspend, tabbed "changed" were what changed after doing the fix that I suggested.

Full dmesg output: https://0paste.com/10601#hl


FFmpeg only locks up on CUDA init if an h264_nvenc stream was started (and stopped, but this is not needed) before putting the system into suspend. If OBS never records anything with the h264_nvenc encoder before suspend, it will work fine when you login again.

If OBS locks up after logging in, it will become usable by:

  1. Exit OBS
  2. Run in terminal:

    sudo rmmod nvidia_uvm && sudo modprobe nvidia_uvm
  3. Open OBS again

  4. ???
  5. Profit

If unloading nvidia_uvm doesn't work, the DRM and modeset modules may need to be reloaded as well, although I've never had this problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.