Its been a while that I wanted to broadcast my desktop screen on Linux. You can set up your broadcast server, of course, but that may not be giving you many viewers.

I want to stream on, I know I need an new /dev/video# for Flash Player to detect as a webcam. Another Video Loopback Device can help create a dummy video device, you can even use it to stream video. The version I used is 0.1.4. AVLD is easy to compile, make and make install, that is all.

Now you can load the kernel module:

sudo modprobe avld width=320 height=240 fps=5 palette=0
sudo chmod 666 /dev/video0

First three parameters to avld module should be clear with explanation, the last one means color palette is RGB24.

The second command allows everyone to read, and to write, to the dummy video device. That may not be a good idea to do that, but I havent had a better way.

Next is to grab your screen and write to dummy video device:

ffmpeg -f x11grab -vc rawvideo -s 1280x960 -r $FPS -an -i :0.0 -f rawvideo -pix_fmt rgb24 - | mencoder - -demuxer rawvideo -rawvideo fps=$FPS:w=1280:h=960:format=rgb24 -nosound -ovc raw -vf scale=320:240,format=bgr24 -of rawvideo -ofps $FPS -o /dev/video0

I use FFmpeg to capture and mencoder to scale image and write to video device. Here is some facts about this command, codec is rawvideo, input format is rgb24, output format is bgr24 (not match with the avld module parameter?), output size is 320240.

You can use MPlayer to check up if it works:

mplayer tv:// -tv "driver=v4l:device=/dev/video0:noaudio:outfmt=bgr24" -vo x11 -fps $FPS

1   Problem

The performance of Flash Player is simply awful, Firefox eats up entire core. Even though I have downed to 4 FPS in setting, the result screen still looks like 1/4 FPS.


I have made a bad patch to solve the FPS issue. Later, I found a better solution, Webcamstudio. (2009-02-02)

I was trying to install Flash Media Live Encoder 3 with WINE, it installed and ran, but it can not grab any screen from the dummy device. I also tried a real webcam, cant do, either.

I also wrote a simple script to help me broadcast, you can check it out, it also use some filters that add blur or desaturation effects.

If you are interested, I am broadcasting at Wearing Fedora.