Question / Help Black screen and delay when switching scenes

Jimixter

New Member
We have two Foscam C2M WiFi web cams set up in OBS Studio as media sources. We are using the latest OBS Studio version 25.0.4.

We have two simple scenes set up, one for each camera. When switching between the scenes, there is a 2-3 second delay, during which the screen goes black.

As a workaround, we tried setting up both cameras on the same scene, and hiding one behind the other whilst toggling visibility. Whilst this addressed the black screen issue, there is still a 2-3 second delay in switching, plus any associated overlay text switches without delay and overlaps the text from the other scene.

Previous historic posts have suggested using "global" sources to keep them active in the background, however other recent posts have suggested that all sources in OBS Studio are global anyway.

What is the solution?
 

FerretBomb

Active Member
Post a logfile from a live streaming or recording session where the issue is occurring.
Do be aware that if you are trying to stream a security system for monitoring purposes, there are much more appropriate tools than OBS which are purpose-built for exactly that, and are far less resource-intensive and have far lower hardware requirements. Immediately to mind is ZoneMinder, which I use for just that purpose with my own security system.

The blackscreen sounds like it is taking some time to acquire the videostream feed from the camera. Having both sources on the same scene and still having that delay supports this assumption.
Methods to correct this vary based on the capture source type in use; we'll be able to see that in the logfile though once you've posted one.

Global sources do still exist in OBS Studio, and default to on, but vary by source type and many do not initialize until they've been loaded at least once.
 

Jimixter

New Member
Post a logfile from a live streaming or recording session where the issue is occurring.
Do be aware that if you are trying to stream a security system for monitoring purposes, there are much more appropriate tools than OBS which are purpose-built for exactly that, and are far less resource-intensive and have far lower hardware requirements. Immediately to mind is ZoneMinder, which I use for just that purpose with my own security system.

The blackscreen sounds like it is taking some time to acquire the videostream feed from the camera. Having both sources on the same scene and still having that delay supports this assumption.
Methods to correct this vary based on the capture source type in use; we'll be able to see that in the logfile though once you've posted one.

Global sources do still exist in OBS Studio, and default to on, but vary by source type and many do not initialize until they've been loaded at least once.

I have pasted the log file below, as requested.

This is to live stream two different bird box cameras to platforms such as YouTube, rather than for security purposes.

How can we make sure our media sources are global?

12:36:27.300: [ffmpeg] [udp @ 000001e2f2723f40] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
12:36:27.301: [ffmpeg] [udp @ 000001e2f2724540] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
12:36:27.449: [ffmpeg] [rtsp @ 000001e2e0968e80] setting jitter buffer size to 500
12:36:27.450: [ffmpeg] [udp @ 000001e2f2724040] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
12:36:27.451: [ffmpeg] [udp @ 000001e2f2723740] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
12:36:27.504: [ffmpeg] [rtsp @ 000001e2e0968e80] setting jitter buffer size to 500
12:36:27.852: [ffmpeg] [h264 @ 000001e2ed566600] Reinit context to 1920x1088, pix_fmt: yuv420p
12:36:28.759: [ffmpeg] [h264 @ 000001e2ed5673c0] Reinit context to 1920x1088, pix_fmt: yuv420p
12:36:45.113: User switched to scene 'Cam 02 Scene'
12:36:45.119: [ffmpeg] [tcp @ 000001e2f1b415c0] Starting connection attempt to 192.168.1.77 port 88
12:36:45.137: [ffmpeg] [tcp @ 000001e2f1b415c0] Successfully connected to 192.168.1.77 port 88
12:36:45.194: [ffmpeg] [rtsp @ 000001e2e09694c0] SDP:
12:36:45.194: v=0
12:36:45.194: o=- 1586950520860868 1 IN IP4 192.168.1.77
12:36:45.194: s=IP Camera Video
12:36:45.194: i=videoMain
12:36:45.194: t=0 0
12:36:45.194: a=tool:LIVE555 Streaming Media v2014.02.10
12:36:45.194: a=type:broadcast
12:36:45.194: a=control:*
12:36:45.194: a=range:npt=0-
12:36:45.194: a=x-qt-text-nam:IP Camera Video
12:36:45.194: a=x-qt-text-inf:videoMain
12:36:45.194: m=video 0 RTP/AVP 96
12:36:45.194: c=IN IP4 0.0.0.0
12:36:45.194: b=AS:96
12:36:45.194: a=rtpmap:96 H264/90000
12:36:45.194: a=fmtp:96 packetization-mode=1;profile-level-id=640028;sprop-parameter-sets=Z2QAKKw7UDwBE/LCAAADAAIAAAMAZQg=,aO484QBCQgCEhARMUhuTxXyfk/k/J8nm5MkkLCJCkJyeT6/J/X5PrycmpMA=
12:36:45.194: a=control:track1
12:36:45.194: m=audio 0 RTP/AVP 0
12:36:45.194: c=IN IP4 0.0.0.0
12:36:45.194: b=AS:64
12:36:45.194: a=control:track2

