Skip to content

Commit

Permalink
Add audio codec RTP/UDP test
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolargo committed May 28, 2011
1 parent e6270e9 commit a88374b
Show file tree
Hide file tree
Showing 13 changed files with 253 additions and 56 deletions.
10 changes: 8 additions & 2 deletions README
Expand Up @@ -8,15 +8,21 @@ audiocodectest.sh: Audio codec / quality
audio-noise-reduction.sh: Audio noise reduction
audio-rcv-aac.sh: Receive and play an AAC audio flow RTP/UDP (send by audio-snd-aac.sh)
audio-rcv-alaw.sh: Receive and play an ALAW audio flow RTP/UDP (send by audio-snd-alaw.sh)
audio-rcv-amr.sh: Receive and play an AMR audio flow RTP/UDP (send by audio-snd-amr.sh)
audio-rcv-celt.sh: Receive and play an CELT audio flow RTP/UDP (send by audio-snd-celt.sh)
audio-rcv-gsm.sh: Receive and play a GSM audio flow RTP/UDP (send by audio-snd-gsm.sh)
audio-rcv-mp3.sh: Receive and play a MP3 audio flow UDP (send by audio-snd-mp3.sh)
audio-rcv-speex.sh: Receive and play a SPEEX audio flow RTP/UDP (send by audio-snd-speex.sh)
audio-rcv-vorbis.sh: Receive and play a VORBIS audio flow RTP/UDP (send by audio-snd-mp3.sh)
audio-relay-aac.sh: Relaw AAC UDP flow from snd to rcv
audio-relay-alaw.sh: Relaw AAC RTP/UDP flow from snd to rcv
audio-rcv-aac.sh: Read (from test file) and send an AAC audio flow RTP/UDP
audio-rcv-alaw.sh: Read (from test file) and send an ALAW audio flow RTP/UDP
audio-rcv-amr.sh: Read (from test file) and send an AMR audio flow RTP/UDP
audio-rcv-celt.sh: Read (from test file) and send an CELT audio flow RTP/UDP
audio-rcv-gsm.sh: Read (from test file) and send a GSM audio flow RTP/UDP
audio-rcv-mp3.sh: Read (from test file) and send a MP3 audio flow UDP
audio-rcv-speex.sh: Read (from test file) and send a Speex audio flow RTP/UDP
audio-rcv-vorbis.sh: Read (from test file) and send a VORBIS audio flow RTP/UDP
clientaudiortpg726.sh: Receive and play a G727 audio flow RTP/UDP
clientaudiortpgsm.sh: Receive and play a GSM audio flow RTP/UDP
Expand All @@ -29,8 +35,8 @@ clientvideortptheora.sh: Receive and display a THEORA video flow RTP/UDP
clientvideortpx264.sh: Receive and display a X264 (H.264) video flow RTP/UDP
dailymotion.sh: Download a video from Daily Motion and display it
linux-client-x264-stream.sh: Test X.264 parameters
livetestvideoencoder.sh: Live test to compare video before and after MPEG4 compression
mp4encoder.sh: A simple but complete script to transcode a video file to .MP4 (MPEG4 / AAC)
livetestvideoencoder.sh: Live test to compare video before and after MPEG4 compression
mp4encoder.sh: A simple but complete script to transcode a video file to .MP4 (MPEG4 / AAC)
oggencoder.sh: A simple but complete script to transcode a video file to .OGG (VORBIS / THEORA)
recordwebcam.sh: Capture Webcam (1 fps) / Display AND encode in a .OGG file (video surveillance...)
recv3dlowdelay.sh: Receive and display a stereo video (3D display)
Expand Down
12 changes: 12 additions & 0 deletions audio-rcv-amr.sh
@@ -0,0 +1,12 @@
#!/bin/sh

CAPS="application/x-rtp, media=(string)audio, clock-rate=(int)8000, encoding-name=(string)AMR, encoding-params=(string)1, octet-align=(string)1, payload=(int)96"
SOURCE="port=6969 caps=\"$CAPS\""

DECODER="gstrtpjitterbuffer latency=200 drop-on-latency=true ! rtpamrdepay ! amrnbdec"

