sr_io ¶
Video / audio input and delivery resizing for Kandinsky6 video super-resolution.
The SR model has its own input contract, so it does not go through the generic load_video (which decodes every frame and drops the audio) or InputValidationStage (which resizes to the request geometry): the source is resampled to 24 fps by a fixed stride, capped at 121 frames aligned to 1 + 8k and kept at its own resolution. Frames are streamed and only the selected ones are kept; the audio track is decoded separately so it can be muxed back.
Classes¶
fastvideo.pipelines.basic.kandinsky6_sr.sr_io.FramePlan dataclass ¶
Stream indices to keep and the rate they play at.
When downsampling, the kept count is int(total_frames / step), which depends on the true stream length: lookahead frames must be read before the selection is final.
Functions:¶
fastvideo.pipelines.basic.kandinsky6_sr.sr_io.read_audio ¶
Mono float audio of path at :data:AUDIO_SAMPLE_RATE, trimmed to the span of num_frames frames.
Returns None when there is no audio track or it cannot be decoded: audio is best effort and never fails the video.
Source code in fastvideo/pipelines/basic/kandinsky6_sr/sr_io.py
fastvideo.pipelines.basic.kandinsky6_sr.sr_io.read_video ¶
Decode path to ([T, C, H, W] uint8, output_fps) following the SR input contract.
Source code in fastvideo/pipelines/basic/kandinsky6_sr/sr_io.py
fastvideo.pipelines.basic.kandinsky6_sr.sr_io.resize_video ¶
Antialiased downscale of a [C, T, H, W] uint8 video to target_hw (no crop, never upscales).
Source code in fastvideo/pipelines/basic/kandinsky6_sr/sr_io.py
fastvideo.pipelines.basic.kandinsky6_sr.sr_io.resolve_target_hw ¶
resolve_target_hw(spec: str | None, sr_hw: tuple[int, int], mode: str, validate_only: bool = False) -> tuple[int, int] | None
Delivery size for spec (a tier name or WxH); None when the SR result is kept as is.
fit shrinks isotropically into the bucket (never upscales, even sizes for the codec); exact returns the bucket itself.
Source code in fastvideo/pipelines/basic/kandinsky6_sr/sr_io.py
fastvideo.pipelines.basic.kandinsky6_sr.sr_io.validate_target_spec ¶
Reject a bad delivery spec before any model runs.