components.io.videofilewriter

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

Bases: pyctools.core.base.Transformer

Write video files.

VideoFileWriter has been superseded by VideoFileWriter2.

This component uses FFmpeg to write video to a variety of formats. Make sure you have installed FFmpeg before attempting to use VideoFileWriter.

The trickiest part of configuring VideoFileWriter is setting encoder. Combinations I’ve found to work on my machine include the following:

  • '-c:v ffv1 -pix_fmt bgr0' – FFV1 lossless encoder, 8-bit colour

  • '-c:v ffv1 -pix_fmt gray' – FFV1, 8-bit luminance

  • '-c:v ffv1 -pix_fmt gray16le' FFV1, 16-bit luminance

  • '-c:v libx264 -pix_fmt yuv444p -qp 0' – “lossless” H264

  • '-c:v libx264 -pix_fmt yuv444p -qp 0 -preset veryslow' – same as above?

I’d be interested to hear of any other good combinations. Email me at the address shown below.

Config

path

str

Path name of file to be created.

encoder

str

A string of ffmpeg options.

fps

int

Video frame rate. Only affects how file is replayed.

16bit

bool

Attempt to write precision than normal 8-bit range.

file_writer(in_frame)[source]

Generator process to write file


Comments or questions? Please email jim@jim-easterbrook.me.uk.