Monday, January 18, 2010

Satellital weather videos

I always liked satellital weather videos, so hipnotic and fascinating. For some reason, when weather channels on the TV or weather websites publish such videos, they are very short, even 4 or 5 frames, leaving me hungry for more.

Luckily, there is where we can find satellital pictures from the last weeks showing different parts of the planet. We just need to download them and convert them to video.

This is how I did it using Ubuntu. This works for sure in ubuntu 2.6.31-14 (Karmic Koala) or higher, it works in lucid too. We open a terminal, go to a chosen directory and type:

wget --limit-rate=100k -e robots=off -U "Mozilla/5.0 (compatible; Konqueror/3.2; Linux)" -np -l1 -r -A .jpg -N

This downloads all the images from to a directory named "" (This dir will be created automatically).

Now we convert all these .jpg to video with the command:

mencoder "mf://*.jpg" -mf fps=8 -o output.avi -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=4000 -vf scale=640:384

That's it, now we have a video named output.avi that we can, for example, upload to youtube:

If we gather enough images, our video will get longer and more interesting. Running the same commands in a few days, will download the new pictures (ignoring the ones we already have) so we can generate longer videos by getting more pics than NASA stores at a time. I mean we can store all the pics we want from NASA before they delete them, if we keep downloading them from time to time. Imagine a weather video showing an entire month!

// TODO: crop the images to remove that jumpy black rectangle in the bottom.

The problem I encountered with this is that sometimes, NASA has pictures taken at irregular intervals of time, so the video seems to get faster or slower randomly. That's an interesting problem to think about, what to do when we want to generate a video from images but we have frames missing. Do we fill the missing frames with blanks?

No comments: