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
59.71k stars 7.92k forks source link

Recording Syphon sources produces black screen videos #4873

Closed LordHDL closed 3 years ago

LordHDL commented 3 years ago

Operating System Info

macOS 11.4

Other OS

No response

OBS Studio Version

27.0.0

OBS Studio Version (Other)

No response

OBS Studio Log URL

https://obsproject.com/forum/attachments/2021-05-28-18-06-09-txt.71614/

OBS Studio Crash Log URL

No response

Expected Behavior

Syphon sources should appear correctly in recordings, as they do in the canvas and while streaming.

Current Behavior

Recording Syphon sources produces black screen videos

Steps to Reproduce

  1. Launch a source that is outputting via Syphon, such as the official Simple Server app or after injecting an OpenGL app such as a game.
  2. Choose any recording setting and codec that would normally work for other captured sources. I tend to use libx264rgb and utvideo, but the default x264 encoder will result in this issue as well.
  3. Confirm the source appears correctly in the canvas, then record a video.

Anything else we should know?

I'm not sure when it started, but this bug has been present for at least a few versions. Streaming is unaffected and works normally.

RytoEX commented 3 years ago

If OBS streams captured content correctly, then it is also likely recording captured content correctly. Once it's rendering on the OBS canvas, any output type should be encoding that content.

  1. Does this occur when capturing other sources?
  2. What are you using to view the recording video files?
  3. Have you tried checking the recordings in VLC?
  4. Can you upload a sample video file here?

Edit: Does this occur in OBS Studio 27.0.0 or newer? You reported this issue against OBS Studio 27.0.0, but your log is for OBS Studio 26.1.2.

LordHDL commented 3 years ago

The log is for an older version yes, but the issue has persisted in the newer version as well. Other sources like window and display capture are not affected, the recordings appear correctly. I use ffplay and VLC to view videos and both show me the black screens. Here are two samples, one with a Syphon source and the other with window capture. I didn't change the codecs or settings.

https://user-images.githubusercontent.com/5182602/121759907-f8820180-caf5-11eb-9c75-9b2b705d9def.mp4

https://user-images.githubusercontent.com/5182602/121759916-00da3c80-caf6-11eb-9087-15677dab4964.mp4

RytoEX commented 3 years ago

The log is for an older version yes, but the issue has persisted in the newer version as well. Other sources like window and display capture are not affected, the recordings appear correctly. I use ffplay and VLC to view videos and both show me the black screens. Here are two samples, one with a Syphon source and the other with window capture. I didn't change the codecs or settings.

Then I would like to see the log file for the current version of OBS, as well as for the session that produced the videos you uploaded.

Firefox will not play, load, or download those videos. Chrome also refuses to play them, but at least lets me download them. VLC shows the first video is blank, and shows the second video has content.

I noticed that you're using "Custom Output (FFmpeg)", which we normally do not provide support for as it's regarded as "you're on your own" territory. Does this occur with the normal recording methods in OBS, either Simple Output Mode or Advanced Output Mode with Standard Type? Please provide a screenshot of your "Custom Output (FFmpeg)" settings, and the full text of any Muxer or Encoder Settings, if possible.

Circling back around to this:

or after injecting an OpenGL app such as a game.

As of macOS 10.14 (Mojave), SyphonInject will no longer work on macOS, which means that Game Capture cannot be used. As far as I know, OBS does still support capturing from apps that integrate Syphon. Just to clarify, is this the app you are using for testing?

LordHDL commented 3 years ago

SyphonInject does still work on macOS if you disable SIP, and with this method I've been able to record without issue in the past. These videos were not recorded with an injected app, however. I used the official Simple Server app from the Syphon website, which is provided by the developers. The one you linked is correct. You can also find it here: http://www.syphon.v002.info/

This bug still happens with simple recording and stream encoder settings.

I attached the log from the sample video session.

2021-06-11 20-29-15.txt

LordHDL commented 3 years ago

I figured out the smoking gun. Turns out that this is the culprit.

Screen Shot 2021-06-13 at 09 24 38

I'm not sure when this broke, but setting the color format to anything else will allow proper recordings of Syphon sources. That's not really ideal, but maybe it can point to the part of code that's breaking.

RytoEX commented 3 years ago

That would make some sense as to why it works for streaming. For the streaming encoder, OBS forces the color format to NV12 if the color format is neither NV12 nor I420.

As far as I'm aware from some limited exploration, this appears to fail as far back as OBS 24.0.6 on macOS 10.15 and OBS 23.2.1 on macOS 10.13. Selecting NV12, I420, or I444 as the color format work fine.

It works on OBS 22.0.1. Curiously, OBS 23.0.1 and OBS 23.1.0 don't seem to show the Syphon Client source on the canvas, but it does end up in the recording. OBS 23.2.0-rc1 shows the Syphon Client source on the canvas, but not in the recording.

However, simply enabling "Allow Transparency" on the Syphon Client Source in OBS fixes the issue that you're describing. So something may have changed between OBS 23.1.0 and 23.2.0-rc1, but I'm not sure what, and I'm not sure if we need to address it if "Allow Transparency" solves the issue described here.

LordHDL commented 3 years ago

Hm, interesting. I wonder if allowing transparency affects recording accuracy in any way. So far in my color tests that doesn't seem to be the case.

It works for me when I enable it, but it seems to also make OBS more unstable. Sometimes it crashes upon ending the recording, though I still get the final output from it. I haven't done extended recording tests so I don't know if it remains stable the whole time, but for now it'll suffice as a workaround.

RytoEX commented 3 years ago

Feel free to test the macOS artifact from #4902.