I'm trying to convert a series of JPEG images into a time lapse video. They're in the format IMGP0001.JPG, IMGP0002.JPG, etc. From the looks of things, this should match the pattern IMGP%04.JPG.

I've tried the following commands (modified from the 2nd entry at this page):

ffmpeg -f image2 -i IMGP%04d.jpg video.mpg

I get the error "IMGP%04d.JPG: No such file or directory".

What am I doing wrong? Perhaps the syntax "IMGP%04d.JPG" is *nix specific? If so what would be the Windows equivalent?

  • Move images to path with short name (no whitespaces etc.).
    – user105748
    Nov 17, 2011 at 8:00
  • If your images aren't sequentially named then this batch file will do that for you superuser.com/a/350633/7018 Mar 31, 2015 at 6:08

3 Answers 3


Try putting the filename template in double quotes. Also, if you are running the command in a script you may need to use %% instead of %.

  • 2
    This was it! It was being called in a batch file, and I needed to escape the % with another. i.e. IMGP%%04d.jpg. Oct 10, 2011 at 8:20
  • 3
    Another thing to note is that the sequence should start with 1 or else it won't detect properly. You may need to rename your files before processing them. That issue bit me today. See stackoverflow.com/questions/2829113/… Nov 23, 2011 at 16:57
  • 2
    @JasonNavarrete: You can avoid having to rename files by using the -start_number switch... ;) Aug 28, 2012 at 13:12
  • @AKE, ah well would you look at that. Back in my day, we had no such thing as 'start_number'. We're in the future now... Aug 30, 2012 at 14:48

Building on Mike's answer above, there are some other useful switches that also work on the Windows solution.

I use the following one liner to get a slower frame rate and to compress the images and have a smaller resulting video:

ffmpeg.exe -f image2 -framerate 25 -pattern_type sequence -start_number 1234 
        -framerate 3 -i "Imgp%%04d.jpg" -s 720x480 test.avi

The -framerate 3 option sets the framerate of the resulting video to 3 frames per second so that I can see each still for a short period of time. Adding -r as an output option will change the framerate of the output if you need it to be different than your -framerate value. The -s option rescales the pictures to the desired resolution to manage the size of the resulting video. Alternatively, the more flexible scale filter can be used instead.

Note, contrary to Jason's comment above, it is not necessary to rename files if using the -start_number switch like so:

ffmpeg -f image2 -start_number n -i "IMGP%%04d.jpg" video.mpg 
    -vcodec mpeg4 test.avi

where n is the start of the sequence of stills.

This will work as long as the sequence is unbroken once it starts. If there are gaps and you want all of the stills included, then renumbering may be necessary to fill the gaps.


There is a much simpler method, requiring the use of a free piece of software (Total Commander) and a free AVI plugin.

See this article "Making Animations from Stills", here.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .