cutcutcodec.core.io

Manage the input/output layer.

Functions

read(filename[, colorspace])

Open the media file with the appropriate reader.

write(streams, filename[, colorspace])

Create, write and encode the multimedia file.

Details

cutcutcodec.core.io.read(filename: Path | str | bytes, colorspace: Colorspace | str | None = None, **kwargs) Node[source]

Open the media file with the appropriate reader.

Parameters

filenamepathlike

The path to the file to be decoded.

colorspacestr or Colorspace, optional

Transmitted to cutcutcodec.core.filter.video.colorspace.FilterVideoColorspace.

**kwargsdict

Transmitted to cutcutcodec.core.io.read_ffmpeg.ContainerInputFFMPEG or cutcutcodec.core.io.read_image.ContainerInputImage or cutcutcodec.core.io.read_svg.ContainerInputSVG.

Returns

containercutcutcodec.core.classes.container.ContainerInput

The appropriated instanciated container, according to the nature of the file.

Raises

cutcutcodec.core.exceptions.DecodeError

If the file can not be decoded by any reader.

cutcutcodec.core.io.write(streams: Iterable[Stream], filename: Path | str | bytes, colorspace: Colorspace | str | None = None, **kwargs)[source]

Create, write and encode the multimedia file.

This is a high-level version of the write method of the cutcutcodec.core.io.write_ffmpeg.ContainerOutputFFMPEG class.

Parameters

streamsiterable[Stream]

These are all the audio and video streams that will be present in the final container.

filenamepathlike

The path to the media file to be encoded.

colorspacestr or Colorspace, optional

The encoded colorspace, by default, it is cutcutcodec.core.classes.colorspace.Colorspace.from_default_target(). Transmitted to cutcutcodec.core.filter.video.colorspace.FilterVideoColorspace.

Modules

cst

All audio, video and image suffixes.

framecaster

This module, implemented in C, offers functions to normalize frames.

pix_map

Pixel format conversion to keep all accuracy and taking care colorspace.

read_color

Delegate the reading to the module read_ffmpeg, and add a filter to manage the colorspace.

read_ffmpeg

Decode the streams of a multimedia file based on ffmpeg.

read_image

Read an image with opencv.

read_svg

Decode the svg vectorial images based on cairosvg lib.

scheduler

Combine several stream to yield frame in monotonic order.

write_ffmpeg

Management of the encoding of a multimedia stream based on PyAV.