Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save datavudeja/edfee771cbf30a1e619e21e4d3ee9a7d to your computer and use it in GitHub Desktop.

Select an option

Save datavudeja/edfee771cbf30a1e619e21e4d3ee9a7d to your computer and use it in GitHub Desktop.
Create mp4 from pictures

mostly from the url here:

-pattern_type glob

This great option makes it easier to select the images in many cases.

Normal speed video with one image per frame at 30 FPS

create mp4 from pictures in a directory: ffmpeg -framerate 30 -pattern_type glob -i '*.png' \ -c:v libx264 -pix_fmt yuv420p out.mp4

same but add audio to it:

ffmpeg -framerate 30 -pattern_type glob -i '*.png' \
-i audio.ogg -c:a copy -shortest -c:v libx264 -pix_fmt yuv420p out.mp4

Slideshow video with one image per second

ffmpeg -framerate 1 -pattern_type glob -i '*.png' \
  -c:v libx264 -r 30 -pix_fmt yuv420p out.mp4

Be a hippie and use the Theora patent-unencumbered video format in an OGG container:

ffmpeg -framerate 1 -pattern_type glob -i '*.png' -i audio.ogg \
  -c:a copy -shortest -c:v libtheora -r 30 -pix_fmt yuv420p out.ogv

Your images should of course be sorted alphabetically, typically as:

0001-first-thing.jpg
0002-second-thing.jpg
0003-and-third.jpg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment