NVENC Error: Device passed to the API is invalid.

exar

New Member
Hello,

After streaming today for around 4 hours on Twitch, I had a NVENC error "[obs-nvenc] get_encoded_packet: nv.nvEncLockBitstream(s, &lock) failed: 4 (NV_ENC_ERR_INVALID_DEVICE): Device passed to the API is invalid." which obviously caused the stream to stop. From that state, stream cannot be started again despite obivously clicking on the Start Stream button, proceeded to kill obs in task manager, started obs again (both before and after crash in admin mode) and continued without the issue replicating for an hour.

The error appears on random timestamp throughout the stream from what I can see in the log.
18:17:17.604: [obs-nvenc] get_encoded_packet: nv.nvEncLockBitstream(s, &lock) failed: 4 (NV_ENC_ERR_INVALID_DEVICE): Device passed to the API is invalid.

The log

The Log Analyzer does not see it as a critical issue so it leaves me quite puzzled on how to advance. As you can see from the log itself, I'm on 9800x3d paired with rtx 5090, neither CPU or GPU usage is above 60%, temps are completly fine, I doubt hardware issue here. Is it OBS issue or NVIDIA drivers issue?

Also something that I have picked up from the log:
18:06:28.616: Source 3. Game audio is lagging (over by 527415.62 ms) at max audio buffering. Restarting source audio.
Doubt it's the cause of the crash, however whilst watching the VOD of the stream, there was no audio desync of any sort, no audio crackling, none of such things, can this be related?
 

exar

New Member
Additional thing worth mentioning, I could not save a crash log that way since technically the OBS did not crash, had to just manually close it down as it wouldn't let me start the stream again.
 

exar

New Member
Update
Same error happend after 10 days, was streaming daily for 4h+ (some days longer) without issues up until today it decided to crash the OBS again with same error message.
 

prgmitchell

Forum Moderator
If it is the exact same issue description and error message then the instructions will be the same for both of you. Your GPU driver is crashing which causes OBS encoding to crash as well. Run DDU and then reinstall your driver afterwards, if you continue to have issues reach out to NVIDIA for support

 

dre74k

New Member
I already did DDU and it didnt fix the problem. I've reached out to Nvidia for support but all they said was to fill out a form for Nvidia to recognise it as an issue. Useless
 

prgmitchell

Forum Moderator
Yeah sorry, not something we can help with...it isn't OBS that is having an issue, it is your GPU which is turn causing the error in OBS.
 

dsubrand

New Member
Probably not a global fix, but I had this on an AMD R9 7950X3D + RTX 5090 combo. I was able to resolve my issue by disabling core isolation in windows 11 and turning off AMD virtualization in the motherboard bios.
 

CaoxmaN

New Member
Hi,

I'm having this issue also with a 5090, but this is only happening on OBS. Sometimes, I stream from OBS and Tiktok studio, both using NVENC and when the error pop up on OBS, Tiktok studio is still streaming with no cuts... So It has to be some combination of Nvidia drivers AND OBS, not just the nvidia drivers... If it is a full crash of the nvidia driver then why the tiktok studio stream is not affected as well?
 

Limealicious

New Member
To add a data point, I started experiencing this issue after switching from a 4090 to a 5090. I did not change the driver but suddenly started getting the error 2-3 times a stream. The games I was playing didn't seem to have an issue and continued uninterrupted. Reinstalling drivers with DDU did not resolve the problem. Switching back to my 4090 immediately fixed the issue, and I'm still running the same driver as before. I'd suspect a bad card, but everything else was flawless (including heavy stress tests, low utilization situations, etc etc) and a number of my other friends in the creator space have had the issue specifically with 5090s. One of them has used every driver on his 5090FE since launch with no resolution, and the other has been having the problem across multiple drivers since MH Wilds launch roughly.

I've had to box my new toy until NVIDIA or OBS figures this out as I can't be nuking my viewer count multiple times a stream.
 

prgmitchell

Forum Moderator
To add a data point, I started experiencing this issue after switching from a 4090 to a 5090. I did not change the driver but suddenly started getting the error 2-3 times a stream. The games I was playing didn't seem to have an issue and continued uninterrupted. Reinstalling drivers with DDU did not resolve the problem. Switching back to my 4090 immediately fixed the issue, and I'm still running the same driver as before. I'd suspect a bad card, but everything else was flawless (including heavy stress tests, low utilization situations, etc etc) and a number of my other friends in the creator space have had the issue specifically with 5090s. One of them has used every driver on his 5090FE since launch with no resolution, and the other has been having the problem across multiple drivers since MH Wilds launch roughly.

I've had to box my new toy until NVIDIA or OBS figures this out as I can't be nuking my viewer count multiple times a stream.

Yeah unfortunately it isn't really for OBS to figure out, NVIDIA is well aware of the many driver issues with 50 series cards at the moment though so I am sure they are working on it. The encoder (which is controlled entirely by NVIDIAs driver) is crashing because of this driver issue, you are one of many having issues.
 

Limealicious

New Member
Yeah unfortunately it isn't really for OBS to figure out, NVIDIA is well aware of the many driver issues with 50 series cards at the moment though so I am sure they are working on it. The encoder (which is controlled entirely by NVIDIAs driver) is crashing because of this driver issue, you are one of many having issues.
Totally fair - Nvidia's drivers really are horrible lately.
 

Laranity

New Member
Yesterday I suddenly also started experiencing this exact issue with a 5080 + 9800X3D, specifically after I added in a 4K webcam to my scenes. Switching to CPU encoding for now, because it's really frustrating to have your stream crash regularly :(
 
Top