! .swf Screencasts on Linux - using x11vnc and vnc2swf
!! required software
# [http://www.karlrunge.com/x11vnc/|x11vnc]
# [http://www.unixuser.org/~euske/vnc2swf|vnc2swf]
# make sure you have xwininfo available

!! Determine window id
we now resize the browser window to a reasonable size, something like 600x600px or whatever suits you. the smaller the better since the screencast filesize will be greatly influenced by this.

open up a terminal such as xterm and type:
{code source=Bash title="Find the window id of the browser"}
$ xwininfo

# to minimize the output, you can use:
$ xwininfo | grep "id:"

your mouse pointer should now be a crosshair. use this to target the browser window and in the terminal it should say something like this:
{code source=Bash title="xwininfo output"}
$ xwininfo

xwininfo: Please select the window about which you
would like information by clicking the
mouse in that window.

xwininfo: Window id: 0xc00008 "Edit: - bitweaver - Opera"
<snip />

the only information we want from this is the the __Window id: 0xc00008__

!! Start up x11vnc
First you should set a password that other people with net access can't simply take over your computer.
{code source=Bash title="Set VNC password"}
x11vnc -storepasswd

To start x11vnc run this in your xterm window, where you insert the window id you just determined. This will start VNC for only the window you specified and therefore only this window will be recorded. Add the trailing & that you can continue working in the one terminal window (you might have to hit enter to regain control of the terminal)
{code source=Bash title="Starting x11vnc"}
x11vnc -usepw -localhost -viewonly -id 0xc00008 &

!! Start recording with vnc2swf
Now that your browser is controlled by x11vnc, you can start vnc2swf. Run the following to create an swf files named by date and time:
{code source=Bash title="Commence recording with vnc2swf"}
vnc2swf -nowindow ~/screencast-$(date +%Y-%m-%d-%H.%M).swf :0
After you have entered your password, your recording will start. Do what you came here to do and once you're done with the recording, hit <ctrl+c> in the terminal where you started vnc2swf. This should stop the recording and also the x11vnc server. You can confirm that x11vnc has stopped by typing:
ps aux | grep x11vnc
If a process other than the just executed grep shows up, kill it by doing the following:
{code source=Bash title="Killing x11vnc"}
ps aux | grep x11vnc
xing 26390 0.0 0.3 10012 3320 pts/8 S 20:01 0:00 x11vnc -localhost -viewonly -usepw -id 0xa0000d
killall x11vnc

that's it. in your home folder, you should have a file called something like:

!! Final tips
If you are planning on doing this regularly, you can add something like this to your ~/.bashrc
{code source=Bash title="Updating ~/.bashrc"}
alias xvnc="x11vnc -usepw -localhost -viewonly"
alias xswf='vnc2swf -nowindow ~/screencast-$(date +%Y-%m-%d-%H.%M).swf :0'
now all you need to type in your terminal is
$ xvnc -id 0xc00008 &
$ xswf
and you're set

if you have [http://www.swftools.org/|swftools] installed, you can get details from your swf file or even manipulate it.
$ swfbbox ~/screencast-2007-01-07-20.04.swf
Original Movie Size: 540.00 x 564.00 :0.00 :0.00
Page History
07 Jan 2007 (21:16 UTC)
Current • Source
View • Compare • Difference • Source
View • Compare • Difference • Source