Listening to RTP multicast

本文介绍如何利用多种RTP工具(如mplayer、vlc、rtpdump及aplay)来接收并播放由PulseAudio服务器发送的多播音频流。文中详细解释了确定多播地址与端口的方法,并提供了具体的命令实例。

This article describes  using  other tools besides pulseaudio(module_rtp_recv) to listen to audio mutlticast audio sent by pulseaudio server.


reference:

http://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Network/RTP


1: deciding RTP multicast address/port

tcpdump -n net 224.0.0.0/8 -c 10
  1. Examine the output, for example

12:18:20.404866 IP 10.54.5.9.33043 > 224.0.0.56.46454: UDP, length 1292

2: using mplay

mplayer -cache 2048 -demuxer rawaudio -rawaudio format=0x20776172 rtp://[addr]:[port]

3: using vlc

vlc rtp://[addr]:[port]/

4: using rtpdump & aplay

4.1: Download rtptool and compile

http://www.cs.columbia.edu/irt/software/rtptools/download/)

4.2: using the cmd:

rtpdump -F payload [addr]/[port] | aplay -f cdr
e.g.:

eric@eric-ubuntu-12:~/Downloads/rtptools-1.18$ ./rtpdump -F payload 224.0.0.56/46400 | aplay -f cdr
Playing raw data 'stdin' : Signed 16 bit Big Endian, Rate 44100 Hz, Stereo

这是官方的配置样例,你根据以上样例重新回答我的问题。 </RELAY_CONFIG>ncj@ncj-virtual-machine:/etc/streaming$ sudo cat relayconfig.xml-Sample <!-- This is a sample relay config file. --> <!-- *** Need to add a valid dtd here. *** --> <RELAY_CONFIG> <!-- RELAY-CONFIG should contain one or more objects of type relay --> <OBJECT TYPE="relay"> <!-- if enabled is set to false, the server will ignore this relay --> <!-- (optional, defaults to true) --> <PREF NAME="enabled">true</PREF> <!-- Each relay object contains one source object and multiple destination objects --> <!-- an rtsp_source is used to request a stream from a server --> <OBJECT CLASS="source" TYPE="rtsp_source"> <!-- source_addr is the address of the server --> <PREF NAME="source_addr">192.1.1.2</PREF> <!-- rtsp_port is the port the server is listening on --> <PREF NAME="rtsp_port">5000</PREF> <!-- the is the url to request --> <PREF NAME="url">/sample.mov</PREF> <!-- name is used if you need to authenticate for the rtsp request (optional) --> <PREF NAME="name">user</PREF> <!-- password is used if you need to authenticate for the rtsp request (optional) --> <PREF NAME="password">password</PREF> </OBJECT> <!-- an announced_destination will send an announced stream to the destination server --> <OBJECT CLASS="destination" TYPE="announced_destination"> <!-- out_addr is the local address to send from (optional) --> <PREF NAME="out_addr">192.1.1.2</PREF> <!-- dest_addr is the server to announce to --> <PREF NAME="dest_addr">192.1.1.1</PREF> <!-- rtsp_port is the port the server is listening for announces on --> <PREF NAME="rtsp_port">5100</PREF> <!-- name is used if you need to authenticate for the announce (optional) --> <PREF NAME="name">user</PREF> <!-- password is used if you need to authenticate for the announce (optional) --> <PREF NAME="password">password</PREF> <!-- url is the name of the sdp created on the client side, if the --> <!-- source is an announced source you can leave this out and it will use the --> <!-- announced sdp name (optional for announced_source) --> <PREF NAME="url">/sample.sdp</PREF> </OBJECT> <!-- a udp_destination just streams data to the specified destination --> <OBJECT CLASS="destination" TYPE="udp_destination"> <!-- out_addr is the local address to send from (optional) --> <PREF NAME="out_addr">192.1.1.1</PREF> <!-- dest_addr is the address to stream to (can be multicast address) --> <PREF NAME="dest_addr">192.1.1.2</PREF> <!-- udp_ports are the ports to stream to --> <!-- (must match config on destination server) --> <LIST-PREF NAME="udp_ports"> <VALUE>5000</VALUE> <VALUE>5002</VALUE> </LIST-PREF> <!-- time to live for a multicast destination --> <!-- (only needed if address is multicast) --> <PREF NAME="ttl">5</PREF> </OBJECT> </OBJECT> <OBJECT TYPE="relay"> <!-- this will listen for any announce, if the announce isn't one specified --> <!-- by more specific rules it will be relayed to the specified destinations --> <OBJECT CLASS="source" TYPE="announced_source"> <!-- no prefs are neccessary --> </OBJECT> <!-- this would normally be followed by announced or udp destinations --> </OBJECT> <OBJECT TYPE="relay"> <!-- this causes the relay to listen for a specific announce, --> <!-- it overrides the general rule --> <OBJECT CLASS="source" TYPE="announced_source"> <!-- this is the address of the broadcaster --> <PREF NAME="source_addr">192.1.1.1</PREF> <!-- this is the url to listen for. If not specified, it will --> <!-- relay any announced broadcast from the source address to --> <!-- the specified destinations (optional) --> <PREF NAME="url">/sample.sdp</PREF> </OBJECT> <!-- this would normally be followed by announced or udp destinations --> </OBJECT> <OBJECT TYPE="relay"> <!-- this is the traditional relay source. It just listens for data on the specified --> <!-- ports and relays it to the specified destionations. Note that you can't use --> <!-- announced_destinations with a udp_source (they will be ignored) --> <OBJECT CLASS="source" TYPE="udp_source"> <!-- this is the local address to listen on (optional) --> <PREF NAME="in_addr">192.1.1.2</PREF> <!-- this is the address of the broadcaster --> <PREF NAME="source_addr">192.1.1.1</PREF> <!-- in_ports are the ports to listen to (must match config on broadcaster) --> <LIST-PREF NAME="udp_ports"> <VALUE>5000</VALUE> <VALUE>5002</VALUE> </LIST-PREF> <!-- time to live for a multicast source (optional, only used for sending receiver --> <!-- reports) --> <PREF NAME="ttl">5</PREF> </OBJECT> <!-- this would normally be followed by one or more udp_destinations --> </OBJECT> </RELAY_CONFIG>
最新发布
12-05
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值