Tizen 2.0 Release
[framework/multimedia/gst-plugins-good0.10.git] / tests / examples / rtp / server-v4l2-H264-alsasrc-PCMA.sh
1 #!/bin/sh
2 #
3 # A simple RTP server
4 #  sends the output of v4l2src 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 #  sends the output of autoaudiosrc as alaw encoded RTP on port 5002, RTCP is sent on
8 #  port 5003. The destination is 127.0.0.1.
9 #  the receiver RTCP reports are received on port 5007
10 #
11 #  .-------.    .-------.    .-------.      .----------.     .-------.
12 #  |v4lssrc|    |h264enc|    |h264pay|      | rtpbin   |     |udpsink|  RTP
13 #  |      src->sink    src->sink    src->send_rtp send_rtp->sink     | port=5000
14 #  '-------'    '-------'    '-------'      |          |     '-------'
15 #                                           |          |
16 #                                           |          |     .-------.
17 #                                           |          |     |udpsink|  RTCP
18 #                                           |    send_rtcp->sink     | port=5001
19 #                            .-------.      |          |     '-------' sync=false
20 #                 RTCP       |udpsrc |      |          |               async=false
21 #               port=5005    |     src->recv_rtcp      |
22 #                            '-------'      |          |
23 #                                           |          |
24 # .--------.    .-------.    .-------.      |          |     .-------.
25 # |audiosrc|    |alawenc|    |pcmapay|      | rtpbin   |     |udpsink|  RTP
26 # |       src->sink    src->sink    src->send_rtp send_rtp->sink     | port=5002
27 # '--------'    '-------'    '-------'      |          |     '-------'
28 #                                           |          |
29 #                                           |          |     .-------.
30 #                                           |          |     |udpsink|  RTCP
31 #                                           |    send_rtcp->sink     | port=5003
32 #                            .-------.      |          |     '-------' sync=false
33 #                 RTCP       |udpsrc |      |          |               async=false
34 #               port=5007    |     src->recv_rtcp      |
35 #                            '-------'      '----------'
36 #
37 # ideally we should transport the properties on the RTP udpsink pads to the
38 # receiver in order to transmit the SPS and PPS earlier.
39
40 # change this to send the RTP data and RTCP to another host
41 DEST=127.0.0.1
42
43 # tuning parameters to make the sender send the streams out of sync. Can be used
44 # ot test the client RTCP synchronisation.
45 #VOFFSET=900000000
46 VOFFSET=0
47 AOFFSET=0
48
49 # H264 encode from the source
50 VELEM="v4l2src"
51 #VELEM="videotestsrc is-live=1"
52 VCAPS="video/x-raw-yuv,width=352,height=288,framerate=15/1"
53 VSOURCE="$VELEM ! queue ! videorate ! ffmpegcolorspace ! $VCAPS"
54 VENC="x264enc tune=zerolatency byte-stream=true bitrate=300 ! rtph264pay"
55
56 VRTPSINK="udpsink port=5000 host=$DEST ts-offset=$VOFFSET name=vrtpsink"
57 VRTCPSINK="udpsink port=5001 host=$DEST sync=false async=false name=vrtcpsink"
58 VRTCPSRC="udpsrc port=5005 name=vrtpsrc"
59
60 # PCMA encode from the source
61 AELEM="autoaudiosrc"
62 #AELEM="audiotestsrc is-live=1"
63 ASOURCE="$AELEM ! queue ! audioresample ! audioconvert"
64 AENC="alawenc ! rtppcmapay"
65
66 ARTPSINK="udpsink port=5002 host=$DEST ts-offset=$AOFFSET name=artpsink"
67 ARTCPSINK="udpsink port=5003 host=$DEST sync=false async=false name=artcpsink"
68 ARTCPSRC="udpsrc port=5007 name=artpsrc"
69
70 gst-launch -v gstrtpbin name=rtpbin \
71     $VSOURCE ! $VENC ! rtpbin.send_rtp_sink_0                                             \
72         rtpbin.send_rtp_src_0 ! $VRTPSINK                                                 \
73         rtpbin.send_rtcp_src_0 ! $VRTCPSINK                                               \
74       $VRTCPSRC ! rtpbin.recv_rtcp_sink_0                                                 \
75     $ASOURCE ! $AENC ! rtpbin.send_rtp_sink_1                                             \
76         rtpbin.send_rtp_src_1 ! $ARTPSINK                                                 \
77         rtpbin.send_rtcp_src_1 ! $ARTCPSINK                                               \
78       $ARTCPSRC ! rtpbin.recv_rtcp_sink_1