Monday 19 November 2007

Incremental backup of a windows folder on a linux server

Here is a simple way of incrementally storing a backup of data on a windows machine to a linux server. This is inspired by the Time Machine on the Mac and the description on http://blog.interlinked.org/tutorials/rsync_time_machine.html of how to do the same on any *nix. The The small script uses a rsync port to windows called cwrsync. I have set up a ssh keypair to ease the operation.
Paste this into a .bat-file:

echo on
Set CURRENTDATE='%date%-%time%'
Set REMOTESERVER=server
Set REMOTEPATH=/home/user/rsyncbackup
Set LOCALPATH=/cygdrive/e/Documents
rsync -azP --delete --link-dest=%REMOTEPATH%/current %LOCALPATH% %REMOTESERVER%:%REMOTEPATH%/%CURRENTDATE%
ssh %REMOTESERVER% "rm %REMOTEPATH%/current && ln -s %CURRENTDATE% %REMOTEPATH%/current"
PAUSE

Change the REMOTEPATH and LOCALPATH to something that suits you. Once correctly set up you can remove the PAUSE and state "echo off" to silently run this at set intervals.

Monday 6 August 2007

Moved the timelapse site to cronolia.com

I have been looking for a new name for the coming webcam/timelapse site I am developing. I ended up getting the domain cronolia.com. I thought it was a reasonable strange name with the 'cron' signifying something about time and the 'olia' as a imaginary place - the place where time slows down or speeds up.

At the moment users are not able contribute by submitting webcams or requiring timelapses, but as I have worked a bit more on the backend this will be possible.

Thursday 7 June 2007

Using gphoto2 with a Canon Digital IXUS 430

For a long time I have been wondering whether our old Canon Digital Ixus 430 was able to remote capture (be controlled by a computer interface through the USB cable). Gphoto2 seems to be the likely answer, but the documentation is rather scarce. I have earlier been able to connect and list the pictures already on my camera, but not been able to control the actual picture taking.

The --list-config option yields:

~$ sudo gphoto2 --list-configDetected a 'Canon:PowerShot S410 Digital ELPH (normal mode)'.
/main/camera/model
/main/camera/owner
/main/camera/capturesizeclass
/main/camera/datetime
/main/camera/setcameratime
/main/camera/firmwareversion
/main/camera/driver
/main/Driver/list_all_files


Recently the AF on the camera was broken. At least, the camera can't seem to find a focus point unless it is in macro mode. If anyone knows of a solution, please let me know. I was very fond of the old camera.

Anyway, I made a last effort to connect it through gphoto2. -And I found the solution!
The solution was to specify the camera model. Gphoto recognises the camera as 'Canon:PowerShot S410 Digital ELPH (normal mode)', but if I specify it as 'Canon Digital IXUS 430 (PTP mode)' it works. To capture, I have to initially enable capture by running the command as instructed onwww.gphoto.org/doc/remote/:

sudo gphoto2 --port usb:. --camera "Canon Digital IXUS 430 (PTP mode)" --set-config capture=on

This retracts the lens. The --list-config option now yields:

~$ sudo gphoto2 --port usb:. --camera "Canon Digital IXUS 430 (PTP mode)" --list-config
/main/settings/owner
/main/settings/model
/main/settings/firmwareversion
/main/settings/time
/main/settings/beep
/main/settings/capturetarget
/main/settings/capture
/main/imgsettings/imgquality
/main/imgsettings/imgsize
/main/imgsettings/iso
/main/imgsettings/whitebalance
/main/imgsettings/photoeffect
/main/capturesettings/zoom
/main/capturesettings/assistlight
/main/capturesettings/exposurecompensation
/main/capturesettings/canonflashmode
/main/capturesettings/aperture
/main/capturesettings/focusingpoint
/main/capturesettings/shutterspeed
/main/capturesettings/meteringmode
/main/capturesettings/afdistance


Now, if I run the command:

sudo gphoto2 --port usb:. --camera "Canon Digital IXUS 430 (PTP mode)" --capture-preview --filename preview.jpg

I get a preview file at the current location. I still have some issues with getting a full capture, but will probably figure it out soon.

My setup is currently:
sudo gphoto2 --port usb:. --camera "Canon Digital IXUS 430 (PTP mode)" --set-config afdistance=1 --set-config canonflashmode=0 --set-config exposurecompensation=6

... and the camera battery is empty. I will be back

Wednesday 2 May 2007

Making a website for user submitted timelapse movies

I'm currently setting up a site for user submitted timelapse movies at timelapse.dotouch.com. I guess I will move it to some more final domain quite soon. At the moment it is possible for registered users to submit url's of webcam pictures. This image is then stored on the server every 4th hour. After a while it will be possible to generate movies showing the seasons change. There is also a feature to generate timelapse movies of chosen webcams with a lot more frequent snapshots (every 2 minutes). This is not open to the public yet.

Feel free to check it out at timelapse.dotouch.com and leave comments. Please bare in mind that this is a spare time project. I do it because i think it is fun, and to learn a little bit about shell scripting, php and drupal, which I use as a web front-end. I am planning on making it into a fun and nice site, though.

Thursday 19 April 2007

Mounting remote folders through ssh on Ubuntu

I tried the guide at the ubuntuguide.org to mount some remote folders through ssh. It worked like a charm! I am aware of the possibility to "Connect to server..." on the Places menu, but I believe this only applies to programs running graphically. It is also simple to mount the folders at boot time (see for example here). I guess you have to set up some ssh key pairs to achieve that.

Wednesday 18 April 2007

One day to go!

I'm looking forward to the next release of Ubuntu tomorrow. The beta is already running on my Dell Latitude D620 laptop, but we will install it on my wife's HP Pavilion dv2130ea and our old Dell Inspiron (4000?). I will document the steps to a final setup.

Timelapse movies with webcams

Recently I have been interested in using some of those webcams lying around to produce some interesting experience of time.

I started off with the one at home and attached it to our asus wl-500g premium router running linux (through the help of www.openwrt.org). The camera is a Creative Nx Pro, and I don't know if it is the driver or what, but it doesn't stand daylight very well. The images get very white during day. I have succeeded in making timelapse movies out of the resulting still images, but until I find a new camera / change the driver settings it can't be used for outdoor filming.

I will be looking into how I possibly could use a digital camera instead. This would give me much better image quality. More about that later.

Anyway - in the mean time I thought I would have some fun with other peoples webcam pictures. On my account on www.dreamhost.com I have set up different conjobs like this:

crontab -l
0 3 * * * wget http://some_webcam_host/fullsize.jpg -O ~/folder_to_store/$(ls ~/folder_to_store/ | grep ".jpg" -c).jpg > /dev/null 2>&1


This saves one image at noon (in Norway - the server is in the US) from each webcam into separate folders with sequential naming of the files (0.jpg, 1.jpg, 2.jpg etc).
This makes it easy to process the images into movies with ffmpeg like it is done at the motion - wiki:

find . -name '*.jpg' -exec cat '{}' ';' | ffmpeg -f mjpeg -s 640x480 -i - -y -r 25 -aspect 4:3 -vcodec mpeg2video -sameq lapse.mpg

I will post some results here when there are some interesting movies made.