Skip to content

vllm_omni.diffusion.models.wan2_2.chunked_mp4

Worker-side MP4 encoding for Wan VAE temporal chunks.

WAN_DEFAULT_BATCH_FRAMES module-attribute

WAN_DEFAULT_BATCH_FRAMES = 17

WAN_DEFAULT_OUTPUT_FPS module-attribute

WAN_DEFAULT_OUTPUT_FPS = 24

WAN_DEFAULT_VIDEO_CODEC_OPTIONS module-attribute

WAN_DEFAULT_VIDEO_CODEC_OPTIONS = {
    "preset": "ultrafast",
    "threads": "0",
}

resolve_wan_output_fps

resolve_wan_output_fps(sampling_params: Any) -> int

Resolve the fps the worker encodes with.

The serving layer resolves output fps from the request's fps field, not from frame_rate, so pre-encoding has to read the same field or the bytes would carry a rate the response does not advertise.

resolve_wan_preencode_batch_frames

resolve_wan_preencode_batch_frames(
    sampling_params: Any,
    *,
    default: int = WAN_DEFAULT_BATCH_FRAMES,
) -> int

Read the MP4 batching threshold before starting expensive generation.

resolve_wan_preencode_mp4

resolve_wan_preencode_mp4(
    sampling_params: Any, *, output_type: str
) -> bool

Return whether this request wants the worker to pre-encode the MP4.

Reject rather than silently downgrade the combinations the pre-encoded path cannot serve: it emits MP4 bytes, so nothing downstream can interpolate frames or hand back an array.

resolve_wan_video_codec_options

resolve_wan_video_codec_options(
    sampling_params: Any,
) -> dict[str, str] | None

Read the request's encoder options, preserving serving defaults.

An absent key inherits the one-shot serving encoder's defaults. Explicit None and an empty mapping remain distinct caller choices.

wan_preencoded_mp4_payload

wan_preencoded_mp4_payload(
    video: Any,
) -> dict[str, Any] | None

Return a post-process payload when the worker already encoded the MP4.

Returns None for the ordinary frame-tensor output so callers fall through to their existing post-processing.

No fps is reported here: :func:resolve_wan_output_fps mirrors the fallback the serving layer applies, so the rate the response advertises already matches the rate these bytes were encoded at.