[mdlug] DRM

Ingles, Raymond Raymond.Ingles at compuware.com
Wed Jan 10 12:38:10 EST 2007


> From: Ken Siersma

> On 1/10/07, Ingles, Raymond <Raymond.Ingles at compuware.com> wrote:

> I've also whipped up scripts to convert movies and DVDs to .avi files for
> my Treo 650. (Don't use that much, but it's fun to play with.)

> Question for you on that one - what app do you use in the scripts to create
> the AVI file?

 Mencoder, primarily.

> I've often found myself needing  to convert GIF animations to AVI movies,
> but end up using Windows to do it. 

 Huh. I haven't really had call to do that. Mostly .mov, .vob (DVD video),
.asf, and suchlike. Let's see. I think you could use ImageMagick's 'convert'
to extract the individual frames, and then run mencoder on the resulting
frames to make a movie. Something like this quick 'gif2avi' hack:

----------------------------
#!/bin/bash

#Usage: first arg is animated gif to convert. Second arg is fps.
# (I couldn't find a quick command-line way of determining this from the
# GIF file. Ah, well.)

FRAMEPERSEC=$2

# Strip the leading dirname (if any) and the ".gif" off the end of the
# file to get the name of the movie we'll make. (Note: case-sensitive,
# won't handle ".GIF".)
AVINAME=`basename $1 .gif`

echo Converting '$1' with fps '${FRAMEPERSEC}' to '${AVINAME}'.

# Make a temp dir to store the frames. ('$$' is our PID.)
TEMPYDIR=/tmp/gif2avi-$$.dir
if [ -e ${TEMPYDIR} ]; then
 echo Temp dir '${TEMPYDIR}' already exists, aborting!
 exit -1
else
 echo Creating temp dir ${TEMPYDIR}.
fi

mkdir /tmp/gif2avi-$$.dir

# Coalesce the gif file to make sure all the frames are of the same
# size. (This can take quite a while.)
echo Coalescing gif...
convert $1 -coalesce ${TEMPYDIR}/coalesce.gif

# Generates a bunch of 'frame####.jpg' files (at 100% quality so we don't
# lose any quality at this stage). Note: if you have more than 10,000
# frames you'll need to up the "%04" to add more digits.
echo Extracting frames...
convert -quality 100 ${TEMPYDIR}/coalesce.gif ${TEMPYDIR}/frame%04.jpg

# Actually make the movie.
echo Generating movie...
mencoder "mf://${TEMPYDIR}/frame*.jpg" -mf fps=${FRAMEPERSEC} -o ${AVINAME}.avi -ovc lavc -lavcopts vcodec=mpeg4

# Clean up after ourselves.
echo Cleaning up tempdir...
rm -r ${TEMPYDIR}
----------------------------

 That should be pretty close to what you want...

 Sincerely,

 Ray Ingles                                            (313) 227-2317

 We were once willing to go nuclear to avoid secret prisons, torture,
          and indefinite detention. What happened? - Malor
The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it. 



More information about the mdlug mailing list