Archive for September 2009

COSIT 2009, L’Aber Wrac’h



L’Aber Wrac’h is on the north coast of Brittany. It’s rather beautiful.


On the first night, outside the pub, we found a bucket of fish. A large group of barefoot heavily suntanned and weatherbeaten young men were very amused at me taking a photo… I presume it was their fish. But you never can be sure. Pictures of buckets of fish never come out as well as you hope though, so here’s a field of maize.

The conference trip was a boat journey to a lighthouse – the tallest stone built lighthouse in the world. It’s a bit rocky around there, so I guess lighthouses are useful.


I think that sometimes Roger would rather I didn’t take photos of him and put them on the internet, but there you go. You just have to put up with these things when you’re that photogenic.


The big stone lighthouse had replaced an earlier, shorter model.
This is the short one from the top of the tall one.


Here are some windswept conference attendees recovering at the top of a rather large flight of stairs — Alasdair Turner, Dan Jacobson, Stephen Hirtle and Christophe Claramunt. Christophe was one of the conference chairs and he did a great job.


I told you there were a lot of stairs.


Max Dupenois and Brandon Bennett, one evening. I think this was the evening they filled us full of pancakes. All the other evenings, they tried to fill us full of fish and seafood… I believe that if you’re not allergic to these things then the food was great. For me, it was a bit “meh”… I could have done pancakes every night though.


A pirate ship moored itself next to the conference centre a few days into the talks.


Dan Jacobson and Mathieu Simmonet (on the jetty), Tony Cohn (in the boat) and various other important people go round the harbour to try out virtual reality navigation aids for blind sailors. (Or maybe they just wanted to go on a boat.)

A long way…

This is a big week travel wise. On Friday we have a project meeting near Nice (we’re going there and back in a day, taking the lab car – this means I have to be at the polygone scientifique at 5.15am Friday morning, and we’re not due back till 10). And on Sunday I go to COSIT’09 in L’Aber Wrac’h, Brittany. This is about as far from Grenoble as it’s possible to get whilst remaining in France. That’ll be a tram-train-metro-train-bus trip, taking about 9 hours. Looking forward to it though – I still think TGVs are super cool (and there’s a good chance that Roger will make it across for the conference).

Rather a long way

Video->images, images->video

Another geeky interlude with mplayer and mencoder… See this earlier post on streaming video for video download assistance. You can get the software from here and it’s free.

Taking a video file and splitting it into a load of numbered jpeg files is a useful thing to be able to do (particularly if you can’t get video input to work with OpenCV). This can be done really easily with mplayer:

mplayer input.avi -vo jpeg:outdir=output_directory

Replace “output_directory” with the directory you want the files to end up in and there you go. You will of course end up with lots of files if your video is of any length, so mplayer has options to make numbered subdirectories and store N frames of video in each. To do this, add subdirs=prefix and maxfiles=N to the command. The “prefix” says what each subdirectory will start with, and the maxfiles determines how many files are put in each subdirectory before moving on to the next one. So this line…

mplayer input.avi -vo jpeg:outdir=output_directory:subdirs=aa:maxfiles=100

…will put 100 files in each subdirectory, and each sub directory will start with the characters “aa”. This is most useful if you’ve got a massive video and there’s a limit on the number of files you can keep in a directory. For example, on a FAT32 system you can “only” have 65,534 files per directory. However, if you’re using Windows you’ll find that performance drops considerably before then, so splitting a huge number of image files between subdirectories is probably a good idea.

Going the other way – from images to video – can also be done really easily. This is useful for creating stop motion animations, or for taking a video that you’ve processed frame by frame and putting it back together into a video file. This command takes a load of jpg files (numbered, in the current directory), and encodes them as a video also in the current directory:

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

To change the frame rate, alter the fps option; to change the output format, change the vcodec option and optionally output filename. If you just want to watch a stack of (numbered) jpgs as a movie, you can use mplayer as follows without saving any output video:

mplayer mf://*.jpg

Panoramix

This view takes about an hour to get to from my front door, on foot all the way. Click on it to see a bigger version, if you want.

View from the Bastille, 1st weekend in Sep

This one’s about half an hour further – the sticky out bit of grassy building & mountain you can see about half way across is where the first pano was taken from.

View from memorial to the troups of the mountain, 1st weekend in Sep

For a 3 hour round trip it certainly blows away the cobwebs. 500m up, 500m down again…

Downloading streaming video using mplayer

General geeky interlude…

From time to time I need to download, grab from a webcam, convert, cut, and generally manipulate video files, and every time I do it I have to look up the settings for mplayer, mencoder or ffmpeg again from scratch. So I thought I’d put some recipes for common tasks up here just in case they are useful for anyone else. These use mplayer and mencoder which are available for windows, macosX and linux, but I can only comment on the linux version so don’t ask me any windows questions!

Finding a webcam

Lots of people put webcams pointing at sites of interest (or sites of utter dullness…) live on the internet. If you find yourself wanting to grab footage from these for later use, there are two ways to do it. Both of these methods start with finding a webcam (duh). You can do this using Google, either by searching for webcams or by searching for particular url strings. This search, for example http://www.google.com/search?q=inurl%3Aview%2Fview.shtml will find Axis brand web cams by looking for the term view/view.shtml in a website address.

If you’re going to go for a movie file, first you have to locate the actual movie file, which can involve poking around in the web source code.

For axis cams it’s often at /mjpg/video.mjpg (so the camera you can view at http://c-cam.uchicago.edu/view/view.shtml has the movie file located at http://c-cam.uchicago.edu/mjpg/video.mjpg).

Saving the stream

Once you have found this, you can get mplayer to save the file for you using this command line:


mplayer -dumpstream http://url_of_videofile -dumpfile outputfile

Note, videos are big, so make sure you’re not dumping it to somewhere with quota issues. In linux, you press control-c to quit downloading the file.

Building the index

The outputfile created by this command line can have some problems – some things will play it, but in order to cut, fastforward and otherwise edit it it’s useful to build an index for the video file. You do this in mplayer with this command line:


mencoder -idx input.avi -ovc copy -oac copy -o output.avi

That’s the first way.

Downloading a stack of jpegs instead of a video

The second way is REALLY HACKY and involves a shell script and a load of jpg files. Most webcams will let you get a snapshot image, and this method exploits that. It’s good for webcams where the video is really slow and you’re not actually bothered about frame rate in your output “video”, or webcams where you can find the snapshot option but not the actual video file. First find the snapshot image on the webcam’s website, view the image, check that pressing reload in your browser updates the image, and then copy the image address.

With the image address, this method gets “video” by using a shell script to download the image repeatedly as fast as it can, saving each image as consecutively numbered jpgs. Here’s a shell script – if you’re not sure how to run or change this, this method’s probably not for you.


#!/bin/sh
for i in $(seq 0 300000); do
k=10000000;
j=$(($i + $k));
echo "getting ";
wget http://server_name/jpg/image.jpg -O $j.jpg;
done

You can turn a stack of jpgs back into a video using mplayer or ffmpeg (I’ll do a post on that later). But if you just want to watch a stack of (numbered) jpgs as a movie, you can use mplayer as follows:


mplayer mf://*.jpg

If that’s going too fast for you, try adding a speed argument e.g.


mplayer -speed 0.1 mf://*.jpg