cutcutcodec.core.io.read_ffmpeg_color

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

Classes

ContainerInputFFMPEGColor(*args, **kwargs)

Same as ContainerInputFFMPEG with colorspace convertion.

Details

class cutcutcodec.core.io.read_ffmpeg_color.ContainerInputFFMPEGColor(*args, **kwargs)[source]

Same as ContainerInputFFMPEG with colorspace convertion.

Examples

>>> import torch
>>> from cutcutcodec.core.analysis.stream.shape import optimal_shape_video
>>> from cutcutcodec.core.io.read_ffmpeg_color import ContainerInputFFMPEGColor
>>> with ContainerInputFFMPEGColor("cutcutcodec/examples/intro.webm") as container:
...     for stream in container.out_streams:
...         if stream.type == "video":
...             stream.snapshot(0, optimal_shape_video(stream)).shape
...         elif stream.type == "audio":
...             torch.round(stream.snapshot(0, rate=2, samples=3), decimals=5)
...
(720, 1280, 3)
(360, 640, 3)
FrameAudio(0, 2, 'stereo', [[     nan,  0.1804 , -0.34765],
                            [     nan, -0.07236,  0.07893]])
FrameAudio(0, 2, 'mono', [[     nan,  0.06998, -0.24758]])

Create a basic ContainerInputFFMPEG then convert the colorspace.