I am using ffmpeg 4.2 (compiled with NVENC support) through OBS to stream to Twitch at 720p, 60FPS. There are days when I’m able to stream games for up to 8 hours in a row without any problems or hiccups, but then there are other days when the audience sees a weird encoding glitch and the broadcast cuts off for them - at which point they notify me in chat that the stream died, and I have to stop the recording on OBS and restart it.
My question is, how do I go about diagnosing this? I’ve tried looking at command line encoder settings, bitrate, format, and I haven’t been able to narrow down the problem. This only happens when encoding with NVENC, and has never happened to me when doing CPU encoding. I have also been unable to replicate the problem in local recordings, I only seem to have this problem when sending the recording to Twitch’s RTMP server. Twitch Inspector does not report any instabilities in the broadcasts that go down, although I do notice that the bitrate seems to vary quite a bit - which is odd, given that I’m telling ffmpeg to use CBR encoding through the encoder options.
Here is an example clip of the type of visual glitches the audience sees right before the stream dies for them:
NVENC encoding glitch example
My GPU is a GTX 760, which while old by today’s standards, should be capable of handling this sort of task, no? Specially on non-demanding games. And besides, what bothers me is the inconsistency. Some days it’s fine for hours-on-end, others it crashes not even 10 minutes in. I’m on Debian Sid, and I’m using nvidia-driver 440.44-1 from the Debian experimental repo (And yes, I know experimental branch can be extremely broken, but I had no option left because Sid’s nvidia-driver is older than what the NVIDIA Video Codec SDK requires to compile ffmpeg with NVENC support. The whole reason I had to resort to compiling ffmpeg w/NVENC support myself is that the version of ffmpeg and OBS in the debian repos does not have this flag turned on).
For context on the compiling process and how I stream, I made this post a few months back detailing the problems I had and the solution I found:
https://forum.level1techs.com/t/solved-compiling-ffmpeg-obs-with-nvenc-support-in-linux-debian-sid/144288