diff options
Diffstat (limited to 'examples/old-stream-stuff/reflect')
20 files changed, 216 insertions, 0 deletions
diff --git a/examples/old-stream-stuff/reflect/count-retrofit.sh b/examples/old-stream-stuff/reflect/count-retrofit.sh new file mode 100755 index 0000000..1ff8c30 --- /dev/null +++ b/examples/old-stream-stuff/reflect/count-retrofit.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +while :; do + date=$(date +"%Y-%m-%d-%H:%M:%S") + #( lsof -n | grep vlc ; ssh root@gaffeltruck.tg12.gathering.org 'lsof -n | grep vlc' ) > /var/log/stream-count/$date + sudo lsof -n | grep vlc > /var/log/stream-count/$date + for PORT in 3013 3014 3015 3016 3017 3018 3019 5013 5015 5019; do + for PROTO in IPv4 IPv6; do + if [ "$PROTO" = "IPv4" ]; then + GREPFOR='151\.216' + else + GREPFOR='2a02:ed02:' + fi + + # 151.216.x.x / 2a02:ed02::/32 -> TG13 + cat /var/log/stream-count/$date | grep EST | egrep $GREPFOR | egrep "(151\.216\..*|2a02:ed02:.*):$PORT->" | cut -d'>' -f2 | sed 's/:[0-9]\+ (ESTABLISHED)//' | sort -u | grep -vEc -e "\[2a02:ed02:|151\.216\." | while read foo; do echo "$date $PORT $PROTO external $foo"; done | tee -a better_datacube.log + cat /var/log/stream-count/$date | grep EST | egrep $GREPFOR | egrep "(151\.216\..*|2a02:ed02:.*):$PORT->" | cut -d'>' -f2 | sed 's/:[0-9]\+ (ESTABLISHED)//' | sort -u | grep -Ec -e "\[2a02:ed02:|151\.216\." | while read foo; do echo "$date $PORT $PROTO internal $foo"; done | tee -a better_datacube.log + done + done + sleep 60 +done; + diff --git a/examples/old-stream-stuff/reflect/count.sh b/examples/old-stream-stuff/reflect/count.sh new file mode 100755 index 0000000..e1fa38c --- /dev/null +++ b/examples/old-stream-stuff/reflect/count.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +while :; do + date=$(date +"%Y-%m-%d-%H:%M:%S") + #( lsof -n | grep vlc ; ssh root@gaffeltruck.tg12.gathering.org 'lsof -n | grep vlc' ) > /var/log/stream-count/$date + sudo lsof -n | grep vlc > /var/log/stream-count/$date + for PORT in 3013 3014 3015 3016 3017 3018 3019 5013 5015 5019; do + for PROTO in IPv4 IPv6; do + if [ "$PROTO" = "IPv4" ]; then + GREPFOR='151\.216' + else + GREPFOR='2a02:ed02:' + fi + + # 151.216.x.x / 2a02:ed02::/32 -> TG13 + cat /var/log/stream-count/$date | grep EST | egrep $GREPFOR | egrep "(151\.216\..*|2a02:ed02:.*):$PORT->" | cut -d'>' -f2 | sed 's/:[0-9]\+ (ESTABLISHED)//' | sort -u | grep -vEc -e "\[2a02:ed02:|151\.216\." | while read foo; do echo "$date $PORT $PROTO external $foo"; done | tee -a count_datacube.log + cat /var/log/stream-count/$date | grep EST | egrep $GREPFOR | egrep "(151\.216\..*|2a02:ed02:.*):$PORT->" | cut -d'>' -f2 | sed 's/:[0-9]\+ (ESTABLISHED)//' | sort -u | grep -Ec -e "\[2a02:ed02:|151\.216\." | while read foo; do echo "$date $PORT $PROTO internal $foo"; done | tee -a count_datacube.log + done + done + sleep 60 +done; + diff --git a/examples/old-stream-stuff/reflect/htb.sh b/examples/old-stream-stuff/reflect/htb.sh new file mode 100755 index 0000000..c6107ea --- /dev/null +++ b/examples/old-stream-stuff/reflect/htb.sh @@ -0,0 +1,79 @@ +#!/bin/bash +it () { + iptables $@ + ip6tables $@ +} + +setup_htb() { + FROM=$1 + TO=$2 + RATEMBIT=$3 + FIFOLIMIT=$(( RATEMBIT * 1048576 / 8 )) # about one second + echo $FROM..$TO ${RATEMBIT}Mbit fifolimit=$FIFOLIMIT >&2 + + for i in $( seq $FROM $TO ); do + # slots need to be in hex, crazy enough + slot=$( printf %x $(( i + 1 )) ) + + # no burst! perfectly even sending at the given rate + echo class add dev eth0 parent 8000: classid 8000:$slot htb rate ${RATEMBIT}Mbit burst 0 mtu 576 + + # every class needs a child qdisc, plug in a plain fifo + # 8000kbit = 512 000 + echo qdisc add dev eth0 parent 8000:$slot handle $slot: bfifo limit $FIFOLIMIT + #echo qdisc add dev eth0 parent 8000:$slot handle $slot: fq_codel limit 1000 + done +} + +ethtool -K eth0 gso off tso off + +# iptables stuff +it -t mangle -F OUTPUT +it -t mangle -A OUTPUT -p tcp -m multiport ! --sport 3013,3014,3015,3016,3017,3018,5013,5015,5016,5018 -j MARK --set-mark 65000 +it -t mangle -A OUTPUT ! -p tcp -j MARK --set-mark 65000 + +( + # reset tc + echo qdisc del dev eth0 root + + # @Sesse Rockj: https://www.google.com/search?q=6000+kbit%2Fsec+*+0.5+seconds+in+byte + # @Sesse ViD: også trenger du flere sett med køer, for 2mbit-strømmer burde shapes annerledes enn 5mbit-strømmer :-P + + # root qdisc should be htb + echo qdisc add dev eth0 root handle 8000: htb r2q 100 + + # all non-vlc traffic (fwmark 5) goes into the default class + echo class add dev eth0 parent 8000: classid 8000:1 htb rate 10Gbit burst 8192 mtu 1514 + echo filter add dev eth0 parent 8000: handle 65000 pref 10 fw classid 8000:1 + + # setup_htb 1 799 6 # Main stream hq 3mbps + # setup_htb 800 1000 15 # Fuglecam raw 7-8mbps + # # setup_htb 10000 11999 15 # South raw ?? + # # setup_htb 12000 13999 1 # South transcoded, 500 kbits + # # setup_htb 14000 15999 25 # NOC Fisheye 15mbps ish + # # setup_htb 20000 21999 2 # Flashstrøm 1mbps + + # setup_htb 1 4999 10 # Main stream hq 6mbps + # setup_htb 5000 7999 5 # Main stream sd 2mbit + # setup_htb 8000 9999 15 # Fuglecam raw 7-8mbps + # setup_htb 10000 11999 15 # South raw ?? + # setup_htb 12000 13999 1 # South transcoded, 500 kbits + # setup_htb 14000 15999 25 # NOC Fisheye 15mbps ish + # setup_htb 16000 18999 2 # Flashstrøm fugleberget 1mbps + # setup_htb 19000 21999 2 # Flashstrøm event 1mbps + # setup_htb 22000 24999 2 # Flashstrøm south 1mbps + # setup_htb 25000 27999 2 # Flashstrøm noc 1mbps + setup_htb 1 4999 10 # Main stream hq 6mbps + setup_htb 5000 5999 5 # Main stream sd 2mbit + setup_htb 8000 9999 15 # Fuglecam raw 7-8mbps + setup_htb 10000 11999 15 # South raw ?? + setup_htb 12000 13999 1 # South transcoded, 500 kbits + setup_htb 14000 15999 25 # NOC Fisheye 15mbps ish + setup_htb 16000 18999 2 # Flashstrøm fugleberget 1mbps + setup_htb 19000 21999 2 # Flashstrøm event 1mbps + setup_htb 22000 24999 2 # Flashstrøm south 1mbps + setup_htb 25000 25999 2 # Flashstrøm noc 1mbps + + # decide between the classes by mark + echo filter add dev eth0 parent 8000: handle 2 pref 20 flow map key mark baseclass 8000:2 +) | tc -b diff --git a/examples/old-stream-stuff/reflect/old/reflectsouth.sh b/examples/old-stream-stuff/reflect/old/reflectsouth.sh new file mode 100755 index 0000000..39504e5 --- /dev/null +++ b/examples/old-stream-stuff/reflect/old/reflectsouth.sh @@ -0,0 +1,5 @@ +#!/bin/sh +while :; do +vlc --intf dummy -v http://pannekake.samfundet.no:9094 vlc://quit --sout '#duplicate{dst=std{access=http,mux=ts,dst=:3014},dst=std{access=udp,mux=ts,dst=233.191.12.2:2014}' --intf dummy --ttl 20 + sleep 1 +done diff --git a/examples/old-stream-stuff/reflect/old/reflectsouth720p.sh b/examples/old-stream-stuff/reflect/old/reflectsouth720p.sh new file mode 100755 index 0000000..355cf8e --- /dev/null +++ b/examples/old-stream-stuff/reflect/old/reflectsouth720p.sh @@ -0,0 +1,6 @@ +#!/bin/sh +while :; do +cvlc --intf dummy -v "#transcode{vcodec=h264,width=320,height=180,acodec=aac,ab=128,vb=500}:rtp{port=4555,sdp=rtsp://151.216.106.2:4555/stream.sdp,mp4a-latm}" +vlc --intf dummy -v http://pannekake.samfundet.no:9093 vlc://quit --sout '#std{access=http,mux=ts,dst=:5014}' --intf dummy --ttl 30 + sleep 1 +done diff --git a/examples/old-stream-stuff/reflect/reflect-event-lol.sh b/examples/old-stream-stuff/reflect/reflect-event-lol.sh new file mode 100755 index 0000000..74dbea6 --- /dev/null +++ b/examples/old-stream-stuff/reflect/reflect-event-lol.sh @@ -0,0 +1,7 @@ +#!/bin/sh +while :; do +sudo cvlc --intf dummy -v --sout-http-mark-start 0 --sout-http-mark-end 4999 udp://@:4013 vlc://quit --sout \ +'#duplicate{dst=std{access=http,mux=ts,dst=[::]:3013}",dst=std{access=udp,mux=ts,dst=[ff7e:a40:2a02:ed02:ffff::13]:2013},dst=std{access=livehttp{seglen=5,delsegs=true,numsegs=5,index=/srv/stream.tg13.gathering.org/ios/event.m3u8,index-url=http://stream.tg13.gathering.org/ios/event-########.ts},mux=ts{use-key-frames},dst=/srv/stream.tg13.gathering.org/ios/event-########.ts}}}' \ +--intf dummy --ttl 60 + sleep 1 +done diff --git a/examples/old-stream-stuff/reflect/reflect-event-sd.sh b/examples/old-stream-stuff/reflect/reflect-event-sd.sh new file mode 100755 index 0000000..aa38018 --- /dev/null +++ b/examples/old-stream-stuff/reflect/reflect-event-sd.sh @@ -0,0 +1,5 @@ +#!/bin/sh +while :; do +sudo cvlc --intf dummy -v --sout-http-mark-start 5000 --sout-http-mark-end 7999 udp://@:4014 vlc://quit --sout '#duplicate{dst=std{access=http,mux=ts,dst=[::]:3014},dst=std{access=udp,mux=ts,dst=[ff7e:a40:2a02:ed02:ffff::14]:2014}' --intf dummy --ttl 60 + sleep 1 +done diff --git a/examples/old-stream-stuff/reflect/reflect-event.sh b/examples/old-stream-stuff/reflect/reflect-event.sh new file mode 100755 index 0000000..3ab8c42 --- /dev/null +++ b/examples/old-stream-stuff/reflect/reflect-event.sh @@ -0,0 +1,7 @@ +#!/bin/sh +while :; do +sudo cvlc --intf dummy -v --sout-http-mark-start 0 --sout-http-mark-end 4999 udp://@:4013 vlc://quit --sout \ +'#duplicate{dst=std{access=http,mux=ts,dst=[::]:3013}",dst=std{access=udp,mux=ts,dst=[ff7e:a40:2a02:ed02:ffff::13]:2013},dst=std{access=livehttp{seglen=5,delsegs=true,numsegs=5,index=/srv/stream.tg13.gathering.org/ios/stream.m3u8,index-url=http://stream.tg13.gathering.org/ios/stream-########.ts},mux=ts{use-key-frames},dst=/srv/stream.tg13.gathering.org/ios/stream-########.ts}}}' \ +--intf dummy --ttl 60 + sleep 1 +done diff --git a/examples/old-stream-stuff/reflect/reflect-fugle-flash.sh b/examples/old-stream-stuff/reflect/reflect-fugle-flash.sh new file mode 100755 index 0000000..5de38bb --- /dev/null +++ b/examples/old-stream-stuff/reflect/reflect-fugle-flash.sh @@ -0,0 +1,6 @@ +#!/bin/sh +while :; do +sudo cvlc -vv --sout-http-mark-start 16000 --sout-http-mark-end 18999 --network-caching 3000 --sout-x264-preset fast --sout-transcode-threads 10 --sout-x264-tune film --no-sout-x264-interlaced --sout-x264-lookahead 50 --sout-x264-vbv-maxrate 800 --sout-x264-vbv-bufsize 800 --sout-x264-keyint 50 -v udp://@:4020 vlc://quit \ +--sout '#std{access=http{mime=video/x-flv},mux=ffmpeg{mux=flv},dst=[::]:5015/stream.flv}' + sleep 1 +done diff --git a/examples/old-stream-stuff/reflect/reflect-fuglecam.sh b/examples/old-stream-stuff/reflect/reflect-fuglecam.sh new file mode 100755 index 0000000..c9a8917 --- /dev/null +++ b/examples/old-stream-stuff/reflect/reflect-fuglecam.sh @@ -0,0 +1,5 @@ +#!/bin/bash +while :; do +sudo vlc -vvv --intf dummy -v --sout-http-mark-start 8000 --sout-http-mark-end 9999 udp://@:4015 vlc://quit --sout '#duplicate{dst=std{access=http,mux=ts,dst=[::]:3015},dst=std{access=udp,mux=ts,dst=[ff7e:a40:2a02:ed02:ffff::15]:2015}' --intf dummy --ttl 60 + sleep 1 +done diff --git a/examples/old-stream-stuff/reflect/reflect-nicfisheye-flash.sh b/examples/old-stream-stuff/reflect/reflect-nicfisheye-flash.sh new file mode 100755 index 0000000..dd4da84 --- /dev/null +++ b/examples/old-stream-stuff/reflect/reflect-nicfisheye-flash.sh @@ -0,0 +1,5 @@ +#!/bin/bash +while :; do +sudo vlc -vvv --intf dummy -v --sout-http-mark-start 25000 --sout-http-mark-end 27999 udp://@:4018 vlc://quit --sout '#duplicate{dst=std{access=http,mux=ts,dst=[::]:3018},dst=std{access=udp,mux=ts,dst=[ff7e:a40:2a02:ed02:ffff::18]:2018}' --intf dummy --ttl 60 + sleep 1 +done diff --git a/examples/old-stream-stuff/reflect/reflect-noc-transcodes.sh b/examples/old-stream-stuff/reflect/reflect-noc-transcodes.sh new file mode 100755 index 0000000..3a1fe4e --- /dev/null +++ b/examples/old-stream-stuff/reflect/reflect-noc-transcodes.sh @@ -0,0 +1,5 @@ +#!/bin/sh +while :; do +sudo cvlc -vvv --intf dummy -v --sout-http-mark-start 25000 --sout-http-mark-end 27999 udp://@:4019 vlc://quit --sout '#duplicate{dst="std{access=http{mime=video/x-flv},dst=[::]:5019/stream.flv}",dst="std{access=http,mux=ts,dst=[::]:3019}",dst="std{access=udp,mux=ts,dst=[ff7e:a40:2a02:ed02:ffff::19]:2019}"}' --intf dummy --ttl 60 + sleep 1 +done diff --git a/examples/old-stream-stuff/reflect/reflect-nocfisheye.sh b/examples/old-stream-stuff/reflect/reflect-nocfisheye.sh new file mode 100755 index 0000000..6a003f4 --- /dev/null +++ b/examples/old-stream-stuff/reflect/reflect-nocfisheye.sh @@ -0,0 +1,5 @@ +#!/bin/sh +while :; do +sudo cvlc -vvv --intf dummy -v --sout-http-mark-start 14000 --sout-http-mark-end 15999 --network-caching 2000 rtsp://151.216.124.79/live.sdp vlc://quit --sout '#duplicate{dst=std{access=http,mux=ts,dst=[::]:3018},dst=std{access=udp,mux=ts,dst=[ff7e:a40:2a02:ed02:ffff::18]:2018}' --intf dummy --ttl 60 + sleep 1 +done diff --git a/examples/old-stream-stuff/reflect/reflect-south-raw.sh b/examples/old-stream-stuff/reflect/reflect-south-raw.sh new file mode 100755 index 0000000..720e94c --- /dev/null +++ b/examples/old-stream-stuff/reflect/reflect-south-raw.sh @@ -0,0 +1,5 @@ +#!/bin/sh +while :; do +sudo cvlc -vvv --intf dummy -v --sout-http-mark-start 10000 --sout-http-mark-end 11999 udp://@151.216.125.4:4016 vlc://quit --sout '#duplicate{dst=std{access=http,mux=ts,dst=[::]:3016},dst=std{access=udp,mux=ts,dst=[ff7e:a40:2a02:ed02:ffff::16]:2016}' --intf dummy --ttl 60 + sleep 1 +done diff --git a/examples/old-stream-stuff/reflect/reflect-south-transcode.sh b/examples/old-stream-stuff/reflect/reflect-south-transcode.sh new file mode 100755 index 0000000..65798dc --- /dev/null +++ b/examples/old-stream-stuff/reflect/reflect-south-transcode.sh @@ -0,0 +1,5 @@ +#!/bin/sh +while :; do +vlc -vvv --intf dummy -v --sout-http-mark-start 12000 --sout-http-mark-end 13999 udp://@:4017 vlc://quit --sout '#duplicate{dst=std{access=http,mux=ts,dst=[::]:3017},dst=std{access=udp,mux=ts,dst=[ff7e:a40:2a02:ed02:ffff::17]:2017}' --intf dummy --ttl 60 + sleep 1 +done diff --git a/examples/old-stream-stuff/reflect/transcode-event-flash.sh b/examples/old-stream-stuff/reflect/transcode-event-flash.sh new file mode 100755 index 0000000..34f546f --- /dev/null +++ b/examples/old-stream-stuff/reflect/transcode-event-flash.sh @@ -0,0 +1,6 @@ +#!/bin/sh +while :; do +sudo cvlc -vv --sout-http-mark-start 19000 --sout-http-mark-end 21999 --network-caching 5000 --sout-x264-preset fast --sout-transcode-threads 10 --sout-x264-tune film --no-sout-x264-interlaced --sout-x264-lookahead 50 --sout-x264-vbv-maxrate 800 --sout-x264-vbv-bufsize 800 --sout-x264-keyint 50 -v http://stream.tg13.gathering.org:3013 vlc://quit \ +--sout '#transcode{height=480,fps=25,vcodec=h264,vb=800,acodec=aac,ab=128}:std{access=http{mime=video/x-flv},dst=[::]:5013/stream.flv}' + sleep 1 +done diff --git a/examples/old-stream-stuff/reflect/transcode-fugle-flash.sh b/examples/old-stream-stuff/reflect/transcode-fugle-flash.sh new file mode 100755 index 0000000..110b8b8 --- /dev/null +++ b/examples/old-stream-stuff/reflect/transcode-fugle-flash.sh @@ -0,0 +1,6 @@ +#!/bin/sh +while :; do +sudo cvlc -vv --sout-http-mark-start 16000 --sout-http-mark-end 18999 --network-caching 3000 --sout-x264-preset fast --sout-transcode-threads 10 --sout-x264-tune film --no-sout-x264-interlaced --sout-x264-lookahead 50 --sout-x264-vbv-maxrate 800 --sout-x264-vbv-bufsize 800 --sout-x264-keyint 50 -v http://stream.tg13.gathering.org:3015 vlc://quit \ +--sout '#transcode{height=480,fps=25,vcodec=h264,vb=800,acodec=aac,ab=128,deinterlace}:std{access=http{mime=video/x-flv},dst=[::]:5015/stream.flv}' + sleep 1 +done diff --git a/examples/old-stream-stuff/reflect/transcode-nocfisheye-flash.sh b/examples/old-stream-stuff/reflect/transcode-nocfisheye-flash.sh new file mode 100755 index 0000000..19f89ad --- /dev/null +++ b/examples/old-stream-stuff/reflect/transcode-nocfisheye-flash.sh @@ -0,0 +1,6 @@ +#!/bin/sh +while :; do +sudo cvlc -vv --sout-http-mark-start 25000 --sout-http-mark-end 27999 --network-caching 5000 --sout-x264-preset fast --sout-transcode-threads 10 --sout-x264-tune film --no-sout-x264-interlaced --sout-x264-lookahead 50 --sout-x264-vbv-maxrate 800 --sout-x264-vbv-bufsize 800 --sout-x264-keyint 50 -v http://stream.tg13.gathering.org:3018 vlc://quit \ +--sout '#transcode{height=480,fps=25,vcodec=h264,vb=800,acodec=aac,ab=128}:std{access=http{mime=video/x-flv},dst=[::]:5018/stream.flv}' + sleep 1 +done diff --git a/examples/old-stream-stuff/reflect/transcode-south-flash.sh b/examples/old-stream-stuff/reflect/transcode-south-flash.sh new file mode 100755 index 0000000..6bf2cb8 --- /dev/null +++ b/examples/old-stream-stuff/reflect/transcode-south-flash.sh @@ -0,0 +1,6 @@ +#!/bin/sh +while :; do +sudo cvlc -vv --sout-http-mark-start 22000 --sout-http-mark-end 24999 --network-caching 5000 --sout-x264-preset fast --sout-transcode-threads 10 --sout-x264-tune film --no-sout-x264-interlaced --sout-x264-lookahead 50 --sout-x264-vbv-maxrate 800 --sout-x264-vbv-bufsize 800 --sout-x264-keyint 50 -v http://stream.tg13.gathering.org:3016 vlc://quit \ +--sout '#transcode{height=480,fps=25,vcodec=h264,vb=800,acodec=aac,ab=128}:std{access=http{mime=video/x-flv},dst=[::]:5016/stream.flv}' + sleep 1 +done diff --git a/examples/old-stream-stuff/reflect/usage.txt b/examples/old-stream-stuff/reflect/usage.txt new file mode 100644 index 0000000..8b90bee --- /dev/null +++ b/examples/old-stream-stuff/reflect/usage.txt @@ -0,0 +1,3 @@ +event-sd - ./reflect-event-sd.sh +event - ./reflect-event-lol.sh +event-flash - ./transcode-event-flash.sh |