nemo_curator.stages.video.clipping.video_frame_extraction

View as Markdown

Module Contents

Classes

NameDescription
VideoFrameExtractionStageStage that extracts frames from videos into numpy arrays.

Functions

NameDescription
get_frames_from_ffmpegFetch resized frames for video.

API

class nemo_curator.stages.video.clipping.video_frame_extraction.VideoFrameExtractionStage(
output_hw: tuple[int, int] = (27, 48),
pyncv_batch_size: int = 64,
decoder_mode: str = 'pynvc',
verbose: bool = False,
name: str = 'video_frame_extraction'
)
Dataclass

Bases: ProcessingStage[VideoTask, VideoTask]

Stage that extracts frames from videos into numpy arrays.

This stage handles video frame extraction using either FFmpeg (CPU/GPU) or PyNvCodec, converting video content into standardized frame arrays for downstream processing.

decoder_mode
str = 'pynvc'
name
str = 'video_frame_extraction'
output_hw
tuple[int, int] = (27, 48)
pyncv_batch_size
int = 64
verbose
bool = False
nemo_curator.stages.video.clipping.video_frame_extraction.VideoFrameExtractionStage.__post_init__() -> None
nemo_curator.stages.video.clipping.video_frame_extraction.VideoFrameExtractionStage.inputs() -> tuple[list[str], list[str]]
nemo_curator.stages.video.clipping.video_frame_extraction.VideoFrameExtractionStage.outputs() -> tuple[list[str], list[str]]
nemo_curator.stages.video.clipping.video_frame_extraction.VideoFrameExtractionStage.process(
task: nemo_curator.tasks.video.VideoTask
) -> nemo_curator.tasks.video.VideoTask
nemo_curator.stages.video.clipping.video_frame_extraction.VideoFrameExtractionStage.setup(
worker_metadata: nemo_curator.backends.base.WorkerMetadata | None = None
) -> None

Setup method called once before processing begins. Override this method to perform any initialization that should happen once per worker. Args: worker_metadata (WorkerMetadata, optional): Information about the worker (provided by some backends)

nemo_curator.stages.video.clipping.video_frame_extraction.get_frames_from_ffmpeg(
video_file: pathlib.Path,
width: int,
height: int,
use_gpu: bool = False
) -> numpy.typing.NDArray[numpy.uint8] | None

Fetch resized frames for video.