obs-studio icon indicating copy to clipboard operation
obs-studio copied to clipboard

"Encoding overloaded": NVENC unusable with ffmpeg 4.4 on an old NVIDIA GPU

Open guihkx opened this issue 3 years ago • 25 comments

Operating System Info

Other

Other OS

Arch Linux

OBS Studio Version

26.1.2

OBS Studio Version (Other)

No response

OBS Studio Log URL

https://obsproject.com/logs/iVp9mPfJw0BLSkVd

OBS Studio Crash Log URL

No response

Expected Behavior

I expect NVENC to be usable with ffmpeg 4.4 on older NVIDIA GPUs (e.g. GTX 660)

Current Behavior

NVENC is unusable with ffmpeg 4.4 on an old GPU.

Steps to Reproduce

  1. Have an old NVIDIA GPU (e.g. GTX 660)
  2. Upgrade to ffmpeg 4.4
  3. Enable NVENC encoding (I'm using Simple Output + Indistinguishable Quality)
  4. Start recording
  5. OBS will complain about the encoder being overloaded, with lots of frame drops

Anything else we should know?

Arch Linux is already shipping ffmpeg 4.4, but this release somehow broke NVENC on older NVIDIA GPUs (such as the GTX 660).

For example, the following ffmpeg command re-encodes a random video using the h264_nvenc encoder:

ffmpeg -loglevel verbose -i input.mp4 -c:v h264_nvenc -rc constqp -qp 28 output.mp4

This is the output I get using ffmpeg 4.3.2: ffmpeg-4.3.2.txt And this is the output I get using ffmpeg 4.4: ffmpeg-4.4.txt

Fortunately, a fix for this specific issue has been pushed to ffmpeg's release/4.4 branch.

However, that fix doesn't have any effect on OBS, which still skips pratically all frames while recording, plus the "Encoding overloaded" message is displayed as soon as I hit "record". Short log:

info: ---------------------------------
info: [NVENC encoder: 'simple_h264_recording'] settings:
	rate_control: CQP
	bitrate:      0
	cqp:          16
	keyint:       250
	preset:       hq
	profile:      high
	width:        1920
	height:       1080
	2-pass:       false
	b-frames:     2
	GPU:          0

[h264_nvenc @ 0x55580179c9c0] The selected preset is deprecated. Use p1 to p7 + -tune or fast/medium/slow.
[h264_nvenc @ 0x55580179c9c0] Using global_quality with nvenc is deprecated. Use qp instead.
info: libfdk_aac encoder created
info: libfdk_aac bitrate: 192, channels: 2
info: ==== Recording Start ===============================================
info: [ffmpeg muxer: 'simple_file_output'] Writing file '/mnt/HDDLinux/2021-05-01 01-46-50.mkv'...
info: Output format name and long_name: matroska, Matroska
info: [ffmpeg muxer: 'simple_file_output'] Output of file '/mnt/HDDLinux/2021-05-01 01-46-50.mkv' stopped
info: Output 'simple_file_output': stopping
info: Output 'simple_file_output': Total frames output: 100
info: Output 'simple_file_output': Total drawn frames: 543
info: ==== Recording Stop ================================================
info: Video stopped, number of skipped frames due to encoding lag: 111/149 (74,5%)
info: libfdk_aac encoder destroyed

If I downgrade ffmpeg to 4.3.2, OBS is able to record just fine with NVENC, plus I don't get the "Encoding overloaded" message anymore:

info: ---------------------------------
info: [NVENC encoder: 'simple_h264_recording'] settings:
	rate_control: CQP
	bitrate:      0
	cqp:          16
	keyint:       250
	preset:       hq
	profile:      high
	width:        1920
	height:       1080
	2-pass:       false
	b-frames:     2
	GPU:          0

[h264_nvenc @ 0x5625f2b804c0] Using global_quality with nvenc is deprecated. Use qp instead.
info: libfdk_aac encoder created
info: libfdk_aac bitrate: 192, channels: 2
info: ==== Recording Start ===============================================
info: [ffmpeg muxer: 'simple_file_output'] Writing file '/mnt/HDDLinux/2021-05-01 01-50-54.mkv'...
info: Output format name and long_name: matroska, Matroska
info: [ffmpeg muxer: 'simple_file_output'] Output of file '/mnt/HDDLinux/2021-05-01 01-50-54.mkv' stopped
info: Output 'simple_file_output': stopping
info: Output 'simple_file_output': Total frames output: 150
info: Output 'simple_file_output': Total drawn frames: 162
info: ==== Recording Stop ================================================
info: libfdk_aac encoder destroyed

I'm not 100% sure, but it sounds like the issue is related to these two messages:

[h264_nvenc @ 0x55580179c9c0] The selected preset is deprecated. Use p1 to p7 + -tune or fast/medium/slow.
[h264_nvenc @ 0x55580179c9c0] Using global_quality with nvenc is deprecated. Use qp instead.

Sorry for the wall of text, guys. 😅

Thank you!

guihkx avatar May 01 '21 04:05 guihkx

This sounds like an ffmpeg issue, not an OBS issue. We don't choose the ffmpeg version on Linux, that's controlled by the package manager.

WizardCM avatar May 01 '21 06:05 WizardCM

Indeed, but don't you guys plan on supporting 4.4 at some point?

I'm mostly referring to these two warnings thrown by some ffmpeg library when trying to record using OBS:

[h264_nvenc @ 0x55580179c9c0] The selected preset is deprecated. Use p1 to p7 + -tune or fast/medium/slow.
[h264_nvenc @ 0x55580179c9c0] Using global_quality with nvenc is deprecated. Use qp instead.

guihkx avatar May 01 '21 06:05 guihkx

This seems to be the line the warning is about for global_quality:

https://github.com/obsproject/obs-studio/blob/2a7fd297e48d05aec9784bad33946352a1a78e83/plugins/obs-ffmpeg/obs-ffmpeg-nvenc.c#L210

WizardCM avatar May 01 '21 07:05 WizardCM

Is there some flag I could add to OBS's muxer to try to get rid of these warnings? 🤔

image

I mean, the warnings themselves aren't the issue; The issue is NVENC not functioning for me at all...

guihkx avatar May 01 '21 07:05 guihkx

"NVENC not functioning properly" could be caused by two issues:

  1. ffmpeg is doing something wrong (potentially entirely out of our control)
  2. the warnings are indicators of misconfiguration on our side causing ffmpeg to misbehave

WizardCM avatar May 01 '21 07:05 WizardCM

Okay, so I have some new information, but I'm not quite sure what to make of it. :p

I've switched OBS' Output Mode to Advanced so I could try out a few things.

And I learned that this "encoding overloaded" issue happens only when I select any of the "Quality" Presets:

  • Max Quality
  • Quality
  • Low-Latency Quality

All the other presets work just fine. No frame skips whatsoever while recording locally.

But just a reminder that after downgrading to ffmpeg 4.3.2, I'm able to use any of the Quality presets on OBS with no issues, so... ffmpeg bug? 🤷‍♂️

guihkx avatar May 01 '21 07:05 guihkx

Try to update driver from nvidia as others on reddit had same issue. The newer ffmpeg us later library.

sensodejay avatar May 01 '21 07:05 sensodejay

Try to update driver from nvidia as others on reddit had same issue.

I'm using 465.27, which I believe is the last version available, no?

guihkx avatar May 01 '21 07:05 guihkx

Asked on #ffmpeg IRC channel, and got an interesting response:

feaneron	i'm asking because, depending on when it may happen, i may need to backport this patch


BtbN		Or just switch to the new way of setting stuff
		Anything that needs this is deprecated anyway

feaneron	new way?

BtbN		-tune lossless
		The presets have all been replaced by the p1 to p7 ones, and anything else is set via tuning info
		[…]
		OBS is also still totally lacking support for target quality mode in nvenc
		Which is in every way superior to cqp mode

GeorgesStavracas avatar May 01 '21 13:05 GeorgesStavracas

Unfortunately, that doesn't address the question of why it works in FFmpeg 4.3 and doesn't in FFmpeg 4.4, including on CLI.

RytoEX avatar May 01 '21 17:05 RytoEX

@GeorgesStavracas Thanks for asking there. Btw, if this is the ffmpeg patch you intend to backport to Flatpak'd OBS, I've already tried it and it didn't have any effect on OBS (though it did fix NVENC encoding on Simple Screen Recording).

And to be honest, I've kind of assumed this issue affects only older NVIDIA GPUs, because I thought it was odd that nobody had reported it yet. But if anyone has a newer GPU model, feel free trying to reproduce it too.

Anyway, this probably won't help, but I recorded a video of me going through all NVENC presets in OBS:

https://www.youtube.com/watch?v=8AvTHiH9i24

guihkx avatar May 01 '21 17:05 guihkx

With OBS Studio 27.2, we're shipping FFmpeg 4.4.1 at commit https://github.com/FFmpeg/FFmpeg/commit/cc33e73618a981de7fd96385ecb34719de031f16 which includes https://github.com/FFmpeg/FFmpeg/commit/e3fb0f0c88f14cf382d005469242bd63338b862e (the cherry-picked copy of https://github.com/FFmpeg/FFmpeg/commit/988f2e9eb063db7c1a678729f58aab6eba59a55b to the release/4.4 branch). The OBS Studio 27.2 beta releases are available from the releases page.

I'd suggest re-testing against our latest beta or commit and seeing if this is still an issue.

RytoEX avatar Jan 12 '22 04:01 RytoEX

Nope, still getting encoding overloaded at commit 723d5a2

image

I did a git bisect against ffmpeg versions 4.3 and 4.4 (using a local Flatpak build of OBS), and this is my result:

git bisect start
# good: [f719f869907764e6412a6af6e178c46e5f915d25] Changelog: update
git bisect good f719f869907764e6412a6af6e178c46e5f915d25
# bad: [dc91b913b6260e85e1304c74ff7bb3c22a8c9fb1] RELEASE_NOTES: Based on the version from 4.3
git bisect bad dc91b913b6260e85e1304c74ff7bb3c22a8c9fb1
# good: [0a8a96c25194b550f3b87902e1b7f061738ae3cd] Bump minor versions to separate 4.3 from master
git bisect good 0a8a96c25194b550f3b87902e1b7f061738ae3cd
# bad: [abcca6a055919916fcd199c6e40d5102a3de4a70] avcodec/wavpack: use av_buffer_replace() to simplify code
git bisect bad abcca6a055919916fcd199c6e40d5102a3de4a70
# good: [4562d8e8d628b6acf5d6cb564ff79ecafe9efc84] avcodec/dxtory: support subsampled formats with non-aligned size
git bisect good 4562d8e8d628b6acf5d6cb564ff79ecafe9efc84
# good: [290de647595051034d8f021f24bb4610b2f39943] avformat/movenc: Avoid allocation for timecode track
git bisect good 290de647595051034d8f021f24bb4610b2f39943
# bad: [e680d50eb4feddafb2d8575b21fc5fc8764f4801] avformat/au: Check for EOF in au_read_annotation()
git bisect bad e680d50eb4feddafb2d8575b21fc5fc8764f4801
# good: [c78c60c3e8b3d8f5e3b27f9c8fd2481a2e7273ab] avcodec/adpcmenc: add "block_size" option
git bisect good c78c60c3e8b3d8f5e3b27f9c8fd2481a2e7273ab
# good: [2f9fc35028364b0140fd6e0d2e4dbaffebed1acd] avcodec/movtextenc: Fix undefined left shifts outside the range of int
git bisect good 2f9fc35028364b0140fd6e0d2e4dbaffebed1acd
# good: [53ac499f0132b924315ce26c2683d6eb1717ce29] avformat/riff: prevent muxing adpcm_swf with a variable block size
git bisect good 53ac499f0132b924315ce26c2683d6eb1717ce29
# good: [1868cb731660490beb750389266adb6e68e9123d] avformat/wtvdec: Check dir_length
git bisect good 1868cb731660490beb750389266adb6e68e9123d
# bad: [92c40ef882be115e72d2aa02f9032b7ce88f8537] avformat/rtsp: support for listen_timeout option for sdp
git bisect bad 92c40ef882be115e72d2aa02f9032b7ce88f8537
# bad: [e0c8e517b6a0d82d8837f78425b62132443ecf15] avcodec/nvenc: reduce automated use of deprecated modes
git bisect bad e0c8e517b6a0d82d8837f78425b62132443ecf15
# bad: [cde3c080338154cc73103939f6ab26ae5bb718cd] avcodec/nvenc: mark newly deprecated rc modes
git bisect bad cde3c080338154cc73103939f6ab26ae5bb718cd
# bad: [11a8e93681dfe51c75683ac5a13b72d4bed7ac1f] avcodec/nvenc: use alias to provide deprecated profiles
git bisect bad 11a8e93681dfe51c75683ac5a13b72d4bed7ac1f
# first bad commit: [11a8e93681dfe51c75683ac5a13b72d4bed7ac1f] avcodec/nvenc: use alias to provide deprecated profiles

Now I'm not an expert in neither FFmpeg nor OBS, but it seems like all hq presets (that still work fine here with FFmpeg 4.3), were replaced by newer ones, from p1 to p7 with https://github.com/FFmpeg/FFmpeg/commit/11a8e93681dfe51c75683ac5a13b72d4bed7ac1f. And the hq preset specifically, was replaced by this p7 preset in FFmpeg 4.4, which according to NVIDIA's NVENC documentation:

For each tuning info, seven presets from P1 (highest performance) to P7 (lowest performance) have been provided to control performance/quality trade off

Maybe my 10 year-old GPU can't handle this encoding preset? I don't know.

guihkx avatar Jan 12 '22 13:01 guihkx

I found this "NVENC H264 preset migration table":

https://docs.nvidia.com/video-technologies/video-codec-sdk/nvenc-preset-migration-guide/index.html#h264-preset-migration-table

For 1080p on Kepler GPUs, NVIDIA recommends using the p4 preset, not the the p7 one. In fact, the p7 preset never even gets mentioned in the entire migration table.

Now, I'll try patching FFmpeg 4.4 to use the p4 preset instead of p7, and see if I get any dropped frames using any of the hq presets in OBS. I'll report back soon.

guihkx avatar Jan 12 '22 13:01 guihkx

So, using the following patch in FFmpeg 4.4.1:

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index b09ddbe0fa..4d0b067132 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -171,11 +171,11 @@ static void nvenc_map_preset(NvencContext *ctx)
         // Compat aliases
         PRESET_ALIAS(DEFAULT,             P4, NVENC_DEPRECATED_PRESET),
         PRESET_ALIAS(HP,                  P1, NVENC_DEPRECATED_PRESET),
-        PRESET_ALIAS(HQ,                  P7, NVENC_DEPRECATED_PRESET),
+        PRESET_ALIAS(HQ,                  P4, NVENC_DEPRECATED_PRESET),
         PRESET_ALIAS(BD,                  P5, NVENC_DEPRECATED_PRESET),
         PRESET_ALIAS(LOW_LATENCY_DEFAULT, P4, NVENC_DEPRECATED_PRESET | NVENC_LOWLATENCY),
         PRESET_ALIAS(LOW_LATENCY_HP,      P1, NVENC_DEPRECATED_PRESET | NVENC_LOWLATENCY),
-        PRESET_ALIAS(LOW_LATENCY_HQ,      P7, NVENC_DEPRECATED_PRESET | NVENC_LOWLATENCY),
+        PRESET_ALIAS(LOW_LATENCY_HQ,      P4, NVENC_DEPRECATED_PRESET | NVENC_LOWLATENCY),
         PRESET_ALIAS(LOSSLESS_DEFAULT,    P4, NVENC_DEPRECATED_PRESET | NVENC_LOSSLESS),
         PRESET_ALIAS(LOSSLESS_HP,         P1, NVENC_DEPRECATED_PRESET | NVENC_LOSSLESS),
 #else

I was able to successfully record CS:GO for about 5 minutes, at 1080p @ 60fps / 30K bitrate, with no frame drops:

info: ---------------------------------
info: [NVENC encoder: 'simple_h264_recording'] settings:
	rate_control: CQP
	bitrate:      0
	cqp:          23
	keyint:       250
	preset:       hq
	profile:      high
	width:        1920
	height:       1080
	2-pass:       false
	b-frames:     2
	psycho-aq:    1
	GPU:          0

[h264_nvenc @ 0x55b317c420c0] The selected preset is deprecated. Use p1 to p7 + -tune or fast/medium/slow.
[h264_nvenc @ 0x55b317c420c0] Temporal AQ not supported
[h264_nvenc @ 0x55b317c420c0] No capable devices found
warning: [NVENC encoder: 'simple_h264_recording'] Failed to open NVENC codec: Generic error in an external library
warning: [NVENC encoder] nvenc_create_internal failed, trying again without Psycho Visual Tuning
info: ---------------------------------
info: [NVENC encoder: 'simple_h264_recording'] settings:
	rate_control: CQP
	bitrate:      0
	cqp:          23
	keyint:       250
	preset:       hq
	profile:      high
	width:        1920
	height:       1080
	2-pass:       false
	b-frames:     2
	psycho-aq:    0
	GPU:          0

[h264_nvenc @ 0x55b3171dca40] The selected preset is deprecated. Use p1 to p7 + -tune or fast/medium/slow.
[h264_nvenc @ 0x55b3171dca40] Using global_quality with nvenc is deprecated. Use qp instead.
info: libfdk_aac encoder created
info: libfdk_aac bitrate: 192, channels: 2
info: ==== Recording Start ===============================================
info: [ffmpeg muxer: 'simple_file_output'] Writing file '/mnt/HDDLinux/2022-01-12 11-46-43.mkv'...
info: Output format name and long_name: matroska, Matroska
info: [ffmpeg muxer: 'simple_file_output'] Output of file '/mnt/HDDLinux/2022-01-12 11-46-43.mkv' stopped
info: Output 'simple_file_output': stopping
info: Output 'simple_file_output': Total frames output: 13461
info: Output 'simple_file_output': Total drawn frames: 13473 (13480 attempted)
info: Output 'simple_file_output': Number of lagged frames due to rendering lag/stalls: 7 (0.1%)
info: ==== Recording Stop ================================================
info: libfdk_aac encoder destroyed

I've also tried patching FFmpeg to use the P5 preset, but then I started getting frame drops again. So apparently NVIDIA's recommendation was on point... :)

