Audio streaming over RTP using the rtpbin plugin of GStreamer


As discovered from the rtp examples published by GStreamer, here’s how you can setup audio streaming using RTP/RTCP, using gstrtpbin. I am using the speex codec.

If you are using different machines, change localhost (at each end) below to hostname or IP address of the other machine.

Receiving end

gst-launch -v gstrtpbin name=rtpbin udpsrc caps="application/x-rtp,media=(string)audio,clock-rate=(int)44100,encoding-name=(string)SPEEX" port=5002 ! rtpbin.recv_rtp_sink_0 rtpbin. ! rtpspeexdepay ! speexdec ! audioconvert ! audioresample ! autoaudiosink udpsrc port=5003 ! rtpbin.recv_rtcp_sink_0 rtpbin.send_rtcp_src_0 ! udpsink port=5007 host=localhost sync=false async=false

Sending end

gst-launch -v gstrtpbin name=rtpbin audiotestsrc ! audioconvert ! speexenc ! rtpspeexpay ! rtpbin.send_rtp_sink_0 rtpbin.send_rtp_src_0 ! udpsink port=5002 host=localhost rtpbin.send_rtcp_src_0 ! udpsink port=5003 host=localhost sync=false async=false udpsrc port=5007 ! rtpbin.recv_rtcp_sink_0

This works on the local LAN, or over the internet if you have a public IP address (you are not behind a NAT).

6 thoughts on “Audio streaming over RTP using the rtpbin plugin of GStreamer

  1. Instead of speex i tried with vorbis by giving the entire configuration caps in the receiving end . But it shows me error as “could not switch codebooks” . Can u help me .

    1. For vorbis compression, unfortunately you have to report 4400 chars of config…. this is a problem related to absent of vorbis inhead information…

    1. You need to install gst-plugins-good package, version 0.10.31.1 or higher. See the plugins page when you have doubt regarding a particular plugin.

      1. Yes..I download and installed.
        Now I have another issue. I cannot add AMRWBENC to the bad plugins. I downloaded the source code and built the .la .lo files. Then i rerun the configure and did a make install for the bad plugin set. But the element is still not found

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