FFMPEG Encoder Crashing

Daerados

New Member
Hello everyone,

I recently decided to try out NVENC ffmpeg encoder with StreamFX, but often (not always) when I start recording it shows error on screenshot.
I use stream encoder for recording (for replay buffer), but stream is all right until I push hotkey to save last x seconds video - stream crashes.
Manually starting recording has same behavior.

Log: https://obsproject.com/logs/JWUG30XFH_Wsxfln

P.S. I tried to get help in StreamFX discord, I assume they're not aware how to fix it.
 

Attachments

  • Error.jpg
    Error.jpg
    7.1 KB · Views: 185

rockbottom

Active Member
Disable B Reference mode
19:21:12.396: [StreamFX] [h264_nvenc] B-Frames: 3 Frames
19:21:12.396: [StreamFX] [h264_nvenc] Reference Mode: middle
 

Daerados

New Member
I know, just curious if it will affect quality (im not pro, but it related to compression?)
I might as well rollback to nvenc (new) then.
 

rockbottom

Active Member
Here's the settings I use without fail, very similar to yours.
18:41:16.976: [StreamFX] <updater> Automatic checks at launch are now enabled.
18:41:20.042: User switched to scene 'Test Screen Slide Show'
18:46:01.284: [StreamFX] [h264_nvenc] Initializing...
18:46:01.284: [StreamFX] [h264_nvenc] FFmpeg:
18:46:01.284: [StreamFX] [h264_nvenc] Custom Settings:
18:46:01.284: [StreamFX] [h264_nvenc] Standard Compliance: Strict
18:46:01.284: [StreamFX] [h264_nvenc] Threading: Slice & Frame (with 1 threads)
18:46:01.284: [StreamFX] [h264_nvenc] Video:
18:46:01.284: [StreamFX] [h264_nvenc] Texture: 1920x1080 nv12 BT.709 tv
18:46:01.284: [StreamFX] [h264_nvenc] Framerate: 60/1 (60.000000 FPS)
18:46:01.284: [StreamFX] [h264_nvenc] Keyframes:
18:46:01.284: [StreamFX] [h264_nvenc] Distance: 120 frames
18:46:01.284: [StreamFX] [h264_nvenc] Nvidia NVENC:
18:46:01.284: [StreamFX] [h264_nvenc] Preset: hq
18:46:01.284: [StreamFX] [h264_nvenc] Rate Control: cbr_hq
18:46:01.284: [StreamFX] [h264_nvenc] Two Pass: Enabled
18:46:01.284: [StreamFX] [h264_nvenc] Look-Ahead: 32 Frames
18:46:01.284: [StreamFX] [h264_nvenc] Adaptive I-Frames: Enabled <Default>
18:46:01.284: [StreamFX] [h264_nvenc] Adaptive B-Frames: Enabled <Default>
18:46:01.284: [StreamFX] [h264_nvenc] Bitrate:
18:46:01.284: [StreamFX] [h264_nvenc] Target: 8200000 bits/sec
18:46:01.284: [StreamFX] [h264_nvenc] Minimum: 0 bits/sec <Default>
18:46:01.284: [StreamFX] [h264_nvenc] Maximum: 0 bits/sec <Default>
18:46:01.284: [StreamFX] [h264_nvenc] Buffer: 16400000 bits
18:46:01.284: [StreamFX] [h264_nvenc] Quality:
18:46:01.284: [StreamFX] [h264_nvenc] Target: 0 <Default>
18:46:01.284: [StreamFX] [h264_nvenc] Minimum: -1
18:46:01.284: [StreamFX] [h264_nvenc] Maximum: -1
18:46:01.284: [StreamFX] [h264_nvenc] Quantization Parameters:
18:46:01.284: [StreamFX] [h264_nvenc] I-Frame: -1 <Default>
18:46:01.284: [StreamFX] [h264_nvenc] P-Frame: -1 <Default>
18:46:01.284: [StreamFX] [h264_nvenc] B-Frame: -1 <Default>
18:46:01.284: [StreamFX] [h264_nvenc] B-Frames: 2 Frames
18:46:01.284: [StreamFX] [h264_nvenc] Reference Mode: disabled <Default>
18:46:01.284: [StreamFX] [h264_nvenc] Adaptive Quantization:
18:46:01.284: [StreamFX] [h264_nvenc] Spatial AQ: Enabled
18:46:01.284: [StreamFX] [h264_nvenc] Strength: 4
18:46:01.284: [StreamFX] [h264_nvenc] Temporal AQ: Enabled
18:46:01.284: [StreamFX] [h264_nvenc] Other:
18:46:01.284: [StreamFX] [h264_nvenc] Zero Latency: Disabled <Default>
18:46:01.284: [StreamFX] [h264_nvenc] Weighted Prediction: Disabled <Default>
18:46:01.284: [StreamFX] [h264_nvenc] Non-reference P-Frames: Disabled <Default>
18:46:01.284: [StreamFX] [h264_nvenc] Strict GOP: Disabled <Default>
18:46:01.284: [StreamFX] [h264_nvenc] Access Unit Delimiters: Disabled <Default>
18:46:01.284: [StreamFX] [h264_nvenc] Bluray Compatibility: Disabled <Default>
18:46:01.284: [StreamFX] [h264_nvenc] A53 Closed Captions: Enabled <Default>
18:46:01.284: [StreamFX] [h264_nvenc] DPB Size: <Error: Operation not permitted>
18:46:01.284: [StreamFX] [h264_nvenc] H.264/AVC:
18:46:01.284: [StreamFX] [h264_nvenc] Profile: high
18:46:01.284: [StreamFX] [h264_nvenc] Level: weighted_pred <Default>
18:46:01.351: [CoreAudio AAC: 'avc_aac_stream']: settings:
 

