• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2#
3# A simple RTP server with retransmission
4#  sends the output of videotestsrc as h264 encoded RTP on port 5000, RTCP is sent on
5#  port 5001. The destination is 127.0.0.1.
6#  the video receiver RTCP reports are received on port 5005
7#
8#  .-------.    .-------.    .-------.      .----------.     .-------.
9#  |videots|    |h264enc|    |h264pay|      | rtpbin   |     |udpsink|  RTP
10#  |      src->sink    src->sink    src->send_rtp send_rtp->sink     | port=5000
11#  '-------'    '-------'    '-------'      |          |     '-------'
12#                                           |          |
13#                                           |          |     .-------.
14#                                           |          |     |udpsink|  RTCP
15#                                           |    send_rtcp->sink     | port=5001
16#                            .-------.      |          |     '-------' sync=false
17#                 RTCP       |udpsrc |      |          |               async=false
18#               port=5005    |     src->recv_rtcp      |
19#                            '-------'      '----------'
20#
21# ideally we should transport the properties on the RTP udpsink pads to the
22# receiver in order to transmit the SPS and PPS earlier.
23
24# change this to send the RTP data and RTCP to another host
25DEST=127.0.0.1
26
27# tuning parameters to make the sender send the streams out of sync. Can be used
28# ot test the client RTCP synchronisation.
29#VOFFSET=900000000
30VOFFSET=0
31AOFFSET=0
32
33# H264 encode from the source
34VELEM="videotestsrc is-live=1 horizontal-speed=1"
35VCAPS="video/x-raw,width=352,height=288,framerate=15/1"
36VSOURCE="$VELEM ! $VCAPS"
37VENC="x264enc tune=zerolatency bitrate=300 ! rtph264pay config-interval=2"
38
39VRTPSINK="udpsink port=5000 host=$DEST ts-offset=$VOFFSET name=vrtpsink"
40VRTCPSINK="udpsink port=5001 host=$DEST sync=false async=false name=vrtcpsink"
41VRTCPSRC="udpsrc port=5005 name=vrtpsrc"
42
43gst-launch-1.0 -v rtpbin name=rtpbin rtp-profile=avpf \
44    $VSOURCE ! $VENC ! rtprtxqueue ! rtpbin.send_rtp_sink_0                               \
45        rtpbin.send_rtp_src_0 ! identity drop-probability=0.1 ! $VRTPSINK                 \
46        rtpbin.send_rtcp_src_0 ! $VRTCPSINK                                               \
47      $VRTCPSRC ! rtpbin.recv_rtcp_sink_0
48