Super User is a question and answer site for computer enthusiasts and power users. 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 want to encode a sequence of images to an video file, I have done this in the past with something like:

ffmpeg -i %08d.jpg out.mp4

But first I had to rename the files to be in that %08d.jpg format. I want to just encode them and let them be in alphabetical order (or whatever) without having to rename them, is this possible? I tried with using *.jpg and ffmpeg just hung and eventually crashed.

share|improve this question
1  
Not possible by default. *.jpg will simply expand to all filenames before FFmpeg even sees the asterisk. Why couldn't you just rename the files, if I may ask? Or copy them somewhere else, then rename? Maybe you can pipe the images into FFmpeg similar to cat *.jpg | ffmpeg -f image2 -i pipe: -r 25 out.mp4? – slhck Oct 23 '12 at 12:31
    
You can do it with Symbolic Links to your list of files... Have a look at this link to give you an idea: Sort images by aspect ratio – Peter.O Oct 23 '12 at 16:21
    
I do currently just rename the files, with a little python script, but it's a kludge and I thought it likely there was a more elegant solution I wasn't aware of. The symbolic link thing had occurred to me, too, but it's really just as much work as renaming the files anyway. I will try the pipe thing next... – wim Oct 24 '12 at 0:30
    
Have you tried the pipe already? Would be interested to see if that works – slhck Oct 29 '12 at 15:07
    
No, it didn't work. But on reading the man pages to try and figure out the syntax to make it work, I saw something else which solved the problem. I'll post it as an answer.. – wim Oct 31 '12 at 12:22
up vote 1 down vote accepted

It is actually possible to let ffmpeg actually handle the glob for you. Use the -pattern_type option from the image2 demuxer and wrap the glob in single quotes to prevent expansion:

ffmpeg -f image2 -pattern_type glob -i '*.jpg' out.mp4

For older versions of FFmpeg, you could use the % character, for example:

ffmpeg -i %*.jpg out.mp4

The above is however considered deprecated.

share|improve this answer
    
Wouldn't just '*.jpg' (note the apostrophes) work just as well, and be a little more familiar since it doesn't rely on a tool-specific syntax? – Michael Kjörling Oct 31 '12 at 12:38
    
nope, and that doesn't work at all. it's explained why in the man pages. – wim Oct 31 '12 at 13:15
    
Be aware that the syntax you were using is considered deprecated and might be removed soon. I added the new syntax from the latest version of the FFmpeg manual but kept the old version as well. – slhck Nov 2 '12 at 19:36

You must log in to answer this question.

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