How can I create a video file from a set of jpg images?
You can use ffmpeg
, which you can install with the command:
sudo apt install ffmpeg
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 image-%05d.jpg
this determines the file name sequence it looks for. image-
means all of the files start with this. The d
indicates decimal integers, 5
is number of digits, the leading zero indicates that numbers requiring fewer digits will be filled, in the left, with zeroes so that every number contains exactly 5 digits. Thus the files it will detect are everything from image-00000
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 your images are named 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.