Using UDP Multicast with GStreamer: Difference between revisions

From RidgeRun Developer Wiki
(Created page with 'In this document you will find how to create a network connection using multicast in order for transmit audio and/or video streaming. == Audio Multicast Streaming == In this se...')
 
Line 10: Line 10:


<pre>
<pre>
gst-launch-0.10 filesrc location=<file.mp3> ! mad ! audioconvert ! audioresample ! mulawenc ! rtppcmupay ! udpsink host=<multicast IP address> auto-multicast=true port=<port number>
gst-launch-0.10 filesrc location=<file.mp3> ! mad ! audioconvert ! audioresample ! mulawenc ! rtppcmupay ! udpsink  
host=<multicast IP address> auto-multicast=true port=<port number>
</pre>
</pre>


Line 16: Line 17:


<pre>
<pre>
gst-launch-0.10 udpsrc multicast-group=<multicast IP address> auto-multicast=true port=<port number> caps="application/x-rtp" ! rtppcmudepay ! mulawdec ! alsasink
gst-launch-0.10 udpsrc multicast-group=<multicast IP address> auto-multicast=true port=<port number> caps="application/x-rtp" !
rtppcmudepay ! mulawdec ! alsasink
</pre>
</pre>


On the server side we first used a ''filesrc'' element to set the media audio file we will play (this pipe is only for MP3 audio files), then the file content is passed through a ''mad'' decoder in order to get the audio in raw format. Then we passed this audio through an ''audioconvert'' and an ''audioresample'', this converts the audio to raw audio with a sample rate of 8KHz which is the sample rate necessary to decode the audio to mu-law using the ''mulawdec'' element.  
On the server side we first used a ''filesrc'' element to set the media audio file we will play (this pipe is only for MP3 audio files), then the file content is passed through a ''mad'' decoder in order to get the audio in raw format. Then we pass this audio through an ''audioconvert'' and an ''audioresample'', this converts the audio to raw audio with a sample rate of 8KHz which is the sample rate necessary to decode the audio to mu-law using the ''mulawdec'' element.  


Before we send the audio through the network it is necessary to package it into a rtp package with the correct payload.  
Before we send the audio through the network it is necessary to package it into a rtp package with the correct payload, that is doing by using ''rtppcmupay''.
 
Finally the audio packages are sent to the network by using the ''udpsink'' element. In order to configure the connection as a multicast type it is necessary to activate the udpsink's multicast compatibility and set the multicast IP address and port (from 1024 to 65535).


== Video Multicast Streaming ==
== Video Multicast Streaming ==

Revision as of 22:33, 30 July 2010

In this document you will find how to create a network connection using multicast in order for transmit audio and/or video streaming.

Audio Multicast Streaming

In this section it will be shown how to build a GStreamer pipe for transmit audio information through a multicast network.

The pipes used are the following

Server:

gst-launch-0.10 filesrc location=<file.mp3> ! mad ! audioconvert ! audioresample ! mulawenc ! rtppcmupay ! udpsink 
host=<multicast IP address> auto-multicast=true port=<port number>

Client:

gst-launch-0.10 udpsrc multicast-group=<multicast IP address> auto-multicast=true port=<port number> caps="application/x-rtp" !
rtppcmudepay ! mulawdec ! alsasink

On the server side we first used a filesrc element to set the media audio file we will play (this pipe is only for MP3 audio files), then the file content is passed through a mad decoder in order to get the audio in raw format. Then we pass this audio through an audioconvert and an audioresample, this converts the audio to raw audio with a sample rate of 8KHz which is the sample rate necessary to decode the audio to mu-law using the mulawdec element.

Before we send the audio through the network it is necessary to package it into a rtp package with the correct payload, that is doing by using rtppcmupay.

Finally the audio packages are sent to the network by using the udpsink element. In order to configure the connection as a multicast type it is necessary to activate the udpsink's multicast compatibility and set the multicast IP address and port (from 1024 to 65535).

Video Multicast Streaming