Wikia

Tovid Wiki

Libtovid

102pages on
this wiki
Talk0

libtovid overview Edit

You've probably heard about some Python development going on. Well, the libtovid module is where it's all happening.

The goal of libtovid is to provide a complete DVD-authoring backend in pure Python. This backend will do all the dirty-work of encoding video, making menus, writing XML disc structure files, authoring and burning your videos, not to mention one day providing a unified GUI for all of it (yeah, that's a lot of stuff to do!)

As of January 14, 2007, things are starting to shape up, though ongoing refactoring has made the current SVN code rather unstable (but please try it anyway!)

You're encouraged to read and comment on the source code, even if you don't know how to program. We developers are nice people, and will not bite newbie users who are interested in the code.

Comments? Leave a message on the talk page.

Structure Edit

libtovid is, essentially, a big Python module with a bunch of smaller sub-modules, breaking down the big tasks into smaller parts. There are several submodules in various .py files:

author
Produces dvdauthor or vcdxbuild XML files from user-defined disc layouts
cli
Providing an interface for building command-lines and pipes, running them, and displaying or capturing output
deps
For checking run-time dependencies
media
For storing info about multimedia video files and their attributes, and functions to get standard (S)VCD/DVD attributes, or read attributes from a file
opts
A Python interface to defining and parsing command-line options (a getopts alternative)
output
Simple functions for doing colored console output
spumux
For adding text or image subtitles to .mpg files
standard
Defines the major video disc standards (VCD, SVCD, and DVD flavors) via Python functions (still needs some work)
stats
Can read and gather data from a ~/.tovid/stats.tovid file; used by tovid-stats
xml
For simple XML generation

Some submodules are too big or complex for a single .py file; these are broken down further and stored in subdirectories of libtovid:

transcode Edit

A video & audio encoding backend, suitable for converting files to (S)VCD or DVD target formats. Currently has three submodules:

encode
Containing encoding backends, using ffmpeg, mencoder, and/or the mplayer/yuv/mpeg2enc chain to encode video or audio
rip
Containing functions to rip a video stream or a sequence of frame images

render Edit

A graphic & video rendering interface, suitable for creating menus & slideshows. This one is pretty large, with the following submodules:

drawing
Having a full Cairo-based image, shape, and text drawing capability
animation
Implementing some basic concepts needed for animated graphics
layer
Defining a bunch of different graphic elements for things like background images, thumbnail grids, and text labels; builds upon drawing to render the graphics
effect
Defining potentially-useful graphic effects like fade, zoom, rotate and translate, also rendered using the drawing interface
flipbook
Builds upon layer, effect, and animation to render full-motion video

gui Edit

Containing all the code for the tovid GUI, which has been ignored so long you can see the dust settling on it. Wapcaplet is hoping to develop a new GUI, but that's a distant dream at this time. GUI developers seem to come and go; it's sad to say, but the tovid GUI sucks, and it needs a better one. Stop by the IRC channel if you are at all interested in helping.

Using it Edit

The best way to become familiar with the libtovid modules is to experiment with them, interactively, using your Python interpreter. Fire up Python:

$ python
Python 2.4.3 (#1, Sep 30 2006, 20:38:19)
[GCC 3.4.6 (Gentoo 3.4.6-r1, ssp-3.4.5-1.0, pie-8.7.9)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

At the >>> prompt, try this:

>>> import libtovid
>>> help(libtovid)

This shows a summary of what libtovid does, the source code filename, and a list of sub-modules contained in libtovid. Let's say you're interested in the opts module:

>>> help(libtovid.opts)

For modules containing classes and functions, help displays documentation on them. To view the documentation for just a single class, you can do like this:

>>> help(libtovid.opts.Option)

help can be used on just about anything; it's like a built-in man utility for Python objects. See Python tips for further reference on using the interpreter.

More to be written

Around Wikia's network

Random Wiki