Hey everyone!
I’m new here and was wondering if anyone has experimented with GStreamer and WebRTC.
Is it possible to use GStreamer to mix multiple video streams from a peer connection into a single grid-style video (and do the same for audio)?
I’m also curious whether this can be done in real time and if there are latency issues to watch out for.
Hi @ggwebrc and welcome!
An easy way to achieve that is by using the webrtcsink & webrtcsrc elements.
A compositing WebRTC producer:
gst-launch-1.0 compositor name=comp sink_1::xpos=320 \
videotestsrc is-live=true pattern=ball ! comp. \
videotestsrc is-live=true ! comp. \
comp. ! webrtcsink run-signalling-server=true
A WebRTC receiver:
gst-launch-1.0 webrtcsrc connect-to-first-producer=true ! autovideosink
Take a look at net/webrtc/README.md · main · GStreamer / gst-plugins-rs · GitLab for more details.
The default latency of the receiver is 200ms (jitter buffer latency).
Thank you for your reply, @fengalin
My goal is to create a bundled peer connection between GStreamer and Janus. The idea is for GStreamer to receive multiple video streams from that peer connection—each corresponding to a different participant—and then mix them into a single composite stream. This combined video would then be sent as one unified output to another party.
Do you think GStreamer is capable of handling this kind of multi-stream mixing and output?
Yes! Take a look at janusvrwebrtcsrc for that. You should be able to combine it with the compositing part from the producer pipeline above.
Hey @fengalin , thanks again for your reply!
I managed to install GStreamer and the plugins you recommended. I’m currently working on a multi-stream video room in Janus, and I’m trying to create a subscriber peer connection from GStreamer to Janus that can receive multiple video tracks through a single peer connection.
However, I’m running into an issue — it seems like I can only receive the video stream that GStreamer itself is sending, rather than the other streams from Janus video room.
I’ve used the commands from this example : janusvrwebrtcsrc