blob: e3a82ebbb7e58a4e44a706540bd02e06e3327f28 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#!/usr/bin/env bash
set -euo pipefail
# Defaults
q=32
cpu=4
time_limit=""
print_only=false
while getopts :q:c:t:s OPT; do
case $OPT in
q|+q)
q="$OPTARG"
;;
c|+c)
cpu="$OPTARG"
;;
t|+t)
time_limit="-to $OPTARG"
;;
s)
print_only=true
;;
*)
echo "usage: `basename $0` [+-q ARG] [+-c ARG} [--] ARGS..."
exit 2
esac
done
shift `expr $OPTIND - 1`
OPTIND=1
command="$(cat<<EOF
ffmpeg -y -i "$1" $time_limit -c:v libvpx-vp9 -b:v 0 -crf $q -an -row-mt 1 -tile-columns 2 -tile-rows 2 -cpu-used $cpu -g 240 -pass 1 -f webm -threads $cpu /dev/null &&
ffmpeg -y -i "$1" $time_limit -c:v libvpx-vp9 -b:v 0 -crf $q -c:a libopus -row-mt 1 -tile-columns 2 -tile-rows 2 -cpu-used $cpu -pass 2 -g 240 -threads $cpu "$2"
EOF
)"
if [ $print_only == true ]; then
echo "$command"
else
eval "$command"
fi
|