12:36:45.195: [ffmpeg] [udp @ 000001e2f2725240] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
12:36:45.195: [ffmpeg] [udp @ 000001e2f2724740] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
12:36:45.311: [ffmpeg] [rtsp @ 000001e2e09694c0] setting jitter buffer size to 500
12:36:45.311: [ffmpeg] [udp @ 000001e2f2723540] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
12:36:45.312: [ffmpeg] [udp @ 000001e2f2723840] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
12:36:45.335: [ffmpeg] [rtsp @ 000001e2e09694c0] setting jitter buffer size to 500
12:36:46.413: [ffmpeg] [h264 @ 000001e2ed568180] Reinit context to 1920x1088, pix_fmt: yuv420p
12:36:46.919: [ffmpeg] [h264 @ 000001e2ec0bd2c0] Reinit context to 1920x1088, pix_fmt: yuv420p
12:36:51.538: User switched to scene 'Cam 01 Scene'
12:36:51.552: [ffmpeg] [tcp @ 000001e2f1b41b80] Starting connection attempt to 192.168.1.74 port 88
12:36:51.604: [ffmpeg] [tcp @ 000001e2f1b41b80] Successfully connected to 192.168.1.74 port 88
12:36:51.706: [ffmpeg] [rtsp @ 000001e2e096a140] SDP:
12:36:51.706: v=0
12:36:51.706: o=- 1586950585300668 1 IN IP4 192.168.1.74
12:36:51.706: s=IP Camera Video
12:36:51.706: i=videoMain
12:36:51.706: t=0 0
12:36:51.706: a=tool:LIVE555 Streaming Media v2014.02.10
12:36:51.706: a=type:broadcast
12:36:51.706: a=control:*
12:36:51.706: a=range:npt=0-
12:36:51.706: a=x-qt-text-nam:IP Camera Video
12:36:51.706: a=x-qt-text-inf:videoMain
12:36:51.706: m=video 0 RTP/AVP 96
12:36:51.706: c=IN IP4 0.0.0.0
12:36:51.706: b=AS:96
12:36:51.706: a=rtpmap:96 H264/90000
12:36:51.706: a=fmtp:96 packetization-mode=1;profile-level-id=640028;sprop-parameter-sets=Z2QAKKw7UDwBE/LCAAADAAIAAAMAZQg=,aO484QBCQgCEhARMUhuTxXyfk/k/J8nm5MkkLCJCkJyeT6/J/X5PrycmpMA=
12:36:51.706: a=control:track1
12:36:51.706: m=audio 0 RTP/AVP 0
12:36:51.706: c=IN IP4 0.0.0.0
12:36:51.706: b=AS:64
12:36:51.706: a=control:track2

