Submitted by whirlpool on Sun, 18/07/2004 - 12:52.

To me the coolest thing one can do with a 24 hour available internet connection is to continously download webcam shots from different parts of the world. Save the series of images locally and produce a video out of them. Pretty cool actually. You can have a look at my first sequence.

The webcam is here

I wrote a 10 line python script to grab the photos and by a simple mencoder command, I create the video.

The python script:

#!/usr/bin/python

import urllib, time, sys

i = 0
url = sys.argv[1]
duration = int(sys.argv[2])
while 1:
        j = str(i).zfill(6)
        filename = "webshot%s.jpg"%j
        urllib.urlretrieve(url, filename)
        time.sleep(duration)
        i = i + 1

This work by:

./webcamer.py URL seconds

The only issue with this script is that it doesn't check if the downloaded image is an undamaged jpeg. As you will find that sometimes the downloading of the image will happen at the same time it is being uploaded. However, this is not very frequent. I resolve them manually.

The mencoder command:

mencoder "mf://*.jpg" -mf fps=25 -o output.avi -ovc lavc

Ah, BTW I think those stop motion sequences could really be a good source of video for VJ's. They can be looped, ping ponged etc..

One more tip, try starting the sequence by night. This way when they loop you will not notice a change in the cloud pattern.


whirlpool's picture
Submitted by whirlpool on Mon, 19/07/2004 - 00:52.

I think this technique is more correctly called time laps and not stop motion. Stop motion is for creating claymation and stuff. There is an intresting linux app for it called frameworks (try watching the lego videos that guy did using this software.

And BTW, the URL should be of the jpg image output of the cam, directly. not the webpage of it.

When deciding the duration, test it yourself in the browser first. keep on refreshing and see how many seconds it takes to refresh. Ofcourse, if the webpage explicitly says how frequent the image get updated. Use this data.

Even though you can choose the duration according to your needs. But be aware that you will encode the video at 25 frames per second. Which means a 12 hour period will pass by in one second, if you decided to make the duration = 1800. This will not be smooth at all. However, if you take 1 shot every minute you will cover a 25 minutes period in one second. Which is very nice. Taking more frequent images, depend on what you need. Experiment and see.

The prague video above took 52M of jpg images space. The sequence covers aprox 20 hours period. One shot every minute. But the resulting video is just 5MB (RIFF (little-endian) data, AVI, 352 x 288, 25.00 fps, video: DivX 4) around 32 seconds. I think the resulting video can be even smaller, with the same quality. But I have no idea on how to do that.


Alaa's picture
Submitted by Alaa on Mon, 19/07/2004 - 06:20.
mencoder -ovc xvid -oac mp3lame fooo.some_media_format

will generate an xvid/mp3 file called test.avi

cheers,

Alaa


http://www.manalaa.net

"u know i once dream that the office of mobinil is from el 7`os :S and the one that answer u and tell u rasidak a girl called ghada"


OneOfOne's picture
Submitted by OneOfOne on Sat, 24/07/2004 - 13:40.

You need to give it -xvidenopts bitrate=xxx or pass=x or it won't work right.

peace


-OneOfOne kernel patching monkey/BORG drone.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.