Last active
August 28, 2022 17:18
-
-
Save gre/f2a9e933d6a191b98256f963124021b8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# usage: timelapse <inputvid> <outputvid> <N> | |
# where <N> is a number with which the video will speed up by 2^(N+1) | |
set -x | |
set -e | |
input=$1 | |
output=$2 | |
tmp=`mktemp -d` | |
avg="tblend=average,framestep=2" | |
times=${3:-4} | |
speed=2 | |
for i in $(seq $times); do | |
avg="$avg,tblend=average,framestep=2" | |
speed=$(($speed * 2)) | |
done | |
ffmpeg -i "$input" -vf "$avg,setpts=PTS/$speed" -r 60 -an "$output" | |
## OTHER IDEA | |
#speedup=${3:-20} | |
#blurdef=$(($speedup * 5)) | |
#blur=${4:-$blurdef} | |
#ffmpeg -i $input -filter:v "tmix=frames=$blur,select='not(mod(n\,$blur))',setpts=PTS/$speedup" -an $output | |
# ffmpeg -i $tmp/first.mp4 -filter:v "setpts=PTS/$speedup" -an -r 60 $output | |
## DIDNT TRY | |
#ffmpeg -i $input -vf minterpolate=fps=1/$speedup $output | |
# tries=${3:-6} | |
# last=$input | |
# for i in $(seq $tries); do | |
# next=$tmp/$i.mp4 | |
# ffmpeg -i $last -filter:v "tmix=frames=4:weights=1" -an -r 60 $tmp/tmp.mp4 | |
# ffmpeg -i $tmp/tmp.mp4 -filter:v "setpts=PTS/2" -an -r 60 $next | |
# rm $tmp/tmp.mp4 | |
# echo $next | |
# done | |
# cp $next $output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment