]> git.plutz.net Git - serve0/blob - actions/transcode.sh
adapted to update in shcgi
[serve0] / actions / transcode.sh
1 #!/bin/zsh
2
3 info="${_GET[i]}"
4 target="${_GET[t]}"
5 video="${_DATA}/videos/$info"
6 meta="${_DATA}/meta/$info.meta"
7 trans="${_DATA}/transcoded/${info}.${target}p.webm"
8
9 head -n1 "$meta" |read length width height name
10
11 twidth=$(($width * $target / $height))
12
13 if ! [ -f "$trans" ]; then
14  [ "$target" -le 240 ] && nohup avconv -i "$video" -s "${twidth}x${target}" -b:a 80k -threads auto "$trans" &
15  [ "$target" -gt 240 ] && nohup avconv -i "$video" -s "${twidth}x${target}" -threads auto "$trans" &
16 fi
17
18 echo "Location: /transcoded/${info}.${target}p.webm"
19 echo