Video capture is a highly experimental feature that will certainly change prior to release, if indeed it
is kept at all. Currently it is only implemented on the Windows platform. Video Capture ('vidcap') allows
a video source (e.g. webcam) to be fed into a rendering just as if it were a still image. Currently, this
is done by overloading the 'sys' filetype in image maps; if vidcap is kept for final release this will
definitely change.
Here is a simplistic example of an image map that will obtain an image from a video capture device:
pigment { image_map {sys ":vidcap:" map_type 0} }
and a more complex one:
pigment { image_map {sys ":vidcap:width=640:height=480:double-buffer=0:skip-initial=0:gamma=1.0" map_type 0} }
The requirements are that the image type is 'sys'
and that the image filename starts with the
text ':vidcap:'
. The text following the :vidcap:
(if any) is considered to be additional
options which are then provided to the platform-specific video capture support code.
At this point of time the following options are supported:
width=nnn
height=nnn
double-buffer=yes|true|1|no|false|0
skip-initial=nnn
gamma=fff
If omitted, defaults are:
width and height - the default for the video capture device.
double-buffer - turned on
skip-initial - 0 frames (i.e. turned off)
gamma - 1.0
It is possible to specify just the width or height, in which case the code will default to using the first
supported resolution with that size in that dimension (i.e. it won't care what the other dimension is.
Specifying '-1' as a width or height is also a way of saying it is a "don't-care". If the requested size is
not available, the render will fail.
skip-initial
is the number of frames to skip before returning from the video device
initialization. This is needed on some webcams that need a number of frames to perform their setup (such
as auto exposure and auto white-balance). This matters mostly if the vidcap input is being used for something
other than real-time rendering.
double-buffer
is a means of telling the video capture system to store the incoming video
data in a separate buffer, which is then copied to the main buffer at the end of each rendered frame. Typically
this is what you would want. However it has a time penalty on SMP systems due to the use of a mutex and thus
is by default turned off. This means that it is possible to see 'tearing' and similar artifacts in RTR.
gamma
allows an input device to have a specific gamma correction applied to the delivered
pixels prior to their being applied to the image map. Generally this is best left at 1.0.
The video source is chosen via a new menu, as shown in the image below.