Wednesday, May 7, 2008

How to record your Mac OS 10.5 Leopard screen to SWF

Sometimes when you want to demo an application or even create a step by step tutorial on something, there is nothing better then a live recording of the action. In those cases vnc2swf is a small and very handy python script able to help you on that job.

I am not very sure on what it depends, but you would need X11, Freetype 2, jpeg and Python Imaging Library (PIL) at least. Python of course, but Leopard already comes with version 2.5. I am not sure about GTK, I already had that on my system. If you don't, please take a look at Compiling GTK+ on Mac OS X 10.5 Leopard and get it to your system. That same post would help you setup all the dependencies but PIL, that we are going to cover now.

Download PIL source code to /usr/src. I assume all your own compiled libraries are installed to /usr/local and you used architecture i686.

cd /usr/src
tar -zxf Imaging-1.1.6.tar.gz
cd Imaging-1.1.6

Now you need to hack accoding to that diff:

--- 2006-12-03 09:37:29.000000000 -0200
+++ 2008-05-06 21:13:29.000000000 -0300
@@ -131,14 +131,10 @@

elif sys.platform == "darwin":
# attempt to make sure we pick freetype2 over other versions
- add_directory(include_dirs, "/sw/include/freetype2")
- add_directory(include_dirs, "/sw/lib/freetype2/include")
+ add_directory(include_dirs, "/usr/local/include/freetype2")
# fink installation directories
- add_directory(library_dirs, "/sw/lib")
- add_directory(include_dirs, "/sw/include")
- # darwin ports installation directories
- add_directory(library_dirs, "/opt/local/lib")
- add_directory(include_dirs, "/opt/local/include")
+ add_directory(library_dirs, "/usr/local/lib")
+ add_directory(include_dirs, "/usr/local/include")

add_directory(library_dirs, "/usr/local/lib")
# FIXME: check /opt/stuff directories here?

Then you are done to build:

export ARCHFLAGS="-arch i686"
export CFLAGS="-arch i686"
python build
sudo python install

Now you would just unzip and go vnc2swf but I couldn't make it work with Leopard's built-in VNC server (Screen Sharing) so you first need OSXVnc. Download the disc image, mount it and copy Vine Server to your Applications folder. Run and start the server.

You are now ready to go vnc2swf:

cd /usr/src
tar -zxf pyvnc2swf-0.9.3.tar.gz
cd pyvnc2swf-0.9.3/pyvnc2swf/
./ -n -o /tmp/myMovie.swf


Brandon said...

This seems crazy complicated for what it is. There are numerous programs that do this for you without messing around.

SnapZ Pro

Or if you want free, Jing

Brandon said...

Also, I forgot to mention, recording something from a VNC server would not provide for fluid video either.