[Gdal-dev] Animation?
Andy Bunn
abunn at whrc.org
Tue Mar 21 09:23:14 EST 2006
> -----Original Message-----
> From: gdal-dev-bounces at lists.maptools.org
> [mailto:gdal-dev-bounces at lists.maptools.org]On Behalf Of Didrik Pinte
> Sent: Tuesday, March 21, 2006 3:17 AM
> To: gdal-dev
> Subject: Re: [Gdal-dev] Animation?
>
>
> Le lundi 20 mars 2006 à 15:24 -0800, Tyler Mitchell a écrit :
> > Didrik,
> > I'd love to hear more about how you did the Python, Mplayer
> animation bit. Sounds really interesting. I can't quite wrap my
> head around MPlayer, but am very familiar with python - so I'd
> love to see what you did.
> >
> > Tyler
>
> That was pretty easy in fact.
>
> My need was to create a movie using pictures created by MapServer (a
> moving tank during an agricultural season). I've used python mapscript
> to pilot mapserver and create png output pictures. Then a really really
> simple call to mplayer does the trick and build a beautiful movie.
>
> Here is the extract used to build the movie :
>
> def createMovie(basePath,path):
> '''
> Create a movie using all the pictures stored in the basePath
> (png files). The movie is compressed using Microsoft codec msmpeg4v2 in
> order to be readable on windows computers. The frames per second are
> fixed at 1.
> TODO : - use popen to redirect stdout and stderr
> - make a second pass for better compression/quality
> '''
>
> try:
> os.system('/usr/bin/mencoder "mf://%s/00*.png" -mf
> type=png:fps=1 -ovc lavc -lavcopts vcodec=msmpeg4v2:vpass=1:$opt
> -nosound -o %s '% (basePath,path))
> except:
> log.error("Error during movie creation")
> return False
> return os.path.exists(path)
>
> Pretty easy ;-)
>
> I did it on a Linux computer but it's obvious that it can be done on a
> Windows computer with a full mplayer installation.
>
> Didrik
>
Thanks all for the tips. I've ended up doing this in R via the Rgdal
bindings. This made the most sense since my image analysis was being done
this way also.
-Andy
More information about the Gdal-dev
mailing list