Sunday, January 08, 2012

Cannot set Chromium as your default browser?

I was using FreeMind to manage information of my work, and there were several links embedded in the mind map. When I was trying to open the links, they were opened in Firefox instead of Chromium that has been my default browser. I tried to set Chromium as the default browser in the Preferences tab but it said ``Chromium cannot determine or set the default browser.''
The solution was found on Ubuntu Forums. In the thread, user cavalier911 provided a method using update-alternatives to set the default browser. The command is as follows.

$ sudo update-alternatives --config x-www-browser

Pretty easy and works like a charm.

Monday, January 02, 2012

Screencast of particular window in Ubuntu using ffmpeg

When you want to record the screen output, there have been some software good to use [1]. However, I found none of them can properly record the zone in which a C++ program produced video stream combining webcam input and OpenGL objects.

After some trials, I found an useful solution [2] and made some modifications. It is a shell script that uses ffmpeg to record the video content of target window.


echo -e "Usage: bash $0 outputfile\nClick on the window to be recorded."

size=$(xwininfo -frame | awk '/geometry/ {print $2}')
offset=$(echo $size | awk -F + '{print $2","$3}')

ffmpeg -f alsa -ac 2 -ab 192k -i pulse -f x11grab -s $size -r 30 -i :0.0+$offset -acodec pcm_s16le -vcodec libx264 -vpre lossless_ultrafast -threads 0 $1
[1] Such as recordMyDesktop and xvidcap
[2] Run FFMPEG with x11grab