Saturday, April 24, 2010

RfbProxy - How to use

Glad to write about a tool which I've experimented to record the remote screen and playback.

    It helps connecting to a VNC server and record the changing contents of its screen to a file, play the recorded file, convert it to MPEG and some other formats.
    Though it doesn't support tight encoding, which is considered to be efficient and occupies low bandwidth when transferring the updates, it works well with the raw encoding.

To record:
    As said in the last articles, RfbProxy will act as a VNC client and captures the screen updates to a file.
./rfbproxy --shared --record ./sample.fbs refers to the IP of the machine where the VNC server is running. To record the server, the connection need to be a shared session.

To Playback:
Way - I (Through VNC viewers):
    Here is the very simple way to view the recorded session. RfbProxy will be streaming the file contents to a port which we need and VNC viewer has to be connected to the port. So, It is more or less similar to simulating the VNC server.

rfbproxy -p sample.fbs
    This command will stream the contents in localhost:10, connect a VNC viewer to it.

Way - II (FBS to MPEG2 conversion):
    By having the fbs file in hand, it isn't possible to play it with players which supports various movie formats like MPEG, AVI, etc., So, it is needed to convert the fbs file to a movie format and play it with any player which supports the format.
    It needs mjpegtools package to be installed in Ubuntu. mjpegtools debian package is available in sourceforge, but I've got error when installing it. Haven't tried much, give a try.

rfbproxy -x sample.fbs | ppmtoy4m -S 420jpeg | mpeg2enc -b 10000 --no-constraints -f 3 -4 1 -2 1 -q 4 -P -N 1.0 -M 2 -E -10 -D 10 -a 2 -o video.mp2
    'rfbproxy -x' will export the fbs file content to PPM frames. Sorry, I have no idea about the options provided for the other commands. But, it worked for me.

    Based on size of the fbs file, it'll consume more time to convert from fbs to mp2. May be you wanted to have a coffee break in between!


Further reading:
     RfbProxy - How to install - Installation guide