There was an error in this gadget

+1

Monday, March 05, 2007

Making animated movie of your Linux/Ubuntu desktop

I have a number of friends who are new to using computers and as usual use windows, recently Windows Vista was launched and a lot of them were really impressed with the snazzy graphics vista offered and were willing to switch from Windows XP to Vista paying a awful amount of money (considering Linux is free) just for Aero looks that vista provides. Well as with most computer newbies they had no clue about Linux or Ubuntu , so when i said that Ubuntu with Beryl provided a interface that could compete with Aero interface that vista provides and to top it is free and comes at no cost whats so ever well they took it with a pinch of salt and did not quite believe me . So well i decided to make a movie of my desktop showing all the glitzy effects that beryl provided so to prove them that Linux can kick Windows Vista Aero interface anytime.


I started google and various other blog looking for tool that would allow me make a movie of my desktop , the softwares that i came across for recording my desktop was xvidcap ,vnc2swf,Wink, Byzanz , and hacked version of ffmpeg . If you have used windows and screen cast tools on windows before you can say these tools are quite similar to tool available on windows for recoding the desktop the Lotus Screen Cam.

Here is how i installed and used these screen cast tools : -


1. xvidcap

Installation : -

Since i could not find xvidcap in my Ubuntu repositories so i had to download xvidcap from it's website (download xvidcap from the following address http://sourceforge.net/project/showfiles.php?group_id=81535 ) , luckily the website provided a debian package which was small in size (2.82 MB) . After downloading the package i launched the Terminal (Applications -> Accessories -> Terminal ) now i moved into directory containing xvidcap and typed in the following command to start the installation of xvidcap.

sudo dpkg -i xvidcap*.deb

After completing the installation go to (Applications -> Sound and Video -> Xvidcap screen capture ) to launch the Xvidcap screen capturing utility.


Now after launching the Xvidcap application you would see a window like this and a Red square that defines the area of screen you would like to capture . You can change this to any size square for capturing that part of screen . However you should note that larger the area the more memory it would consume hence slower your system would become so try to get a small square .

Now to start capturing select this tool to select screen area you would like to capture . Now click on Record button to start capturing the screen .


However since recording videos consume a lot of memory so be careful about the type of applications that you would like to record and frame rates and video format when recording application . I had very bad experience recording video since my laptop is not very fast and frame rates were low with default DivX compression , but with a descent hardware you should be able to record videos without any problem. So well i found a way changing this right click on the button that shows test.mpg there go to Preferences .

The following window should show up , now go to Multi-Frame there increase the number of Frames per second to at least 25 and remove the auto before Video Codec and select MPEG1 if you are low on hardware and want to capture screen at a nice frame rate without significant lag. However if you are not low on hardware specs you can experiment with the Quality and Frame rate and video codec .Also you may like to disable the recording of audio to save some resources . Give a suitable name to the file name .

A nice feature of xvidcap is that it allows making screen cast in a variety of different file format including Macromedia Flash which allows you to include your screen cast in your website . To create Screen Cast in Flash format type in the name of file in the Multi-Frame of Preference dialog box as filename.swf this causes xvidcap to automatically select Video Output as Flash Video and File Format as Flash File (.swf)

Now you are ready to start recording your desktop.

After completing the recording the following windows should show up . Click close /play depending upon what you would like to do .Y our movie should be ready to be played .

2. The simplest one Byzanz

Byzanz is a small Gnome Panel applet that allows one to record screen as a animated gif file .

To install Byzanz type the following command at the terminal .

sudo apt-get install byzanz

now after completeing installation right click on the gnome panel now select the "Desktop Recorder" applet from the Miscellaneous section . After selecting you would find a Cross marked button in your applet .


Now to start recording click on the button it would start recording your desktop . Now when you have completed recording press the button again , it would ask for filename and after this your screen cast should be ready.

3. Patched version of ffmpeg(using ideas from this blog)

FFmpeg is a software that allows one to record and convert digital media . It can be used for converting video files from one file format to another file format .It also allows playing of simple media files. However the best utility of ffmpeg is in converting file from one format to another file format.

Now ffmpeg does not as such supports recording screen but we patch it's source code to make it record the desktop and create a screen cast based on that.

Now , to start this first launch terminal from (Applications -> Accessories -> Terminal) and type the following command in the terminal .

Now since by default ubuntu does not come with tool for compiling programs so we download a few additional tool for compiling applications and development libraries xlib

sudo apt-get install build-essential xlibs-dev

This command would fetch ffmpeg source code.

wget http://un.sh.nu/screencasts/ffmpeg-0.4.9-p20051216.tar.bz2

Now we extract the archive

tar xjfv ffmpeg-0.4.9-p20051216.tar.bz2

cd ffmpeg-0.4.9-p20051216

Now after moving into ffmpeg source code directory we download a patch and apply them here .

wget http://un.sh.nu/screencasts/ffmpeg-0.4.9-p20051216.diff

patch -Np1 -i ffmpeg-0.4.9-p20051216.diff


Now after this you have to modify configure script (open gedit or vi or any other text editor) and open "configure" script(for gedit configure in ffmpeg directory) and change this line

#!/bin/sh

to

#!/bin/bash


Now after this issue the following command to build Makefile

./configure --extra-ldflags=-L/usr/X11R6/lib --enable-x11grab --enable-gpl

now you are ready to start building ffmpeg

make

After completion of this operation your ffmpeg binary should be ready for making screen cast.

Now to record your entire desktop issue the following command : -

