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?

  • 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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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