Main Page | Class Hierarchy | Compound List | File List | Compound Members | File Members

RVE - Realtime Video Effects

Introduction

RVE is a helper application for creating realtime effects on video using the bmovl filter in MPlayer. It's mostly intended for being driven by scripts, e.g. to show info or statistics of a live event on a big screen. The current version comes preloaded with a few effects, such as scrolling a text across the screen, fading a text in and out, voting, etc., and it's quite easy to add more effects.

Getting started

After building and installing (see the INSTALL file) you will find scripts for easy operation of rve in the TOOLS/ directory of the source.

Try running "./demo" to see if everything is working correctly (requires a recent version of perl). Either your mplayer must be built with libjpeg support, or you must give the path to a movie file as an argument to this script. When all tests have run you must terminate the demo with CTRL+C.

To actually do something useful, use the mplayer_wrapper and rve_wrapper scripts. They both take a "prefix" as their first argument, this is the prefix for the file names that will be used as temporary files. "test" is a fine value for this. Running the scripts with no arguments will print their usage.

Here is an example:
$ (./mplayer_wrapper test mymovie.avi&)
$ ./rve_wrapper test -- 0 hscroll_text -s 3 "Does this work?"

rve_wrapper will print out the command it's executing so that you can see what the real command line to rve is. You will find information about the available commands in the Command list section.

Usage

The wrapper scripts only give you access to a limited part of rve's functionality. To harness its full power you have to run it directly, or through scripts written by yourself. The wrapper scripts provide a good starting platform if you want to script rve yourself.

First create a fifo (named pipe) for talking to mplayer:
$ mkfifo myfifo.fifo

Run rve, for example like:
$ ./rve 320 240 0 hscroll_text "It works" > myfifo.fifo

Then (probably in another shell) run mplayer with
$ mplayer -vf bmovl=1:0:myfifo.fifo movie.avi

Run rve with no arguments for usage information:

Usage: rve [OPTIONS] SCREENW SCREENH LENGTH COMMAND [CMD-OPTIONS] [ARGS]
Send video effects to stdout. See http://rve.sf.net.

  -c  Text color. Specified like #123456
  -f  Framerate. The maximum framerate rve should output commands with.
  -F  Font. You'll also want to set fontpath in ~/.gozerrc
  -q  Quiet mode. Output nothing to stderr.
  -s  Font size. Measured in percentage of screen height
  -S  Style file. See gozer's docs for syntax
  -v  Increase verbosity. Specify twice for debug output.
  -x  X offset. If rve should only operate in a limited area of the screen
  -y  Y offset. If rve should only operate in a limited area of the screen
Valid commands are:

  bluebox
  clear
  static_text
  fading_text
  hscroll_text
  tile_text
  clock
  showimg
  simple_anim
  streamer
  rollcount
  vote
  drift

See the manual for info about each command.

Command list

bluebox

Renders a transparent blue box. Used for testing if bmovl even works.

clear

Clears the screen

static_text

Renders a text string in the top left corner. Requires one argument: the text string.

fading_text

Renders a text centered on the screen and makes it fade in and out. Requires one argument: the text string.

hscroll_text

Scrolls a text across the screen from right to left one or more times. Requires one argument: the text string.

Parameters:
-r Max repeat count
-s Speed, an integer > 0, defaults to 2

tile_text

Renders a text centered on the screen and makes it appear/disappear with a tile transition. Requires one argument: the text string.

clock

Renders a clock in milliseconds on the screen, for testing timing.

showimg

Blits an image to screen, nothing else. Requires a single argument: the file name.

Parameters:
-a An optional alpha value from 0 to 255

simple_anim

Scrolls a simple looping animation across the screen. Each argument is a bitmap file, and the bitmaps will be moved from right to left on the screen while looping in an animation.
Parameters:
-s The movement speed. Around 2-5 usually looks good.

streamer

This works like hscroll_text, except that the text will be blended on top of an animated streamer. For now the documentation is the source.

rollcount

Animates a rolling counter counting from a time (hours:minuts:seconds) towards zero.
Parameters:
(d)elay The number of frames that the digits to the left will lag behind those to the right. This makes it look more mechanical when multiple digits are changing.
(D)igits Force this number of digits to be shown, even if the number is smaller or larger.
(g)roupspacing Extra space, in pixels, between pairs of digits (e.g. in a time value like 2:03:58).
(i)mage background that will be shown behind the counter always. When using this, it will only look right if Digits, groupspacing, Xmargin, Ymargin and size_of_digits are tuned to suit this image.
(s)ize_of_digits The font size for printing the digits. When it has to match a background image, this is best given as a negative value, which is interpreted as absolute.
(t)ext An optional text label to be shown next to the counter.
x,y Position of counter
X,Y Where to place the counter inside the background image, if one is given. Otherwise these parameters are ignored.

vote

Visualizes a voting between 2 or more choices. The names of those choices are given as arguments to the vote command, and the scores are updated by feeding in numbers on stdin, like "3 2 5\n" for a voting with 3 choices.

drift

Interfaces with Driftnet (http://www.ex-parrot.com/~chris/driftnet/) to capture images coming across the network and display them at random positions on the screen.

To make this work you need to install Driftnet and run the TOOLS/driftd script on the machine that will be capturing from the network. You may want to edit the Driftnet Makefile to disable the GUI code. Also remember to edit the configuration at the top of driftd and to create a temporary dir on the capturing machine (default: ./drift).

Instead of connecting to a host/port, the drift command can also just read from stdin if you give the "-" argument.

Hacking the source code

To add a new command, put it in rve.cc. Look at how the other cmd_* functions are done for examples. Most of the simple commands initialize a Bitmap and an Effect and then run() the Effect.

To create your own effects add a class to effect.h that inherits from Effect and provides the run() and step() member functions. If it takes any parameters it should do so in a param() function.

If part of the effect can be implemented as an Animation, that should be done. This ensures maximum reusability and also helps to seperate parts of your code that are independent. See Effect_move_animation for a simple example and Effect_counter for an advanced one.

Oh, and indentations are done with 4-space tabs, like God intended them to be :-)


Generated on Sun Oct 19 17:34:47 2003 for rve by doxygen 1.3.3