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.
 
Top