5 of 13
I settled on, and recommend adding a note on "-pattern_type glob". With this syntax you do not have to renumber if your files start at a large count or itterate by more than 1 at a time(My files ranged from 20360 to 25000 with steps of 20)

This is the command all together:

ffmpeg -framerate 25 -i image-%05d.jpg -c:v libx264 -profile:v high -crf 20 -pix_fmt yuv420p output.mp4

Let me break it down:

-framerate

is the number of frames (images) per second

-i scene_%05d.jpg

this determines the file name sequence it looks for. image- means all the files start with this. 0 is the number repeated, and the 5 is number of times (so it is looking for any file starting at image-00000.jpg. The d is telling it to count up in whole numbers, so the files it will detect are everything from image-00001 to image-99999.

-c:v libx264 -profile:v high -crf 20 -pix_fmt yuv420p

-c:v libx264 - the video codec is libx264 (H.264).

-profile:v high - use H.264 High Profile (advanced features, better quality).

-crf 20 - constant quality mode, very high quality (lower numbers are higher quality, 18 is the smallest you would want to use).

-pix_fmt yuv420p - use YUV pixel format and 4:2:0 Chroma subsampling

output.mp4

The file name (output.mp4)

Remember that ffmpeg needs a continuous sequence of images to load in. If it jumps from image-00001 to image-00003 it will stop.

If you images are like this:

image-1
image-2
...
image-35

then change the -i part to -i image-%00d.


Update. Your edit says the pattern is image-01.jpg to image-02.jpg. That means you need the image-%02d.jpg pattern.


Update. A quick, dirty, but somewhat more flexible option is as follows:

ffmpeg -pattern_type glob -framerate 25 -i 'image-*.jpg' -c:v libx264 -profile:v high -crf 20 -pix_fmt yuv420p output.mp4

Here I am adding "-pattern_type glob", using the wildcard "", and putting my file name in single quotations ('image-.jpg')

The benefit: This syntax allows you to start at any number and have any pattern in your numbering (I often create a count by 20, starting around 20000 for example).

The drawbacks: This syntax does not allow you to skip repeating figures like the '%##d' syntax allows. Also, you cannot have a numbering scheme without preceding 0s. That is, the file naming scheme must be something like 00001, 00002,...00033... (Numbering cannot be 1,2,3,...33,..., else the number '3' will sort between '39' and '40' for example).

Separately, also note that I had to put my input file name in single quotation marks, otherwise ffmpeg tried to overwrite all of my picture files with a copy of the first picture (It is always a good idea to copy for a backup before manipulating files).

Tim
  • 32.8k
  • 27
  • 118
  • 178