Page tree
Skip to end of metadata
Go to start of metadata



This command / function is broken and / or unreliable in VBS4.

Introduced in

Version:1.24

Description

Description:

Records in-game video. The command changes the current video image into a smaller one and sends it into a system memory buffer. The buffer is locked and read with a delay to speed up asynchronous sending. The command sends the bitmaps into an encoder to produce an AVI video file. The image capture is done using the specified frame rate, which means that some images may not be taken at all, if the actual frame rate is higher than the one specified. When recording sound too, see Audio recording.

For more information on using this command, see Live Stream Broadcast in the VBS3 Administrator Manual.

Syntax

Syntax:captureStart [filename, width, height, framerate, codecs, sound, ui, buffersize, thread, cliprectangle]
Parameters:
  • filename: String - Path to save video in (backslashes need to be specified in the following way: for example, "O:\\fp\\vbs-video.avi"). If the path does not contain a backslash, it is regarded as a relative path with respect to $HOME\Documents\VBS2\videos. Files are recorded in the AVI video-file format. If no file extension is used, an .avi file is appended to the path automatically. If "live" (V3.8.1+) is used instead of a path, live streaming is started, and when "live" is used and the resolution specified by width and height is higher than the limit of 480K (for example, 800x600), then the resolution is down-scaled to that limit. You can stream to a port, using "live:<portNumber>" (for example, "live:9534") (the default port is 11234).
    Note: If the specified file already exists, the existing file is overwritten by the new one, without any warning. Also, in V19.1.0+, if the file size exceeds 3.5GB, the file is split into several files.
  • width: Number - Capture video width (optional, default: 640, has to be a multiple of 4).
  • height: Number - Captured video height (optional, default: 480, has to be a multiple of 4).
  • framerate: Number - Frames / seconds. The recommended value is between 20-25 (optional, default: 20).
  • codecs: Array - List of codecs (set by their standard four letter names: ["MPG4", "DIVX", "XVID", "MPG2", "MPG1", "MJPG", "MSVC"]) that are tried one by one (even if the codecs parameter is omitted). If none works, raw data ("RAW") is written (optional).
    Note: The MSVC codec is generally available in Windows. However, it produces low-quality video.
  • sound: Number - Record sound on / off (optional, default: 1).
  • ui: Number - Record video with UI shown / hidden (optional, default: 1).
  • buffersize: Number - Buffer size in MB. Can be up-to 100MB. It is not necessary to use such a large amount unless raw data is saved (when no codec is used). In those cases, the buffer helps for the periods of disk writes. For example, the raw data case works well with framerate set to 10 and buffersize set to 100 (optional, default: 10).
  • thread: Number - Obsolete in V1.30+. A worker thread can be used for the video encoding task. Disable it by setting the argument to 0 (optional, default: 1).
  • cliprectangle: Array - Rectangular area of screen that is streamed instead of the whole screen. The whole screen is streamed, if cliprectangle is not specified. The rectangular area is specified by an array containing exactly 4 non-negative numbers: origin_X, origin_Y, width, and height of the rectangle (in screen coordinates). If the given rectangle is partly outside the screen, it is clipped to fit the screen. If the given rectangle is completely outside the screen or if the rectangle area is zero, clipping is stopped and streaming of the whole screen begins (optional, default: none) (V17.4.0+).
Return Value:Boolean - Returns false, when already recording.

Examples

Examples:
captureStart ["O:\\fp\\vbs-video.avi", 640, 480, 20, ["MPG4", "DIVX", "XVID", "MPG2", "MPG1", "MJPG"], 1, 0, 10] 
captureStart ["my_video.avi"]

Additional Information

See also:captureStop, captureTest, Audio recording, VBS screenshot
Multiplayer:
Problems:

Notes