diff options
Diffstat (limited to 'roles/prerec/templates')
-rwxr-xr-x | roles/prerec/templates/reencode.sh | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/roles/prerec/templates/reencode.sh b/roles/prerec/templates/reencode.sh index 7ae3234..66c2f57 100755 --- a/roles/prerec/templates/reencode.sh +++ b/roles/prerec/templates/reencode.sh @@ -7,7 +7,8 @@ q=32 cpu=4 time_limit="" print_only=false -resolution=1080 +limit_resolution=1080 +limit_fps=30.01 while getopts :q:c:t:s OPT; do case $OPT in @@ -32,8 +33,18 @@ shift `expr $OPTIND - 1` OPTIND=1 command="$(cat<<EOF -ffmpeg -y -i "$1" $time_limit -vf "scale='-1':'min($resolution,ih)'" -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 -vf "scale='-1':'min($resolution,ih)'" -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" +ffmpeg -y -i "$1" $time_limit \ + -vf "scale='-1':'min($limit_resolution,ih)', + select='eq(n,0)+if(gt(t-prev_selected_t,1/$limit_fps),1,0)'" \ + -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 \ + -vf "scale='-1':'min($limit_resolution,ih)', + select='eq(n,0)+if(gt(t-prev_selected_t,1/$limit_fps),1,0)'" \ + -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 -threads $cpu "$2" EOF )" |