Archive for August, 2009

The good old English to English translator

August 31st, 2009

Some years ago, for a reason that I don’t remember, I wrote an English to English translator. Basically it translates from English through a whole host of other languages and then back to English.

Anyhow, someone out there on the Internet found it amusing and posted this comment on an unrelated entry:

dude your english to english converter rocks, where can i find something like this for microsoft word or a web version that i can use on large documents

So I responded in email, which spawned this conversation:

random internet guy to me:
Thank you for returning to me, I am very happy with this tool is useful for something in the translation from English into another language besides English, they speak English well, or to say that, like language, queen of Great Britain is cold, this tool is that the majority of Britons seem silly, but it is a kind of spiritual support, he plays all the tribal mentality of Le Mans. Whether or not interest me, but it seems very impressive and culturally cool. But Google was that of syntax or algorithm that is used, because we noticed that in motion, or at least five different languages.

me to random internet guy:
I am glad that he was a useful tool. I do not know why and I said, a translator, but it must be useful, since it is often in response to people who actually come to conflicting messages. Sometimes I wish I had heard that people are sent e-mail, yes, but again I sometimes think that life is absurd afraid of me. I do not know better, what the hell is going on in the head. In any case, I am pleased that, as a useful and entertaining.

I love the Internet.


Time Lapse Video using gphoto2 and ffmpeg

August 30th, 2009

An interesting little project I’ve been working on is time lapse photography. I picked up a used Canon Powershot A520 pretty cheap, and set up a laptop with Ubuntu to communicate with the camera. I’m still working on the best angle to minimize the power lines out front, but I’ve got a good start going.

What you’ll need:

  • A Linux machine (a laptop really helps)
  • gphoto2 >= 2.4.5 (note that you can upgrade jaunty’s gphoto2 with the karmic packages to get this version)
  • A camera that supports remote capture
  • An AC power outlet near were you want to take your photos (and an AC adapter for your camera unless you have really awesome batteries).
  • jpeg2yuv and ffmpeg (with libx264 support)
  • Something relatively interesting to take pictures of

This is what I ended up with:

So here’s what I did:

  1. Connect the USB cable to the camera
  2. Run the following command (in a while loop in case it crashes):
    while true ; do
        gphoto2 --capture-and-download -I 30

  3. Wait about 8 hours or so
    1. If you’re impatient like me, you can nfs mount the laptop after about 45 frames (about 20 minutes) and get a preview.
    2. You can rsync the laptop’s nfs mounted directory locally so you don’t have to copy the files over (most likely) wireless every time you want to encode the latest version
  4. Collect all of your images and make sure that each frame is numbered sequentially.
  5. Create an MPEG with jpeg2yuv by piping the output to ffmpeg:
    starframenum=XXXX # put the number of the first image in the sequence here
    jpeg2yuv -b $startframenum \
            -v 0 \
            -j the/path/to/your/images/IMG_%04d.JPG \
            -f 15 \
            -I p | ffmpeg -threads 2 -y -i - \
            -vcodec libx264 \
            -b 2500k \
            -acodec libfaac -ab 48k -ar 48000 -ac 2
            -s 1024x768 -f mp4 \

  6. In the options above, the important ones are ffmpeg “-f” which is the framerate. You can change this to speed up and or slow down your movie. The “-s” option is the size. Keep in mind that the width and height of your images needs to be a multiple of 16 (ie, 640×480, 1024×768, 1920×1152, etc). Note that 1080 is not divisble by 16. 1280×720 will work for widescreen (16:9) hi-def though. Lastly, the “-b” option is the video encoding bitrate. Increase it for better quality and decrease it for smaller output movie files.

    General ,