Encoding issues when rescaling output to 1440?

FightinCowboy

New Member
Been encountering an odd issue on a few games lately with using the rescale output functions for livestreams. I play and record in 4K and would typically stream in 1440. I'm on YouTube so 4K or 1440 streams are a thing and they usually look quite crispy.

Was having some issues with Dying Light 2 and For Honor in particular though and decided to mess with some settings and discovered that while playing in 4K, if I was streaming in 4K I had no lag. If I rescaled things down to 1080, also had no lag, but if I rescaled to 1440 we're suddenly taking trips to frame city.

This shouldn't be a hardware issue (3950x, EVGA 3080, 64gb memory) because otherwise Playing/Streaming in 4K simultaneously wouldn't be smooth. It's also not a bitrate issue as I'm on fiber and did the following bitrate tests using numbers pulled from YTs live encoding recommendations:

1080 @ 9000 bitrate = Smooth
1080 @ 18000 bitrate = Smooth
1440 @ 9000 bitrate = Laggy
1440 @ 18000 bitrate = Laggy
4k @ 30,000 bitrate = Smooth

The obvious solution is to just not stream those 2 titles at 1440 but I've never encountered an issue like this before and I'm curious for any thoughts. 2 logs from recent streams with the issue and one from this morning when I was doing the testing attached.

Streaming encoding is typically done with NVENC New, CBR, low-latency quality, high, look-ahead, psycho visual tuning, 4 max bframes.
 

Attachments

  • 2022-02-09 14-57-18.txt
    106.5 KB · Views: 38
  • 2022-02-09 16-54-36.txt
    103.4 KB · Views: 21
  • 2022-02-10 09-55-54.txt
    213.1 KB · Views: 20

terrorfrog

New Member
oh no this is rather obivious :)
you play in 4k 3840 x 2160 and then ofc streaming at the same resolution or 1920 x 1080 is easy. straight 50%
easy to scale
1440p is 2560 x 1440 is a wierd fraction givign you many issues

if you play in 1440p and wanna scale down i would recommend either 864p or 720p.

one possible option could be scaling in the canvas and use NO downscale filter. that could help but fractional values still persist.
 

FightinCowboy

New Member
did you everytime change the resolution of your stream when you play in another resolution.
have you RTX options on ? did you use HDR ? GSYNC?
Diable this try again

next try to use DX11 instead of DX12

and please deactivate Streamelements plugin on the next log its hard to read with the garbage of the plugin in the log
I've tried DX11 and DX12, I've tried with RTX options on/off. A lot of these aren't applicable to For Honor but were for Dying Light. TBH I know the game is unoptimized but still odd to see this occurrence with both.

oh no this is rather obivious :)
you play in 4k 3840 x 2160 and then ofc streaming at the same resolution or 1920 x 1080 is easy. straight 50%
easy to scale
1440p is 2560 x 1440 is a wierd fraction givign you many issues

if you play in 1440p and wanna scale down i would recommend either 864p or 720p.

one possible option could be scaling in the canvas and use NO downscale filter. that could help but fractional values still persist.
It's weird though that it's only these two games. My only guess is that the game is fighting for resources against whatever is doing the downscaling.
 

terrorfrog

New Member
I've tried DX11 and DX12, I've tried with RTX options on/off. A lot of these aren't applicable to For Honor but were for Dying Light. TBH I know the game is unoptimized but still odd to see this occurrence with both.


It's weird though that it's only these two games. My only guess is that the game is fighting for resources against whatever is doing the downscaling.

ITS NOT RESOURCES, this old fairy tale has to DIE asap.
THe issue is more nasty. Its Frameprocessing time. Windows using now a shiny new Framework to capture and give applications access.
Now the issue is that depending how the gameengine is coded it could cause the game basically to wait for every participant in the framework chain to finish processing a frame.

so in essence the longer obs takes the more framelag, inputlag you get in game. It also happens with the source engine aka apex legends and csgo. even tough csgo the effect might be smaller do to insane amount of frames produced.

so streaming now native reduces the time OBS needs not the resources. you still might have plenty resources left over. doesnt help.

i was experimenting a lot because i run 1440p at 240hz so i cannot use capture cards and cloning to a capture card is a hole different input lag rtabbit hole you really dont wanna go into. its worse.

so i found a solution. i run NDI screen capture (not hx) and use NDI bridge localmode (no transcode encoder setting) then sue obs to take the bridge signal.

this way encoding and capture is decoupled. the bdige basically works like a proxy. and tthis solved yall my input lag problems down to a utter minimum. if you use NDI direct to OBS then ndi will wait for obs to process and windows api waits for ndi. same food chain again. so bridge is needed and does the trick

so i will propose a feature to OBS devs to make kind of an internal decoupler/bdige(proxy for screengrab to eliminate gamelag while recording/streaming
 

koala

Active Member
@FightinCowboy You're using an inferior rescaling function. Currently, you rescale in the encoder settings in Settings->Output->Streaming. This takes place in CPU space and is a bottleneck with high resolutions. Uncheck that option and instead go to Settings->Video and enter the desired output (scaled) resolution here. This rescaling will take place in GPU memory, and as result even the encoding will also completely run in GPU space.

If you rescale with the encoder settings, the raw images are first downloaded to CPU space, rescaled, and re-uploaded to GPU space for the nvenc encoder. Very resource intensive, especially for 4k sources. This is indicated as "15:02:51.892: [jim-nvenc] scaling enabled, falling back to ffmpeg" in your log. Heavy-weight.
If you use the other rescaling, everything will run in GPU space and only the small encoded data will be transferred to CPU space for streaming out to the network. Light-weight.
 

terrorfrog

New Member
scaling even on the cpu is not that resource intensive. a few cpu percent difference at most.
also this would not explain why higher resolutions have better performance as he resclaes assumingly always the same way
 

koala

Active Member
It seems clear for me: native 4k is smooth, because input res = output res = actually no rescaling takes place. 1440 isn't smooth, because rescaling to 2560*1440 = 3.7 mio pixels is too much data for smooth cpu rescaling. 1080 is smooth again, because rescaling 1920*1080 = 2 mio pixels (about half as with 1440p) can be handled fine by cpu rescaling.

Rescaling on the GPU doesn't have this constraint, because the GPU has very efficient functions for this kind of data processing.
 

terrorfrog

New Member
lol koala, not that i would disagree without, i dont. i just have to laught because a bug report on github got shutdown by "competent" mods who blantanly say that rescaling or bitrate is not an expensive task and is done in no time as if it doesnt matter.

and btw its what i said in as first post here, that ratios matter a lot for processing time.

however i have similar effect, even tough its not related to compute power or saturation of resources.
and while i agree that better ratios help and are less expensive the game lag is not cause by lack of resources.

Hell we can see this effect even on cloned displays with SOME game engines. So for example you clone ur display to a capture card, arun nothing on the streaming pc - its fine no added lag (well some but really tiny), you open OBS and record you get lag, you transform to some time expensive task (either higher render time and or higher total processing time) you get massive lag - on the gaming machine.

so obs processing is able to affect the game on the other machine. to me it looks like its windows api DDA or WGC (i dunno what OBS uses in game capture tough). it feels like there is some sort of vsync or pipeline going that causes certain engines to lag the hell out.

editg: ofc its not directly OBS fault, as its anything that would now deal with that capture has similar effects.
however it could be solved in OBS by somehow breaking that chain.

however sadly noone recognize this problem so far as any other similar problem get shut down with "oh its ur computer".
but ive seen this on going for at least 2 years in similar circumstances where OBS capture should not have any influence on game lags
 
Last edited:
Top