./ffmpeg -vcodec mpeg4 -b 1000 -r 10 -g 300 -vd x11:0,0 -s 1024x768 ~/screencast.avi

This would create a file named screencast.avi in your $HOME directory and you can use any video player to play your screencast.

Now you can explore more options that ffmpeg provides , you can chose a different video codec if you like or change screen size to capture a portion of screen .

./ffmpeg -vcodec mpeg4 -b 1000 -r 10 -g 300 -vd x11:10,10 -s 102x76 ~/screencast.avi

-vd option specifies the upper left corner of screen from which ffmpeg should start making screen cast. and -s 102x76 is size of window to be used for making screencast.

./ffmpeg -vcodec mpeg4 -b 1000 -r 10 -g 300 -i ~/screencast.avi -s 640×480 ~/screen.avi

This would convert your previous screen cast to a video resized to 640x480 resolution.

4. pyvnc2swf

pyvnc2swf is a python script that records one desktop using vnc protocol and stores it in a file in swf file format.

To install pyvnc2swf issue the following command in terminal(assuming you are running Ubuntu 6.10 ) : -

sudo apt-get install x11vnc

sudo apt-get install python-tk

sudo apt-get install python-pygame

after this all libraries should be ready to enable recording of screen.

Now download vnc2swf from this website :- http://www.unixuser.org/~euske/vnc2swf/pyvnc2swf-0.9.1.tar.gz

Open and extract this file either by using file-roller tool or from command line

Now open two terminal windows in one windows start x11vnc server by typing the following command at terminal

x11vnc

This would start a vnc server on your machine if you like you can specify a password to avoid unauthorized access to your machine.

in second terminal go to the directory where you have extracted pyvnc2swf and type

./pyvnc2swf.py

at terminal to launch the application.

After this the following windows should show up allowing you to record your Ubuntu desktop screen . Since the application is graphical so it should not give you any major problem.


Press start to start recording desktop and when you have completed press stop button . Then go to file and save as and give a appropriate name of file and directory where you want to save flash video and associated HTML file.

5. Wink

Wink is a tool for creating tutorials and presentation that is available both on Windows and linux platform . It provides one feature that's not available in the other Screen cast tools available on linux , that it allows adding of popup windows having additional informations within the Screen cast . So it can be really handy for explaining someone Linux with help and hints popping up.Besides this Wink is available in a number of languages including English, French, German, Italian, Danish, Spanish, Serbian, Japanese, Brazilian Portuguese and Simplified/Traditional Chinese. .

It is probably the best tool to create interactive tutorial like presentation . Anyways you can download Wink from the following website address .

http://www.debugmode.com/wink/

After downloading it extract it into any directory you wish . Open terminal from (Applications -> Accessories -> Terminal) and go to that directory where you have extracted files and issue the following command to start installation of Wink.

./installer.sh

now go to direcotry which you specified to install Wink and type

./wink

to launch Wink

To start making screen casts go to (File -> New Project ) set various parameters according to your need and press OK .


Now you should see a dialog similar to this .


Now to start recording screen press " Shift + Pause " and to stop press it again.
To create a swf file click on Render (Project -> Render ) inside the Wink interface to compile the Screen Cast to a swf file(IMP : Change the frame rate of screen cast to value you typed when you started recording). You can explore other option of Wink yourself. Since it is graphical and should not present any major challenge .

By
Ambuj Varshney ( blogambuj(at) gmail.com)
For Linux On Desktop

13 comments:

Anonymous said...

Did you try to use beryl’s built-in vidcap plugin? It would have been much easier.

Anonymous said...

Interessting article, but plz. dont use the word "NOW" in every other sentence...
It's irritating

AMBUJ said...

Yes you are right i do type now too often i would surely take care about this in next article
thanx
Ambuj

Christian said...

Where the heck is the "Preferences" menu in xvidcap?????

Anonymous said...

Seems like a lot of steps. Couldn't something like this be done much easier with Istanbul, which is in the Ubuntu repositories?

Anonymous said...

So where's the video? Is there a URL for one of the videos you created?

Mackenzie said...

Why are you having them change #!/bin/sh to #!/bin/bash? They do the same thing. /bin/sh calls whatever your default shell is. If it's bash, it's the same as doing #!/bin/bash. If it's not bash, none of the commands you gave up to that point would've worked properly anyway.

Anonymous said...

mackenzie:
possibly because it makes the ./configure command work....

before changing that line, the ./configure command (even with no arguments) throws a syntax error. After the change, it works.

I'm not an expert, but theres some substance behind that instruction....

Anonymous said...

mackenzie, that's not correct at all.

/bin/sh points to /bin/dash on some systems, and to /bin/bash on others. dash and bash are both posix-compliant and will both do what you expect from a real "sh" Bourne shell. However, some scripts are written for bash and won't work with dash.

Tormod

Abhay said...

Ambuj this is a great Article, but as mentioned by someone Beryl already has a video cap plugin which you might find easiest to use.
After reading this, I know I have more options.

Anonymous said...

The newer ffmpeg has the patch in it already with a little difference. I thkn the equivalent command line to:

./ffmpeg -vcodec mpeg4 -b 1000 -r 10 -g 300 -vd x11:0,0 -s 1024x768 ~/screencast.avi

is
./ffmpeg -vcodec mpeg4 -b 1000 -r 10 -g 300 -f x11grab -s cif -i :0.0 -s 1024x768 ~/screencast.avi

html kodları said...

thanks

Arun said...

Try gtk-recordmydesktop, the best screencast tool
http://ubuntu-india.blogspot.com/2010/10/desktop-recording-screencasting.html

Post a Comment