user5461722
user5461722

Reputation: 55

Animation from large number of jpg files

I have more than 100,000 jpg images in a directory and want to create an animation from these files. These files are sequentially numbered from file1 to file125000. I have tried using ImageMagick and many other free tools, but hasn't worked. After 3 hours, imagemagick gave an error saying that the number of files is too large. Is there any tool (Windows) that can process this?

Upvotes: 1

Views: 470

Answers (1)

sardylan
sardylan

Reputation: 54

You can use ffmpeg with a command like this one:

ffmpeg.exe -f image2 -r 30 -i image%06d.jpg -codec:v libx264 -crf 23 video.mp4

ffmpeg command line have a structure like this:

ffmpeg [input params] -i <input> [output params] <output>

Input params are:

  • -f: is used to force input or output format. In my example is used to indicate that input file is intended to be parsed as image2, an internal ffmpeg format which can be used to specify multiple images using a pattern;
  • -r: can be used to force frame rate both on input or output. If used only on input, output framerate is inherited.
  • -i image%06d.jpg: this flag specify to read all image with 6 integer digits, filled with leading zeroes (from image000000.jpg to image999999.jpg). Of course ffmpeg will stop at last existing file.

Other params are used to specify output format and video codec. In particular:

  • -codec:v libx264: specify video codec (x264 using libx264)
  • -crf 23: this parameter is peculiar of x264 encoder, used to specify Constant RateFactor, and influences output bitrate and others.
  • video.mp4: If not specified, FFMpeg try to guess output format from the output file name. In my example I used .mp4, so FFmpeg will encode video using libx264 encoder and MP4 format.

FFMpeg windows build can be download from zeranoe

Edit: if your images names don't have leading zeroes try using file%6d.jpg instead of file%06d.jpg as input filename (without 0).

Upvotes: 1

Related Questions