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
.
Klueless – Online Treasure Hunt
People interested in treasure hunt can check out this . I had a really great time working on the questions with nutty . And ofcourse a big one to Abhilash . It was his code for labyrinth that i had reused ( On the lines of good coders code and great coders reuse
) . The treasure hunt is still on. I guess i ll keep the database active for few more weeks atleast since I see people play it daily
.
The Private Magic Show at Sun Lab
Today was one of my lucky days . I was in sun lab with my laptop , and had gone out for dinner . When I came back , was surprised to see abhilash with a set of cards and AJ sitting in front of him . I went shouting “Hey me too , for the magic trick ” . And hence the private magic show of AJ began in the sun lab , with abhilash ,me and srinivas watching him do amazing things with cards .
I was a bit late , had missed a trick . So i pulled a chair and sat down and the next half an hour was breath-taking . I have watched lots of videos of David Blaine’s Street magic . I was amazed at those tricks at first but was convinced at times that they were all fake . But this one by AJ totally blew my minds off. I happened to see abt 7-8 of his card tricks and i was really amazed to see how a couple of hands , a mouth and a pack of cards could take you out for an awesome entertaining journey. And then finally , he made me do all the magic. I am gonna explain this .
AJ : So you wanna do some magic ?
Me : Ofcourse yeah .
He then gave me a deck of cards and then,
AJ : Now you are the magician . As a magician what would you want me to do ?
Me : Pick a card ( I couldnt think of anything else )
AJ Picked a card randomly , I was holding the deck all the time . And then he asked me to shuffle the cards . Now I did all possible shuffling to make sure he was not cheating . And then he asked me do deal a set of cards of my own choice . So i arbitly cut a few of cards . While he still had the card which he originally chose , I divided the cards I dealt into two sets .
AJ : Now the first deck gives me the value and the second card gives me the suit.
And then voila !! He opened the first card of first deck . Turned out to be Queen of Spades. Opened the first card of the other deck , which turned out to be Six Dice . And then he opened the card that he had initally taken . Believe me or not , it was a Queen of dice
. I was like OMG . He had not touched the entire deck of cards except for choosing the first card. I dealt all the cards, shuffled them all up myself. And still this guy pulls off a beautiful trick and amazes me ( and still says I ‘am the magician
) .
I feel really lucky to have been the one of very few to get his private magic show . I have seen some of my friends do magic tricks , but this one just blew me off. Totally entertaining.
Hats off AJ . You totally rock !!! .
PS : AJ you are “deeeeee” magician
Go Back
If you have come this far , then it means you are wrong . Now Go Back , take a deep breath and start thinking again
PS : For those who have no clue what this is all about , this is a clue for the online treasure hunt Klueless for Vortex
Check it out here
TV Series I covered in my third year :)
Heroes – 3 seasons
How i met your mom – 4 seasons
Prison Break – 4 seasons
Numbers -3 season
Big Bang Theory - 2 seasons
24 – 6 seasons
House – 2 seasons
Kyle XY – 1 season
Planning to watch All 10 seasons of friends this summer
gstreamer bug in Ubuntu and a temporary fix
Off late I found that some of the movies that I downloaded from the internet played really wierd . The quality of the movie was good but the colors seem to be distorted and there used to be a green band . Look at the pics below . The one in the left is how the actual movie is supposed to be and the one in the right is how it appears.


Few things I tried out to fix this :
1. I thought it was the problem with the video i downloaded because not all videos had this prolem . So I tried using mencoder to convert to other formats and fix the video . Didn’t work
2. Tried re-downloading and changing my torrent managers . Miserably failed
3. Tried playing in all sorts of different player . All of them had the same problem . Now I was sure it was not a problem with the codecs used nor the player.
4. Booted in windows and tried playing . Worked perfectly fine. So I was sure the problem was still with Linux .
In the mean time I had deleted a couple of movies because I really got irritated because of the problem .
This is when googling struck me and I found out about the gstreamer bug . GStreamer is a library for constructing graphs of media-handling components. The applications it supports range from simple Ogg/Vorbis playback, audio/video streaming to complex audio (mixing) and video (non-linear editing) processing.
Tried meddling with the properties of gstreamer from the command line . No effect
Finally did the following
sudo apt-get remove totem-gstreamer
sudo apt-get install totem-xine gxine
Yippe !!! All videos worked fine with the new players using the xine engine
. I hope they get to the bug fix soon . Mean while you can log your complaints at http://bugzilla.gnome.org/show_bug.cgi?id=357741 and please mention any fixes you get to know . One of them involving changing gstreamer properties seems to work for some .
Life and the paradox
It so happens that we are never sure of what we actually want . When I’am so free , I used to think , why is life so boring , can’t I have a busy day
. And when I have my hands full , I think why am I doing all this work . Can’t I just be free for a moment
. I am never sure of what I wanted . I still dunno why i am posting this , but you see , something tingled my brain to stop thinking about debugging a code i wrote for the “Pete Mitrichev Contest 3 “ and start writing on some thing . I still can’t figure out why i have been so dull for the past few days or why my mom keeps saying that ” Nowadays you talk to people only when you dont have your laptop around !! ” ( That includes when i watch some TV Series on the comp too
) .Life has changed . In my childhood days , I used to talk a lot to my parents. I used to tell them things that I found funny , things that I found mysterious and things that made an evening with a cup of tea pleasurable . I wish I was a child again
. But then , there were lots of other things that I wish I got rid off then . Missing things make them special to you .
Things that are very significant and important to us may very well be worth not even a mention to others . I was walking by yesterday and could see a group of people organizing a culturals in a local govt college . To them what they were doing at the moment , meant a lot to them . But to some one who just gazes at them for a moment , its yet another insignificant thing compared to plenty other things happening around him . Its just like the view of variables in a block of code . Two blocks that don’t share a common variable are useless interacting with each other . But then should we be selfish enough to just keep thinking of things that only concern us or can we just lend an ear to some one who is virtually jumping to tell you something very special to him ? You never know the exact answer to such questions .
Perhaps this post will look silly to you or to me at some other point of time .:)
4 comments