gstreamer-send
gstreamer-send is a simple application that shows how to send video to your browser using Pion WebRTC and GStreamer.
Instructions
Install GStreamer
This example requires you have GStreamer installed, these are the supported platforms
Debian/Ubuntu
sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-plugins-good
Windows MinGW64/MSYS2
pacman -S mingw-w64-x86_64-gstreamer mingw-w64-x86_64-gst-libav mingw-w64-x86_64-gst-plugins-good mingw-w64-x86_64-gst-plugins-bad mingw-w64-x86_64-gst-plugins-ugly
macOS
brew install gst-plugins-good gst-plugins-ugly pkg-config && export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"
Download gstreamer-send
export GO111MODULE=on
go install github.com/pion/example-webrtc-applications/v3/gstreamer-send@latest
Open gstreamer-send example page
jsfiddle.net you should see two text-areas and a 'Start Session' button
Run gstreamer-send with your browsers SessionDescription as stdin
In the jsfiddle the top textarea is your browser, copy that and:
Linux/macOS
Run echo $BROWSER_SDP | gstreamer-send
Windows
- Paste the SessionDescription into a file.
- Run
gstreamer-send < my_file
Copy the text that gstreamer-send
just emitted and copy into second text area
Hit 'Start Session' in jsfiddle, enjoy your video!
A video should start playing in your browser above the input boxes, and will continue playing until you close the application.
Congrats, you have used Pion WebRTC! Now start building something cool
Customizing your video or audio
gstreamer-send
also accepts the command line arguments -video-src
and -audio-src
allowing you to provide custom inputs.
When prototyping with GStreamer it is highly recommended that you enable debug output, this is done by setting the GST_DEBUG
enviroment variable.
You can read about that here a good default value is GST_DEBUG=*:3
You can also prototype a GStreamer pipeline by using gst-launch-1.0
to see how things look before trying them with gstreamer-send
for the examples below you
also may need additional setup to enable extra video codecs like H264. The output from GST_DEBUG should give you hints
These pipelines work on Linux, they may have issues on other platforms. We would love PRs for more example pipelines that people find helpful!
-
a webcam, with computer generated audio.
echo $BROWSER_SDP | gstreamer-send -video-src "autovideosrc ! video/x-raw, width=320, height=240 ! videoconvert ! queue"
-
a pre-recorded video, sintel.mkv is available here
echo $BROWSER_SDP | gstreamer-send -video-src "uridecodebin uri=file:///tmp/sintel.mkv ! videoscale ! video/x-raw, width=320, height=240 ! queue " -audio-src "uridecodebin uri=file:///tmp/sintel.mkv ! queue ! audioconvert"