• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2#
3# A simple RTP receiver
4#
5#  receives H264 encoded RTP video on port 5000, RTCP is received on  port 5001.
6#  the receiver RTCP reports are sent to port 5005
7#  receives alaw encoded RTP audio on port 5002, RTCP is received on  port 5003.
8#  the receiver RTCP reports are sent to port 5007
9#
10#             .-------.      .----------.     .---------.   .-------.   .-----------.
11#  RTP        |udpsrc |      | rtpbin   |     |h264depay|   |h264dec|   |xvimagesink|
12#  port=5000  |      src->recv_rtp recv_rtp->sink     src->sink   src->sink         |
13#             '-------'      |          |     '---------'   '-------'   '-----------'
14#                            |          |
15#                            |          |     .-------.
16#                            |          |     |udpsink|  RTCP
17#                            |    send_rtcp->sink     | port=5005
18#             .-------.      |          |     '-------' sync=false
19#  RTCP       |udpsrc |      |          |               async=false
20#  port=5001  |     src->recv_rtcp      |
21#             '-------'      |          |
22#                            |          |
23#             .-------.      |          |     .---------.   .-------.   .-------------.
24#  RTP        |udpsrc |      | rtpbin   |     |pcmadepay|   |alawdec|   |autoaudiosink|
25#  port=5002  |      src->recv_rtp recv_rtp->sink     src->sink   src->sink           |
26#             '-------'      |          |     '---------'   '-------'   '-------------'
27#                            |          |
28#                            |          |     .-------.
29#                            |          |     |udpsink|  RTCP
30#                            |    send_rtcp->sink     | port=5007
31#             .-------.      |          |     '-------' sync=false
32#  RTCP       |udpsrc |      |          |               async=false
33#  port=5003  |     src->recv_rtcp      |
34#             '-------'      '----------'
35
36# the destination machine to send RTCP to. This is the address of the sender and
37# is used to send back the RTCP reports of this receiver. If the data is sent
38# from another machine, change this address.
39DEST=127.0.0.1
40
41# this adjusts the latency in the receiver
42LATENCY=200
43
44# the caps of the sender RTP stream. This is usually negotiated out of band with
45# SDP or RTSP. normally these caps will also include SPS and PPS but we don't
46# have a mechanism to get this from the sender with a -launch line.
47VIDEO_CAPS="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264"
48AUDIO_CAPS="application/x-rtp,media=(string)audio,clock-rate=(int)8000,encoding-name=(string)PCMA"
49
50VIDEO_DEC="rtph264depay ! avdec_h264"
51AUDIO_DEC="rtppcmadepay ! alawdec"
52
53VIDEO_SINK="videoconvert ! autovideosink"
54AUDIO_SINK="audioconvert ! audioresample ! autoaudiosink"
55
56gst-launch-1.0 -v rtpbin name=rtpbin latency=$LATENCY                                  \
57     udpsrc caps=$VIDEO_CAPS port=5000 ! rtpbin.recv_rtp_sink_0                       \
58       rtpbin. ! $VIDEO_DEC ! $VIDEO_SINK                                             \
59     udpsrc port=5001 ! rtpbin.recv_rtcp_sink_0                                       \
60         rtpbin.send_rtcp_src_0 ! udpsink port=5005 host=$DEST sync=false async=false \
61     udpsrc caps=$AUDIO_CAPS port=5002 ! rtpbin.recv_rtp_sink_1                       \
62       rtpbin. ! $AUDIO_DEC ! $AUDIO_SINK                                             \
63     udpsrc port=5003 ! rtpbin.recv_rtcp_sink_1                                       \
64         rtpbin.send_rtcp_src_1 ! udpsink port=5007 host=$DEST sync=false async=false
65