gst-launch -tv \
udpsrc $SOURCE ! $DECODER ! audioconvert ! audioresample ! alsasink



12 changes: 12 additions & 0 deletions audio-rcv-celt.sh
@@ -0,0 +1,12 @@
#!/bin/sh

CAPS="application/x-rtp, media=(string)audio, clock-rate=(int)32000, encoding-name=(string)CELT, encoding-params=(string)1, frame-size=(string)480, payload=(int)96"
SOURCE="port=6969 caps=\"$CAPS\""

DECODER="gstrtpjitterbuffer latency=200 drop-on-latency=true ! rtpceltdepay ! celtdec"

gst-launch -tv \
udpsrc $SOURCE ! $DECODER ! audioconvert ! audioresample ! alsasink



12 changes: 12 additions & 0 deletions audio-rcv-speex.sh
@@ -0,0 +1,12 @@
#!/bin/sh

CAPS="application/x-rtp, media=(string)audio, clock-rate=(int)24000, encoding-name=(string)SPEEX, encoding-params=(string)1, payload=(int)110"
SOURCE="port=6969 caps=\"$CAPS\""

DECODER="gstrtpjitterbuffer latency=200 drop-on-latency=true ! rtpspeexdepay ! speexdec"

gst-launch -tv \
udpsrc $SOURCE ! $DECODER ! audioconvert ! audioresample ! alsasink



19 changes: 19 additions & 0 deletions audio-snd-amr.sh
@@ -0,0 +1,19 @@
#!/bin/sh

SOURCE="filesrc location=\"samples/wb_male.wav\" ! decodebin ! audioconvert ! legacyresample ! audio/x-raw-int,rate=8000"
ENCODER="amrnbenc"
PAYLOADER="rtpamrpay"
DESTINATION_IP=${1-"127.0.0.1"}
# Vers relay
#DESTINATION="port=6868 host=$DESTINATION_IP"
# Vers rcv
DESTINATION="port=6969 host=$DESTINATION_IP"

# SON OK mais attention à voir si le CAPS ne change pas dynamiquement d'une machine à l'autre
gst-launch -tv \
gstrtpbin name=rtpbin latency=100 buffer-mode=0 \
$SOURCE \
! queue ! $ENCODER ! $PAYLOADER \
! rtpbin.send_rtp_sink_1 \
rtpbin.send_rtp_src_1 ! udpsink $DESTINATION qos-dscp=46

19 changes: 19 additions & 0 deletions audio-snd-celt.sh
@@ -0,0 +1,19 @@
#!/bin/sh

SOURCE="filesrc location=\"samples/wb_male.wav\" ! decodebin ! audioconvert ! legacyresample ! audio/x-raw-int,rate=32000"
ENCODER="celtenc bitrate=32"
PAYLOADER="rtpceltpay"
DESTINATION_IP=${1-"127.0.0.1"}
# Vers relay
#DESTINATION="port=6868 host=$DESTINATION_IP"
# Vers rcv
DESTINATION="port=6969 host=$DESTINATION_IP"

# SON OK mais attention à voir si le CAPS ne change pas dynamiquement d'une machine à l'autre
gst-launch -tv \
gstrtpbin name=rtpbin latency=100 buffer-mode=0 \
$SOURCE \
! queue ! $ENCODER ! $PAYLOADER \
! rtpbin.send_rtp_sink_1 \
rtpbin.send_rtp_src_1 ! udpsink $DESTINATION qos-dscp=46

19 changes: 19 additions & 0 deletions audio-snd-speex.sh
@@ -0,0 +1,19 @@
#!/bin/sh

SOURCE="filesrc location=\"samples/wb_male.wav\" ! decodebin ! audioconvert ! legacyresample ! audio/x-raw-int,rate=24000"
ENCODER="speexenc bitrate=32000 vad=true dtx=true"
PAYLOADER="rtpspeexpay"
DESTINATION_IP=${1-"127.0.0.1"}
# Vers relay
#DESTINATION="port=6868 host=$DESTINATION_IP"
# Vers rcv
DESTINATION="port=6969 host=$DESTINATION_IP"

