Skip to content

Instantly share code, notes, and snippets.

@tkarna
Last active May 31, 2021 18:46
Show Gist options
  • Save tkarna/c5bba20628d66385a76a1ef960613033 to your computer and use it in GitHub Desktop.
Save tkarna/c5bba20628d66385a76a1ef960613033 to your computer and use it in GitHub Desktop.
Script to generate an mp4 video file from still images
#!/bin/bash
# generate mp4 animation from still images with ffmpeg.
if [ $# != 2 ]; then
echo "Usage: $(basename "$0") \"image/file/pattern_*.png\" output.mp4"
exit -1
fi
pattern=$1
outputfile=$2
ffmpeg -y -r 25 -pattern_type glob -i "$pattern" \
-r 25 -c:v libx264 -preset slow -crf 5 \
-vf "scale=ceil(iw/3)*2:ceil(ih/3)*2" \
-pix_fmt yuv420p \
$outputfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment