Back to Aurora Vision Library website

You are here: Start » Function Reference » All Functions » Image IO » AvsFilter_WriteVideo

AvsFilter_WriteVideo


This is Filter Equivalent. This function may be present in generated code, but should not be used in hand-written code. OpenOutputVideoStream and WriteVideoStream should be used instead.

Header: AVL.h
Namespace: avs
Module: FoundationLite

Writes an image sequence to a video file one frame per iteration.

Syntax

void avs::AvsFilter_WriteVideo
(
	avs::OutputVideoStream& ioState,
	const avl::Image& inImage,
	const atl::File& inFile,
	const avl::VideoEncoderName& inFourCC,
	atl::Optional<float> inFPS
)

Parameters

Name Type Range Default Description
Input will be modified ioState OutputVideoStream& Object used to maintain state of the function.
Input value inImage const Image& Current frame
Input value inFile const File& File path of the output file
Input value inFourCC const VideoEncoderName& Four-character code, designating which codec to use
Input value inFPS Optional<float> 1.0 - 500.0 20.0f Requested frame rate of the produced video file

Requirements

For input inImage only pixel formats are supported: 3⨯uint8.

Read more about pixel formats in Image documentation.

Description

The operation saves the sequence of images passed onto its inImage port to an AVI file using the selected video encoder. Available encoders represented by theirs fourCC codes can be obtained using GetAvailableVideoCompressors filter. Please note, that no encoder is shipped with Aurora Vision products, and to use this filter correctly additional, third party software has to be installed. Examples of freely available video encoders:

  • Cinepak - legacy encoder that should be available on nearly every Windows-based machine, as it comes bundled with the Video for Windows for x86 platform.
  • FFDShow - configurable encoder supporting various formats. The newest version can be obtained from the website http://ffdshow-tryout.sourceforge.net/. When used with Windows 10, only x86 version is working.
  • Xvid - popular, modern encoder available at https://www.xvid.com/.

The filter requires that the selected file has an .avi extension. If the selected file does not exist, it will be created on filter execution. If the selected file does exist, it will be overwritten.

The filter produces the resulting video by putting together frames at rate of one frame per iteration. As the FPS of the produced avi file is fixed (at the value of inFPS), the resulting videos may appear as sped up (if the iteration time was longer than 1/inFPS of a second) or slowed down (if the iteration time was shorter than 1/inFPS of a second).

Remarks

This filter uses external components, which can open additional windows or require initial configuration. Please, consult your codecs vendor in case of any troubles.

Errors

List of possible exceptions:

Error type Description
DomainError Empty FourCC code. If no FourCCs codes are available, please install external codecs.
DomainError Empty path inFile in WriteVideo.
DomainError File path cannot be changed during writing in WriteVideo.
DomainError Image width and height must be a multiple of four in WriteVideo.
DomainError Not supported inImage pixel format in AvsFilter_WriteVideo. Supported formats: 3xUInt8.
RuntimeError An runtime error occurred during video writing. This is probably caused by faulty codec. Try to use different codec
RuntimeError An runtime error occurred during video writing. This is probably caused by faulty codec.Error message

See Also