# SON OK mais attention à voir si le CAPS ne change pas dynamiquement d'une machine à l'autre
gst-launch -tv \
gstrtpbin name=rtpbin latency=100 buffer-mode=0 \
$SOURCE \
! queue ! $ENCODER ! $PAYLOADER \
! rtpbin.send_rtp_sink_1 \
rtpbin.send_rtp_src_1 ! udpsink $DESTINATION qos-dscp=46

27 changes: 24 additions & 3 deletions clientvideortpmpeg4.sh
Expand Up @@ -2,8 +2,29 @@
#
# OK but had to set the config string in the caps

gst-launch -v --gst-debug-level=2 \
udpsrc caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)MP4V-ES, profile-level-id=(string)1, config=(string)000001b001000001b58913000001000000012000c48d8800a51604481463000001b24c61766335322e32302e30, payload=(int)96" port=5000 \
PORTCLIENT=${1-"5000"}
LATENCY=${2-"200"}

DECODER="ffdec_mpeg4"
DEPAYLOADER="rtpmp4vdepay"

RTPCAPS="application/x-rtp, media=\(string\)video, clock-rate=\(int\)90000, encoding-name=\(string\)MP4V-ES, profile-level-id=\(string\)1, payload=\(int\)96"

gst-launch -tvm \
gstrtpbin name=rtpbin latency=$LATENCY buffer-mode=0 \
udpsrc caps="$RTPCAPS" port=$PORTCLIENT \
! rtpbin.recv_rtp_sink_0 \
rtpbin. ! queue ! $DEPAYLOADER ! $DECODER ! autovideosink

##################
# OTHERS PIPELINES
##################

exit

gst-launch -tv \
udpsrc caps="$RTPCAPS" port=5000 \
! queue ! rtpmp4vdepay \
! queue ! ffdec_mpeg4 ! autovideosink
! queue ! ffdec_mpeg4 \
! ffmpegcolorspace ! autovideosink

13 changes: 8 additions & 5 deletions clientvideortptheora.sh
@@ -1,9 +1,12 @@
# RTP
# Not Work: needs string "configuration" in caps...

gst-launch -v --gst-debug-level=2 \
udpsrc caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)THEORA, sampling=(string)YCbCr-4:2:0, width=(string)352, height=(string)288, delivery-method=(string)inline, payload=(int)96, ssrc=(guint)384708083, clock-base=(guint)355459878, seqnum-base=(guint)6971" port=5000 \
! queue ! gstrtpjitterbuffer latency=3000 \
! queue ! rtptheoradepay \
! queue ! theoradec ! autovideosink
VIDEOCAPS="application/x-rtp,media=\(string\)video,clock-rate=\(int\)90000,encoding-name=\(string\)THEORA,sampling=\(string\)YCbCr-4:2:0,width=\(string\)320,height=\(string\)240,delivery-method=\(string\)inline,ssrc=\(guint\)1157217335,payload=\(int\)96,clock-base=\(guint\)1092900643,seqnum-base=\(guint\)22781"
VIDEOPORT=5000

gst-launch -tvm \
gstrtpbin name=rtpbin latency=0 buffer-mode=0 \
udpsrc caps=$VIDEOCAPS port=$VIDEOPORT do-timestamp=true \
! rtpbin.recv_rtp_sink_0 \
rtpbin. ! rtptheoradepay ! theoradec ! autovideosink

23 changes: 22 additions & 1 deletion clientvideortpx264.sh
@@ -1,10 +1,31 @@
#!/bin/sh
# Receive video from client with RTP/X.264

PORTCLIENT=${1-"5000"}
LATENCY=${2-"500"}

DECODER="ffdec_h264"
DEPAYLOADER="rtph264depay"

RTPCAPS="application/x-rtp,media=\(string\)video,clock-rate=\(int\)90000,encoding-name=\(string\)H264,ssrc=\(guint\)2834894965,payload=\(int\)96,clock-base=\(guint\)751940475,seqnum-base=\(guint\)56645"

gst-launch -tvm \
gstrtpbin name=rtpbin latency=$LATENCY buffer-mode=0 \
udpsrc caps=$RTPCAPS port=$PORTCLIENT \
! rtpbin.recv_rtp_sink_0 \
rtpbin. ! queue ! $DEPAYLOADER ! $DECODER ! autovideosink

##################
# OTHERS PIPELINES
##################

