Making a Screencast in Linux !!
Making small utilities in Linux is fun . There are a hell lot of small tools in linux that when you put together , make cool things. I made a few this week when I was bored after watching “House” continuosly.
There are three things I am gonna put up here .
- Making a screencast of your desktop .
- Making a recursive video
- Opening a man page in a pdf viewer .
1. Making screencast of your desktop :
The main motivation behind this is Topcoder and Petr(yeah the target red coder … he is an Alien too ) . Petr used to screencast his topcoder matches to the world . So I started looking into the net for tools to capture my desktop as a video file ( not that I wanted to screencast my topcoder matches . Would be pathetic
) . So I came across a couple of GUI’s for windows and then Abhilash was out looking for the same thing ( may be his screencast would be interesting . He types at an amazing 90 wpm
) . By this time I had got my hands on this tool ffmpeg which had the option to grab the video from anything . So little bit of googling lead me to a site which gave me this
ffmpeg -f x11grab -s wxga -r 25 -i :0.0 -sameq ~/Desktop/out.mpg
But sadly this didnt work for me . And then I went on to read the man pages of ffmpeg and this is when i found it buggy to read the man page of a big command in terminal and I went on to create a small utility to open man pages in evince (later on this ) . But this command didnt work for me and gave some error in the input format. Reading the man pages, -f is for forcing the source format which is “grabbing the X11 display ” ( the desktop of X actually ) . The -s argument is for the output video resolution size and found that setting it to wxga was the mistake . I changed it to suit my resolution which is xga . -r is for the frame rate in fps . -i gives the input file which in our case is the :0.0 display . -sameq says the ffmpeg to use the same video quality as produced by the source. You might wanna remove this incase you want a video file of small size. And finally this command worked
.
ffmpeg -f x11grab -s xga -r 25 -i :0.0 -sameq ~/Desktop/1.mpg
Now , this is not an easy command to write and I wont be needing it often . So , I thought why not make a script out of it . So put the following in a file and named it as “capturevideo” and changed the command to
ffmpeg -f x11grab -s xga -r 25 -i :0.0 -sameq ~/Desktop/$1.mpg
so that I can get the output file name from the command line . Now all I had to do was export my PATH variable to make it search my /home/Sathya/Tools folder where I have kept all these small tools . Opened my .bashrc file and added
export PATH=$PATH:/home/Sathya/Tools
and then finally did a
chmod u+x /home/Sathya/Tools/capturevideo .
And Bingo !!! capturevideo sample created a sample video of my desktop operations . I actually made a recursive video out of it
.
2. Making a Recursive video using Step 1 :
Actually I stumbled upon this by mistake . Follow the following steps to make a recursive video .
- Run the above capturevideo command .
- Open the video file that is being created while the command is still running and put it to full screen
- Keep watching till you feel you have recursed enough in the video
.
Now press a ‘q’ in the prompt of capturevideo and enjoy watching the recursive video . Here is a screen shot of my recursive video
. This will create a linear recursion . In case you wanna double up, open it in two players and capture .

3. Opening a man page directly in your pdf viewer.
I had already blogged about a part of this here on how to convert a man page to pdf here . Basically man has a -t option which creates the ps form of the man pages . I redirect that to a file and store it as a post script file and use the ps2pdf utlity to convert the file to pdf. Till now is what i usually used to do . But this was getting irritating since each time I had to delete the files created after I am done viewing the page. Hence this is what I did .
man -t $1 > /tmp/$1.ps ps2pdf /tmp/$1.ps /tmp/$1.pdf evince /tmp/$1.pdf rm -rf /tmp/$1.ps /tmp/$1.pdf
Now we store this in a file called manpdf and then do the following to give it permissions to execute .
chmod u+x /home/Sathya/Tools/manpdf
And from now on , doing a manpdf ls would directly open the man page in evince and after you are done reading the man page , it will delete the temporary files created in the /tmp folder. Is’nt that really simple
Any more easy utilities are welcome as comments
.
havent you heard of istanbul??
hmmm.. not until today
.. but i wud prefer this
…
I follow your posts for quite a long time and should tell you that your articles always prove to be of a high value and quality for readers.
This looks like an awful lot of work when recordMyScreen (which is based on Istanbul) does the same thing.