cutcutcodec.core.analysis.video.properties.colorspace

Find or guess the colorspace of a video stream.

Functions

get_colorspace(filename[, index])

Open the stream to read the colorspace.

Details

cutcutcodec.core.analysis.video.properties.colorspace.get_colorspace(filename: Path | str | bytes, index: int = 0) Colorspace[source]

Open the stream to read the colorspace.

Parameters

filenamepathlike

The pathlike of the file containing a video stream.

indexint

The relative index of the video stream being considered, by default the first stream encountered is selected.

Returns

colorspaceColorspace

The name of the guessed colorspace.

Raises

MissingStreamError

If the file does not contain a playable video stream.

Examples

>>> from cutcutcodec.core.analysis.video.properties.colorspace import get_colorspace
>>> from cutcutcodec.utils import get_project_root
>>> media = get_project_root() / "media" / "video" / "intro.webm"
>>> get_colorspace(media)
Colorspace("y'pbpr", 'bt709', 'bt1361e, bt1361')
>>>