Skip to content

Instantly share code, notes, and snippets.

@ykrkn
Last active May 1, 2020 10:31
Show Gist options
  • Save ykrkn/5091138 to your computer and use it in GitHub Desktop.
Save ykrkn/5091138 to your computer and use it in GitHub Desktop.
have a nice tee!
gst-launch --gst-debug=*:5 --gst-debug-no-color filesrc location=111.pcma ! audio/x-alaw,rate=8000,channels=1 ! alawdec ! audio/x-raw-int,rate=8000,channels=1,width=16 ! audioresample ! audio/x-raw-int,rate=16000,channels=1,width=16 ! speexenc mode=2 quality=6 ! tee name=t ! queue ! audio/x-speex ! flvmux streamable=true ! rcslabsrtmpsink url="rtmp://192.168.1.230/live/dima" librtmp-loglevel=0 t. ! queue ! filesink location=/home/ykrikun/spx/111.spx
speex to flash ok
gst-launch --gst-debug=*:2 --gst-debug-no-color filesrc location=ypp8k.wav ! wavparse ! audio/x-raw-int,rate=8000,channels=1,width=16 ! audioresample ! audio/x-raw-int,rate=16000,channels=1,width=16 ! speexenc mode=2 quality=6 ! flvmux streamable=true ! rcslabsrtmpsink url="rtmp://192.168.1.230/live/dima" librtmp-loglevel=0
speex from flash ok
gst-launch --gst-debug=*:5 --gst-debug-no-color rcslabsrtmpsrc url="rtmp://192.168.1.230/live/dima" librtmp-loglevel=0 ! flvdemux name=demux demux.audio ! audio/x-speex,rate=16000 ! speexdec ! audio/x-raw-int,rate=16000,channels=1 ! wavenc ! filesink location=111.wav
simple send 8k sine to UDP
gst-launch audiotestsrc is-live=true ! audio/x-raw-int,rate=8000,channels=1,width=16 ! alawenc ! rtppcmapay pt=8 mtu=172 ssrc=0xffffffff ! udpsink host=127.0.0.1 port=55555 sockfd=-1 closefd=false sync=false async=false
make && sudo make install && sudo cp /usr/local/lib/gstreamer-0.10/libgstflv.so /usr/lib64/gstreamer-0.10/libgstflv.so
make && sudo make install && sudo cp /usr/local/lib/gstreamer-0.10/libgstspeex.so /usr/lib64/gstreamer-0.10/libgstspeex.so
// phone to flash
((ip.src==192.168.1.35 && udp) || (tcp.dstport==1935 && ip.src==192.168.1.230 && ip.dst==192.168.1.230 && (tcp.len==54 || tcp.len==57 || tcp.len==65)) || (tcp.srcport==1935 && ip.dst==192.168.1.43 && (tcp.len==54 || tcp.len==57 || tcp.len==65)))
// flash to phone
((ip.dst==192.168.1.35 && udp) || (tcp.srcport==1935 && ip.src==192.168.1.230 && ip.dst==192.168.1.230 && (tcp.len==116 || tcp.len==108 || tcp.len==105)) || (tcp.dstport==1935 && ip.src==192.168.1.43 && ip.dst==192.168.1.230 && (tcp.len==54 || tcp.len==57 || tcp.len==65)))
// flash to phone rtmpt
(tcp.port==80 && ip.dst==95.168.187.233) || (tcp.srcport==1935 && ip.dst==95.168.187.233) || (rtp && ip.dst==193.201.229.35 && !icmp)
gst-launch filesrc location=111.pcma ! audio/x-alaw,rate=8000,channels=1 ! wavenc ! filesink location=333.wav
gst-launch filesrc location=111.pcma ! audio/x-alaw,rate=8000,channels=1 ! alawdec ! audio/x-raw-int,rate=8000,channels=1,width=16 ! audioresample ! audio/x-raw-int,rate=16000,channels=1,width=16 ! speexenc mode=2 quality=6 ! flvmux streamable=true ! rcslabsrtmpsink url=rtmp://192.168.1.230/live/dima librtmp-loglevel=0
/usr/bin/gst-launch-0.10 --gst-debug=*:5 --gst-debug-no-color
flvmux name="mux" !
rcslabsrtmpsink url="rtmp://95.168.187.234:1935/live/13dd8e78-a654-44a7-bf55-71b49d24440b" librtmp-loglevel=0 udpsrc sockfd=369 closefd=false !
application/x-rtp, media=audio, payload=8, clock-rate=8000 ! rtppcmadepay ! alawdec ! ffenc_nellymoser ! mux.
/usr/bin/gst-launch-0.10 --gst-debug=*:5 --gst-debug-no-color
flvmux name="mux" !
rcslabsrtmpsink url="rtmp://95.168.187.234:1935/live/46811a9e-3fa5-479d-9f16-0cfb37d80f79" librtmp-loglevel=0 udpsrc sockfd=370 closefd=false !
application/x-rtp, media=video, payload=126, clock-rate=90000, encoding-name=H264 ! rtph264depay ! ffdec_h264 ! ffenc_flv ! queue ! mux.
/usr/bin/gst-launch-0.10 --gst-debug=*:5 --gst-debug-no-color
rcslabsrtmpsrc url="rtmp://95.168.187.234:1935/live/fecbdabf-3399-4850-a486-748de643bb45" librtmp-loglevel=0 !
flvdemux name=demux demux.video ! queue name="queue.video" ! ffdec_flv ! x264enc byte-stream=true bitrate=300 pass=5 speed-preset=1 ! rtph264pay pt=126 !
udpsink host=193.201.229.35 port=28862 sockfd=370 closefd=false sync=false async=false demux.audio ! queue name="queue.audio" ! fakesink sync=false async=false
/usr/bin/gst-launch-0.10 --gst-debug=*:5 --gst-debug-no-color rtpdtmfmux name="dtmfmux" !
udpsink host=193.201.229.35 port=34462 sockfd=369 closefd=false sync=false async=false
rcslabsrtmpsrc url="rtmp://95.168.187.234:1935/live/6287d7f2-fab5-4851-8ac5-087a7d374a6f" librtmp-loglevel=0 !
flvdemux name=demux demux.video ! queue name="queue.video" ! fakesink sync=false async=false demux.audio ! queue name="queue.audio" !
ffdec_nellymoser ! alawenc ! rtppcmapay pt=8 mtu=172 min-ptime=50000000000 ssrc=1468797040 ! queue name="queue.data" ! dtmfmux. udpsrc port=50440 ! queue name="queue.dtmf" ! dtmfmux.
gst-launch videotestsrc ! video/x-raw-yuv, framerate=25/1, width=640, height=360 ! x264enc ! flvmux ! rcslabsrtmpsink url="rtmp://192.168.1.47/live/111" librtmp-loglevel=6
gst-launch -v rcslabsrtmpsrc url="rtmp://192.168.1.47/live/111" librtmp-loglevel=2 ! flvdemux name=demux demux.video ! queue name="queue.video" ! rtph264pay pt=126 ! udpsink host=127.0.0.1 port=55555 sockfd=-1 closefd=false sync=false async=false demux.audio ! queue name="queue.audio" ! fakesink sync=false async=false
gst-launch --gst-debug=*:3 udpsrc port=55555 ! application/x-rtp, media=video, payload=96, clock-rate=90000, encoding-name=H264 ! rtph264depay ! ffdec_h264 ! ximagesink
/usr/bin/gst-launch-0.10 --gst-debug=*:5 --gst-debug-no-color \
rcslabsrtmpsrc url="rtmp://192.168.1.47/live/111" librtmp-loglevel=2 \
! flvdemux name=demux demux.video ! queue name="queue.video" ! rtph264pay pt=126 \
! udpsink host=127.0.0.1 port=55555 sockfd=-1 closefd=false sync=false async=false demux.audio \
! queue name="queue.audio" ! fakesink sync=false async=false > 1.txt 2>&1
-Dvideoonly.outgoingStream.cmd=gst-launch --gst-debug={media.log.config} --gst-debug-no-color rcslabsrtmpsrc url=\"{rtmp-in-url}\" librtmp-loglevel={rtmp.log.level} ! flvdemux name=demux demux.video ! queue name=\"queue.video\" ! rtph264pay pt={rtp-payload-type} ! udpsink host={remote-host} port={remote-video-port} sockfd={local-rtp-video-socket-fd} closefd=false sync=false async=false demux.audio ! queue name=\"queue.audio\" ! fakesink sync=false async=false
server:
gst-launch -v gstrtpbin name=rtpbin \
filesrc location=filesrc location=../../../partage/Videos/superman_originale.avi ! decodebin name=dec \
dec. ! queue ! x264enc byte-stream=false bitrate=300 ! rtph264pay ! rtpbin.send_rtp_sink_0 \
rtpbin.send_rtp_src_0 ! udpsink port=5000 host=127.0.0.1 ts-offset=0 name=vrtpsink \
rtpbin.send_rtcp_src_0 ! udpsink port=5001 host=127.0.0.1 sync=false async=false name=vrtcpsink \
udpsrc port=5005 name=vrtpsrc ! rtpbin.recv_rtcp_sink_0 \
dec. ! queue ! audioresample ! audioconvert ! alawenc ! rtppcmapay ! rtpbin.send_rtp_sink_1 \
rtpbin.send_rtp_src_1 ! udpsink port=5002 host=127.0.0.1 ts-offset=0 name=artpsink \
rtpbin.send_rtcp_src_1 ! udpsink port=5003 host=127.0.0.1 sync=false async=false name=artcpsink \
udpsrc port=5007 name=artpsrc ! rtpbin.recv_rtcp_sink_1
client:
gst-launch -v gstrtpbin name=rtpbin latency=200 \
udpsrc caps="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264" port=5000 ! rtpbin.recv_rtp_sink_0 \
rtpbin. ! rtph264depay ! decodebin ! xvimagesink \
udpsrc port=5001 ! rtpbin.recv_rtcp_sink_0 \
rtpbin.send_rtcp_src_0 ! udpsink port=5005 host=127.0.0.1 sync=false async=false \
udpsrc caps="application/x-rtp,media=(string)audio,clock-rate=(int)8000,encoding-name=(string)PCMA" port=5002 ! rtpbin.recv_rtp_sink_1 \
rtpbin. ! rtppcmadepay ! decodebin ! audioconvert ! audioresample ! alsasink \
udpsrc port=5003 ! rtpbin.recv_rtcp_sink_1 \
rtpbin.send_rtcp_src_1 ! udpsink port=5007 host=127.0.0.1 sync=false async=false
or :
gst-launch -vvv playbin uri=file:///home/sx/client.sdp
with client.sdp:
v=0
o=- 1188340656180883 1 IN IP4 127.0.0.1
s=Session streamed by GStreamer
i=server.sh
t=0 0
a=tool:GStreamer
a=type:broadcast
m=video 5000 RTP/AVP 96
c=IN IP4 127.0.0.1
a=rtpmap:96 H264/90000
m=audio 5002 RTP/AVP 8
c=IN IP4 127.0.0.1
gst-launch -v videotestsrc ! queue ! x264enc byte-stream=false bitrate=300 ! rtph264pay pt=126 ! udpsink port=55555 host=127.0.0.1 ts-offset=0
ok but toooooo slow:
gst-launch -v rcslabsrtmpsrc url="rtmp://192.168.1.47/live/111" librtmp-loglevel=2 ! flvdemux name=demux demux.video ! queue name="queue.video" ! ffdec_h264 ! x264enc ! rtph264pay pt=96 ! udpsink port=55555 host=127.0.0.1 sync=false async=false ts-offset=0
works very good but only with sdp:
gst-launch -vvv playbin uri=file:///home/sx/client.sdp
v=0
o=- 1188340656180883 1 IN IP4 127.0.0.1
s=Session streamed by GStreamer
i=server.sh
t=0 0
a=tool:GStreamer
a=type:broadcast
m=video 55555 RTP/AVP 96
c=IN IP4 127.0.0.1
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=0; profile-level-id=42001f; sprop-parameter-sets=Z0KAH5ZUCg/YCoQAAAMABAAAAwB6doSJqA==,aM41IA==
profile_idc = 42 imply Baseline profile
profile_iop = 00 ???
level_idc = 1f imply level 3.1 ???
sprop-parameter-sets
SPS 67 42 80 1f 96 54 0a 0f d8 0a 84 00 00 03 00 04 00 00 03 00 7a 76 84 89 a8
|
|...0 0111 = Type: NAL unit - Sequence parameter set (7)
| start SPS
PPS 68 ce 35 20
|
| NAL unit header or first byte of the payload
| ...0 1000 = Type: NAL unit - Picture parameter set (8)
| start PPS
this is good one
67 42 e0 28 96 54 0b 04 b4 20 00 01 77 00 00 57 e4 10 80
68 ce 04 89 e8
80 1f 96 54 0a 0f d8 0a 84 00 00 03 00 04 00 00 03 00 7a 76 84 89 a8
e0 28 96 54 0b 04 b4 20 00 01 77 00 00 57 e4 10 80
@see http://stackoverflow.com/questions/2378609/how-to-decode-sprop-parameter-sets-in-a-h264-sdp
@see sprop-parameter-sets http://tools.ietf.org/html/draft-lennox-avt-h264-source-fmtp-00
The "sprop-parameter-sets" parameter encodes H.264 sequence parameter
set (SPS) and picture parameter set (PPS) Network Adaptation Layer (NAL) units.
@see H264 spec http://www.itu.int/rec/T-REC-H.264
@see http://thompsonng.blogspot.com/2010/10/sdp-h264-profile-level-id.html
profile-level-id define the properties of the incoming H.264 stream.
It indicates the profile level the decoder must comply to in order to decode the incoming NAL unit stream.
It is a Base16 representation of 3 bytes in the SPS of NAL unit.
1 byte - profile_idc
1 byte - profile_iop
1 byte - level_idc
for example, profile-level-id=42E015 imply
profile_idc = 42 imply Baseline profile
profile_iop = E0 imply only common subset of profile is supported
level_idc = 15 imply level 2.1
In general, profile-level-id and packetization-mode identify the media format configuration for H.264
See RFC 3984 Section 8.1 for details
good enough workaround
gst-launch -vvv rcslabsrtmpsrc url="rtmp://192.168.1.47/live/111" librtmp-loglevel=2 ! flvdemux name=demux demux.video ! queue name="queue.video" ! h264parse config-interval=1 ! rtph264pay pt=96 ! udpsink port=55555 host=127.0.0.1 sync=false async=false ts-offset=0
=========================== SPEEX ================
gst-launch-0.10 --gst-debug=*:5 --gst-debug-no-color rcslabsrtmpsrc url="rtmp://localhost/live/111" librtmp-loglevel=0 ! flvdemux name=demux demux.audio ! queue name="queue.audio" ! speexdec ! alawenc ! fakesink
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment