Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to create a video file from a series of JPGs using the following command:-

ffmpeg -f image2 -i img*.jpg -s 640x480 movie.mpg

but it fails after generating a lot of output with the following:-

<lots of output, removed>
Stream #0.0 -> #89.0
Stream #0.0 -> #90.0
Stream #0.0 -> #91.0
Stream #0.0 -> #92.0
Press [q] to stop encoding
[mjpeg @ 0x95dfac0]get_buffer() failed (-1 0 0 (nil))
Video encoding failed

What's causing the error and how can I fix it?

share|improve this question
Welcome to AskUbuntu. Have you try ffmpeg -f image2 -i img*.jpg -r 1 -vcodec mjpeg -i - -vcodec libx264 -s 640x480 movie.mpg – penreturns Oct 7 '12 at 19:06

Glob syntax (*) won't work for image sequences. You must use %d for indicating where to look for the number (assuming that your image sequence is numbered, otherwise it will not work). Also you might specify an output framerate with -r

ffmpeg -f image2 -i img%d.jpg -r 25 -s 640x480 movie.mpg

This takes the images img0.jpg, img1.jpg, img2.jpg... and creates a video with 25 frames per second.

share|improve this answer
The %d instead of * was the missing element! – Skizz Oct 7 '12 at 20:37

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.