Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS screen capture freezes randomly #11435

Open
BartlomiejLewandowski opened this issue Oct 22, 2024 · 6 comments
Open

macOS screen capture freezes randomly #11435

BartlomiejLewandowski opened this issue Oct 22, 2024 · 6 comments

Comments

@BartlomiejLewandowski
Copy link

Operating System Info

macOS 14

Other OS

No response

OBS Studio Version

30.2.3

OBS Studio Version (Other)

No response

OBS Studio Log URL

https://obsproject.com/logs/TOdgwuvLpRtJSDOQ

OBS Studio Crash Log URL

No response

Expected Behavior

Recording and screen capture working without issues

Current Behavior

Randomly, but happens quite often, the macOSScreenCap source no longer updates when the screen is being updated.
The workaround is to open the properties of the source and click on Restart Capture.

The UI is updated to show the latest capture and everything works smoothly. Until it happens again.

Steps to Reproduce

  1. Add source - screen capture on a mac
  2. Wait some time
  3. The capture no longer updates when the screen changes

Anything else we should know?

Interestingly after clicking the button (restart capture) is disabled. Is it only enabled when we detect something is wrong?
I'd like to understand where the issue is.

@jcm93
Copy link
Contributor

jcm93 commented Oct 22, 2024

This has been kind of a known issue since SCK has existed. It used to be prevalent mostly under memory pressure, and so lower memory configurations would run into it more often. It is also known to occur if you have a relatively low amount of free disk space (less free disk space than RAM, for example).

Outside of that, it does seem to still happen semi-randomly after prolonged periods (several hours of recording or streaming).

Important to note that sources freezing if the machine goes to sleep is both known and expected; should be sure that this is not the case on your machine.

Possible dupe of: #8320, #9056

@BartlomiejLewandowski
Copy link
Author

Yes, I'm recording a workshop, so I'm on the machine the whole time. Can you shed some light on the code behind disabling the Restart Capture button? When does the state of that button change?

@jcm93
Copy link
Contributor

jcm93 commented Oct 23, 2024

Restart Capture is only activated in cases where OBS explicitly receives a "the stream stopped" message from ScreenCaptureKit (the underlying API); i.e. SCK reported an error, or the user pressed Apple's little extra menu bar control to stop the capture.

In the cases where captures freeze inexplicably, most frequently the cause is replayd (the system process associated with screen capture) crashing (though not always). When replayd crashes, no error reaches OBS and so OBS is not aware that the capture has stopped; it pretty much just stops receiving frames.

@BartlomiejLewandowski
Copy link
Author

Can OBS detect that no new frames are being received while it expect those to arrive? It sounds like a more robust solution, instead of reacting on a error that might never arrive.

@jcm93
Copy link
Contributor

jcm93 commented Oct 24, 2024

There are many situations in normal operation where you won't receive a new frame for a prolonged period of time. SCK only delivers frames when there are actual updates, to remain efficient. Differentiating between a situation where content is temporarily static versus one where a stream has frozen would be very nontrivial.

One approach might be to try and closely monitor replayd to see if it crashes, but there isn't a great way to do that, and moreover, that shouldn't really be OBS's job; the system should just be more reliable.

I would confirm that you have ample free disk space, more than you ought to need, and see if that alleviates the issue for you. I'd also file feedback with Apple, since the issue here ultimately lies with them.

@BartlomiejLewandowski
Copy link
Author

I agree, wasn't aware that the stream doesn't contain some sort of a keepalive. I'll file feedback then. Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants