Sunday, December 23, 2007

Creating stopmotion movies with ffmpeg

Based on this page, I've just been able to successfully convert a bunch of photos to a MPEG4 movie:
c=0; for i in *.jpg; do mv "$i" "`printf %05d $c`.jpg"; c=$((c+1));done
for i in *.jpg; do convert "$i" -resize 600x600 -normalize "$i"; done
ffmpeg -r 5 -b 1800 -i %05d.jpg output.mp4
These are the settings for a bitrate of 1800 and 5 fps and the larger side of the images being scaled down to 600 pixels.

Thursday, December 20, 2007

The best of three worlds

Yay! After thinking about re-installing OS X, Ubuntu and finally adding Windows XP to the mix, I played around for about 9 hours and finally was able to install Windows XP together with Mac OS X and Ubuntu 7.10, so triple-booting is now standard here! That's Windows XP for games and the usual website compatibility testing, then there is Ubuntu for all development and "default work environment" stuff and finally Mac OS X for some other useful things. All three OSes boot really quick from rEFIt, and it's much better than any virtualization can ever provide. Sadly, triple-booting is a little tricky, and especially Windows is very picky about when it decides to boot and when it doesn't (most of the time today, it didn't ;).

The trick is to get the GPT-to-MBR mapping to produce a partition table that has the Windows XP partition as last entry and be sure to let the Windows XP setup (the blue console-based one) reformat the partition - or else you will get media errors or the famous hal.dll error. Hints on how to do all this can be found here and here. You will probably not want to have swap partition, but only three "real" partitions: One for Mac OS X, one for Linux and one for Windows (in that order!). The fourth of the four partitions the MBR can have will be the EFI partition. All other partitions beyond that cannot be seen by MBR/BIOS-based OSes (like Windows). Linux and Mac OS X will "see" the GPT partition table, but I don't know if GRUB or Lilo can successfully boot off GPT partitions or if they still rely on the "bootable" partition to be accessible through the MBR.

I somehow followed the guides and did much trial-and-error, because I didn't start from scratch but wanted to keep my OS X partition and Ubuntu partition. But it is possible to get it working. If you have backups of all your data and all installation media ready (and a fast internet connection for the updates), I recommend wiping out the entire MacBook and starting from scratch by restoring Mac OS X and then following the triple-boot guide described above. And don't forget: The Windows XP partition has to be the last one in the MBR. And the partition has to be re-formatted by the windows installer to boot after the first restart. This can be accomplished by zero-ing out (using dd) the first one hundred megabytes of the Windows partition before starting the XP install.

After all, it's worth the hassle. All three mainstream operating systems on one machine is really helpful. And you won't ever go "ah, a great application, but not for me - I don't have {Windows|Mac OS X|Linux}". Yep - the best of three worlds.

Tuesday, December 18, 2007

MacBook Ubuntu: Keypad enter opens Terminal

Here's just a short note I want to put somewhere in case I really decide to re-install Ubuntu on my MacBook and want the nice "open terminal" functionality of the keypad enter button (the button on the right side of the right apple key): Add the following line to ~/.Xmodmap:

keycode 108 = ISO_Level3_Shift

After that, you can configure the key in System, Preferences, Keyboard Shortcuts. After logging in again (and letting Ubuntu load the Xmodmap file for you), the next terminal is just one keystroke away! Improves my productivity a lot :) The rest of setting up Ubuntu on a MacBook (including nice tweaks such as OS X-like font rendering and the correct color profile) can be found at the MacBook Ubuntu Community page.

Monday, December 17, 2007

Bash: Power off after long-running command

Some weeks ago, I was going to go away from my machine which was running on battery power, but still had a command running (I think it was converting a MythTV recording to XviD) - anyway, I have already started the command and was now looking for a way to say "when this long-running process is finished, please shutdown the machine". Usually, you could do this using "longrunningcommandline && sudo poweroff" or similiar. However, how are you going to do this if the long-running command is already working? I had an idea and tried it straight away - it worked! You basically suspend the process (^Z) and then put it into the foreground again (fg). The "fg" command returns when the command is finished, so doing something like "fg && sudo poweroff" should accomplish the wanted thing. Of course, this can be combined with some nice script like smp to send an SMS when the command has finished.

I wanted to post this earlier, but always forgot. Today I got reminded by this website with 10 interactive shell anti-patterns - a recommended read! Shellify!

Tuesday, December 11, 2007

The (re)presentational "Ähh"

"Ähhs"/"Ähms" are the German equivalent of the "umms" or "uhms" in English. Today, I held a short presentation at my University, where we did peer review by other students. Two people already counted the times I said "Ähh" (one person counted 49 - "49 Ähm's sind schon viel, nicht?!" -; another one 42 - my talking time was roughly 13 minutes). Good feedback is probably the best way to improve your presentation skills. I'm glad we did enough presentations at school, so at least the content and the presentation (apart from the numerous "Ähms") was quite okay-ish. Maybe video-taping one's own presentations would increase feedbacks and the learning effect even more :)

Saturday, December 8, 2007

Copy and paste in Linux

This week, I observed someone working on Linux struggling with copying and pasting SQL code from Emacs to a Firefox textarea. The Ctrl+C/Ctrl+V way of doing things (which I first saw on Windows, don't know who "invented" it) is nice, but once you tried the X11 way of copy and paste (using the X selection), you will never want to live without it. Being a happy user of X11 copy/paste for some years now, here's a short note for all who have not yet tried this great feature :)

To copy some text, simply select it with the mouse (no, really - just select it, no keystrokes). To paste the text you just selected, middle-click with your mouse directly where you want to paste the text - the text will be copied! As clipboard handling in Linux/X11 was (is?) a bit inconsistent, there might be some things to watch out for. For example you can only paste the selected text if the window in which you selected the text is still open.

Once you get used to that, it's really useful and you can work more productively. Nice side-effect: You can middle-click inside an open tab in firefox and have the URL in the X selection get loaded in this tab. So, to open a URL from a text file (or similiar), just select the URL, open a new tab in Firefox (or use an existing one) and middle-click inside the content area of the tab. Firefox will load the URL you just "pasted". Simple.