Skip to content

Instantly share code, notes, and snippets.

@mildred
Last active February 23, 2017 11:58
Show Gist options
  • Save mildred/95cb25d42852e76fc136 to your computer and use it in GitHub Desktop.
Save mildred/95cb25d42852e76fc136 to your computer and use it in GitHub Desktop.
Listen to Pulseaudio RTP stream using gstreamer

This ought to be in the wiki

The command line is :

gst-launch-1.0 udpsrc address=224.0.0.56 port=46194 caps="application/x-rtp, media=audio, payload=10, clock-rate=44100" ! .recv_rtp_sink_0 rtpbin ! rtpL16depay ! audioconvert ! audioresample ! alsasink device=hw:0,0

gst-launch-1.0 udpsrc address=224.0.0.56 port=45678 caps="application/x-rtp, media=audio, payload=10, clock-rate=44100" ! .recv_rtp_sink_0 rtpbin ! rtpL16depay ! audioconvert ! audioresample ! alsasink device=hw:1,0

Of course, you adjust the sink how you want and update the port number according to the method given on the above page of the wiki (tcpdump -n net 224.0.0.0/8 -c 10).

Now, how does this pipeline works:

  • udpsrc will listen to the multicast address on the given UDP port (that you have to configure)
  • You have to tell what kind of stream it is (the caps). I found playing the stream using VLC that it was PCM 16bits stereo audio. Looking up RTP constants on the IANA website I found that this corresponded to the stream type 10 (The L16 codec of RFC 3551).
  • rtpbin will manage the rtp session and output a rtp stream
  • rtpL16depay will decode PCM audio and output an audio stream
  • you can do what you want from this point on

References:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment