linux – Generate a video with an image every 5 seconds using ffmpeg

I want to create a video from command line with some images like those:

-rw-r--r--  1 dt dt   3360622 Sep  4 23:57  IMG_0670.jpg
-rw-r--r--  1 dt dt   2949398 Sep  4 23:57  IMG_0671.jpg
-rw-r--r--  1 dt dt   3710442 Sep  4 23:57  IMG_0675.jpg
-rw-r--r--  1 dt dt   4569791 Sep  4 23:57  IMG_0680.jpg
-rw-r--r--  1 dt dt   5235626 Sep  4 23:57  IMG_0681.jpg
-rw-r--r--  1 dt dt   3688616 Sep  4 23:57  IMG_0682.jpg
-rw-r--r--  1 dt dt   5149644 Sep  4 23:57  IMG_0684.jpg
-rw-r--r--  1 dt dt   3415468 Sep  4 23:57  IMG_0686.jpg

that change every 5 seconds:

0s - - - - 5s - - - - 10s - - - - 15s...
img1.jpg...img2.jpg...img3.jpg....img4.jpg...
           ^          ^
           |          |
         change     change

The command I’ve tried to use is:

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

But it generate a 2 second video with images staying for 0.01 seconds…

And in this question I’ve found that I could add -loop 1 -t 5 before the input to make it stay for more seconds. The command become this:

ffmpeg -y -framerate 25 -loop 1 -t 5 -pattern_type glob -i '*.jpg' -c:v libx264 -profile:v high -crf 20 -pix_fmt yuv420p output.mp4

But now I’ve a video of more than 1 Gb (I’ve interrupted the command). How could I do this?

Read more here: Source link