obsproject / obsproject/obs-browser

Frame swap artifacts occurring when HW acceleration enabled and CPU under load

Open
#488 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
904
Forks
267
Avg merge
1d 23h
Merged PRs (30d)
2

Description

Operating System Info

Windows 11

Other OS

Windows 11 & Windows 10

OBS Studio Version

31.1.0-beta2

OBS Studio Version (Other)

31.1.0-beta2 & 31.0.3

OBS Studio Log URL

https://obsproject.com/logs/HsUwuFk33D2Y1Yxw

OBS Studio Crash Log URL

No response

Expected Behavior

The browser source should be rendered artifact-free.

Current Behavior

Below are screencaps showing the 1-frame long artifacts affecting a browser source set to play a 4k60 video above a #00ff00 color source. There are patterns across the different screencaps, but the artifacts are not always the same. These images were captured by screen capturing the OBS preview, but can also be seen on recordings made by the OBS doing the rendering, as well as in decklink output.

Browser hardware acceleration must be enabled for the issue to arise.

The frequency of frames which are effected is proportional to the load that the CPU is under. The CPU core assigned to run OBS compositing is particularly sensitive.

The issue appears either infrequently or not-at-all if the GPU is running 100% (i.e. GPU bottlenecked). In this instance the video will slow/drop frames, but no artificing is minimized. This part was tested changing videos to ones that were hardware decoded vs software, higher and lower bitrates, and different resolutions to affect GPU usage.

The above was found by correlating HW usage in task manager while trying various combos of things we found to make the problem worse.

Things that exacerbate the issue:

  • setting the OBS process priority to idle and unfocusing the window
  • throttling the CPU
  • applying load across the CPU (tested running a multi-core CPU CineBench 2024 benchmark)
  • starting a recording using the software encoder (x264)
  • starting obs virtual camera output
  • starting decklink output

Things that don't seem to affect the issue:

  • pixel format (happens on BGRA, NV12, I420, I444 at least)
  • drop frame (happens on 60 & 59.94 fps)
  • starting a recording using a GPU encoder (NVENC)
  • the specific contents of the browser source, as long as its updating each frame (we have found the same issue with CSS animation-based pages, for example)

The issue was first noticed to happen occasionally on beefy renderer machines with identical hardware to each other, then reproduced on several separate machines, one of which is where the attached logs come from. On those we see several affected frames per second.

We have some renderer machines on slightly different hardware, but running the same software which don't show the issue at all.

Image
Image
Image
Image
Image

Steps to Reproduce
  1. Set OBS to 4k59.94, process priority idle, BGRA video format, Browser Hardware Acceleration enabled.
  2. Create a 4k browser source, and point it to the debug page w/ video you can find here.
  3. Optionally add a green color source underneath to make the issue more clear.
  4. Depending on system specs, the issue may already occasionally appear already.
  5. Try to force the issue by adding one or more of the things from the above list of steps that can make the issue worse. The one thing that always makes it show up for me is the CPU benchmark using Cinebench.
Anything else we should know?

Obviously running CPU benchmarks in the background is not what we're doing in production, so I think its appearing in that scenario when the CPU scheduler puts too much work on one core, leading to more sporadic issues.

At least on the renderers we see the issue, it seems like the compositing, decklink output and browser source all work from one core, even on a 32 thread machine. My speculation is that some point the CPU takes too long to copy the browser texture from the GPU into RAM, and a partial frame is seen.

I'm very keen to explore the issue more with someone who understands the render pipeline better than I do, in the hope we can find a fix.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Begin with the supplied OBS log and the Windows reproduction steps, using the 4K browser source, green color source, and CPU-load conditions described. Compare the affected preview, recording, and Decklink output against the listed controls; done means the browser source renders without frame-swap artifacts when hardware acceleration is enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics, desktop
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.