]> git.plutz.net Git - serve0/blobdiff - actions/transcode.sh
adapted to update in shcgi
[serve0] / actions / transcode.sh
old mode 100644 (file)
new mode 100755 (executable)
index 835a166..427c154
@@ -1,7 +1,7 @@
 #!/bin/zsh
 
-info="$_GET[\"i\"]"
-target="$_GET[\"t\"]"
+info="${_GET[i]}"
+target="${_GET[t]}"
 video="${_DATA}/videos/$info"
 meta="${_DATA}/meta/$info.meta"
 trans="${_DATA}/transcoded/${info}.${target}p.webm"
@@ -10,7 +10,10 @@ head -n1 "$meta" |read length width height name
 
 twidth=$(($width * $target / $height))
 
-[ -f "$target" ] || nohup avconv -i "$video" -s "${twidth}x${target}" "$trans" &
+if ! [ -f "$trans" ]; then
+ [ "$target" -le 240 ] && nohup avconv -i "$video" -s "${twidth}x${target}" -b:a 80k -threads auto "$trans" &
+ [ "$target" -gt 240 ] && nohup avconv -i "$video" -s "${twidth}x${target}" -threads auto "$trans" &
+fi
 
-echo "Location: transcoded/${info}.${target}p.webm"
-echo
+echo "Location: /transcoded/${info}.${target}p.webm"
+echo