Recording VNC session as MPEG2 video stream (2009/10/20)


It is very handy if you can record your VNC session as a video stream. Such as video stream can be used for many purposes such as research demo and educational video.

There exist several variants of VNC clients, but almost all of them are derived from the original VNC. Thus, most of those clients take to VNC server with the standard RFB (Remote FrameBuffer) protocol.

1. Install vncrec-twibright

Use Twribright Lab's enhanced version of vncrec, which is available at

Orignial vncrec ( can be used, but Twibright version is much easier to use.

2. Install ffmpeg (optional)

Obtain and install ffmpeg from http://. If you build ffmpeg from source archive, make sure all required shared libraries installed.

3. Record VNC session in vncrec format

Connect to your VNC server as:

  vncrec -record file.vncrec hostname:5901

All screen updates are recorded in file.vncrec.

4. Convert vncrec file into yuv4mpeg format
  vncrec -movie file.vncrec >file.y4m

If you are using yuv4mpeg-compatible player/editor, that's all. If you still want video file in other format, use ffmpeg for conversion.

5. (optional) Convert to other file format
  ffmpeg -i file.y4m file.flv

Note that transcode must have been compiled with yuv4mpeg and ffmpeg support, and ffmpeg must have been properly installed. Since transcode seems not so stable, I recommend you to use yuv4mpeg format.


Hey! The above document had some coding errors, which are explained below:

Around line 16:

'=item' outside of any '=over'

Hiroyuki Ohsaki (ohsaki[atmark]