Method 1: Use sequence patterns
What you really need is this, if your first image is called GOPR0001.JPG
:
ffmpeg.exe -i "GOPR%04d.JPG" -pix_fmt yuv420p out.mp4
Or if the first image is called GOPR3973.JPG
, you need to give ffmpeg the start number to look for:
ffmpeg.exe -start_number 3973 -i "GOPR%04d.JPG" -pix_fmt yuv420p out.mp4
Method 2: Use globbing patterns
If your ffmpeg version has support for globbing (which the Windows builds do not have, I think), then you can simply do:
ffmpeg.exe -pattern_type glob -i "GOPR*.JPG" -pix_fmt yuv420p out.mp4
This is preferred if you don't know the start number or simply don't care for precise control.
Why it doesn't work
ffmpeg.exe -i GOPR*.JPG out.mp4
This does not work because it will expand to something like this (assuming your first image is called GOPR0001.JPG
):
ffmpeg.exe -i GOPR0001.JPG GOPR0002.JPG … out.mp4
Since ffmpeg treats the last unnamed argument option (i.e. anything without a leading -
) as the output file name, GOPR2.JPG
would be the output, and anything until out.mp4
will not be applied.
Some hints
-pix_fmt yuv420p
is needed to convert from the JPEG's YUV 4:2:2 colorspace to 4:2:0 subsampling. Otherwise, some (most non-FFmpeg-based) players will not be able to show the videoControl the quality by setting the
-crf 23
option, and choosing something between 18 and 28, where lower means better quality.You may want to set the framerate according to which the input frames (images) were captured. Do this by running
ffmpeg.exe -framerate 30 -start_number …
. If you don't specify the framerate, ffmpeg will assume that your original frames were recorded at 25 Hz.Read the
image2
demuxer part of the manual.Double quotes are always good to use to prevent shell expansion of patterns.