exit

gst-launch -tv --gst-debug-level=2 \
udpsrc caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96" port=5000 \
! queue ! rtph264depay \
! queue ! ffdec_h264 ! gconfvideosink
! queue ! ffdec_h264 ! autovideosink


# A mettre avant le rtph264depay si gros débit vidéo
# ! queue ! gstrtpjitterbuffer latency=3000 \
Expand Down
65 changes: 44 additions & 21 deletions servervideortpmpeg4.sh
@@ -1,28 +1,51 @@
# RTP

IPCLIENT=$1
PORTCLIENT=5000

WIDTH=704
HEIGHT=576
FPS=20
BITRATE=200000
BITRATE_TOLERANCE=20000

IPCLIENT=${1-"127.0.0.1"}
PORTCLIENT=${2-"5000"}
LATENCY=${3-"0"}

ENCODER="ffenc_mpeg4"
PAYLOADER="rtpmp4vpay send-config=true"

# LE TOP POUR LA VISIO
VIDEOSRC="autovideosrc"
VIDEOCAPS="video/x-raw-yuv,width=352,height=288,framerate=10/1"
BITRATE=128000
ENCODER_OPT="bitrate=$BITRATE bitrate-tolerance=$BITRATE pass=0 trellis=1 idct-algo=11 quant-type=0 rc-qmod-amp=99 rc-buffer-aggressivity=99"

# LE TOP POUR LIVE SCREENCASTING
#VIDEOSRC="ximagesrc"
#VIDEOCAPS="video/x-raw-yuv,width=352,height=288,framerate=10/1"
#BITRATE=160000
#ENCODER_OPT="bitrate=$BITRATE bitrate-tolerance=$BITRATE pass=0 trellis=0 idct-algo=11 quant-type=0 rc-qmod-amp=50 rc-buffer-aggressivity=50"

gst-launch -tv \
gstrtpbin name=rtpbin latency=$LATENCY buffer-mode=0 \
$VIDEOSRC \
! queue ! videoscale method=1 ! videorate ! $VIDEOCAPS \
! tee name="display" \
! queue ! cairotextoverlay text="$ENCODER $BITRATE" shaded-background=true \
! queue ! $ENCODER $ENCODER_OPT \
! $PAYLOADER \
! rtpbin.send_rtp_sink_0 rtpbin.send_rtp_src_0 \
! udpsink port=$PORTCLIENT host=$IPCLIENT sync=false async=false \
display. \
! queue ! cairotextoverlay text="Source" shaded-background=true \
! autovideosink


##################
# OTHERS PIPELINES
##################

exit

# Sans gstrtpbin
gst-launch -v --gst-debug-level=2 \
autovideosrc ! ffmpegcolorspace \
! queue ! decodebin \
$VIDEOSRC ! ffmpegcolorspace \
! queue ! videoscale method=1 ! video/x-raw-yuv,width=$WIDTH,height=$HEIGHT \
! queue ! videorate ! video/x-raw-yuv,framerate=$FPS/1 \
! queue max-size-bytes=20971520 ! ffenc_mpeg4 bitrate=$BITRATE bitrate-tolerance=$BITRATE_TOLERANCE \
! rtpmp4vpay \
! queue max-size-bytes=20971520 ! ffenc_mpeg4 $MPEG4_OPT \
! rtpmp4vpay send-config=true \
! queue ! udpsink port=$PORTCLIENT host=$IPCLIENT sync=false async=false

# WIDTH=352
# HEIGTH=288
# FPS=20
# BITRATE=200000
# BITRATE_TOLERANCE=20000
#
# -> OK bonne qualité

29 changes: 19 additions & 10 deletions servervideortptheora.sh
@@ -1,16 +1,25 @@
# RTP
# Not Work

IPCLIENT=127.0.0.1
PORTCLIENT=5000
CLIENTIP=127.0.0.1
VIDEOCAPS="video/x-raw-yuv,width=(int)320,height=(int)240,framerate=(fraction)15/1"
VIDEOPORT=5000

