Wednesday, October 21, 2009

Is Windows really easier to use?

A recent experience left me wondering whether the oft-repeated statement that "Windows is much easier to use than Linux" really holds good any more. The other day I connected a data cable from my cell phone to my recently installed Linux Mint 7 laptop to transfer some files. The files didn't get transferred until much later - not because of any hitch, but because the system gave me a most pleasant surprise that left me playing with a new toy! My Linux system detected the USB device (a mobile broadband device), popped up a window showing me the region I was connecting from and allowed me to select my service provider from a list of operators in the region. Seconds later, I had established a connection through the cell phone and was browsing the Internet. Talk about simple!


Saturday, October 10, 2009

Nobel Peace Prize 2009

And the loser is...the Nobel committee, for abrogating its responsibility and settling for a politically safe decision. It's hard to believe that there were no better options - why, a second award for a group like MSF would have been so much better. To honour the leader of a nation that has always been interfering in the internal affairs of countries across the world is rather sad, to say the least - especially when his achievements are all still in rhetoric. And make no mistake, Obama's great intentions will only last as long as they are convenient to the USA. This year's award has set an unfortunate precedent - one that the Nobel committee itself will find hard to justify and sustain in future.

Monday, July 27, 2009

Compiz, the cube, wallpapers, and desktop icons...

As of now, compiz doesn't get along too well with Gnome or XFCE desktops as far as wallpapers are concerned. The wallpaper plugin to compiz allows one to set different backgrounds for each virtual desktop, but those backgrounds are obscured by Nautilus in Gnome and xfdesktop in XFCE.

One way to to get back the compiz wallpapers is to disable the desktop drawing by Nautilus and xfdesktop. This has the unfortunate side-effect of removing all desktop icons as well. Under Gnome, it also disables auto-mount of removable drives. Sadly, one has to live with this trade-off until someone fixes the whole thing.

With Gnome, there is another option that works most of the time.
1. Turn on desktop drawing by Nautilus.
2. Enable compiz and the desktop cube.
3. In CCSM, under General Options -> Desktop Size, set the sliders to 4-1-2.
4. Check that rotate cube works across the 4 virtual desktops.
5. Check the pager in the bottom panel - it should show 2 desktops.
6. Click on the second desktop - you should see the wallpapers set up in the wallpaper plugin of compiz, and you should be able to rotate through the 4 virtual desktops on this (second) cube.
7. If the Gnome panels don't appear, open a terminal (it's a good idea to set up a shortcut key to launch the terminal, otherwise you may get stuck on the second desktop without the panels), and killall gnome-panel. The panels should reappear.

If all went OK, the 4 virtual desktops on the first desktop should show the same (Gnome) wallpaper as well as the desktop icons. The 4 virtual desktops of the second desktop should show the compiz wallpapers, *without* any desktop icons. If both sets of virtual desktops show the same (Gnome) wallpaper, try logging out and back in - it worked for me most of the time!


Wednesday, February 11, 2009

Canon FS10 recordings and Linux

I've been playing around with my new Canon FS10 digital camcorder (and having fun). The digital 2000x zoom sounds good but is not worth much in practice. The rest of the package is pretty good.

The recordings are saved as 2 files - a .MOD file (which is actually an MPEG-2 interlaced video file), and a corresponding .MOI file. The MOI file apparently contains information about the MOD file including date and time of the recording, duration and aspect ratio. Since I work on a Linux laptop most of the time, I was curious to see how easy it would be to transcode the MOD file into a smaller (e.g. DivX/XviD file), and also retain some of the information like the date and time of the recording. With a little help from Google, here's what I came up with, wrapped into a bash script:
  • pick up a .MOD file
  • read the corresponding .MOI file and extract the fields of interest (year, month, day, hour and minute of the recording, in my case). This page gives the structure of the .MOI file.
  • construct a human-readable string of the date and time
  • use FFMPEG to transcode the .MOD to an AVI using mpeg4 video and libmp3lame audio codecs, and also overlay the date and time string on the output using the drawtext.so vhook filter feature of FFMPEG
  • finally, use cfourcc to change the FourCC code as required.
Works like a charm, gets me good quality videos in half (or less) the original size, along with the date and time information embedded in the video. The complete script looks like this:

#!/bin/bash

### Convert .MOD files (from Canon FS10 digital camcorder) into AVI files.
### Source (.MOD) is MPEG-2 video sequence @ 9600 kbps, with AC3 audio @256 kbps,
### destination is .AVI with MPEG4 video @ 4800 kbps and MP3 audio @128 kbps.
### First pick the date/time of the recording from the .MOI file,
### then encode movie and overlay date/time info. using vhook of ffmpeg

months=(none Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)

for f in *.MOD
do
   bname=`basename $f .MOD`

   params=(`od -t x1 -j 6 -N 6 $bname.MOI | head -1`)
   yr=$((0x${params[1]}${params[2]}))
   mon=$((0x${params[3]}))
   day=$((0x${params[4]}))
   hr=$((0x${params[5]}))
   min=$((0x${params[6]}))

   if [ $hr -lt 10 ]
   then
      hr="0$hr"
   fi
   if [ $min -lt 10 ]
   then
      min="0$min"
   fi
   dtstr="$day ${months[$mon]} $yr, $hr:$min hrs"
   echo $dtstr > /tmp/mod.txt

   ffmpeg -i $f -deinterlace -vcodec mpeg4 -b 4800k -acodec libmp3lame -ab 128k -vhook '/usr/lib/vhook/drawtext.so -f /home/user/.fonts/Vera.ttf -s 14 -t mod.txt -T /tmp/mod.txt' $bname.avi

   cfourcc -u XVID $bname.avi

   rm /tmp/mod.txt
done

### end of script