On ur laptop, making ur still frames into a movie.
July 14, 2007 3:29 AM   Subscribe

What's the quickest, easiest way to turn a directory of sequentially numbered JPG files into a video file? Linux or Windows.

I've got a stack of files, generated by POVRAY, named as such:

frame1.jpg
frame2.jpg
...
frame330.jpg

I want to turn then into a video file. MPEG-1 is fine - anything that's reasonably standard will do. I don't really want to have to specify anything apart from the directory the files are in, and the frame rate.

What's the best way to do this? A solution for Linux or Windows would both be okay. Google-disclaimer: The closest I could find was some ancient 16-bit Windows software that produced AVIs from BMPs (not really what I'm after).
posted by Jimbob to Computers & Internet (12 answers total) 7 users marked this as a favorite
 
On my mac, I use Quicktime Pro. It has an import image sequence option.

Quicktime Pro for Windows.
posted by popcassady at 3:53 AM on July 14, 2007


Ffmpeg can do it (available for both windows and linux). For example:
ffmpeg -f image2 -i frame%d.jpg video.mpg
There are (lots) of options to specify the bitrate, output format and size, frame rate etc. See the documentation for the details.
posted by rpn at 4:05 AM on July 14, 2007


Sorry, I should have also specified free / open souce solutions. I figure turning JPGs into an MPG can't be that difficult, it's not worth US$29.99 for my purposes.
posted by Jimbob at 4:06 AM on July 14, 2007


I will give ffmpeg a go after POVRAY has finished rendering, rpn, that looks like a reasonably simple command line.
posted by Jimbob at 4:19 AM on July 14, 2007


Microsoft Windows Movie Maker will do that (although it will produce a WMA file that might be ok for you or at least then you can convert that into something else).
posted by mmascolino at 4:54 AM on July 14, 2007


mencoder on linux can do it too.

This line does it using mjpeg, you can use whatever codec you want.

mencoder mf://vq*.jpg -ovc lavc -lavcopts vcodec=mjpeg -o output.avi

If you want to subsequently be able to play the avi on Windows look at my answer to my own question yesterday: here. It's a two stage process but the output works in windows and looks OK.
posted by handee at 7:02 AM on July 14, 2007


Copy and paste mistakee there, sorry. Obviously, vq*.jpg should be replaced by whatever wildcard specifies your stack of jpegs, I tested it on a set which went vq001.jpg etc.
posted by handee at 7:04 AM on July 14, 2007


Doesn't that * need escaping/quoting, otherwise the shell might expand it? In the mencoder man page, it gives this example at the bottom:

mencoder "mf://*.jpg" -mf fps=25 -o output.avi -ovc lavc -lavcopts vcodec=mpeg4
posted by Neon at 7:16 AM on July 14, 2007


Neon: It would if "mf://*.jpg" actually matched anything -- that is, if there was a "mf:" directory in the current working directory that contained jpegs. If a wildcard doesn't match it's passed along as a literal argument.

You can test that with "echo mf://*.jpg"
posted by mendel at 8:34 AM on July 14, 2007


be careful with wildcards tho -- based on the filenames you have, the frame order may screw up.

ls frame*.jpg will give:

frame100.jpg
frame101.jpg
...
frame109.jpg
frame10.jpg
frame110.jpg
frame111.jpg
...
frame199.jpg
frame1.jpg
...

so either change the naming such that
frame001.jpg
frame002.jpg
...
frame010.jpg
...

or use the ffmpeg example with %d which will "do the right thing" (but %d will not work as a wildcard in regular shell functions...)
posted by dorian at 9:34 AM on July 14, 2007


Hmmm. I've finally got around to trying this, and ffmpeg gives doens of the the following errors:
[mjpeg @ 0x8336308]mjpeg: unsupported coding type (cd)
[mjpeg @ 0x8336308]mjpeg: unsupported coding type (c9)
[mjpeg @ 0x8336308]mjpeg: unsupported coding type (c2)
[mjpeg @ 0x8336308]huffman table decode error
Before spitting out a video file that doesn't play. mencoder does something pretty similar. But I think it may be a problem on the POVRAY side of things...maybe I only think I'm generating JPGs because of the file extension, when I'm really creating BMPs or something. In the absence of any more suggestions, I'll keep trying...
posted by Jimbob at 3:52 PM on July 14, 2007


Yes...POVRAY was produing PNGs but calling them .JPG. Once converted to JPG, the ffmpeg solution works great.
posted by Jimbob at 3:58 PM on July 14, 2007


« Older Recommend me a good driving instructor in south...   |   Can you give up on a dream? Newer »
This thread is closed to new comments.