All Projects → centricular → webrtcsink

centricular / webrtcsink

Licence: MIT License
All-batteries included GStreamer WebRTC producer

Programming Languages

rust
11053 projects
javascript
184084 projects - #8 most used programming language
Svelte
593 projects
python
139335 projects - #7 most used programming language
CSS
56736 projects
HTML
75241 projects
typescript
32286 projects

Projects that are alternatives of or similar to webrtcsink

Brave
Basic Real-time AV Editor - allowing you to preview, mix, and route live audio and video streams on the cloud
Stars: ✭ 474 (+2533.33%)
Mutual labels:  gstreamer, multimedia, live-streaming
Srs
SRS is a simple, high efficiency and realtime video server, supports RTMP, WebRTC, HLS, HTTP-FLV, SRT and GB28181.
Stars: ✭ 16,734 (+92866.67%)
Mutual labels:  multimedia, webrtc, live-streaming
auteur
Live GStreamer node compositor service, implemented in rust
Stars: ✭ 24 (+33.33%)
Mutual labels:  gstreamer, multimedia, live-streaming
Dockerfiles
Optimized media, analytics and graphics software stack images. Use the dockerfile(s) in your project or as a recipe book for bare metal installation.
Stars: ✭ 98 (+444.44%)
Mutual labels:  gstreamer, webrtc
Srt
Secure, Reliable, Transport
Stars: ✭ 1,898 (+10444.44%)
Mutual labels:  multimedia, live-streaming
Gstreamer Rs
GStreamer bindings for Rust - This repository moved to https://gitlab.freedesktop.org/gstreamer/gstreamer-rs
Stars: ✭ 319 (+1672.22%)
Mutual labels:  gstreamer, multimedia
Mediasoup3 Record Demo
Simple Record Demo using Mediasoup 3 and GStreamer
Stars: ✭ 84 (+366.67%)
Mutual labels:  gstreamer, webrtc
Gst Plugin Rs
Rust crate for writing GStreamer plugins and various plugins - This repository moved to https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs
Stars: ✭ 63 (+250%)
Mutual labels:  gstreamer, multimedia
Notes
let me know if my notes help you :D (it's a mess, I know)
Stars: ✭ 119 (+561.11%)
Mutual labels:  gstreamer, webrtc
gstcefsrc
A simple gstreamer wrapper around Chromium Embedded Framework
Stars: ✭ 46 (+155.56%)
Mutual labels:  gstreamer, multimedia
Gstreamer Rockchip
The Gstreamer hardware encoder/decoder plugins for Rockchip platform
Stars: ✭ 86 (+377.78%)
Mutual labels:  gstreamer, multimedia
flutter live
Live streaming player, iOS+Android, RTMP/HTTP-FLV/HLS/WebRTC, by Flutter+SRS.
Stars: ✭ 211 (+1072.22%)
Mutual labels:  webrtc, live-streaming
ros-gst-bridge
a bidirectional ros to gstreamer bridge and utilities for dynamic pipelines
Stars: ✭ 46 (+155.56%)
Mutual labels:  gstreamer, webrtc
docker-nvidia-glx-desktop
MATE Desktop container designed for Kubernetes supporting OpenGL GLX and Vulkan for NVIDIA GPUs with WebRTC and HTML5, providing an open source remote cloud graphics or game streaming platform. Spawns its own fully isolated X Server instead of using the host X server, therefore not requiring /tmp/.X11-unix host sockets or host configuration.
Stars: ✭ 47 (+161.11%)
Mutual labels:  gstreamer, webrtc
easy-voice-call
A self-hosting voice chating App
Stars: ✭ 30 (+66.67%)
Mutual labels:  webrtc
gst-plugin-ndi
GStreamer NDI Plugin for Linux
Stars: ✭ 94 (+422.22%)
Mutual labels:  gstreamer
udpeer
A simple UDP peer to peer networking proxy using webrtc
Stars: ✭ 19 (+5.56%)
Mutual labels:  webrtc
baresip-webrtc
Baresip WebRTC Demo
Stars: ✭ 33 (+83.33%)
Mutual labels:  webrtc
streamdelay
A delay + dump button for live streams, allowing screening and redaction of explict content.
Stars: ✭ 31 (+72.22%)
Mutual labels:  gstreamer
classroom-demo
Full web application (Angular 7 + Spring Boot 2 + MySQL) making use of OpenVidu
Stars: ✭ 50 (+177.78%)
Mutual labels:  webrtc

webrtcsink

All-batteries included GStreamer WebRTC producer, that tries its best to do The Right Thing™.

Use case

The webrtcbin element in GStreamer is extremely flexible and powerful, but using it can be a difficult exercise. When all you want to do is serve a fixed set of streams to any number of consumers, webrtcsink (which wraps webrtcbin internally) can be a useful alternative.

Features

webrtcsink implements the following features:

  • Built-in signaller: when using the default signalling server (provided as a python script here), this element will perform signalling without requiring application interaction. This makes it usable directly from gst-launch.

  • Application-provided signalling: webrtcsink can be instantiated by an application with a custom signaller. That signaller must be a GObject, and must implement the Signallable interface as defined here. The default signaller can be used as an example.

    An example project is also available to use as a boilerplate for implementing and using a custom signaller.

  • Sandboxed consumers: when a consumer is added, its encoder / payloader / webrtcbin elements run in a separately managed pipeline. This provides a certain level of sandboxing, as opposed to having those elements running inside the element itself.

    It is important to note that at this moment, encoding is not shared between consumers. While this is not on the roadmap at the moment, nothing in the design prevents implementing this optimization.

  • Congestion control: the element levarages transport-wide congestion control feedback messages in order to adapt the bitrate of individual consumers' video encoders to the available bandwidth.

  • Configuration: the level of user control over the element is at the moment quite narrow, as the only interface exposed is control over proposed codecs, as well as their order of priority, and disabling congestion control. Consult gst-inspect=1.0 for more information.

More features are on the roadmap, focusing on mechanisms for mitigating packet loss.

It is important to note that full control over the individual elements used by webrtcsink is not on the roadmap, as it will act as a black box in that respect, for example webrtcsink wants to reserve control over the bitrate for congestion control.

If more granular control is required, applications should use webrtcbin directly, webrtcsink will focus on trying to just do the right thing, although it might expose interfaces to guide and tune the heuristics it employs.

Building

Prerequisites

The element has only been tested for now against GStreamer main.

For testing, it is recommended to simply build GStreamer locally and run in the uninstalled devenv.

Make sure to install the development packages for some codec libraries beforehand, such as libx264, libvpx and libopusenc, exact names depend on your distribution.

git clone --depth 1 --single-branch --branch main https://gitlab.freedesktop.org/gstreamer/gstreamer 
cd gstreamer
meson build
ninja -C build
ninja -C build devenv

Compiling

cargo build

Usage

Open three terminals. In the first, run:

cd signalling
python3 simple-server.py --addr=127.0.0.1 --disable-ssl

In the second, run:

cd www
python3 -m http.server

In the third, run:

export GST_PLUGIN_PATH=$PWD/target/debug:$GST_PLUGIN_PATH
gst-launch-1.0 webrtcsink name=ws videotestsrc ! ws. audiotestsrc ! ws.

When the pipeline above is running succesfully, open a browser and point it to the python server:

xdg-open http://127.0.0.1:8000

You should see an identifier listed in the left-hand panel, click on it. You should see a test video stream, and hear a test tone.

Configuration

The element itself can be configured through its properties, see gst-inspect-1.0 webrtcsink for more information about that, in addition the default signaller also exposes properties for configuring it, in particular setting the signalling server address, those properties can be accessed through the gst::ChildProxy interface, for example with gst-launch:

gst-launch-1.0 webrtcsink signaller::address="ws://127.0.0.1:8443" ..

The signaller object can not be inspected, refer to the source code for the list of properties.

Enable 'navigation' a.k.a user interactivity with the content

webrtcsink implements the GstNavigation interface which allows interacting with the content, for example move with your mouse, entering keys with the keyboard, etc... On top of that a WebRTCDataChannel based protocol has been implemented and can be activated with the enable-data-channel-navigation=true property. The demo implements the protocol and you can easily test this feature, using the wpesrc for example.

As an example, the following pipeline allows you to navigate the GStreamer documentation inside the video running within your web browser (in http://127.0.0.1:8000 if you followed previous steps of that readme):

gst-launch-1.0 wpesrc location=https://gstreamer.freedesktop.org/documentation/ ! webrtcsink enable-data-channel-navigation=true

Testing congestion control

For the purpose of testing congestion in a reproducible manner, a simple tool has been used, I only used it on Linux but it is documented as usable on MacOS too. I had to run the client browser on a separate machine on my local network for congestion to actually be applied, I didn't look into why that was necessary.

My testing procedure was:

  • identify the server machine network interface (eg with ifconfig on Linux)

  • identify the client machine IP address (eg with ifconfig on Linux)

  • start the various services as explained in the Usage section (use GST_DEBUG=webrtcsink:7 to get detailed logs about congestion control)

  • start playback in the client browser

  • Run a comcast command on the server machine, for instance:

    /home/meh/go/bin/comcast --device=$SERVER_INTERFACE --target-bw 3000 --target-addr=$CLIENT_IP --target-port=1:65535 --target-proto=udp
  • Observe the bitrate sharply decreasing, playback should slow down briefly then catch back up

  • Remove the bandwidth limitation, and observe the bitrate eventually increasing back to a maximum:

    /home/meh/go/bin/comcast --device=$SERVER_INTERFACE --stop

For comparison, the congestion control property can be set to disabled on webrtcsink, then the above procedure applied again, the expected result is for playback to simply crawl down to a halt until the bandwidth limitation is lifted:

gst-launch-1.0 webrtcsink congestion-control=disabled

Monitoring tool

An example server / client application for monitoring per-consumer stats can be found here.

License

All code in this repository is licensed under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].