class VideoFileReader2(config={}, **kwds)[source]

Bases: Component

Read raw or conventional (mp4, flv, AVI, etc.) video files.

This component uses FFmpeg to read video from a wide variety of formats, including “raw” files without a header. Make sure you have installed FFmpeg before attempting to use VideoFileReader2.

Unlike VideoFileReader the file data is not always converted to Y or RGB video format. This may be useful if you want to process the YUV data directly, rather than having to convert it from RGB to YUV again.

The format config item can be used to force conversion to a particular format. This can be useful if most of your sources are in the same format but you’d like your script to work with sources in any format.

The zperiod config item can be used to adjust the repeat period so it is an integer multiple of a chosen number, e.g. 4 frames for a PAL encoded sequence. It has no effect if looping is off.

“Raw” video files

Video is usually stored in file formats (such as AVI) with a complex structure to allow a mix of audio, video and other data. “Raw” files contain nothing but the picture data. Even the image dimensions have to be stored in a separate “metadata” file. (Use the pyctools-setmetadata tool to create or modify the metadata file.)

There are many possible arrangements of data in raw files. For example, the colour components can be packed (multiplexed) together or stored in separate planes. The formats are labelled with a short string known as a fourcc code. This code needs to be in the metadata file with the image dimensions.

Note that when reading “YUV” formats the U & V outputs are offset by 128 to restore their range to -128..127 (from the file range of 0..255). This makes subsequent processing a lot easier.




Path name of file to be read.



Force output format. Can be 'native', 'RGB', 'Y', 'YUV444', 'YUV422', or 'YUV420'.



Whether to play continuously. Can be 'off' or 'repeat'.



Don’t output file’s “audit trail” metadata.



Adjust repeat period to an integer multiple of zperiod.

outputs = ['output_Y_RGB', 'output_UV']

Comments or questions? Please email