12:36:51.707: [ffmpeg] [udp @ 000001e2f2723a40] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
12:36:51.707: [ffmpeg] [udp @ 000001e2f2723b40] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
12:36:51.807: [ffmpeg] [rtsp @ 000001e2e096a140] setting jitter buffer size to 500
12:36:51.807: [ffmpeg] [udp @ 000001e2f2723940] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
12:36:51.808: [ffmpeg] [udp @ 000001e2f2723740] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
12:36:51.821: [ffmpeg] [rtsp @ 000001e2e096a140] setting jitter buffer size to 500
12:36:51.965: [ffmpeg] [h264 @ 000001e2ec0bd740] Reinit context to 1920x1088, pix_fmt: yuv420p
12:36:53.017: [ffmpeg] [h264 @ 000001e2ec0c0e00] Reinit context to 1920x1088, pix_fmt: yuv420p
12:36:56.466: User switched to scene 'Cam 02 Scene'
12:36:56.469: [ffmpeg] [tcp @ 000001e2f1b415c0] Starting connection attempt to 192.168.1.77 port 88
12:36:56.500: [ffmpeg] [tcp @ 000001e2f1b415c0] Successfully connected to 192.168.1.77 port 88
12:36:56.550: [ffmpeg] [rtsp @ 000001e2f3ec24c0] SDP:
12:36:56.550: v=0
12:36:56.550: o=- 1586950520860868 1 IN IP4 192.168.1.77
12:36:56.550: s=IP Camera Video
12:36:56.550: i=videoMain
12:36:56.550: t=0 0
12:36:56.550: a=tool:LIVE555 Streaming Media v2014.02.10
12:36:56.550: a=type:broadcast
12:36:56.550: a=control:*
12:36:56.550: a=range:npt=0-
12:36:56.550: a=x-qt-text-nam:IP Camera Video
12:36:56.550: a=x-qt-text-inf:videoMain
12:36:56.550: m=video 0 RTP/AVP 96
12:36:56.550: c=IN IP4 0.0.0.0
12:36:56.550: b=AS:96
12:36:56.550: a=rtpmap:96 H264/90000
12:36:56.550: a=fmtp:96 packetization-mode=1;profile-level-id=640028;sprop-parameter-sets=Z2QAKKw7UDwBE/LCAAADAAIAAAMAZQg=,aO484QBCQgCEhARMUhuTxXyfk/k/J8nm5MkkLCJCkJyeT6/J/X5PrycmpMA=
12:36:56.550: a=control:track1
12:36:56.550: m=audio 0 RTP/AVP 0
12:36:56.550: c=IN IP4 0.0.0.0
12:36:56.550: b=AS:64
12:36:56.550: a=control:track2

12:36:56.551: [ffmpeg] [udp @ 000001e2f2724640] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
12:36:56.551: [ffmpeg] [udp @ 000001e2f2725040] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
12:36:56.618: [ffmpeg] [rtsp @ 000001e2f3ec24c0] setting jitter buffer size to 500
12:36:56.618: [ffmpeg] [udp @ 000001e2f2723c40] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
12:36:56.619: [ffmpeg] [udp @ 000001e2f2723640] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
12:36:56.630: [ffmpeg] [rtsp @ 000001e2f3ec24c0] setting jitter buffer size to 500
12:36:57.782: [ffmpeg] [h264 @ 000001e2ec0bf740] Reinit context to 1920x1088, pix_fmt: yuv420p
12:36:58.227: [ffmpeg] [h264 @ 000001e2ec0c0500] Reinit context to 1920x1088, pix_fmt: yuv420p
12:37:02.029: User switched to scene 'Cam 01 Scene'
12:37:02.035: [ffmpeg] [tcp @ 000001e2f1b41b80] Starting connection attempt to 192.168.1.74 port 88
12:37:02.119: [ffmpeg] [tcp @ 000001e2f1b41b80] Successfully connected to 192.168.1.74 port 88
12:37:02.227: [ffmpeg] [rtsp @ 000001e2e09694c0] SDP:
12:37:02.227: v=0
12:37:02.227: o=- 1586950585300668 1 IN IP4 192.168.1.74
12:37:02.227: s=IP Camera Video
12:37:02.227: i=videoMain
12:37:02.227: t=0 0
12:37:02.227: a=tool:LIVE555 Streaming Media v2014.02.10
12:37:02.227: a=type:broadcast
12:37:02.227: a=control:*
12:37:02.227: a=range:npt=0-
12:37:02.227: a=x-qt-text-nam:IP Camera Video
12:37:02.227: a=x-qt-text-inf:videoMain
12:37:02.227: m=video 0 RTP/AVP 96
12:37:02.227: c=IN IP4 0.0.0.0
12:37:02.227: b=AS:96
12:37:02.227: a=rtpmap:96 H264/90000
12:37:02.227: a=fmtp:96 packetization-mode=1;profile-level-id=640028;sprop-parameter-sets=Z2QAKKw7UDwBE/LCAAADAAIAAAMAZQg=,aO484QBCQgCEhARMUhuTxXyfk/k/J8nm5MkkLCJCkJyeT6/J/X5PrycmpMA=
12:37:02.227: a=control:track1
12:37:02.227: m=audio 0 RTP/AVP 0
12:37:02.227: c=IN IP4 0.0.0.0
12:37:02.227: b=AS:64
12:37:02.227: a=control:track2
 

