• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2#
3# A simple RTP server
4#
5# Transcodes and streams audio and video to H263p and AMR respectively from any
6# file that is decodable by decodebin.
7#
8# use ./client-H263p-AMR.sh to receive the RTP stream.
9#
10
11# change these to change the server sync. This causes the server to send the
12# packets largly out-of-sync, the client should use the RTCP SR packets to
13# restore proper lip-sync between the streams.
14AOFFSET=0
15VOFFSET=0
16
17# encoder seems to be picky about PAR, so force one that should work
18VCAPS="video/x-raw,width=352,height=288,framerate=15/1,pixel-aspect-ratio=1/1"
19
20# video and audio encoding and payloading
21VENCPAY="avenc_h263p ! rtph263ppay"
22AENCPAY="amrnbenc ! rtpamrpay"
23
24# video conversion
25VCONV="videoconvert ! videoscale ! videorate ! $VCAPS ! videoconvert"
26
27ACONV="audioconvert ! audioresample"
28
29#HOST=192.168.1.126
30HOST=127.0.0.1
31
32if test -z "$1"; then
33  echo "No URI argument.";
34  echo "Usage: $0 file:///path/to/video.file";
35  exit 1;
36fi
37
38gst-launch-1.0 -v rtpbin name=rtpbin \
39           uridecodebin uri="$1" name=decode \
40           decode. ! $VCONV ! $VENCPAY ! rtpbin.send_rtp_sink_0      \
41                     rtpbin.send_rtp_src_0 ! queue ! udpsink host=$HOST port=5000 ts-offset=$AOFFSET      \
42                     rtpbin.send_rtcp_src_0 ! udpsink host=$HOST port=5001 sync=false async=false         \
43                     udpsrc port=5005 ! rtpbin.recv_rtcp_sink_0                                           \
44           decode. ! $ACONV ! $AENCPAY ! rtpbin.send_rtp_sink_1                         \
45	             rtpbin.send_rtp_src_1 ! queue ! udpsink host=$HOST port=5002 ts-offset=$VOFFSET      \
46	             rtpbin.send_rtcp_src_1 ! udpsink host=$HOST port=5003 sync=false async=false         \
47                     udpsrc port=5007 ! rtpbin.recv_rtcp_sink_1
48