obsproject / obs-studio

OBS Studio - Free and open source software for live streaming and screen recording
https://obsproject.com
GNU General Public License v2.0
60.59k stars 8.01k forks source link

Stutters and screen tearing/worble artifacts with VAAPI on AMD 7000 GPUs #11417

Open BuyMyMojo opened 1 month ago

BuyMyMojo commented 1 month ago

Operating System Info

Other

Other OS

Nobara Linux 40 (7800XT) + NixOS (7900XTX)

OBS Studio Version

Other

OBS Studio Version (Other)

30.2.2 Nobara Build + 30.2.3 NixOS

OBS Studio Log URL

7800XT 7900XTX

OBS Studio Crash Log URL

No response

Expected Behavior

A smooth clean video

Current Behavior

Video has strange screen tearing artifacts in vsynced content and stutters from incorrect frame ordering.

This is what it looks like on my 7800XT: https://www.youtube.com/watch?v=Ttq4xIfv8lM

And this is what it looks like on my friend's 7900XTX:

https://github.com/user-attachments/assets/dec5c0e5-8fa9-4167-8191-c0b845e263d7

Steps to Reproduce

1.Add either some form of display/game capture 2.Set video encoder to VAAPI H264 ffmpeg

  1. profile: high
  2. Level: auto
  3. bitrate: doesn't matter (Tested at 2500, 6000, 7500)
  4. keyframe interval: doesn't matter (Tested at 0 and 2s)
  5. bframes: 0 (Increasing bring on it's own issue, possibly the same issue just worse. look here for more info: #11252)
  6. record moving content, can be a simple camera pan, just something there screen tearing will be ovious

Anything else we should know?

No response

BuyMyMojo commented 1 month ago

These two issues don't seem to appear when using the 3rd party vaapi encoder plugin but the bframe issue does

https://github.com/user-attachments/assets/e955c2c8-53f2-4724-b19d-fbd6656fd8ab

mihawk90 commented 1 month ago

This is a Mesa bug. Update your Mesa since this was fixed in 24.2.3 and 24.3.

BuyMyMojo commented 1 month ago

This is a Mesa bug. Update your Mesa since this was fixed in 24.2.3 and 24.3.

I appear to be running 24.2.3 already

➜  ~ dnf list installed | rg mesa
mesa-dri-drivers.i686                                  24.2.3-1.fc40                                    @nobara-baseos-multilib-40                               
mesa-dri-drivers.x86_64                                24.2.3-1.fc40                                    @nobara-baseos-40                                        
mesa-filesystem.i686                                   24.2.3-1.fc40                                    @nobara-baseos-multilib-40                               
mesa-filesystem.x86_64                                 24.2.3-1.fc40                                    @nobara-baseos-40                                        
mesa-libEGL.i686                                       24.2.3-1.fc40                                    @nobara-baseos-multilib-40                               
mesa-libEGL.x86_64                                     24.2.3-1.fc40                                    @nobara-baseos-40                                        
mesa-libEGL-devel.x86_64                               24.2.3-1.fc40                                    @nobara-baseos-40                                        
mesa-libGL.i686                                        24.2.3-1.fc40                                    @nobara-baseos-multilib-40                               
mesa-libGL.x86_64                                      24.2.3-1.fc40                                    @nobara-baseos-40                                        
mesa-libGL-devel.x86_64                                24.2.3-1.fc40                                    @nobara-baseos-40                                        
mesa-libGLU.i686                                       9.0.3-4.fc40                                     @nobara-baseos-multilib                                  
mesa-libGLU.x86_64                                     9.0.3-4.fc40                                     @nobara-baseos                                           
mesa-libGLU-devel.x86_64                               9.0.3-4.fc40                                     @nobara-baseos-40                                        
mesa-libOSMesa.x86_64                                  24.2.3-1.fc40                                    @nobara-baseos-40                                        
mesa-libOpenCL.x86_64                                  24.2.3-1.fc40                                    @nobara-baseos-40                                        
mesa-libgbm.i686                                       24.2.3-1.fc40                                    @nobara-baseos-multilib-40                               
mesa-libgbm.x86_64                                     24.2.3-1.fc40                                    @nobara-baseos-40                                        
mesa-libgbm-devel.x86_64                               24.2.3-1.fc40                                    @nobara-baseos-40                                        
mesa-libglapi.i686                                     24.2.3-1.fc40                                    @nobara-baseos-multilib-40                               
mesa-libglapi.x86_64                                   24.2.3-1.fc40                                    @nobara-baseos-40                                        
mesa-va-drivers-freeworld.i686                         24.2.3-1.fc40                                    @nobara-appstream-40                                     
mesa-va-drivers-freeworld.x86_64                       24.2.3-1.fc40                                    @nobara-appstream-40                                     
mesa-vdpau-drivers-freeworld.x86_64                    24.2.3-1.fc40                                    @nobara-appstream-40                                     
mesa-vulkan-drivers.i686                               24.2.0-git.20240904.90d91f7.fc40                 @nobara-baseos-multilib-40                               
mesa-vulkan-drivers.x86_64                             24.2.0-git.20240904.90d91f7.fc40                 @nobara-baseos-40

I'm also pretty sure my friend on Nix would also be on the latest they could get

mihawk90 commented 1 month ago

I'm also pretty sure my friend on Nix would also be on the latest they could get

I don't know about your case, since I don't know if Nobara is using any patches to Mesa.

But your friend is on 24.2.2:

16:12:46.246: OpenGL loaded successfully, version 4.6 (Core Profile) Mesa 24.2.2, shading language 4.60

Either way this is not an OBS bug, and GitHub issues aren't used for support. You should head into the Discord or Forums for support.

BuyMyMojo commented 1 month ago

I just built the latest version of mesa to test, issues still persist.

https://obsproject.com/logs/iL7WeVKgK0XYvM2T

Video, still includes momentary stutters from the video going back 2 frames or so:

https://github.com/user-attachments/assets/fa4870cd-bc44-43d9-9c1b-9c4449f1980c

bframe issue still persists too:

https://github.com/user-attachments/assets/91401db9-18d8-43c5-81cc-058589e00051

Slowed down gif from the fiest video (A stuter consisting of a frame tear where the top half appears to be from the future): out

kkartaltepe commented 1 month ago

OBS has no control over tearing, you'll have to file a bug against mesa if their fixes are incomplete. And your capture method is also unsupported and may introduce tearing, please try without any 3rd party plugins.

BuyMyMojo commented 1 month ago

does mesa handle the VAAPI encoder and where can I submit this bug to them?

the screen tearing isn't in the game of the preview, it doesn't happen when encoding with base x264

Eckoa commented 3 weeks ago

I submitted a issue over to the folks of the mesa project and was pointed to head over to those behind the framework (ffmpeg in this case i believe). Ill have to familiarize myself with their bug tracker and will resubmit there. If anyone else comes across this here is the mesa issue

EDIT: I was corrected in that this isnt something generally done by ffmpeg for hw encoders. It seems for the moment it may be best to simply not use b-frames in OBS on AMD hw encoders on linux. Seeing as this doesnt appear to be a Mesa issue and that it doesnt look to be something that can be handled by ffmpeg you can either test to see if b-frames happen to work for you or just avoid them entirely.

https://gitlab.freedesktop.org/mesa/mesa/-/issues/12124

to quote "This happens with high motion. Ideally b-frames should not be used for frames with high motion, but that needs frame analysis and lookahead which can't be done in driver and would have to be done in the framework using VAAPI (ffmpeg, gstreamer, ...)."