From b450c785f35dc0dd66990b3a75aa5e96b62d0a88 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Thu, 11 May 2017 11:48:26 +0200 Subject: Process audio before video. --- bin/recv-gst-rtp-v-a | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'bin/recv-gst-rtp-v-a') diff --git a/bin/recv-gst-rtp-v-a b/bin/recv-gst-rtp-v-a index 1da2106..dbf21c0 100755 --- a/bin/recv-gst-rtp-v-a +++ b/bin/recv-gst-rtp-v-a @@ -4,12 +4,12 @@ set -e CAMIP=${CAMIP:-$1} # origin host - default: use multicast group -VCOUNT=${VCOUNT:-${2:-1}} # number of video stream(s) to display - default: 1 -ACOUNT=${ACOUNT:-${3:-0}} # number of audio stream(s) to play - default: 0 -VFORMAT=${VFORMAT:-$4} # H264 VP8 RAW - default: RAW -AFORMAT=${AFORMAT:-$5} # AMR OPUS RAW - default: RAW -VSINK=${VSINK:-autovideosink} +ACOUNT=${ACOUNT:-${2:-0}} # number of audio stream(s) to play - default: 0 +VCOUNT=${VCOUNT:-${3:-1}} # number of video stream(s) to display - default: 1 +AFORMAT=${AFORMAT:-$4} # AMR OPUS RAW - default: RAW +VFORMAT=${VFORMAT:-$5} # H264 VP8 RAW - default: RAW ASINK=${ASINK:-autoaudiosink} +VSINK=${VSINK:-autovideosink} set -u # set multicast groups (also for recorder host) if camera host is wildcard @@ -22,25 +22,6 @@ CAMHOST="${CAMIP:+host=$CAMIP}${CAMMIP:+host=$CAMMIP auto-multicast=true}" ABUFFERS=80000 NETLATENCY=20 -case "$VFORMAT" in - H264) - VCAPS=application/x-rtp,media=video,clock-rate=90000,payload=96,encoding-name=H264 - VDEC="rtph264depay ! avdec_h264" - ;; - VP8) - VCAPS=application/x-rtp,media=video,clock-rate=90000,payload=96,encoding-name=VP8 - VDEC="rtpvp8depay ! vp8dec" - ;; - RAW|'') - VCAPS=application/x-rtp,media=video,clock-rate=90000,encoding-name=RAW,sampling=YCbCr-4:2:0,depth="(string)8",width="(string)432",height="(string)240",payload=96,a-framerate=30 - VDEC="rtpvrawdepay ! videoconvert ! queue" - ;; - *) - echo "ERROR: Unsupported video format: \"$VFORMAT\"" - exit 1 - ;; -esac - case "$AFORMAT" in AMR) ACAPS=application/x-rtp,media=audio,clock-rate=8000,encoding-name=AMR,encoding-params="(string)1",octet-align="(string)1",payload=96 @@ -60,6 +41,25 @@ case "$AFORMAT" in ;; esac +case "$VFORMAT" in + H264) + VCAPS=application/x-rtp,media=video,clock-rate=90000,payload=96,encoding-name=H264 + VDEC="rtph264depay ! avdec_h264" + ;; + VP8) + VCAPS=application/x-rtp,media=video,clock-rate=90000,payload=96,encoding-name=VP8 + VDEC="rtpvp8depay ! vp8dec" + ;; + RAW|'') + VCAPS=application/x-rtp,media=video,clock-rate=90000,encoding-name=RAW,sampling=YCbCr-4:2:0,depth="(string)8",width="(string)432",height="(string)240",payload=96,a-framerate=30 + VDEC="rtpvrawdepay ! videoconvert ! queue" + ;; + *) + echo "ERROR: Unsupported video format: \"$VFORMAT\"" + exit 1 + ;; +esac + stream() { ID=$1 CAPS=$2 @@ -77,6 +77,6 @@ stream() { gst-launch-1.0 -v \ rtpbin name=rtpbin latency=$NETLATENCY drop-on-latency=true \ $(n=0;\ - for i in $(seq "$VCOUNT"); do n=$((n+1)); stream "$n" "$VCAPS" "$VDEC ! $VSINK"; done;\ for i in $(seq "$ACOUNT"); do n=$((n+1)); stream "$n" "$ACAPS" "$ADEC ! $ASINK buffer-time=$ABUFFERS"; done;\ + for i in $(seq "$VCOUNT"); do n=$((n+1)); stream "$n" "$VCAPS" "$VDEC ! $VSINK"; done;\ ) -- cgit v1.2.3