From d0a508929374879a814468abc4747883f7d96546 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sat, 20 Oct 2012 19:14:56 +0200 Subject: added hls handlers --- src/hls/create-runit-conf.sh | 45 +++++++++++++++++++++++++++++++++++++ src/hls/install.sh | 10 +++++++++ src/hls/m3u8-segmenter-git-repo | 1 + src/hls/start-hls.sh | 50 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 106 insertions(+) create mode 100755 src/hls/create-runit-conf.sh create mode 100755 src/hls/install.sh create mode 100644 src/hls/m3u8-segmenter-git-repo create mode 100755 src/hls/start-hls.sh diff --git a/src/hls/create-runit-conf.sh b/src/hls/create-runit-conf.sh new file mode 100755 index 0000000..4d43282 --- /dev/null +++ b/src/hls/create-runit-conf.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +if [ -z "$1" ]; then + echo "Usage $0 " + exit 1 +fi + +name=$1 +OUT_D=runit + +rm -rf "$OUT_D" +mkdir -p "$OUT_D" + +for src in av-orig av-en; do + for profile in low medium high; do + echo "creating runit instance for $src - $profile" + DIR="$OUT_D/hls-$name-$src-$profile" + mkdir -p "$DIR/log" +cat >> "$DIR/run" <&1 +exec chpst -u flumotion:flumotion /usr/local/bin/start-hls.sh "$name" "$src" "$profile" +EOF + chmod +x "$DIR/run" + +cat >> "$DIR/log/run" < (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 -- cgit v1.2.3