Stream WebM video over RTP with GStreamer


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.

GStreamer version

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!

7 thoughts on “Stream WebM video over RTP with GStreamer

  1. Thank you very much for the simple instructions. It was very useful to me. I am really new to gstreamer. Could you pls suggest how to send a avi or mpeg file same like in your example over RTP. Thank you.

  2. So you are saying that it is possible to integrate a Gstreamer Pipeline as a transport layer with a SIP protocol application to establish a connection between the two parties that are going to be exchanging media?

    1. SIP messages are usually transported over UDP or TCP, using different port number/connection (i.e. they are out-of-band of audio/video streams). A GStreamer pipeline is most useful for streaming audio/video. It cannot (should not?) be used as a transport layer for SIP.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s