Homepage: http://www.unixuser.org/~euske/vnc2swf/
Discussion: http://lists.sourceforge.net/lists/listinfo/vnc2swf-users
$Id: pyvnc2swf.html,v 1.1 2007/03/31 04:02:15 euske Exp $
Pyvnc2swf is a cross-platform screen recording tool. It captures screen motion through VNC protocol and generates a Shockwave Flash (SWF) movie. Pyvnc2swf suite comes with three Python programs:
vnc2swf.py
- Recorder
edit.py
- Movie editor
(This is NOT a general SWF file editor. It only supports movies generated by vnc2swf.)
play.py
- Simple movie viewer
For questions, please read the FAQ and list archives before sending me emails.
Terms and Conditions: Pyvnc2swf comes with ABSOLUTELY NO WARRANTY. This software is distributed under the GNU General Public License.
In all platforms, the following packages are required:
In most Linux distros, these packages are readily available. In Mac OS X, you would need an additional OS X build of Pygame package.
Also, you need at least one VNC server:
vnc2swf.py
program
captures a VNC sessions and records it in either SWF or VNCLog format.
This is a VNC client and communicates directly with a VNC server.
A user need to start a VNC server in advance.
vnc2swf.py
runs in two different modes:
GUI (Graphical User Interface) mode and CLI (Command Line Interface) mode.
In the GUI mode, start recording by clicking the "Start" button.
Then choose the "Save as..." command from the "File" menu to save
the recorded movie to a file.
In the CLI mode, a user needs to specify the output filename from command line.
Recording is started immediately. In both modes, a user is
prompted for a VNC password if the server requires authentication
(and unless the user doesn't specify the password file).
In the CLI mode, hit Control-C to stop recording.
After finishing recording, it generates two files with the specified name:
a .swf
and .html
file.
The .html
file contains an HTML tag and a javascript code
to provide seek bar function.
A user can choose three different methods to encode movie image:
"shape
", "video
" and "vnc
".
The first shape
encoding (default) provides a reasonable movie size.
The second encoding method, video
provides a smaller SWF movie.
This is, however, not recommended to use within vnc2swf.py
for
two reasons: This type of encoding is only supported by Flash Player
version 7 or newer. Also, generating a movie with on-the-fly
video
encoding is slower so you might experience frame dropping.
Actually, you can convert a shape
-encoded movie into video
-encoded
one after recording by using edit.py
, so anyway you don't need to
use this method when recording. The third encoding method is vnc
.
This method generates a .vnc
(VNCLog) file, which is compatible with
vncrec output file.
You can convert it to a SWF movie with edit.py
.
A .vnc
file is not a SWF movie by itself, but its encoding is the fastest.
NOTE:
Unlike the C version, vnc2swf.py
doesn't handle any
user interaction. If you want to control the server's desktop,
you need to launch vncviewer or its equivalent separately.
$ vnc2swf.py [-o filename] [options] [host[:display] [port]]
$ vnc2swf.py -n -o filename [options] [host[:display] [port]]
(Set up a virtual screen) $ vncserver -geometry 640x480 ... $ vnc2swf.py -o out.swf localhost:1 (Record an existing screen with audio recording) $ x11vnc -localhost -viewonly -wait 10 -defer 10 & ... $ vnc2swf.py -o out.swf -S "arecord -r 22050 voice.wav" localhost:0
If you're using x11vnc, see also recordwin. This is a convenient script to record a particular window.
.swf
movie with edit.py
program.
This will give a little improvement in movie quality.
You can also use vncrec for recording.
However be careful that a generated file will be now about 10 times larger.
edit.py
.
shape
-encoded movie, the Flash player holds
all expanded images in a memory. So it can be inflated to a very big process!
-n
-o outputfile
.swf
" or ".vnc
".
Otherwise, the user need to specify the output movie encoding with -t
option
(see below.)
-C clipping
widthxheight+left+top
"
(e.g. "400x300+120+0
").
Unlike other X11 applications, all rectangular components are required. Negative values are not supported.
-r framerate
-t encodingtype
shape
", "video
" or "vnc
").
When omitted, the encoding type is automatically inferred from the filename
(*.swf
= shape, *.vnc
= vnc).
-N
-P passwdfile
vncpasswd
. A user can directly specify
~/.vnc/passwd
, which normally contains the password
for the local vnc server.
-e vncencodings
-S subprocess
(Supported on Un*x only, Python 2.4 or above is required)
-d
edit.py
program is for editing or reorganizing one or multiple movies
generated by vnc2swf.py
. This program also supports converting
a .vnc file into .swf movie, changing the encoding method (shape->video),
attaching MP3 audio file to a movie, extracting
images from a movie and resampling/scaling/clipping a movie image.
edit.py
currently supports only command line interface.
The user must give one output filename and one or more input filename(s).
Input movies are concatenated sequentially (in the specified order)
and the desired effects are applied.
$ edit.py -o outfile.swf [options] infile ...
(Convert .vnc file into .swf with compressed video encoding) $ edit.py -o out.swf -c -t video input.vnc (Attach an mp3 file to .swf) $ edit.py -o out.swf -a voice.mp3 in.swf (Concatenate two movies and extract the frames into another movie) $ edit.py -o out.swf -f 100-200,350- movie1.swf movie2.swf (Clip the top left area of the movie and shrink it to half the size) $ edit.py -o small.swf -C 320x240+0+0 -s 0.5 in.swf (Convert .swf into MPEG) $ edit.py -o out.mpg input.swf (Convert .swf into .flv) $ edit.py -o out.flv input.swf
-o outputfile
-c
shape
and video
) types of movies, but
usually it's most effective when applied to video
-encoded movies.
-t encodingtype
Type | Extension | Description |
---|---|---|
shape | .swf | SWF movie (default) |
video | SWF movie with stream video encoding | |
flv | .flv | FLV movie |
mpeg | .mpg | MPEG movie (requires PyMedia) |
bmp | .bmp | BMP image sequence |
png | .png | PNG image sequence |
Note that video
encoding is supported only with Flash Player version 7 or newer.
-V
video
method.
This is equivalent to -t video
.
-f frames
or
-F frames
-
(hyphen) sign.
For example: 10,200,300-400
specifies the frames whose number is 10 and 200,
plus every frame between frame 300 and 400. The beginning (or ending) frame number can be omitted
(e.g. -100
or 300-
). In this case, the first (or last) frame number is used
as the other end of the range.
-F
option and -f
option is same except that -F
doesn't
chop the audio while -f
does. When you're putting audio on the movie, if
you use -f
and -a
option at the same time, it chops an mp3 file
according to the selected frames. However, when you want to cast a continuous sound (such as music)
onto a whole movie, this might not be the desired effect. In such a case, use -F
instead of -f
.
-a mp3file
-s scaling
-C clipping
widthxheight+left+top
"
(e.g. "400x300+120+0
").
-K keyinterval
-K 500
) is recommended.
-r framerate
edit.py
tries
to keep the original frame rate in the output movie.
-R resampleframes
-S skipmp3frames
s
' is appended to the number (such as '1.0s
'),
it indicates the number of seconds instead of frames.
This option is useful when there is a time lag between a
recorded image and audio.
-B blocksize
video
encoding method (default=32).
This must be a multiple of 16.
-b
-l
-d
play.py
is a simple player for a .swf
or .vnc
file.
This program might be useful for spotting the right frame number in a recorded movie.
However its speed is awkward and audio output is not supported.
It only supports vnc2swf-generated files and cannot play general SWF movies.
The player accepts the following keys:
q
" / Escape: Quit.
s
": Take a snapshot. The image is saved as "inputfile-frameno.bmp
".
$ play.py [options] moviefile ...
-r framerate
-s scaling
-C clipping
widthxheight+left+top
"
(e.g. "400x300+120+0
").
-d
vnc2swf.py
and the VNC server or
the screen size is too big. In the former case, make sure to use RealVNC
version 4 or newer and allow local connections. This can be done by the following:
Open the VNC server property window, click "Connections" tab, and check the
"Only allow connections from the local machines" box.
In the latter case, you can either choose the smaller desktop size
or try to narrow the recording area by specifying a clipping rectangle
with -C
option.
This problem doesn't exist in pyvnc2swf 0.7.2 or newer.
vnc2swf.py
or edit.py
.
edit.py
.
-K
option in edit.py
.
Normally putting keyframes in every 500 frames (-K 500
) gives a reasonable result.
For those who are interested in learning or extending the program, I drew a simple figure to explain how data goes between objects within pyvnc2swf.
<yusuke at cs dot nyu dot edu>