From fdfe76ac535dbb8166a9f0da93d01c7bd8acdc83 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 15 Nov 2010 10:52:31 +0100 Subject: [PATCH] examples: improve RTP examples MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Make the examples use autovideosink and ffmpegcolorspace for better compàtibility. Make some more variables for the sink and the decoders. Set zerolatency tuning on x264enc for better realtime results. --- tests/examples/rtp/client-H263p-AMR.sh | 10 ++++++++-- tests/examples/rtp/client-H263p-PCMA.sh | 10 ++++++++-- tests/examples/rtp/client-H263p.sh | 6 +++++- tests/examples/rtp/client-H264-PCMA.sh | 10 ++++++++-- tests/examples/rtp/client-H264.sh | 10 ++++++++-- tests/examples/rtp/client-PCMA.sh | 6 +++++- tests/examples/rtp/server-v4l2-H264-alsasrc-PCMA.sh | 2 +- 7 files changed, 43 insertions(+), 11 deletions(-) diff --git a/tests/examples/rtp/client-H263p-AMR.sh b/tests/examples/rtp/client-H263p-AMR.sh index 216c6b0..07a466f 100755 --- a/tests/examples/rtp/client-H263p-AMR.sh +++ b/tests/examples/rtp/client-H263p-AMR.sh @@ -6,12 +6,18 @@ VIDEO_CAPS="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H263-1998" AUDIO_CAPS="application/x-rtp,media=(string)audio,clock-rate=(int)8000,encoding-name=(string)AMR,encoding-params=(string)1,octet-align=(string)1" +VIDEO_DEC="rtph263pdepay ! ffdec_h263" +AUDIO_DEC="rtpamrdepay ! amrnbdec" + +VIDEO_SINK="ffmpegcolorspace ! autovideosink" +AUDIO_SINK="audioconvert ! audioresample ! autoaudisink" + gst-launch -v gstrtpbin name=rtpbin latency=100 \ udpsrc caps=$VIDEO_CAPS port=5000 ! rtpbin.recv_rtp_sink_0 \ - rtpbin. ! rtph263pdepay ! ffdec_h263 ! xvimagesink \ + rtpbin. ! $VIDEO_DEC ! $VIDEO_SINK \ udpsrc port=5001 ! rtpbin.recv_rtcp_sink_0 \ rtpbin.send_rtcp_src_0 ! udpsink port=5005 sync=false async=false \ udpsrc caps=$AUDIO_CAPS port=5002 ! rtpbin.recv_rtp_sink_1 \ - rtpbin. ! rtpamrdepay ! amrnbdec ! autoaudiosink slave-method=1 \ + rtpbin. ! $AUDIO_DEC ! $AUDIO_SINK \ udpsrc port=5003 ! rtpbin.recv_rtcp_sink_1 \ rtpbin.send_rtcp_src_1 ! udpsink port=5007 sync=false async=false diff --git a/tests/examples/rtp/client-H263p-PCMA.sh b/tests/examples/rtp/client-H263p-PCMA.sh index 90e6deb..8204c1f 100755 --- a/tests/examples/rtp/client-H263p-PCMA.sh +++ b/tests/examples/rtp/client-H263p-PCMA.sh @@ -9,14 +9,20 @@ AUDIO_CAPS="application/x-rtp,media=(string)audio,clock-rate=(int)8000,encoding- #DEST=192.168.1.126 DEST=localhost +VIDEO_DEC="rtph263pdepay ! ffdec_h263" +AUDIO_DEC="rtppcmadepay ! alawdec" + +VIDEO_SINK="ffmpegcolorspace ! autovideosink" +AUDIO_SINK="audioconvert ! audioresample ! autoaudisink" + LATENCY=100 gst-launch -v gstrtpbin name=rtpbin latency=$LATENCY \ udpsrc caps=$VIDEO_CAPS port=5000 ! rtpbin.recv_rtp_sink_0 \ - rtpbin. ! rtph263pdepay ! ffdec_h263 ! xvimagesink \ + rtpbin. ! $VIDEO_DEC ! $VIDEO_SINK \ udpsrc port=5001 ! rtpbin.recv_rtcp_sink_0 \ rtpbin.send_rtcp_src_0 ! udpsink host=$DEST port=5005 sync=false async=false \ udpsrc caps=$AUDIO_CAPS port=5002 ! rtpbin.recv_rtp_sink_1 \ - rtpbin. ! rtppcmadepay ! alawdec ! autoaudiosink buffer-time=10000 \ + rtpbin. ! $AUDIO_DEC ! $AUDIO_SINK \ udpsrc port=5003 ! rtpbin.recv_rtcp_sink_1 \ rtpbin.send_rtcp_src_1 ! udpsink host=$DEST port=5007 sync=false async=false diff --git a/tests/examples/rtp/client-H263p.sh b/tests/examples/rtp/client-H263p.sh index 9368429..70542f6 100755 --- a/tests/examples/rtp/client-H263p.sh +++ b/tests/examples/rtp/client-H263p.sh @@ -8,10 +8,14 @@ VIDEO_CAPS="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding #DEST=192.168.1.126 DEST=localhost +VIDEO_DEC="rtph263pdepay ! ffdec_h263" + +VIDEO_SINK="ffmpegcolorspace ! autovideosink" + LATENCY=100 gst-launch -v gstrtpbin name=rtpbin latency=$LATENCY \ udpsrc caps=$VIDEO_CAPS port=5000 ! rtpbin.recv_rtp_sink_0 \ - rtpbin. ! rtph263pdepay ! ffdec_h263 ! xvimagesink \ + rtpbin. ! $VIDEO_DEC ! $VIDEO_SINK \ udpsrc port=5001 ! rtpbin.recv_rtcp_sink_0 \ rtpbin.send_rtcp_src_0 ! udpsink host=$DEST port=5005 sync=false async=false diff --git a/tests/examples/rtp/client-H264-PCMA.sh b/tests/examples/rtp/client-H264-PCMA.sh index bebeae8..600cefe 100755 --- a/tests/examples/rtp/client-H264-PCMA.sh +++ b/tests/examples/rtp/client-H264-PCMA.sh @@ -47,12 +47,18 @@ LATENCY=200 VIDEO_CAPS="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264" AUDIO_CAPS="application/x-rtp,media=(string)audio,clock-rate=(int)8000,encoding-name=(string)PCMA" +VIDEO_DEC="rtph264depay ! ffdec_h264" +AUDIO_DEC="rtppcmadepay ! alawdec" + +VIDEO_SINK="ffmpegcolorspace ! autovideosink" +AUDIO_SINK="audioconvert ! audioresample ! autoaudisink" + gst-launch -v gstrtpbin name=rtpbin latency=$LATENCY \ udpsrc caps=$VIDEO_CAPS port=5000 ! rtpbin.recv_rtp_sink_0 \ - rtpbin. ! rtph264depay ! ffdec_h264 ! xvimagesink \ + rtpbin. ! $VIDEO_DEC ! $VIDEO_SINK \ udpsrc port=5001 ! rtpbin.recv_rtcp_sink_0 \ rtpbin.send_rtcp_src_0 ! udpsink port=5005 host=$DEST sync=false async=false \ udpsrc caps=$AUDIO_CAPS port=5002 ! rtpbin.recv_rtp_sink_1 \ - rtpbin. ! rtppcmadepay ! alawdec ! audioconvert ! audioresample ! autoaudiosink \ + rtpbin. ! $AUDIO_DEC ! $AUDIO_SINK \ udpsrc port=5003 ! rtpbin.recv_rtcp_sink_1 \ rtpbin.send_rtcp_src_1 ! udpsink port=5007 host=$DEST sync=false async=false diff --git a/tests/examples/rtp/client-H264.sh b/tests/examples/rtp/client-H264.sh index db69aff..c5cca86 100755 --- a/tests/examples/rtp/client-H264.sh +++ b/tests/examples/rtp/client-H264.sh @@ -24,13 +24,19 @@ # have a mechanism to get this from the sender with a -launch line. VIDEO_CAPS="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264" +VIDEO_DEC="rtph264depay ! ffdec_h264" + +VIDEO_SINK="ffmpegcolorspace ! autovideosink" + # the destination machine to send RTCP to. This is the address of the sender and # is used to send back the RTCP reports of this receiver. If the data is sent # from another machine, change this address. DEST=127.0.0.1 -gst-launch -v gstrtpbin name=rtpbin \ +LATENCY=200 + +gst-launch -v gstrtpbin name=rtpbin latency=$LATENCY \ udpsrc caps=$VIDEO_CAPS port=5000 ! rtpbin.recv_rtp_sink_0 \ - rtpbin. ! rtph264depay ! ffdec_h264 ! xvimagesink \ + rtpbin. ! $VIDEO_DEC ! $VIDEO_SINK \ udpsrc port=5001 ! rtpbin.recv_rtcp_sink_0 \ rtpbin.send_rtcp_src_0 ! udpsink port=5005 host=$DEST sync=false async=false diff --git a/tests/examples/rtp/client-PCMA.sh b/tests/examples/rtp/client-PCMA.sh index e338392..5d47340 100755 --- a/tests/examples/rtp/client-PCMA.sh +++ b/tests/examples/rtp/client-PCMA.sh @@ -23,6 +23,10 @@ # SDP or RTSP. AUDIO_CAPS="application/x-rtp,media=(string)audio,clock-rate=(int)8000,encoding-name=(string)PCMA" +AUDIO_DEC="rtppcmadepay ! alawdec" + +AUDIO_SINK="audioconvert ! audioresample ! autoaudisink" + # the destination machine to send RTCP to. This is the address of the sender and # is used to send back the RTCP reports of this receiver. If the data is sent # from another machine, change this address. @@ -30,6 +34,6 @@ DEST=127.0.0.1 gst-launch -v gstrtpbin name=rtpbin \ udpsrc caps=$AUDIO_CAPS port=5002 ! rtpbin.recv_rtp_sink_0 \ - rtpbin. ! rtppcmadepay ! alawdec ! audioconvert ! audioresample ! autoaudiosink \ + rtpbin. ! $AUDIO_DEC ! $AUDIO_SINK \ udpsrc port=5003 ! rtpbin.recv_rtcp_sink_0 \ rtpbin.send_rtcp_src_0 ! udpsink port=5007 host=$DEST sync=false async=false diff --git a/tests/examples/rtp/server-v4l2-H264-alsasrc-PCMA.sh b/tests/examples/rtp/server-v4l2-H264-alsasrc-PCMA.sh index 75386cc..910b69e 100755 --- a/tests/examples/rtp/server-v4l2-H264-alsasrc-PCMA.sh +++ b/tests/examples/rtp/server-v4l2-H264-alsasrc-PCMA.sh @@ -51,7 +51,7 @@ VELEM="v4l2src" #VELEM="videotestsrc is-live=1" VCAPS="video/x-raw-yuv,width=352,height=288,framerate=15/1" VSOURCE="$VELEM ! $VCAPS ! queue ! videorate ! ffmpegcolorspace" -VENC="x264enc byte-stream=true bitrate=300 ! rtph264pay" +VENC="x264enc tune=zerolatency byte-stream=true bitrate=300 ! rtph264pay" VRTPSINK="udpsink port=5000 host=$DEST ts-offset=$VOFFSET name=vrtpsink" VRTCPSINK="udpsink port=5001 host=$DEST sync=false async=false name=vrtcpsink" -- 2.7.4