setvideo command

The setvideo command sets values associated with video playback and capture. Digital-video and VCR devices recognize this command.

To send this command, call the mciSendString function with the lpszCommand parameter set as follows.

  TEXT("setvideo %s %s %s"), 



Identifier of an MCI device. This identifier or alias is assigned when the device is opened.


Flag for video playback and capture. The following table lists device types that recognize the setvideo command and the flags used by each type.

digitalvideoalgorithm algorithmbitsperpel to countbrightness to factorclocktimecolor to factorcontrast to factorgamma to valuehalftoneinputkey color to r:g:bkey index to indexoffonoutputover durationpalette color color over indexto newrgb palette handle to handlequality descriptorrecord frame rate to raterecord onrecord offsharpness to factorsource to source number valuestill algorithm algorithmstill quality descriptorstream to numbertint to factor
vcroffonmonitor to type number numberrecord offrecord track track_number offrecord onrecord track track_number onsource to type number number track track_number offtrack track_number on


The following table lists the flags that can be specified in the lpszVideo parameter and their meanings.

algorithm algorithmSpecifies a video compression algorithm for use by a subsequent reserve or record command. Algorithms supported by a device are device specific. MCI defines the constants "mpeg" and "h261" for algorithm.

If the specified algorithm conflicts with the current file format, the file format is changed to the default format for the algorithm.

bitsperpel to countSets the number of bits per pixel for saving data with the capture or record command.
brightness to factorSets the video brightness level.
clocktimeIndicates that the time specified in the "over" flag is in milliseconds. The time is absolute and not in step with the playing of the workspace.
color to factorSets the color-saturation level.
contrast to factorSets the video-contrast level.
gamma to valueSpecifies the gamma correction exponent multiplied by 1000. For example, to specify an exponent of 2.2, use 2200 for value. A gamma value of 1.0 (1000) indicates no gamma correction is applied. Gamma correction adjusts the mapping between the intensity encoded in the presentation source and the displayed brightness.
halftoneCauses the halftone palette to be used instead of the default palette. This flag is recognized only by the MCIAVI digital-video driver.
inputModifies the "brightness", "color", "contrast", "gamma", "sharpness", or "tint" flag so that it affects the input signal and modifies what is recorded. If possible, this is the default when monitoring the input.
key color to r:g:bSets the key color. The r:g:b variable is an RGB value. Colons (:) separate the individual red, green, and blue values.
key index to indexSets the key index. The index variable is a physical palette index.
monitor to type number numberControls which source input will be passed to the VCR output, without changing the recording source input selection. Type can be "output", or one of the valid input sources. If "number" is not specified, then the first input of that type is chosen.
offonEnables or disables display of video. Disabling video sets the pixels in the put "destination" rectangle (or its default, the client region of the current window) to a solid color. It has no effect on the frame buffer.

The video source, whether the workspace or an external input, might continue to store new images in the frame buffer. They are not displayed until video is enabled. You can use the window "state" command to hide the window. The default is setvideo "on".

outputModifies the "brightness", "color", "contrast", "gamma", "sharpness", or "tint" flag so that it modifies only the displayed signal and not what is recorded. If possible, this is the default when monitoring a file.
over durationSpecifies how long it should take to make a change that uses a factor variable. The units for duration are in the current time format. Changes occur in step with the playing of the workspace. When playing is suspended, the change is also suspended until the play continues. If "over" is not used or not supported, the change occurs immediately.
palette color color over index to newrgbSets a new palette color. The color and palette index to be changed are specified by the color and index parameters; the new color is specified by newrgb. This flag is recognized only by the MCIAVI digital-video driver.
palette handle to handleSpecifies the handle to a palette the device must use for rendering. This item is supported only by devices that use palettes. If handle is zero, the default palette is used.

Digital-video devices should not free the palette passed with this command. Applications should free it after they close the device.

quality descriptorSpecifies the characteristics of the video compression performed when video is recorded to a file. All devices support the three descriptors: "low", "medium", and "high". The default is device specific. The significance of these names depends on the algorithm and the device. Devices might define additional descriptor names. The quality command can be used to define additional descriptor names.

If the "algorithm" flag is not used, the descriptor applies to the current algorithm.

record frame rate to rateSets the recording for motion video. The recording rate is specified in units of frames per second multiplied by 1000. For example, the NTSC frame rate of 29.97 frames per second is represented as 29970.
record onrecord offEnables or disables recording of video data. Recording video data is the default.
record track track_number offClears the video-source selection so that no video will be recorded with the next record command. "Track" allows independent track selection. If "track" is not specified, a default value of 1 is assumed. It might be necessary to first issue a set "assemble record off" command before the video recording can be turned off.
record track track_number onSelects the video source to be recorded with the next record command. "Track" allows independent track selection. Track 2 corresponds to the PCM track in Hi8. If "track" is not specified, a default of 1 is assumed.
sharpness to factorSets the video sharpness level.
source to source number valueSets the source of the video input. This usually corresponds to external connectors. The constants defined for source include "rgb", "pal", "ntsc", "svideo", and "secam". If more than one input of the specified type exists, the optional "number" value indicates the desired input. For example, setvideo "source to ntsc number 2" specifies the second NTSC input.

If "to" source is omitted, then the absolute source is used as defined by the list "video source" command.

source to type number numberSelects the video source to be recorded on the tape. Type must be "tuner", "line", "svideo", "aux", "generic", "mute", or "rgb".
still algorithm algorithmSpecifies the still image compression algorithm used by the capture command. Every device must support an algorithm of "none", which means no compression. This is the default. In this case, digital-video devices save still images as RGB device-independent bitmaps. Devices might also support a device-specific list of additional algorithms.
still quality descriptorSpecifies the characteristics of the still-image compression performed while capturing a still image. All devices support the descriptors "low", "medium", and "high". The default is device specific.

If the "algorithm" flag is not used, the descriptor applies to the current algorithm.

The quality command can be used to define other descriptor names.

stream to numberSpecifies the video stream played back from the workspace. If the stream is not specified and a default stream is not defined by the file format, then the physically first interleaved video stream is played.
tint to factorSets the image tint. Typically, this adjustment is modeled after the tint control of many color television sets, with 250 meaning green, 750 meaning red, and 0 (or



Can be "wait", "notify", "test", or a combination of these. For more information about these flags, see The Wait, Notify, and Test Flags.

Return Value

Returns zero if successful or an error otherwise.


For VCR devices, using setvideo with a flag that turns off an individual track ("track track_number off") might cause your application to receive a status message indicating that the command could not be carried out. Some VCRs can turn off only combinations of tracks, not individual tracks; for example, the first audio track and a video track of a video cassette. In this case, simply use setaudio and setvideo to continue to turn off the other tracks that make up the combination. The driver will turn off the tracks when it receives the command to turn off the last track in the combination.


Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

See also

MCI Command Strings