Archive for May, 2014

using gtk-recordmydesktop

Here I sum up how I use gtk-recordmydesktop. gtk-recordmydesktop produces huge .ogv files that I like to convert to much smaller .mp4 files (without quality loss).

My gtk-recordmydesktop settings:

  • video quality 100%
  • audio quality 100%
  • in Advanced -> Performance:
    • frames per second: 20
    • full shots at every frame: yes

Convert .ogv to .mp4:

/opt/ffmpeg/ffmpeg -i "input.ogv" -codec:v libx264 -quality good -cpu-used 0 -profile:v baseline -level 30 -y -maxrate 2000k -bufsize 2000k -threads 4 -codec:a copy -b:a 128k "output.mp4"

I record audio with a microphone but it always has some white noise. To get rid of it, extract the audio:

/opt/ffmpeg/ffmpeg -i file.mp4 -f wav output.wav

Open the .wav file with Audacity, remove the noise and save the result in .mp3 format. Finally, replace the audio in the .mp4 file:

/opt/ffmpeg/ffmpeg -i audio.mp3 -i video.mp4 -c copy final_video.mp4
Categories: bash Tags: , , , ,


I have an .ogv file that I want to convert to .mp4.

My ffmpeg is compiled from source. With the following command I got output of good quality:

/opt/ffmpeg/ffmpeg -i "input.ogv" -codec:v libx264 -quality good -cpu-used 0 -profile:v baseline -level 30 -y -maxrate 2000k -bufsize 2000k -threads 4 -codec:a copy -b:a 128k "output.mp4"
Categories: bash Tags:

how to create and print a booklet

I wanted to print a booklet, i.e. “print a document two pages at a time ordered in a way that folding the whole printout would produce a booklet, half the size of the paper which could be stapled in the middle.”

How to do it? Adobe Reader can do this but I had no luck. It seemed that it created the booklet correctly but when I printed it, the pages were flipped on the long side instead of the short side, so the result landed in the dustbin.

There is a nice little software called PdfBooklet that can create a booklet PDF that you can then print. Just open the original PDF in PdfBooklet, make sure that the ordering is OK (it should be), then click on the “Go” button to create a new booklet PDF. PdfBooklet didn’t show all the pages correctly in its view pane but the produced output was OK.

Tip from here.

Categories: ubuntu Tags: , , ,

Install Adobe Reader on Ubuntu 13.10+

If you use Ubuntu 13.10+, you won’t find Adobe Reader in the Software Center. Instead, download the .deb file from and install it. In my case it complained about the state of the package but I chose “install anyway”.

The easiest way is to open the downloaded .deb package with the Software Center. First I tried to install it from .tar.gz, but when I tried to launch it, it didn’t find some library.

More details here.

If you have some missing dependencies when you try to launch it, refer to this thread.

Categories: ubuntu Tags: , ,

measure execution time in bash

While working in bash, quite often I need to launch scripts/programs that take some time to finish. I would like to have an idea how much time it took. How to do it?

Solution #1 and #2 (easy to forget)
In Unix, there is a command called time, which can measure the execution time of a process. Example:

$ time sleep 3

real    0m3.001s
user    0m0.000s
sys     0m0.001s

Nice, but you don’t want to start everything with time, do you?

Another way is to print the date before and after the process:

$ date; echo "serious calculation in progress..."; sleep 3; date
Tue May 13 11:40:42 CEST 2014
serious calculation in progress...
Tue May 13 11:40:45 CEST 2014

Now you can see when the process started and when it finished.

Fine, but… What if you start a process normally and then you realize after a few minutes that it won’t finish soon. Stop it and restart it with one of the aforementioned two methods? No. You wait until it stops and if you are not at the computer, you won’t have any idea how long it was running. Damn!

Is there an easy solution for this problem? A painless, straightforward way? Well, yes, there is. See below.

Solution #3 (the easy way)
In bash, you can customize the prompt via the PS1 variable. By default, its value is set to something similar:

$ export PS1="\u@\h:\w\$ "
jabba@nancy:~$ cd /trash/

All we need to do is add the time in the prompt. Then, when a process terminates, you will see right away when it stopped. For adding the time, simply insert “\t” in PS1:

$ export PS1="\u@\h [\t] \w\$ "
jabba@nancy [11:52:20] ~$ cd /trash
jabba@nancy [11:52:29] /trash$

This is the basic version. In addition, my prompt is colored. To have a colored prompt, I include a file in my .bashrc. Thus, the end of my .bashrc looks like this:

# this is the last line in my .bashrc:
source ~/.bash_prompt

You can find my .bash_prompt file here.


Categories: bash Tags: ,

Automate with IFTTT

IFTTT is a great service that enables users to connect different web applications (e.g., Facebook, Evernote, Weather, Dropbox, etc.) together through simple conditional statements known as “Recipes”.” (via wikipedia)

IFTTT stands for “if this then that”. That is, if a condition is met, then an action is triggered.

Here is a nice introductory video. It shows how to get an SMS if it’s going to rain tomorrow:


Let’s see another example. Say you have a favourite TV show that you want to watch as soon as possible. When the new episode is out, you want to get an email notification.

As reddit user ACreatureVoidOfForm pointed out, we need and “Create a page on showrss for all the shows you watch and generate an RSS feed. Create a rule on ifttt to email you when a new entry is added to the feed.” (tip from here)

send an email at a specific date and time

Update (20140512): There is a better way. Check out this post.

I have a favorite TV show whose new episodes I want to watch as soon as possible. However, I don’t want to keep in my mind the release dates. When a new episode is out, I want to get an email notification.

At you can check out the release dates of the episodes (example). LetterMeLater provides a service to send emails at a specific date and time (it’s free up to 30 emails/month). To the release dates I added one day and set LetterMeLater to send emails at that day.

It may not be the best way to do it. If you have a better method, let me know.

Categories: Uncategorized Tags: , , ,