summaryrefslogtreecommitdiff
path: root/contrib/hls/start-hls.sh
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2012-10-20 19:15:54 +0200
committerChristian Pointner <equinox@spreadspace.org>2012-10-20 19:15:54 +0200
commitb372f3c141621305299e50961a16583d28db37de (patch)
tree63f71b039a35b4081eec0eff664d95d8a850071d /contrib/hls/start-hls.sh
parentadded hls handlers (diff)
moved hls to conrib dir
Diffstat (limited to 'contrib/hls/start-hls.sh')
-rwxr-xr-xcontrib/hls/start-hls.sh50
1 files changed, 50 insertions, 0 deletions
diff --git a/contrib/hls/start-hls.sh b/contrib/hls/start-hls.sh
new file mode 100755
index 0000000..418416e
--- /dev/null
+++ b/contrib/hls/start-hls.sh
@@ -0,0 +1,50 @@
+#!/bin/sh
+#
+# Installation:
+#
+# $ git clone git://github.com/johnf/m3u8-segmenter.git
+# $ cd m3u8-segmenter
+# $ ./confiugure
+# $ make
+# $ sudo cp m3u8-segmenter /usr/local/bin
+# $ copy start-hls.sh /usr/local/bin
+#
+# add following to /etc/fstab
+# tmpfs /var/www/elevate-live tmpfs size=1G,mode=755,uid=flumotion,gid=flumotion 0 0
+#
+
+if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then
+ echo "Usage: $0 <name> <src> (high|medium|low)"
+ exit 1
+fi
+
+name=$1
+quality=$3
+stream_name="$name/$2-hls-$quality"
+src="http://localhost:8000/$2-flash-$quality.flv"
+segmenter="/usr/local/bin/m3u8-segmenter"
+len=3
+num=3
+url="http://r38.realraum.at/"
+
+case "$3" in
+ high)
+ arate=160k
+ ;;
+ medium)
+ arate=128k
+ ;;
+ low)
+ arate=96k
+ ;;
+ *)
+ arate=128k
+ ;;
+esac
+
+cd /var/www
+ffmpeg -y -i "$src" -f mpegts -acodec libmp3lame -ar 44100 -ab "$arate" -vcodec copy -vbsf h264_mp4toannexb -async 2 - | $segmenter -i - -d $len -n $num -p "$stream_name" -m "$stream_name.m3u8" -u "$url"
+rm -f "$stream_name"-*.ts
+rm -f "$stream_name".m3u8
+
+exit 0