General Description of xscript 
Revision: 1.10

Christian Queinnec
Université Paris 6 --- Pierre et Marie Curie
LIP6, 4 place Jussieu, 75252 Paris Cedex -- France

xscript is a script-based video capturer of windows.

xscript is based on XVidCap 1.0.9 by Rasca Gmelch, Berlin 1997-1999, who published XVidCap under the GNU GPL. xscript is, of course, published under GNU GPL (see the COPYING file).

The very small modifications brought to XVidCap were written by Christian Queinnec and by Choun Tong Lieu .

Remember script ? That utility used to record a terminal session. xscript is similar except that it captures a window receiving everything emitted by a script file. This tool is used to enrich an educational CDROM with animations showing how to use gcc, gdb and other tools. xscript is part of the VideoC project.

1   xscript options

xscript is a strict superset of xvidcap and supports some new options on the command line.

xscript may be run without user intervention (with the previous options) or with full user interactive support (the user selects the window to grab then press the 'start' button). The following options of xvidcap are still useful.

2   xscript script files

The script is a simple text file whose characters are sent one after another to the grabbed window. Just before a character is sent, the window to be grabbed is captured and an image file is produced (you may see its number increment in the control window of xvidcap). There is no sensible way to send a character, waits for its effect and then automatically grabs the window. Therefore the window is grabbed before sending the character rather than some time after. If you know how long to wait, you may use the use the @sleep command (see below).

There are two special characters. No capture is done before processing special characters.

Backslash (\\) means``send the next character whatever it is''. It is therefore possible to send a backslash or an arrobas.

Arrobas (@) prefix a command that ends with the next newline (lines are limited to 1Kbyte though). A command often starts with a word possibly followed by some other arguments. Extra stuff after the last argument is completely ignored. There are a number of commands.

A small example is in order. This script shows simple use of shell commands. Script files often have the .xs extension. This script file appears in the distribution as cdls.xs.


@# $Revision: 1.10 $     to identify the script
@fps 1                            # 1 frame/second
cd /tmp
ls
@sleep 5000                       # ie 5 seconds
cat > /tmp/coucou.tmp
coucou
@\\C-d                             # ie a ^D
@echo sound "commentLS.au"
@subtitle See how many files there are in that directory!
@# When playing this result file, you will hear the sound
@# file and see a running subtitle under the image.
@capture                          # the last image and
@quit 

3   xscript result files

xscript produces a result file that contains some information on the generated files as well as other information produced by @echo directives from the script. All lines are dated (in milliseconds from the start of the script).

For instance, the produced file for the previous script will contain lines such as:


image "cdls0000.xwd" at 4
image "cdls0001.xwd" at 1016
image "cdls0002.xwd" at 2026
image "cdls0003.xwd" at 3036
image "cdls0004.xwd" at 4046
image "cdls0005.xwd" at 5056
image "cdls0006.xwd" at 6066
image "cdls0007.xwd" at 7076
image "cdls0008.xwd" at 8086
image "cdls0009.xwd" at 9096
image "cdls0010.xwd" at 10106
sound "commentLS.au" at 16126
subtitle "See how many files there are in that directory!" at 16126
image "cdls0011.xwd" at 16126 

You may now combine these images into an animated gif but without the sound files. Currently, I record the sound in separate files and I may work on a player to run these result files. I will probably write some day a converter to the SMIL language. Since I did not find a tool to produce a .avi file, I wrote a perl script to produce an html page with animated gifs; the subtitles are turned into text put besides the animated gif and followed by a link to the sound file. This is a poor man's animation but better than nothing.

Here is the resulting animated gif (6516 bytes only):


I will develop this section in some undeterminate future and comment upon the various tools to manage those images. For instance the .xwd format is the fastest (on my machine) for xvidcap to generate. Each glimpse is about 300 Kbytes for a 24x80 window (with a color depth of 16bits). A glimpse converted to gif may give a file of about 30 kbytes but combining some gifs allows to use a differential compression scheme that further shorten an image to a few bytes only.

4   xscript installation

Same as xvidcap: run ./configure then make xscript then make install. You may test the xscript concept with make cdls.gif or look at other tests in the first part of the qnc.mk makefile.

You may alternatively download an i686 .rpm file from the my site.

More to come! That's all, enjoy!


This document was translated from LATEX by HEVEA.