Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have all of these images as jpegs and I want to stream them into an AVI. I am trying to use ffmpeg with the command noted here but I get an error "No such file or directory".

My exact command is (from the folder containing all of these files):

ffmpeg -f image2 -i frame_%d.jpg view.avi

How do I do this? Also, how can I do this for a specific range of images? Say I only want frames 500 to 1000, so I want frame_0500.jpg to frame_1000.jpg?

share|improve this question
If you were doing it one by one, does it work (thinking of a workaround)? –  soandos Dec 22 '11 at 4:11
It might not be working because it is looking for frame_1, and you have frame_0001. –  soandos Dec 22 '11 at 4:13
I think that is the reason, you're correct :) But there's no way I'm renaming thousands of files to remove those zeros. There must be a way ffmpeg can handle this? –  water Dec 22 '11 at 4:13
You can rename the files with Bulk Renamer but I don't think there is a way to do it without that –  soandos Dec 22 '11 at 4:20
You can use frame_%04d.jpg to correctly handle the leading zeros but ffmpeg will still insist the sequence start at 0001. To start are 0500 I think you'll need to bulk rename. –  Mike Fitzpatrick Dec 22 '11 at 4:23
add comment

2 Answers 2

up vote 1 down vote accepted

The correct command should be

ffmpeg -f image2 -i frame_%04d.jpg view.avi

The %04d means the number is 4 characters in length, zero padded (0000-9999).

If you want to do a range, I would just move the files you want into their own directory.

This is easy with a gui, but with command line you could do

mv frame_0[5-9]* newfolder
mv frame_1000* newfolder
share|improve this answer
add comment

glob pattern

For those of you using a non-ancient build of ffmpeg the glob pattern is the most flexible method:

ffmpeg -framerate 10 -pattern_type glob -i "*.png" -pix_fmt yuv420p output.mkv


This will convert a series of numbered inputs, image-0001.png, image-0002.png, etc:

ffmpeg -framerate 30000/1001 -i image-%04d.png -pix_fmt yuv420p output.mkv
  • Add -start_number, such as -start_number 100, as an input option if you want to start with particular image.


You can also use cat to pipe your images to ffmpeg:

cat *.jpg | ffmpeg -framerate ntsc -f image2pipe -c:v mjpeg -i - -pix_fmt yuv420p output.mp4


  • The output will use the same frame rate as the input. If you do not declare -framerate then the default of 25 will be used. You can also add -r as an output option, such as in -r 25, if you want ffmpeg to read the input at a certain rate, and then drop or duplicate frames to achieve a different output frame rate.

  • Depending on your input, ffmpeg version, and selected encoder, ffmpeg will attempt to avoid or minimize chroma subsampling. Although this may be good in a technical sense it can produce an output that is not playable by non-FFmpeg based players. Adding -pix_fmt yuv420p will ensure that your output is playable when encoding to H.264 video.

  • It is recommended to use a recent build of ffmpeg since development is so active and to avoid bugs that have already been fixed. See the FFmpeg Download page for links to builds for Windows, OS X, and Linux.

Also see

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.