Can't stream with x264 encoder while using AMD graphics card

Proenke

New Member
I couldn't find similar cases on the internet, that's why I'm asking here:

Back then, my combo was:
AMD Ryzen 9 3900XT
Nvidia GeForce GTX 1660 Ti

I decided to stream with x264 and chose following options:
Output: 864p
CBR
6000 Kbps
Keyframe 2s
CPU Preset Fast
Profile High
x264 options rc-lookahead=60 trellis=1 direct-pred=spatial

With those settings, my streams ran flawlessly for 2 years.
No frames missed due to rendering lag
No skipped frames due to encoding lag
In rare cases, dropped frames due to internet connection

Then, I upgraded the graphics card to AMD Radeon RX 7900 XT. OBS Settings are the same, still using x264. And the problem began. I got skipped frames due to encoding lag which indicates an overload for the CPU.

Back then, I used DDU for the exchange but in the meantime, a fresh reinstall of Win10 happened and it didn't help.

My workaround was to reduce the CPU Preset to veryfast but the skipped frames due to encoding lag still exist. Let's say 120 skipped frames after 2 hours.
Doesn't sound that bad but I was used to have 0 at Fast.

Today, I was testing it again and to provide the logs for you.
Win10 22H2
OBS Studio 30.2.3
Same settings as mentioned above.

Jumping around the Overwatch Training area for 1 minute.
"Übersprungene Frames..." means skipped frames...

x264 with AMD GPU

AMD GPU.jpg


x264 with Nvidia GPU

Nvidia GPU.jpg


Why does x264 not work properly with the AMD GPU? I don't see the connection.

Really appreciate your help. Thank you!
 

Attachments

  • Log with AMD GPU.txt
    35.7 KB · Views: 13
  • Log with Nvidia GPU.txt
    22.1 KB · Views: 11
Last edited:

Proenke

New Member
Thanks to the moderator who gave his approval!

Meanwhile, I was asking on discord for help. powerfuldot tried to help me and came to the conclusion that it's up to the AMD GPU.
Well, it seems like but I would like to know the reason. It is known that some software is Nvidia GPU optimized but they actively use the GPU. In my case, it's not. CPU does everything.

Also meanwhile, I fixed "Capture Interference" and "Multiple Game Capture" but it didn't help.
 

rockbottom

Active Member
You set-up looks good but fix your "Spiel" Scene, only (1) Display, Game or Window capture per to avoid interference. Create new Scenes if needed.

So there's now 4.6% encoding lag, previously it was 0.

Your system did have some audio lag when the 1660TI was in there, looks worse now. Not sure if that's all the result of system overload or that surround sound set-up that's running.

Assuming you are running the game with the same settings as you were with the 1660. The 7900XT could be playing a part. It's way more powerful & that also adds additional load to the CPU, especially with the 144 refresh rate. Try knocking it down to 120 or even 60HZ & see if that frees up some CPU to knock down that lag. You may need to just switch to the Very Fast preset.
 

rockbottom

Active Member
Video thread doesn't look so good with the 7900 but it looked great with the 1660TI.

Did you DDU the old Nvidia driver prior to removing the GPU? Was the PC disconnected from the internet during the entire installation process & through driver installation? No idea what you did but there could be a driver conflict.

7900 XT
09:37:22.056: video_thread(video): min=0.558 ms, median=0.708 ms, max=288.287 ms, 99th percentile=37.754 ms
09:37:22.056: ┗receive_video: min=0.555 ms, median=0.706 ms, max=288.286 ms, 99th percentile=40.217 ms
09:37:22.056: ┗do_encode: min=0.555 ms, median=0.706 ms, max=288.285 ms, 99th percentile=40.217 ms
09:37:22.056: ┣encode(advanced_video_stream): min=0.545 ms, median=0.691 ms, max=288.261 ms, 99th percentile=40.193 ms
09:37:22.056: ┗send_packet: min=0.002 ms, median=0.011 ms, max=0.352 ms, 99th percentile=0.032 ms

1660TI
10:43:10.631: video_thread(video): min=0.002 ms, median=0.758 ms, max=80.743 ms, 99th percentile=1.562 ms
10:43:10.631: ┗receive_video: min=0 ms, median=0.756 ms, max=80.74 ms, 99th percentile=1.56 ms
10:43:10.631: ┗do_encode: min=0.575 ms, median=0.756 ms, max=80.74 ms, 99th percentile=1.559 ms
10:43:10.631: ┣encode(advanced_video_stream): min=0.57 ms, median=0.742 ms, max=80.724 ms, 99th percentile=1.53 ms
10:43:10.631: ┗send_packet: min=0.003 ms, median=0.01 ms, max=0.191 ms, 99th percentile=0.025 ms
 

rockbottom

Active Member
I'm fairly certain the encoding lag will go away after the video thread is improved & where it should be. Seems the lag is more the result of the frame not being available & ready for the encoder in time consistently.
 

Proenke

New Member
First of all, thanks for your input!

Your system did have some audio lag when the 1660TI was in there, looks worse now. Not sure if that's all the result of system overload or that surround sound set-up that's running.

Those are the speakers. They are rarely used while streaming. The test I'll mention later is done with USB Headset as input/output audio source.

Assuming you are running the game with the same settings as you were with the 1660. The 7900XT could be playing a part. It's way more powerful & that also adds additional load to the CPU, especially with the 144 refresh rate. Try knocking it down to 120 or even 60HZ & see if that frees up some CPU to knock down that lag. You may need to just switch to the Very Fast preset.

Do you also assume I play now with higher FPS with 7900XT? Should have mention it, that is not the case. Both 1660Ti and 7900XT work with a frame limiter set at 144 FPS. So 144 Hz and max. 144 FPS. So from my understanding, the load to the CPU is the same.
But I did the test with 60 Hz and frame limiter set to 60 FPS. Mention it later.

Did you DDU the old Nvidia driver prior to removing the GPU? Was the PC disconnected from the internet during the entire installation process & through driver installation? No idea what you did but there could be a driver conflict.

Yes and yes. And even a fresh reinstall of Win10 with 7900XT didn't help. So, it can't be a driver conflict.



I followed your suggestion. I put the monitor down to 60 Hz, put Overwatch down to 60 Hz and set the frame limiter to 60 FPS.
Done with USB Headset.
Same OBS settings like in my first post.
Result: 3,7 % encoding lag.
Log attached.



Has video thread something to do with the AMD GPU encoder?
 

Attachments

  • 60Hz60FPS.txt
    22.5 KB · Views: 10

rockbottom

Active Member
Yeah, it appears to be the GPU causing your pain. It could be many things. Since you just switched, it's more than likely a driver conflict or the GPU may not be seated correctly or maybe even defective.

If you powered up the PC with the internet connected after installing the 7900 , Windows more than likely installed a driver before it even got to the sign in screen.
 

rockbottom

Active Member
HDR is enabled on the LG, kill it. Color conversion is mucking up the works.

20:37:06.864: name=LG ULTRAGEAR
20:37:06.864: pos={0, 0}
20:37:06.864: size={1920, 1080}
20:37:06.864: attached=true
20:37:06.864: refresh=60
20:37:06.864: bits_per_color=10
 

rockbottom

Active Member
Spiel still has a game & window capture.

Glad I went back through that new log, I missed that HDR crap last night/first time through. You should see big improvement with it disabled.
 

Proenke

New Member
Yeah, it appears to be the GPU causing your pain. It could be many things. Since you just switched, it's more than likely a driver conflict or the GPU may not be seated correctly or maybe even defective.

I think the easiest way is to test it with another AMD card. That's my job for the next weeks.

If you powered up the PC with the internet connected after installing the 7900 , Windows more than likely installed a driver before it even got to the sign in screen.

That's not the case. After DDU, the driver was "Microsoft Basic Display Adapter". Still without internet, I installed AMDs newest driver, then restarted PC. After the log in, I plugged in my USB WLAN Adapter. There can't be another driver in between.

HDR is enabled on the LG, kill it.

It is always disabled.

1727296963653.png


I was quick-testing around with RGB and YCbCr and the different bpc. No changes, still losing to encoding lag. I spare the logs.

