diff options
author | Leo Vivier <zaeph@zaeph.net> | 2022-12-02 08:25:48 +0100 |
---|---|---|
committer | Leo Vivier <zaeph@zaeph.net> | 2022-12-02 08:25:48 +0100 |
commit | 1e448d2e99ff47b17d03aa5979d893b425ee7ab1 (patch) | |
tree | 6f569c699c43164058412f68f77e1d14a36cc361 /roles/prerec/templates | |
parent | 0fb08084d720946cac64b7fd7ee68c0864c29d6a (diff) | |
download | emacsconf-ansible-1e448d2e99ff47b17d03aa5979d893b425ee7ab1.tar.xz emacsconf-ansible-1e448d2e99ff47b17d03aa5979d893b425ee7ab1.zip |
Add prototype for limiting fps
Problem: doesn’t update the fps metadata info; needs another pass.
Diffstat (limited to '')
-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 )" |