Daerados

New Member
Im ok with mine, no crashes with disabled b reference. Need to compare quality later on.
Thank you anyway :)
 

rockbottom

Active Member
Im ok with mine, no crashes with disabled b reference. Need to compare quality later on.
Thank you anyway :)

Cool, it's a bug with FFMPEG not StreamFX. Xaymar explains what's going on here. Honestly, I was able to use the Middle setting previously & there's really no noticeable difference.
 

rockbottom

Active Member
FYI, I just ran a little test. I set B-Frame Reference back to Middle on the Streaming side & used my Custom FFMPEG output for recording, ran both concurrently & there was no crash.
 

Daerados

New Member
Isn't having two of them uses more resources rather than having "use streaming encoder"?
Also I took mine settings from blog, are yours more efficient? I'm battling with webcam blurriness/pixelation (have full room of lights, and going close to 8k bitrate for Twitch).

Thanks for source, will note down to check on 27th.
 

rockbottom

Active Member
Yes, but your 2080 can encode up to (3) 1080p streams concurrently with ease. I do it all the time with my 1660 Super & never drop a frame. When I'm running (3) streams the encoder is 72-74% utilized.

Xaymar's blog settings are good, I started with them & then made adjustments over time.
 

rockbottom

Active Member
I looked back at your log, you're downscaling. Have you tried running your streams without downscaling? It may help to clear up some of the blurriness.
 

rockbottom

Active Member
I forgot to mention, I did some more tests with the B-Frame Reference mode this afternoon.

If you don't use the stream encoder for your recordings, you can set the reference mode back to Middle for your streams. For the recording encoder it will need to stay Disabled until FFMPEG is updated in OBS.
 

rockbottom

Active Member
Here are the settings I used this afternoon that passed the reference mode test with no crashes.
StreamFX-Streaming Settings A.JPG
StreamFX-Streaming Settings B.JPG


Recording H265
StreamFX-Recording Settings A.JPG
StreamFX-Recording Settings B.JPG
StreamFX-Recording Settings C.JPG


And if you want PCM audio on your recordings, give this a shot. I tested this as well.
Custom Video Encoder Settings, Copy/Paste: preset=hq profile=main tier=high rc=constqp rc-lookahead=32 init_qpP=18 init_qpB=18 init_qpI=18 bf=2 b_ref_mode=disabled
Custom FFmpeg - 24bit PCM.JPG
 

Daerados

New Member
I know about dedicated chip on those GPU, but how do you check encoder utilization separately from overall GPU utilization? I also need to keep high FPS in shooters, thought it's impacting it.

I care only for stream quality (recording is just for replay moments, have shadowplay running for everything else), I'm satisfied with gameplay image, only webcam behaving... Upscaling to 1080p on twitch will degrade quality with such bitrate - already going over the top and sometimes ending up with #1000 error on stream start. I play mostly FPS games, bitrate matters.

I probably don't need PCM audio, don't know what it is exactly :)

Thanks for your replies.
 

Daerados

New Member
Also had an idea to download newer ffmpeg dlls or something and put in OBS folder, I wonder if it will work lol
 

rockbottom

Active Member
Windows Task Manager, click on GPU. I'm running (3) 1080p streams right now, see below.

Gotcha, staying at 6Mb/s is a bit of a challenge @ 1080p

PCM = uncompressed audio

I tried to replace FFMPEG a while back & couldn't get it to work quite right. But from what I've read, it can be done. If I can find the link to the thread, I'll post it for you.

That thread is really old, take a look at the last post on Page 2.
Task Manger.JPG
 

rockbottom

Active Member
Here's the thread with some info on replacing FFMPEG

 

Daerados

New Member
I didn't expect it to work, but worth a shot (settings same, with middle b-rate) :)

19:36:48.457: ==== Recording Start ===============================================
19:36:48.457: [ffmpeg muxer: 'adv_file_output'] Writing file 'D:/Videos/OBS/2020-11-26/19-36-48.mkv'...
19:36:49.017: [ffmpeg muxer: 'adv_file_output'] os_process_pipe_write for info structure failed
19:36:49.017: [ffmpeg muxer: 'adv_file_output'] ffmpeg-mux: ffmpeg version 4.3.1-2020-11-19-essentials_build-www.gyan.dev Copyright (c) 2000-2020 the FFmpeg developers
19:36:49.017: built with gcc 10.2.0 (Rev5, Built by MSYS2 project)
19:36:49.017: configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus -
19:36:49.017: [ffmpeg muxer: 'adv_file_output'] Output of file 'D:/Videos/OBS/2020-11-26/19-36-48.mkv' stopped
19:36:49.017: Output 'adv_file_output': stopping
19:36:49.017: Output 'adv_file_output': Total frames output: 1
19:36:49.017: Output 'adv_file_output': Total drawn frames: 34
19:36:49.018: ==== Recording Stop ================================================
 
Top