LibrePlanet: Conference/2017/Streaming

From LibrePlanet
Jump to: navigation, search
(Created page with " == Slides streaming script == <pre> #!/bin/bash BITRATE=500000 MOUNT=room-141-slides.webm...")
 
Line 6: Line 6:
  
 
BITRATE=500000
 
BITRATE=500000
MOUNT=room-141-slides.webm                                                                                                            
+
MOUNT=room-141-slides.webm
 
PASSWORD=pw
 
PASSWORD=pw
 
FRAMERATE=10
 
FRAMERATE=10
Line 12: Line 12:
 
while true; do
 
while true; do
 
   sleep 1
 
   sleep 1
   gst-launch-1.0 -e ximagesrc use-damage=false show-pointer=false ! videoconvert !  videorate ! video/x-raw,framerate=$FRAMERATE/1 ! videoscale ! video/x-raw, width=1024, height=768 ! queue ! vp8enc target_bitrate=$BITRATE cpu-used=16 deadline=1 threads=2 ! webmmux streamable=true ! shout2send ip=live2.fsf.org port=80 mount=$MOUNT password=$PASSWORD sync=false
+
   gst-launch-1.0 -e ximagesrc use-damage=false show-pointer=false ! videoconvert !  videorate ! video/x-raw,framerate=$FRAMERATE/1 ! videoscale ! video/x-raw, width=1024, height=768 ! queue ! vp8enc target_bitrate=$BITRATE cpu-used=16 deadline=1 threads=2 keyframe-max-dist=$(expr $FRAMERATE \* 2) ! webmmux streamable=true ! shout2send ip=live2.fsf.org port=80 mount=$MOUNT password=$PASSWORD sync=false
 +
done
 +
</pre>
 +
 
 +
== 480p Scaling script ==
 +
 
 +
This takes a video that is being streamed at live*.fsf.org/video.webm, scales it down to 480p, and publishes it back as live*.fsf.org/video-480p.webm
 +
 
 +
<pre>
 +
#!/bin/bash
 +
 
 +
if [ $# != 1 ]; then
 +
echo usage $0 http://foo.bar/baz.webm
 +
exit 1
 +
fi
 +
 
 +
BITRATE=500000
 +
URL=$1
 +
PASSWORD=pw
 +
 
 +
MOUNT=$(echo $URL |sed 's=.*/==; s/.webm//')-480p.webm
 +
 
 +
while true; do
 +
  sleep 1
 +
  if wget $URL -O - -q | grep . -q ; then
 +
    gst-launch-1.0 -v souphttpsrc location=http://live2.fsf.org/room-141-slides.webm ! decodebin ! videoconvert ! videoscale ! video/x-raw, width=853, height=480 ! queue ! vp8enc target_bitrate=$BITRATE cpu-used=16 deadline=1 threads=2 ! webmmux streamable=true ! shout2send ip=live2.fsf.org port=80 mount=$MOUNT password=$PASSWORD sync=false
 +
  else
 +
    echo $URL is not live
 +
  fi
 
done
 
done
 
</pre>
 
</pre>

Revision as of 14:28, 21 March 2017

Slides streaming script

#!/bin/bash

BITRATE=500000
MOUNT=room-141-slides.webm
PASSWORD=pw
FRAMERATE=10

while true; do
  sleep 1
  gst-launch-1.0 -e ximagesrc use-damage=false show-pointer=false ! videoconvert !  videorate ! video/x-raw,framerate=$FRAMERATE/1 ! videoscale ! video/x-raw, width=1024, height=768 ! queue ! vp8enc target_bitrate=$BITRATE cpu-used=16 deadline=1 threads=2 keyframe-max-dist=$(expr $FRAMERATE \* 2) ! webmmux streamable=true ! shout2send ip=live2.fsf.org port=80 mount=$MOUNT password=$PASSWORD sync=false
done

480p Scaling script

This takes a video that is being streamed at live*.fsf.org/video.webm, scales it down to 480p, and publishes it back as live*.fsf.org/video-480p.webm

#!/bin/bash

if [ $# != 1 ]; then
 echo usage $0 http://foo.bar/baz.webm
 exit 1
fi

BITRATE=500000
URL=$1
PASSWORD=pw

MOUNT=$(echo $URL |sed 's=.*/==; s/.webm//')-480p.webm

while true; do
  sleep 1
  if wget $URL -O - -q | grep . -q ; then
    gst-launch-1.0 -v souphttpsrc location=http://live2.fsf.org/room-141-slides.webm ! decodebin ! videoconvert ! videoscale ! video/x-raw, width=853, height=480 ! queue ! vp8enc target_bitrate=$BITRATE cpu-used=16 deadline=1 threads=2 ! webmmux streamable=true ! shout2send ip=live2.fsf.org port=80 mount=$MOUNT password=$PASSWORD sync=false
  else
    echo $URL is not live
  fi
done