Jimixter

New Member
Would need a screenshot of your settings...
I always setup remote IP cameras as VLC sources using RTSP (Foscam has this as well: https://www.foscam.com/faqs/view.html?id=81) , so that I can control playback and pause/stop. Then in Visibility BehaviourI put "Always play even when not visible".
Please see attached. Happy to use VLC in between the cameras and OBS Studio if it will fix the issue, but otherwise it seems like an additional layer of complexity.
 

Attachments

  • Untitled.jpg
    Untitled.jpg
    96.3 KB · Views: 604

FabriA

New Member
Yes, I'd definitely try the VLC source as a playlist. No added complexity, except that you need to have VLC installed. Works OK also for background music, I use it for a ton of applications.
 

Attachments

  • Cattura.JPG
    Cattura.JPG
    31.7 KB · Views: 359

Jimixter

New Member
Yes, I'd definitely try the VLC source as a playlist. No added complexity, except that you need to have VLC installed. Works OK also for background music, I use it for a ton of applications.
Thank you. Why would VLC potentially eliminate a black screen in between scene changes?

Could you please confirm the additional steps I would need to follow to get this working? i.e.
- Install some sort of VLC plug-in for OBS Studio(?)
- Open and run two instances of VLC, and configure each to point at the respective cameras (how does one do this?)
- Set up new sources to point at the VLC instances

I'm sure the above is wrong, but just to prompt for guidance. I have VLC installed, but have only used it to play .iso files to-date.

I also have an AutoHotKey macro running, to automatically toggle between scenes every 10 seconds. If I use VLC, perhaps this will also do this for me if a "playlist" is set up?
 

Narcogen

Active Member
Because VLC is more performant as an RTSP client. OBS when used as an RTSP client is known to drop the connection and then either not reestablish it, or have a delay reestablishing it (hence the black screen).
 

Jimixter

New Member
Ok so I set up a VLC Video Source for each Foscam C2M WiFi camera, adding the URL of each camera to the respective playlists. I then added each source to it's own scene, and switched between them. And hey presto, I still see a black screen for 1 second when toggling between them.

Any other ideas please?
 

Attachments

  • Untitled2.jpg
    Untitled2.jpg
    82.6 KB · Views: 149

Jimixter

New Member
Ok so I set up a VLC Video Source for each Foscam C2M WiFi camera, adding the URL of each camera to the respective playlists. I then added each source to it's own scene, and switched between them. And hey presto, I still see a black screen for 1 second when toggling between them.

Any other ideas please?
Right, the key appears to be to set the visibility behaviour to "Always play even when not visible". Hopefully this issue is now solved!
 

Attachments

  • Untitled3.jpg
    Untitled3.jpg
    85.9 KB · Views: 335
Top