@BtbN would be willing to lower the preset quality from P7 to P4 to accommodate owners of ancient GPUs? :(

guihkx avatar Jan 12 '22 14:01 guihkx

Changing the behaviour in ffmpeg for this now would be an API break, so I can't reasonably do that. The correct way forward would be for OBS to expose the new presets. Or query the available AVOptions and show the available const values in the UI, which would also future-proof it for any further changes. With the next major release, the old presets will likely go away entirely.

BtbN avatar Jan 12 '22 15:01 BtbN

We are, in fact, looking into and working on improvements for how we handle NVENC, including exposing the new presets. Unfortunately, I cannot give an estimate on when those will land.


Digging into this a bit further, it looks like we list the old "Default" preset as "Performance" in the OBS UI: https://github.com/obsproject/obs-studio/blob/046d98d87104712b82f143688876894ab3d0753d/plugins/obs-ffmpeg/obs-ffmpeg-nvenc.c#L581 https://github.com/obsproject/obs-studio/blob/046d98d87104712b82f143688876894ab3d0753d/plugins/obs-ffmpeg/data/locale/en-US.ini#L19

In FFmpeg's compatibility aliases, Default maps to P4. Wouldn't this mean that for a Kepler GPU, selecting "Performance" in OBS would be the same as P4 in FFmpeg 4.4?


If your output resolution is 1920x1080, and you select Simple Output mode with "Indistinguishable Quality" and NVENC, OBS internally sets these:

rate control: CQP
profile: high
preset: hq
cqp: 16

If your output resolution is 1920x1080, and you select Simple Output mode with "High Quality" and NVENC, OBS internally sets these:

rate control: CQP
profile: high
preset: hq
cqp: 23

This being the case, OBS FFmpeg NVENC on Kepler GPUs may not be usable in certain configurations in Simple Output Mode until we address this. In the meantime, if you select Advanced Output Mode and select "Performance", that should be the same as Default/P4, which is the recommended preset for Kepler GPUs according to the preset migration table previously linked.

RytoEX avatar Jan 13 '22 05:01 RytoEX

We are, in fact, looking into and working on improvements for how we handle NVENC, including exposing the new presets.

Awesome! Thank you.

Wouldn't this mean that for a Kepler GPU, selecting "Performance" in OBS would be the same as P4 in FFmpeg 4.4?

That's correct, for now I can use the Performance preset without having to patch anything. I only have issues when I select either of the HQ presets.

This being the case, OBS FFmpeg NVENC on Kepler GPUs may not be usable in certain configurations in Simple Output Mode until we address this

Yeah, I figured as much. ~~But at the same time, making it work is just as simple as ticking a box in OBS' settings, so no biggie:~~ (EDIT: This only works when streaming. For local recordings, I do have to use Advanced mode. Sorry.. 😅)

guihkx avatar Jan 13 '22 13:01 guihkx

Just as a comment to anyone following this issue, there is a lot of additional context/testing that was done in #6062 that we've just marked as a duplicate of this case.

Fenrirthviti avatar May 06 '22 19:05 Fenrirthviti

@RytoEX any news on this issue? For me only using 26.1.1 really fixed this encoder lag for me. The problem is with that version I can't stream. For me specifically using 27.2.4, the second the game drops a few fps, which is common on loading screens, the recording starts to lag. I tried the manual preset "p5" thing, without luck. One thing that helps is set FPS recording to 58 or lower and using the performance mode. Even so still way inferior when using 26.1.1, which is much more stable, and I don't have the FPS drop issue. So right now I am using 26.1.1 to record and 27.2.4 to stream with caution, using 50fps and performance mode.

lucasmarotta avatar Jul 24 '22 12:07 lucasmarotta

@RytoEX any news on this issue? For me only using 26.1.1 really fixed this encoder lag for me. The problem is with that version I can't stream. For me specifically using 27.2.4, the second the game drops a few fps, which is common on loading screens, the recording starts to lag. I tried the manual preset "p5" thing, without luck.

No, there is no news. If 26.1.1 fixes the issue for you, it's most likely the issue I've described. It is still on our to-do list to address this.

Why can you not stream with OBS 26.1.1?

Unfortunately, without a log file, it's unclear which NVENC implementation you're actually using (OBS Studio has two).

If "p5" is unusable, you can try selecting "Performance" or "Max Performance", which map to P4 and P1 in the FFmpeg-based implementation. You can also try putting "p1" in your recordEncoder.json file to test to see if there is some other issue occurring on your system. Please keep in mind that you cannot change any encoder settings in the OBS UI, or it will overwrite the settings in the recordEncoder.json file.

RytoEX avatar Jul 24 '22 14:07 RytoEX

@RytoEX any news on this issue? For me only using 26.1.1 really fixed this encoder lag for me. The problem is with that version I can't stream. For me specifically using 27.2.4, the second the game drops a few fps, which is common on loading screens, the recording starts to lag. I tried the manual preset "p5" thing, without luck.

No, there is no news. If 26.1.1 fixes the issue for you, it's most likely the issue I've described. It is still on our to-do list to address this.

Why can you not stream with OBS 26.1.1?

Unfortunately, without a log file, it's unclear which NVENC implementation you're actually using (OBS Studio has two).

If "p5" is unusable, you can try selecting "Performance" or "Max Performance", which map to P4 and P1 in the FFmpeg-based implementation. You can also try putting "p1" in your recordEncoder.json file to test to see if there is some other issue occurring on your system. Please keep in mind that you cannot change any encoder settings in the OBS UI, or it will overwrite the settings in the recordEncoder.json file.

Thanks for the response. I can't stream to Twitch (maybe YT is possible) I think due to the old v5 api I guess. But for now is this, I will use performance preset with lower FPS and resolution to have fewer encoding lag. Just to add here, I am using Windows 11 with RTX 2080S

lucasmarotta avatar Jul 24 '22 14:07 lucasmarotta

I can't stream to Twitch (maybe YT is possible) I think due to the old v5 api I guess.

This is only true about connecting your account. You can still manually enter a stream key and stream to Twitch.

RytoEX avatar Jul 24 '22 14:07 RytoEX

Thanks for the response. I can't stream to Twitch (maybe YT is possible) I think due to the old v5 api I guess. But for now is this, I will use performance preset with lower FPS and resolution to have fewer encoding lag. Just to add here, I am using Windows 11 with RTX 2080S

I don't think this problem that @lucasmarotta is experiencing is related to this issue. This issue is about a specific regression that happens with newer versions of ffmpeg when combined with rather old nvidia GPUs, and @lucasmarotta does not have one of the affected GPUs.

alinsavix avatar Jul 24 '22 15:07 alinsavix

Thanks for the response. I can't stream to Twitch (maybe YT is possible) I think due to the old v5 api I guess. But for now is this, I will use performance preset with lower FPS and resolution to have fewer encoding lag. Just to add here, I am using Windows 11 with RTX 2080S

I don't think this problem that @lucasmarotta is experiencing is related to this issue. This issue is about a specific regression that happens with newer versions of ffmpeg when combined with rather old nvidia GPUs, and @lucasmarotta does not have one of the affected GPUs.

Well my GPU seems affected idk. The curious thing is as soon the FPS drops for a second (like on loading screens) from the recording target the encoder lag happens, don't return to normal and the video end up looking like a slideshow. I tested with the new beta 28, and still there, but I know there's no metion for this FFMPEG version issue.

@RytoEX thanks for clarifying, I just miss live UI settings from Twitch inside OBS, but indeed I can stream to Twitch. So for now I stick to 26.1.1.

lucasmarotta avatar Aug 07 '22 04:08 lucasmarotta

As we've exposed the P1-P7 presets directly as of OBS Studio 28.1, this specific Issue should technically be resolved. It is possible that there are other issues related to older NVIDIA GPUs, but I do not want to expand the scope of this GitHub Issue to cover all possible issues.

Please retest in OBS Studio 28.1.1 or newer and confirm if this specific Issue has been resolved.

RytoEX avatar Nov 04 '22 01:11 RytoEX

Confirming it works!

Test environment:

  • OS: Arch Linux
  • OBS: 28.1.1 (Flatpak)
  • GPU: NVIDIA GTX 660 (drivers: 470.141.03)

Recording settings that I'm using:

image

The NVIDIA video engine just barely handles it (although I could probably do some more tweaking in OBS), but it does work:

image

Here's the output of a test recording of 1m 30s:

info: ---------------------------------
info: [FFmpeg NVENC encoder: 'advanced_video_recording'] settings:
	encoder:      NVIDIA NVENC H.264 (FFmpeg)
	rate_control: CQP
	bitrate:      0
	cqp:          15
	keyint:       250
	preset:       p4
	tuning:       ll
	multipass:    disabled
	profile:      high
	width:        1920
	height:       1080
	b-frames:     2
	psycho-aq:    0
	GPU:          0

[h264_nvenc @ 0x5632ecfb4b00] Using global_quality with nvenc is deprecated. Use qp instead.
info: ---------------------------------
info: [FFmpeg aac encoder: 'Track1'] bitrate: 160, channels: 2, channel_layout: 3

info: ==== Recording Start ===============================================
info: [ffmpeg muxer: 'adv_file_output'] Writing file '/home/gui/2022-11-03 22-24-24.mkv'...
warning: Failed to create xdg-screensaver: 2
warning: Failed to create xdg-screensaver: 2
warning: Failed to create xdg-screensaver: 2
info: [ffmpeg muxer: 'adv_file_output'] Output of file '/home/gui/2022-11-03 22-24-24.mkv' stopped
info: Output 'adv_file_output': stopping
info: Output 'adv_file_output': Total frames output: 5646
info: Output 'adv_file_output': Total drawn frames: 5658
info: ==== Recording Stop ================================================

Thank you so much OBS team. <3

guihkx avatar Nov 04 '22 01:11 guihkx