X-Git-Url: http://git.plutz.net/?a=blobdiff_plain;f=actions%2Ftranscode.sh;h=427c154742d240ff6917dd927a72ea4e6c990c2b;hb=76af039ece14f3407e9187f7b2003e68a07d0076;hp=a61c2bb7345b67012df6e5f2cbdd5fff127e8dbf;hpb=d13af69e22fe3dfb384ce6334590b595cbf6904f;p=serve0 diff --git a/actions/transcode.sh b/actions/transcode.sh old mode 100644 new mode 100755 index a61c2bb..427c154 --- a/actions/transcode.sh +++ b/actions/transcode.sh @@ -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}" -threads auto "$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