[lug] individual frames from AVI file?

Tkil tkil at scrye.com
Thu Jun 10 00:54:06 MDT 2004

>>>>> "Tkil" == tkil  <tkil at scrye.com> writes:

Tkil> ... format is MJPEG, in an AVI container ...

Tkil> My eventual goal is to extract about 2 seconds of video at about
Tkil> the 2:50 mark as individual frames (either JPEG or PNG or any
Tkil> raster format, really); do some smoothing, posterization,
Tkil> quantization, then rebuilding them into a small animated GIF.

Thanks to everyone that had advice!  My solution so far uses "mplayer"
and "convert -coalesce".  Starting with my source file "0066.avi", I

   mplayer -vo png -z 0 0066.avi

This created some 2700 PNG files, with no compression (-z 0).

I then used "feh" to quickly scan through them.  When I found a subset
that seemed appealing, I used "animate" (another tool from the
ImageMagick suite) to loop it a few times to make sure it wasn't too

I moved those frames to a subdirectory "keep", and blew the rest away.
Then I started experimenting with different "convert" command lines;
the best I've found so far is:

   convert keep/* \
     -crop 200x200+60 -page +0+0 \
     -blur 6 \
     -resize 100x100 \
     -colors 8 \
     -delay 4 -coalesce output.gif

And the result:


Which is just about what I want, but twice the size (I'm shooting for
a 40KB limit).  I suspect that doing further filtering and figuring
out how to get one image as a background then rendering appropriate
diffs on top of it might make it small enough.

(I could also just make it about 70x70, instead of 100x100, which
should cut the size in half in and of itself.  Would like to make it
work at 100x100 if at all possible, tho.)

Thanks again,

More information about the LUG mailing list