Kino Enhancements

[ Home ] [ Kino Plus ] [ SMIL Utils ]

SMIL Utils

SMIL is the file format kino uses to save projects. Here are a collection of command line tools for SMIL manipulation.


smilutils-0.1.0.tar.gz - First release
smilutils-0.1.1.tar.gz - Sigh.. g++ 3.2 fixes...
smilutils-0.1.2.tar.gz - More tools, some silly ;-)


The same requirements as kino but not necessarily kino itself.

Version 0.1.2 introduces optional libquicktime support. If this is anyway interesting to you, please install this before configuring/compiling smilutils.

It has come to my attention that some of the tools mentioned here may not be installed on your system and if they are, they probably don't behave as I describe them here. The tools in question are libdv playdv and dvconnect.

If you wish to use these tools as describe here, please contact your local libdv representantive :-D. Sorry about this - I've forwarded patches recently and in the past for these modifications...


Man pages now available.

The current release provides the following tools:



Usage: smil2raw [ options ] file [ file ... ]
Where: file is smil, dv avi or raw dv
       -o offset : frame offset (default: 0)
       -f count  : frame count (default: all)

This tool converts input to raw dv on stdout - useful for leveraging the growing
support for raw dv from previously captured avi stuff, and acts as a nice input
mechanism to tools which do allow raw dv on stdin (such as dvconnect, mplayer 
and playdv).


To export a kino project back to your cam:

smil2raw project.smil | dvconnect -s -

Or to export a bunch of captured dv files back to your cam:

smil2raw file1.avi file2.avi file3.dv | dvconnect -s -

Or to play them via playdv:

smil2raw file1.avi file2.avi file3.dv | playdv -

NB: the playdv included in the libdv-0.98 release is broken for stdin - it 
should be fixed in libdv CVS soon.


Usage: smil2yuv [ -i type ] [ -a audio-file ] file [ file ... ]
Where: file is smil, dv avi (1 or 2) or raw dv
       -i type   : 0 no deinterlacing, 1 bad deinterlacing (more to follow)
       -a file   : mp2 or wav file to write to (more to be supported)
       -o offset : frame offset (default: 0)
	   -f count  : frame count (default: all)

This tool converts input to the raw yuv format, as produced by the lav tools. 
It can also produce wav or mp2 files in the same parse of the input.


To convert a mixture of raw dv, smil and avis of 48khz audio to divx:

smil2yuv raw.dv project.smil type1.avi type2.avi -a temp.wav -i 1 | 
yuv2divx -o output.avi -A temp.wav -a 128
rm temp.wav

[anyone know how to use a mkfifo here to avoid the creation of the unecessary 
wav - presumably the fifo is being opened in the wrong order I guess? anyone 
know why a wav of 48khz goes out of sync unless I specify the -a 128 switch or 
32khz without the -a 96?]

Or to play the stream via yuvplay:

smil2yuv input | yuvplay

Or to encode to VCD:

smil2yuv file.dv -i 1 -a test.mp2 | 
yuvscaler -O VCD | 
mpeg2enc -o test.mpv -f 1
mplex -f 1 test.mpv test.mp2 -o test.mpg
rm test.mpv test.mp2


* Mixtures of audio sampling in a project are handled by badly resampling 
(anyone care to provide a better resampler? ta).
* Mixtures of PAL/NTSC aren't supported
* Deinterlacing produces pretty noisy/large files - planning to provide better 
deinterlacing techniques through use of the tvtime deinterlacing plug-ins.


Usage: smil2wav [ -a audio-file ] file [ file ... ]
Where: file is smil, dv avi (1 or 2) or raw dv
       -o offset : frame offset (default: 0)
       -f count  : frame count (default: all)
       -a file   : wav or mp2 to write to (more formats soon)
                   (default is a non-fixated wav on stdout)

In case you really, really want the audio only... Misnamed though, should be 
smil2audio or something. Might change this further down the line.


Export to mp2:

smil2wav -a test.mp2 file.dv

Export to wav:

smil2wav -a test.wav file.dv


xwd2raw [ -n ] [ -w window ] [ -i id ]
where: -n        : for NTSC (default is PAL)
       -w window : for window to capture (default is whole screen)
       -i id     : for id to capture (default is whole screen)
       -s        : interactively select the window
NB: Use xwininfo to obtain the wm_name or id - only one is needed
    or use the interactive selector (when no -i or -w is specified)

This is just weird :-). Allows you to capture the content of an X-Window
directly to raw DV... absolutely nothing to do with SMIL, but figured
'what the hell?'.


Interactively select a window, and send to your cam:

xwd2raw -s | dvconnect -s --

Interactively select a window, and play the stream:

xwd2raw -s | playdv --

(same caveat on playdv as above).


Usage: raw2webcam [ options ]
Where: options are
       -s server    - ftp server to connect to
       -u user      - ftp user to connect with
       -p password  - ftp password to connect with
       -r realfile  - file to create on server (default: kino.jpeg)
       -t tempfile  - temp file to use on server (default: kino.tmp)
       -l localtemp - temp file to use on local system (default: /tmp/kino.jpeg)
       -f fps       - frames per second (default: 1)
       -w width     - width of image (default: 160)
       -h height    - height of image (default: 144)
       -q quality   - quality of jpeg image (default: 80)
       -d           - turn deinterlacing off

Now this is getting just a bit off topic :-). Turn any raw dv stream into a
feed for a web cam.


Feed from your cam:

dvconnect -- | raw2webcam -s ftp.server -u user -p password

Feed from a smil project:

smil2raw project.smil | raw2webcam -s ftp.server -u user -p password

Feed from a selected X Window (.. umm...):

xwd2raw -s | raw2webcam -s ftp.server -u user -p pasword

Need some html to handle it? Javascript solution supplied.


Usage: raw2yuv [ options ]
Where: options are
       -a aufiofile - audio file to write (wav or mp2)
       -i type      - deinterlacing type (0 = none, 1 = simple)

This slightly overlaps with the smil2yuv tool. The distinction is that raw DV
is expected on stdin, so it comes a useful tool for transcoding raw DV producing tools,
but without the necessity to capture to a file first.

NB: This really is not intended as an option for use with live raw producers (such as 
dvconnect or xwd2raw) unless:

1. You have a very fast machine (and I mean very fast... a my p4 2gighz can't do much 
with this without dropping a lot of frames in the yuv output);
2. You don't care about dropping frames :-).

What will work are non-real time raw sources... watch this space... there will be a few
coming in future revisions of these tools.


Usage: image2raw [ [ options ] [ file ... ] ]
Where: file is any image file (jpeg/png/gif et al)
       -n          - NTSC usage (MUST come first)
       -a          - Maintain aspect ration (default)
       -s          - Scale to full size
       -r number   - repeat frames n times (default: 1)

A non realtime raw DV producer. Takes image files on the command line and pushes them out
as raw DV. Not much more than a repackaging of the kinoplus multiple image import, but it
is a bit more flexible...