Spiel still has a game & window capture.

I deleted window capture. No changes.
 

rockbottom

Active Member
The 1660TI was the perfect mate for your CPU. Hope you're getting paid to test those AMD GPU's.

Yeah, deleting Window capture from that Scene won't help with lag but it corrected a set-up error.
 

Proenke

New Member
It's being reported as 10-bit video, HDR. Auto HDR overrides Windows, check your monitor for it/disable it.

Even OSD of LG monitor says it's off

1727299031662.jpeg


The 1660TI was the perfect mate for your CPU. Hope you're getting paid to test those AMD GPU's.

Yeah, deleting Window capture from that Scene won't help with lag but it corrected a set-up error.

Don't worry. I will find ways. Either I stay with AMD or I swap to Nvidia.

Back then, I tested with 3900XT and 1660Ti how slow I can set the CPU Preset. At slow or slower I started to lose frames because all 24 threads had usage of 80-90 %. That's why I took "Fast" as sweet spot and it was running fine for 2 years.
Now due to 7900XT graphics card, I lose frames with x264 but CPU doesn't have high-percentage usage. It's rather bored.

It's just burdensome that this has happened with this specific graphics card.

When another one reports this issue, he will hopefully find this thread.

Again, thank you for your help, rockbottom!

I keep you updated!
 

rockbottom

Active Member
Something is causing the video to be reported as 10-bit. The OBS log & your Windows screenshot above show 10-bit & they should be reporting 8-bit. Maybe the monitor needs to be reset. Unplugging the monitor &/or disconnecting/re-connecting to the GPU can clear issues.
 

Proenke

New Member
I have something under suspicion: The RX 7000 series is the first ever graphic cards line with a multi chiplet design. RX 7900 XT with one chip, cut into 5 multi-chip modules. I think that's causing the latency as the modules have to communicate with each other. Only RX 7600 (XT) got a monolithic design like older AMD cards and all Nvidia cards.
RX 7600 has been ordered. Should arrive on Wednesday.
 

Proenke

New Member
My suspicion is wrong. The RX 7600 with its monolithic design behaves equally like the RX 7900 XT.

12:37:26.556: Video stopped, number of skipped frames due to encoding lag: 210/4632 (4.5%)
12:39:29.614: video_thread(video): min=0.548 ms, median=0.728 ms, max=262.907 ms, 99th percentile=68.335 ms
12:39:29.614: ┗receive_video: min=0.548 ms, median=0.727 ms, max=262.905 ms, 99th percentile=65.135 ms
12:39:29.614: ┗do_encode: min=0.548 ms, median=0.726 ms, max=262.905 ms, 99th percentile=65.135 ms
12:39:29.614: ┣encode(advanced_video_stream): min=0.54 ms, median=0.71 ms, max=262.881 ms, 99th percentile=65.115 ms
12:39:29.614: ┗send_packet: min=0.002 ms, median=0.013 ms, max=0.295 ms, 99th percentile=0.036 ms
Either it is the RX 7000 series at all (RDNA 3) or the AMD graphics driver. You would have to test it with former generations (6000/5000/Vega/500/...) but I won't do this.

My next test was to get a Nvidia card. RTX 4070. And look at this:

01:23:36.449: video_thread(video): min=0.567 ms, median=0.775 ms, max=91.602 ms, 99th percentile=1.155 ms
01:23:36.449: ┗receive_video: min=0.566 ms, median=0.773 ms, max=91.599 ms, 99th percentile=1.152 ms
01:23:36.449: ┗do_encode: min=0.565 ms, median=0.772 ms, max=91.598 ms, 99th percentile=1.151 ms
01:23:36.449: ┣encode(advanced_video_stream): min=0.558 ms, median=0.757 ms, max=91.583 ms, 99th percentile=1.136 ms
01:23:36.449: ┗send_packet: min=0.002 ms, median=0.01 ms, max=0.375 ms, 99th percentile=0.032 ms
0 skipped frames due to encoding lag as there is no time stamp. It works perfectly like with GTX 1660 Ti.


