1

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?

water
  • 27

2 Answers2

9

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
Paul
  • 61,193
7

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

sequence

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.

cat

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

Notes

  • 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

llogan
  • 63,280