Video-specific GPU operations: overlay, mix, scale, crop, convert.
All operations run on GPU-resident frame buffers and return new frame buffers.
Examples
result = ExCubecl.Video.overlay(base_frame, overlay_frame, x: 100, y: 50, alpha: 0.8)
result = ExCubecl.Video.mix(frame_a, frame_b, mode: :dissolve, ratio: 0.5)
result = ExCubecl.Video.scale(frame, width: 1280, height: 720)
rgb = ExCubecl.Video.convert(frame, :yuv420p, :rgb24)
cropped = ExCubecl.Video.crop(frame, x: 0, y: 0, width: 640, height: 360)
Summary
Functions
Converts a video frame between pixel formats on the GPU.
Crops a video frame to the specified rectangle.
Blends two video frames using the specified blend mode.
Alpha-composites overlay onto base at position (x, y) with opacity alpha.
Scales a video frame to the specified dimensions using GPU-accelerated resampling.
Saves a snapshot of the frame to a PNG file.
Types
@type blend_mode() :: :dissolve | :add | :multiply
@type frame() :: ExCubecl.VideoFrame.t()
@type pixel_format() :: :yuv420p | :rgb24 | :rgba | :nv12
Functions
@spec convert(frame(), pixel_format(), pixel_format()) :: {:ok, frame()} | {:error, term()}
Converts a video frame between pixel formats on the GPU.
Examples
rgb = ExCubecl.Video.convert(frame, :yuv420p, :rgb24)
Crops a video frame to the specified rectangle.
Options
:x— left edge (default 0):y— top edge (default 0):width— crop width:height— crop height
Blends two video frames using the specified blend mode.
Options
:mode— blend mode::dissolve(default),:add, or:multiply:ratio— blend ratio 0.0 (all A) to 1.0 (all B), default 0.5
Alpha-composites overlay onto base at position (x, y) with opacity alpha.
Uses Porter-Duff Over compositing on the GPU.
Options
:x— horizontal offset (default 0):y— vertical offset (default 0):alpha— opacity 0.0–1.0 (default 1.0)
Scales a video frame to the specified dimensions using GPU-accelerated resampling.
Options
:width— target width in pixels:height— target height in pixels
Saves a snapshot of the frame to a PNG file.
Note: This triggers a GPU→CPU readback, so it should be used sparingly.