Conclusion:
Streaming with x264 encoder works perfectly with Nvidia, works so-so with AMD.
Of course, you can stream with x264 encoder with AMD. It's just that you have to stick to veryfast preset although your CPU is much more powerful. The moment you add x264 options and/or choose or slower preset than veryfast, you lose frames.

The loss at veryfast with x264 options can be negligible for many people as you lose randomly 1 frame in 1 sec. That specific second had been streamed with 59 frames. No one will notice that.
However, it's over when you use a more demanding CPU preset.

Thanks again for your help!
 

Attachments

  • RX7600.txt
    25.2 KB · Views: 5
  • RTX4070_1.txt
    30.6 KB · Views: 5

rockbottom

Active Member
Better but you should test without the LG connected or get it fixed, it's still stuck @ 10-bit & the unnecessary color conversion is adding extra load on your system.

00:57:02.927: name=LG ULTRAGEAR
00:57:02.927: pos={0, 0}
00:57:02.927: size={1920, 1080}
00:57:02.927: attached=true
00:57:02.927: refresh=144
00:57:02.927: bits_per_color=10
00:57:02.927: space=RGB_FULL_G22_NONE_P709
 

rockbottom

Active Member
Profiler results from the logs are similar until:

7600
12:39:29.614: video_thread(video): min=0.548 ms, median=0.728 ms, max=262.907 ms, 99th percentile=68.335 ms
12:39:29.614: ┗receive_video: min=0.548 ms, median=0.727 ms, max=262.905 ms, 99th percentile=65.135 ms
12:39:29.614: ┗do_encode: min=0.548 ms, median=0.726 ms, max=262.905 ms, 99th percentile=65.135 ms
12:39:29.614: ┣encode(advanced_video_stream): min=0.54 ms, median=0.71 ms, max=262.881 ms, 99th percentile=65.115 ms
12:39:29.614: ┗send_packet: min=0.002 ms, median=0.013 ms, max=0.295 ms, 99th percentile=0.036 ms

4070
01:23:36.449: video_thread(video): min=0.567 ms, median=0.775 ms, max=91.602 ms, 99th percentile=1.155 ms
01:23:36.449: ┗receive_video: min=0.566 ms, median=0.773 ms, max=91.599 ms, 99th percentile=1.152 ms
01:23:36.449: ┗do_encode: min=0.565 ms, median=0.772 ms, max=91.598 ms, 99th percentile=1.151 ms
01:23:36.449: ┣encode(advanced_video_stream): min=0.558 ms, median=0.757 ms, max=91.583 ms, 99th percentile=1.136 ms
01:23:36.449: ┗send_packet: min=0.002 ms, median=0.01 ms, max=0.375 ms, 99th percentile=0.032 ms
 

Nite_

New Member
Hello,
I signed up on the forum specifically for your post because I noticed the same thing, but I didn't necessarily push the tests as you did (I only have an old graphics card, the 5700XT). A few months ago, I switched from StreamlabsOBS to OBS, on principle (I prefer to use the "real" software rather than a version that is based on another and may add things that I don't necessarily need).
Already, I could see that OBS's statistics were far more complete than SlOBS (streamlabs OBS). Four little global indicators (CPU load in percentage / FPS / dropped frames / bitrate) compare with a big statistics window on OBS that covers all network and encoder-related data.
But above all, I quickly noticed the "Skipped frames due to encoding lag" section, which wasn't problematic (the stream wasn't choppy, no major issues) but it hovered around 0.1% at the end of each stream. I had never managed to understand why, even after doing tests, lowering the settings (bitrate, presets, etc.), nothing worked, always a small percentage of frames skipped.
Your topic roughly confirms my tests, the veryfast preset is the best setting where the missing frame is the least noticeable and the percentages stay at the "lowest level" but there are still frame drops.
Initially, I thought the issue was caused by the various capture sources (I had one for games using Game Capture, another for my HD60S capture card, and a third for windows, Window Capture). I read that this could lead to frame skipping. So, I created two identical scenes, each with a single capture source, but it didn't make any difference.
It might be interesting to create a thread on the AMD subreddit with your data and feedback, especially those from the video_thread.
these encoding delays without any particular reason are really strange !
 
Top