Skip to content

Instantly share code, notes, and snippets.

@rieder
Last active December 2, 2022 11:09
Show Gist options
  • Save rieder/817a437bdbba7dacee2b50f0230a7f55 to your computer and use it in GitHub Desktop.
Save rieder/817a437bdbba7dacee2b50f0230a7f55 to your computer and use it in GitHub Desktop.
Make a movie from a set of PNG images, using ffmpeg
framerate=60
i=0
padtowidth=6
for plot in plot-??????.png; do
ln -s $plot `printf "frame-%0*d.png \n" $padtowidth $i`;
let i=i+1
done
ffmpeg -framerate $framerate \
-i frame-%06d.png \
-c:v libx264 \
-r $framerate \
-pix_fmt yuv420p \
-vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" \
movie.mp4
rm frame-*.png
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment