# 3.7.5.98 Vw

LabTalk Object Type:

External Object

The vw object does the following:

• Creates a video and set its file name, file path and video dimensions.
• Sets the compression method of the generated video and checks to see that the method is supported on the local computer.
• Adds a specified graph as one or more frames, to write the video.

## Methods:

Method Description
vw.Create(fileName, codec, framepersec, width, height)

Start creating a video with the specified file name (include complete file path), codec, frames per second (range from 0.001 to 120) and dimensions.
Return value:

• 0:successful.
• Other values:failure and the value is the standard error code
vw.FourCC( )

Return the unique codec value from the four character code. The characters are case sensitive. For example: vw.FourCC('F', 'M', 'P', '4'). This value is used as the codec in vw.Create. See the FourCC Table for details.

vw.IsCodecInstalled(int codec)

Check whether the codec is supported on your computer.
Return value:

• 0:The compression method is not supported on the computer.
• 1:The compression method is supported on the computer.
vw.WriteGraph(WindowName, numFrames)

Write a specified window to the video being created and, optionally, specify the number of frames. While generally intended for graph windows, the function works with workbooks, matrixbooks, graphs, function plots and layout windows. If the number of frames is not specified, then one frame is written. If WindowName is not specified, then the active window is written.
Return value:

• 0:successful.
• Other values:failure and the value is the standard error code
vw.Release( )

Release the video writer and generate the video using previously chosen settings and the written frames.
Return value:

• 0:successful.
• 1:failure

## Examples:

This script specifies a codec and checks to see that it is supported on the local computer. If not, the codec value is changed to 0, indicating no compression.

int codec = vw.FourCC('F','M','P','4'); //The compression method of MPEG4
if(vw.IsCodecInstalled(codec) == 0) //Check whether this compression method is supported
codec = 0; //If it's not supported.
//Showing whether a compression method is chosen
if(codec)
{
type "The compression method is MPEG4";
}
else
{
type "MPEG4 not supported, no compression is chosen";
}

The following script shows how to create a video with existing graphs.

//Create a video example.avi under d:\ disk use default settings.
int err = vw.Create(d:\example.avi);
//Write existing graphs into the video if the video can be created.
if(0 == err)
{
//Write specified graphs to video as one or more frames.
vw.Release();