In post Live WebM video streaming with Flumotion I discussed how to setup GStreamer with the appropriate WebM plugins, and stream a live WebM feed over HTTP using Flumotion. In this post we’ll see how WebM video can be streamed over RTP using the command line.
The version of source code we use in the previous post has a bug, the rtpvp8pay and rtpvp8depay plugins are not properly built. We’ll have to build the following GStreamer components from the git source code repository. This is not recommended for production deployments, you should wait for a proper release from the GStreamer project.
- GStreamer – git clone git://anongit.freedesktop.org/gstreamer/gstreamer
- Plugins base – git clone git://anongit.freedesktop.org/gstreamer/gst-plugins-base
- Plugins good – git clone git://anongit.freedesktop.org/gstreamer/gst-plugins-good
- Plugins bad – git clone git://anongit.freedesktop.org/gstreamer/gst-plugins-bad
Follow the instructions in post Live WebM video streaming with Flumotion on how to build and install these components.
Stream WebM video over RTP/UDP
Issue the following command to start streaming. We’re using the test video source, but you can use any other source.
gst-launch -v videotestsrc ! vp8enc ! rtpvp8pay ! udpsink host=127.0.0.1 port=9001
Take note of the following information output to the console. We’ll need that to play the stream.
/GstPipeline:pipeline0/GstUDPSink:udpsink0.GstPad:sink: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)VP8-DRAFT-0-3-2, payload=(int)96, ssrc=(uint)1276425242, clock-base=(uint)4009186568, seqnum-base=(uint)60154
In a peer-to-peer application you will probably transmit the parameters after caps above using RTCP, or some other signaling mechanism such as SIP or XMPP.
Receive and play the stream
Issue the following command to play the video stream:
gst-launch udpsrc port=9001 caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)VP8-DRAFT-0-3-2, payload=(int)96, ssrc=(uint)1276425242, clock-base=(uint)4009186568, seqnum-base=(uint)60154" ! rtpvp8depay ! vp8dec ! ffmpegcolorspace ! autovideosink
It really is that simple with GStreamer!