-
-
Save jonasbg/3e59034e28b2fb1ae74e49ded343f36c to your computer and use it in GitHub Desktop.
4K timelapse from photos using ffmpeg
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/bash | |
if [[ -z "$1" || -z "$2" ]]; then | |
echo "Usage: timelapse input/*.jpg output.mp4"; | |
exit; | |
fi | |
mkdir "./working" | |
output="${!#}" | |
files_length=$(($#-1)); | |
files=${@:1:$files_length} | |
for f in $files; do | |
base_f=`basename $f`; | |
f_noext="${base_f%.*}" | |
echo "Scaling $base_f"; | |
convert "$f" -resize "3840x2160^" -gravity center -crop "3840x2160+0+0" "./working/$f_noext.jpg"; | |
done | |
ffmpeg -framerate 24 -pattern_type glob -i './working/*.jpg' -c:v libx264 -pix_fmt yuv420p "$output" | |
rm -r "./working" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment