]> git.plutz.net Git - serve0/blobdiff - actions/transcode.sh
transcoding option for additional resolutions
[serve0] / actions / transcode.sh
diff --git a/actions/transcode.sh b/actions/transcode.sh
new file mode 100644 (file)
index 0000000..835a166
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/zsh
+
+info="$_GET[\"i\"]"
+target="$_GET[\"t\"]"
+video="${_DATA}/videos/$info"
+meta="${_DATA}/meta/$info.meta"
+trans="${_DATA}/transcoded/${info}.${target}p.webm"
+
+head -n1 "$meta" |read length width height name
+
+twidth=$(($width * $target / $height))
+
+[ -f "$target" ] || nohup avconv -i "$video" -s "${twidth}x${target}" "$trans" &
+
+echo "Location: transcoded/${info}.${target}p.webm"
+echo