Converting rfbproxy PPM to MPEG

I was playing with the WebEx recorder and wondered if I could do something similar with VNC on Win32. It turns out that RealVNC 3.3.7 libvncauth and rfbproxy compile under Cygwin and can be used to capture a VNC session’s video pretty easily. But, what do you do with the recorded file and its non-standard format? Google didn’t turn up much help, so now that I’ve figured out how to convert it, I figured I’d share what I learned with everyone.

I’m going to assume that you can figure out how to compile and install stuff under Cygwin. If you don’t, it’s probably too difficult for me to explain in a general manner. To get started, you’ll need the following packages installed:

First, capture your VNC session with rfbproxy. I saved mine to a file called test.rec. Once you’re done, you’ll want to convert it to YUV4MPEG format:

$ rfbproxy -x test.rec | ppmtoy4m > test.y4m

Then, you want to convert the YUV4MPEG to MPEG format:

$ ffmpeg -i test.y4m test.mpg

There you have it! Simple as that … if, you can get all the necessary prerequisites compiled, which is definitely the hard part on Cygwin/Win32. It’s a lot easier on Linux, where you should be able to just pick up the binary packages for your distribution and install them.

Tags: , , , ,


  1. Two things. One, awesome binaries here:

    Compiled regularly from svn, they should do the trick.

    Two, output RGB/YUV420 uncompressed video and uncompressed audio into an avi container. No loss in quality, which is great if you intend to edit the video. Perfect for bringing your project into VirtualDub:

    $ ffmpeg -i test.y4m -vcodec rawvideo -acodec pcm_s16le test.avi

    You can also set a high bitrate if you prefer something like mpeg-1 video. (This example is 4Mbps. Chose whatever fits your fancy):

    $ ffmpeg -i test.y4m -b 4000k test.mpg

    Or, use a quantizer-based quality setting (this example fixes quantizer at 2, but you can also use a range):

    $ ffmpeg -i test.y4m -qmin 2 -qmax 2 test.mpg

    Quantizer of 1 is perfect (but pointless), 2 is perfect with compression to save space, greater than 2 is lossy.

    Check out the ffmpeg documentation for more options:

    If you want to know which formats you can use with the -vcodec and -acodec flags, type:

    $ ffmpeg -formats

Speak Your Mind