gst-launch -v --gst-debug-level=2 \
autovideosrc ! ffmpegcolorspace \
! queue ! decodebin \
! queue ! videoscale method=1 ! video/x-raw-yuv,width=352,height=288 \
! queue ! videorate ! video/x-raw-yuv,framerate=10/1 \
! queue max-size-bytes=20971520 ! theoraenc bitrate=200 \
! queue ! rtptheorapay \
! queue ! udpsink port=$PORTCLIENT host=$IPCLIENT sync=false async=false
gst-launch -tv \
gstrtpbin name=rtpbin latency=0 buffer-mode=0 \
! autovideosrc ! videoscale ! videorate ! $VIDEOCAPS \
! queue ! ffmpegcolorspace ! theoraenc bitrate=200 \
! rtptheorapay \
! rtpbin.send_rtp_sink_0 rtpbin.send_rtp_src_0 \
! udpsink host=$CLIENTIP port=$VIDEOPORT

#gst-launch -v --gst-debug-level=2 \
# autovideosrc ! ffmpegcolorspace \
# ! queue ! decodebin \
# ! queue ! videoscale method=1 ! video/x-raw-yuv,width=352,height=288 \
# ! queue ! videorate ! video/x-raw-yuv,framerate=10/1 \
# ! queue max-size-bytes=20971520 ! theoraenc bitrate=200 \
# ! queue ! rtptheorapay \
# ! queue ! udpsink port=$PORTCLIENT host=$IPCLIENT sync=false async=false


49 changes: 35 additions & 14 deletions servervideortpx264.sh
@@ -1,25 +1,46 @@
#!/bin/sh
# Send video (Webcam) to server with RTP/X.264

IPCLIENT=$1
PORTCLIENT=5000
IPCLIENT=${1-"127.0.0.1"}
PORTCLIENT=${2-"5000"}
LATENCY=${3-"200"}

WEBCAM_DEV="/dev/video0"
WEBCAM_WIDTH=352
WEBCAM_HEIGHT=288
WEBCAM_FPS=24
ENCODER="x264enc"
PAYLOADER="rtph264pay config-interval=3"

X264_BITRATE=600
X264_PARAM="byte-stream=true bframes=4 ref=4 me=hex subme=4 weightb=true threads=0"
RTP_CONFIG_INTERVAL=5
VIDEOSRC="autovideosrc"
VIDEOCAPS="video/x-raw-yuv,width=352,height=288,framerate=10/1"
BITRATE=160
ENCODER_OPT="bitrate=$BITRATE byte-stream=true bframes=4 ref=4 me=hex subme=4 weightb=true threads=0"

gst-launch -tv \
gstrtpbin name=rtpbin latency=$LATENCY buffer-mode=0 \
$VIDEOSRC \
! queue ! videoscale method=1 ! videorate ! $VIDEOCAPS \
! tee name="display" \
! queue ! cairotextoverlay text="$ENCODER $BITRATE" shaded-background=true \
! queue ! $ENCODER $ENCODER_OPT \
! $PAYLOADER \
! rtpbin.send_rtp_sink_0 rtpbin.send_rtp_src_0 \
! udpsink port=$PORTCLIENT host=$IPCLIENT sync=false async=false \
display. \
! queue ! cairotextoverlay text="Source" shaded-background=true \
! autovideosink


##################
# OTHERS PIPELINES
##################

exit

gst-launch -tv --gst-debug-level=2 \
v4l2src device=$WEBCAM_DEV \
! queue ! videoscale method=1 ! video/x-raw-yuv,width=$WEBCAM_WIDTH,height=$WEBCAM_HEIGHT \
! queue ! videorate ! video/x-raw-yuv,framerate=$WEBCAM_FPS/1 \
! queue ! x264enc bitrate=$X264_BITRATE $X264_PARAM ! rtph264pay config-interval=$RTP_CONFIG_INTERVAL \
$VIDEOSRC ! ffmpegcolorspace \
! queue ! videoscale method=1 ! videorate ! $VIDEOCAPS \
! queue ! x264enc $ENCODER_OPT ! rtph264pay config-interval=$RTP_CONFIG_INTERVAL \
! queue ! udpsink port=$PORTCLIENT host=$IPCLIENT sync=false async=false



# PROFILS

#-----------------------------------------------------------------------------
Expand Down

0 comments on commit a88374b

Please sign in to comment.