Skip to content

Conversation

@Sean-Der
Copy link
Owner

@Sean-Der Sean-Der commented Jul 9, 2023

Add WebRTC Simulcast Support

@mpisat
Copy link

mpisat commented Jul 12, 2023

How can we test this? I downloaded latest build from artifacts but I don't see any new option on OBS? A little help? :)

@Sean-Der
Copy link
Owner Author

Thanks for trying it out @mpisat!

I described how to use it here

I am adding support for Advanced Output Simulcast today. I will make sure to post updates on this PR as I work on it.

@Sean-Der Sean-Der force-pushed the simulcast branch 3 times, most recently from 5f24f56 to 16d2f99 Compare July 12, 2023 17:58
@alexthedamager
Copy link

Tested with Broadcast Box - works great! This is very cool indeed.

@ygit
Copy link

ygit commented Jul 13, 2023

Nice! 🥇

@chhofi
Copy link

chhofi commented Jul 14, 2023

Hey @Sean-Der thanks for your great work! I am running the Arm MacOs OBS version and can successfully stream with simulcast enabled to the website. At least that is what I think is happening as all the metrics look good in OBS. On the website I also get the simulcast controls but unfortunately the stream does not load whether I use Safari or Chromium as a browser. What is the best way to debug this further and provide feedback?

@Sean-Der Sean-Der force-pushed the simulcast branch 3 times, most recently from e99b4c3 to ed6dcb6 Compare July 22, 2023 03:46
@SetoKaiba
Copy link

Hi @Sean-Der , I got the same problem as @chhofi .
I tried it with siobud. And this is my settings.
image
It's not loading.
image
It does show the quality levels.
image
When I click stop, it shows this. Is it intended?
image

@Sean-Der
Copy link
Owner Author

Sean-Der commented Aug 5, 2023

Sorry about that @SetoKaiba @chhofi

What encoder are using? Can you try these settings? Does it help if you lower the bitrate? Does it work without Simulcast enabled?

Screenshot 2023-08-05 at 2 48 31 PM

@SetoKaiba
Copy link

SetoKaiba commented Aug 6, 2023

Hi, @Sean-Der .
I use NVIDIA NVENC H.264 before.
I tried with your settings. It's sometimes able to load with green or blur pixels and extra low framerate, maybe 1-5.
But I can't determine whether this is caused by network.

And then I tried it with my local ZLMediaKit server. It's working with OBS WHIP before. It supports simulcast.
I tried with the translate-libdatachannel-to-cpp branch. It's working without simulcast.
I tried with the simulcast branch. It's not working even without simulcast.

And here's the warning I saw from ZLMediaKit logs for simulcast branch.
I didn't enable simulcast.

2023-08-06 16:34:53.251 W [MediaServer] [667-event poller 0] WebRtcTransport.cpp:779 onRtcp | 未识别的sr rtcp包:version:2
padding:0
report_count:0
pt:200(RTCP_SR)
size:28
--------
ssrc:1043019512
ntpmsw:3900299693
ntplsw:1079742464
ntp time:2023-08-06 16:34:53.251
rtpts:3000
packet_count:0
octet_count:0

"未识别的sr rtcp包" means "unrecognized sr rtcp packet".

And also, I found that the stream is registered as _l _m _h in ZLMediaKit even I didn't enable simulcast. Is the checkbox working?
It seems the change of simulcast checkbox need restart of OBS. May be it's a bug.

@SetoKaiba
Copy link

image
Here's the screenshot for using your settings with your server.
And also, I checked the chrome://webrtc-internals with choosing the quality level.
It someimes can be switched to other level. I have never switched to h level.
image

@Sean-Der
Copy link
Owner Author

Sean-Der commented Aug 6, 2023

@SetoKaiba can you try running https://github.com/glimesh/broadcast-box locally?

Just to debug

  • is issue OBS encoding
  • Is issue network
  • Is issue WebRTC implementation

@SetoKaiba
Copy link

@Sean-Der I tried with broadcast-box go run . locally. It's working without problem.

Another small question, I run it with docker in windows. The video is not loaded. But the streaming doesn't report any error.

For ZLMediaKit, I'll try to debug the problem with ZLMediaKit's maintainers. But the ZLMediaKit is working with simulcast. Its demo page run successfully. So it seems to be a compatiblity problem.

Thank you.

@Sean-Der
Copy link
Owner Author

Sean-Der commented Aug 6, 2023

@SetoKaiba thanks for all the testing!

My guess is that we aren't implementing something properly? If you can figure out what ZLMediaKit is looking for I can implement that right away!

tytan652 and others added 18 commits November 26, 2025 13:50
This adds the devices_match function to null monitor to fix linking
issues on linux when pulse audio is disabled.
Fixes obsproject#12810

Signed-off-by: pkv <pkv@obsproject.com>
Improves app shutdown in a few ways, including separating out different
pieces of the OBSBasic close handler into their own functions.

Removes the crash handler sentinel earlier when the main window is closed,
preventing unclean shutdown warnings when a plugin causes issues. While not
ideal, the dialog is not useful when we cannot specify which plugin caused the
problem.

Increases shutdown priority of the main application so that when OBS interrupts
the session ending, CEF is not closed at the same time. This fixes a crash.

Additional safeguards and event handling to try to ensure a smoother shutdown.
Updates targets to be consistent in their order putting uppercase before lowercase
The monitoring deduplication was previously checking at each audio tick
the whole audio tree for Audio Output Capture (AOC) devices used for
monitoring. The profiling did not show any big impact on the audio
callback. But due to reports of a significant slowdown for scenes with
numerous audio sources, we have moved the check on AOC from the audio
thread to the UI thread.

So we implemented obs_source_audio_output_capture_device_changed which
is triggered whenever:
- a monitoring device is changed in Settings > Audio,
- an Audio Output Capture source changes its device or on startup.

This function compares the AOC device with the monitoring device in UI
thread. If they are identical, a signal is sent to the audio thread to
add an audio task updating the AOC duplicating source pointer at the end
of an audio tick.

This triggers monitoring deduplication if the ptr is not NULL.
The calls in the AOC are implemented in next commits.
The rest of the logic in obs-audio.c is the same except on one count,
which is that we check against the muted state of the AOC rather than
its user_muted; with the new logic, muted works better.

Signed-off-by: pkv <pkv@obsproject.com>
For 'wasapi output capture', calls are added when devices are either
changed, started or removed.

The calls trigger checks against the monitoring device.

Signed-off-by: pkv <pkv@obsproject.com>
For 'coreaudio_output_capture', calls are added when devices are either
changed, started or removed.

The calls trigger a check against the monitoring device.

Signed-off-by: pkv <pkv@obsproject.com>
For 'pulse_output_capture', calls are added when devices are either
changed, started or removed.

The calls trigger a check against the monitoring device.

Signed-off-by: pkv <pkv@obsproject.com>
The default device retrieved was the one used for system sounds.
This fixes it by retrieving the one used to output audio.

It seems the bug has been there since the initial writing of this bit of
code (so 2017).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.