Tuesday, November 2, 2010

The dark art of desktop capture in linux

I recently had to record a video demo for an application of mine. Quite an experience it turned out to be. I was told that XvidCap and Istanbul, apps available on ubuntu 10.04, were the way to go. Unfortunately with GLSL shader messing with the FB and for reasons that I'm not willing to venture into I never managed to get them to record what I wanted.

Finally I learned that in linux ffmpeg has a decent desktop capture mechanism. My initial source was from here. Much of that deals with setting up ffmpeg. The relevant piece of command to record the desktop was

/ffmpeg -vcodec mpeg4 -sameq -r 25 -vd x11:0,0 -s 1024x768 ~/screen_op.avi


This produced a video that was close enough to the original visualization. Unfortunately the video turned out to be like 300 Mb for 3 mins which was quite unacceptable.

Furthermore readablity of text was necessary. Straightforward downsizing introduced unacceptable artifacts especially to text elements.

I found Mencoder with the xvid codec to do a good job here. A small bash script to perform a 2 pass encoding:


for pass in 1 2
do
mencoder ~/screen_op.avi -ovc xvid \
-xvidencopts chroma_opt:vhq=4:bvhq=1:quant_type=mod_quant:pass=${pass}:bitrate=4000 \
-o screen_op_xvid.avi
done


Much of the docs for the options were from here and the mplayer man pages on section "xvidencopts".

In general the two pass approach with quant_type=mod_quant(2pass needed for this) seems to work well for text. I found that throttling the bitrate beyond a certain point produced unacceptable results. Further downsizing of videos upto 640x480 retained smooth animations with readable text. I managed to encode about 3 mins of video at 25 fps into about 33mb with text elements readable. I still think more can be done.

One thing that was annoying is that I could never acceptably reduce framerate from the original recording. If I did the result was either jerky or blurry both of which were not ok. As far as I understand there's no getting around unless you are willing to reduce it by an integral factor.

Friday, June 26, 2009

Mukurti - Round 2

Shhhh!! Gone 2 days during the week. Plans materialized very quickly on Monday. Though it was to be expected given the crankiness of the DFO office in Ooty. All the same could not pass up an opportunity to climb Mukurti peak. It was all misted up though. And we could see only glimpses of the kerala side. The western catchment side was all misted up. Last time around we could clearly see the western catchment but not the kerala side. This time, as I said, we just got glimpses. All in all it was fun but really didnt see anything new. Must retry in jan.

over and out .. :)

Monday, December 1, 2008

Mukurti

Been to mukurti recently on a trek. A real Heaven on earth. Ive put up a slide show. I mustve lost a couple of kilos on the way.:). was really worth it .. considering that I did risk my graphics project.. Im glad it all worked out though

Friday, October 10, 2008

Ubuntu & Dell Vostro 1510 .. Frazzles

So over the last week I installed ubuntu on my laptop.. When I finally got my wireless working I thought I was done with all my setups. Before purchasing the laptop I figured that I might not be able to get the wireless up on dell laptops and took a risk .. But that worked like a charm.. I hardly spent about 15 mins resolving that.. (which is pretty good .. sometimes i spend hours and days to get stuff working).. But that hardly is the end of things .. I compiling here a list of problems I had faced and where I found the resolutions

Ethernet Problems..
On the 1510 the onboard ethernet card is an RTL81111/8168B.. ubuntu loads r8169.ko driver.. I had to download and install the driver from the realtek website detailed instructions can be found here.. https://bugs.launchpad.net/ubuntu/+bug/208012. The 8169 driver functions sometimes . That led me to believe NetworkManager was screwing up things.. But really I still dont know why it worked sometimes

Update as of 28th oct I think this is resolved in ubuntu hardy.. I dont think that this is a problem anymore.. not sure which Kernel version it was fixed

Wireless ..
This was easy to come to .. Ubuntu distributes ndiswrapper package.. you just need to install and follow instructions.. you will need the windows drivers for this..

Web cam ..
Ok .. so basically the uvc video driver in ubuntu hardy works well ..I was able to get the webcam up and working using programs like cheese .. but I still had problems with getting it to work with flash and firefox.. The answers were here.. this is still a hack and you have to have the flashcam program running if you wanna use the cam..a small inconvenience..;)

Nvidia Drivers

I found that the nvidia drivers that are available in the ubuntu reps to be a bit older .. Im not sure why this is so .. basically the version numbers in the reps are around 68. or 69.xxx. The ones in the nvidia drivers page are around the 178.xx series.. really not sure what these mean but in general I decided to trust nvidia's drivers .. Installation is fairly straigt forward..
1. Bring up the system
2. Goto the nvidia site and download drivers for your card series
3. goto the shell using ctrl-alt- f1.
4. login as root.
5. type killall gdm Xorg gdmgreeter
6. run the downloaded program using sh Nvidiadrivers.xxxx
7. follow the instructions..
8. type startx and things should be fine..

the only problem is that you need to do this every time the kernel updates..

I actually managed to get sim city 4 using wine .. working on this .. so it is pretty cool

ciao