pyflink.multimodal.operators.video_extract_frames#
- video_extract_frames(*columns, frame_selector='keyframe', sample_interval_ms=None, max_frames=None, on_error='raise', container_options=None, read_chunk_size=None, max_cached_blocks=None, read_ahead_blocks=None, concurrency=None)[source]#
Extract selected frames as an array on the same output row.
This scalar UDF is useful when downstream logic expects all selected frames from one video together. For streaming one frame per row, prefer
video_explode_frames.- Parameters
*columns – Optional URI or segment column. When provided, the UDF is applied directly instead of returning a factory.
frame_selector – Frame selection mode,
"keyframe","sample", or"all_frames".sample_interval_ms – Sampling interval for
frame_selector="sample".max_frames – Optional safety limit for frames retained in memory.
Noneretains all selected frames.on_error – Error handling policy.
"raise"propagates failures;"null"returnsNonefor unreadable inputs.container_options – Optional PyAV
av.openoptions.read_chunk_size – Optional Java-backed file read chunk size in bytes. Must not exceed the 16 MiB Java bridge read range limit.
max_cached_blocks – Optional per-file cache block count.
0disables block caching.read_ahead_blocks – Optional number of blocks to prefetch after a cache miss.
0disables read-ahead.concurrency – UDF concurrency.
Noneuses the framework default.
- Returns
A scalar UDF producing
ARRAY<IMAGE>. The selected frames are retained in memory on the same output row.
- Example::
>>> df = df.with_column( ... "keyframes", video_extract_frames(col("uri")))