gizai:h3
giz's worker of MiniMax H3 (gizai:diffusion's D.H3): its video.generate jobs as WanGP makes them (sliding windows, a video to extend, control videos, Ref2VA references, a soundtrack) and the enhance-video and interpolate-video jobs (RTX Video and optical flow on the same GPU).
import * as H3 from "gizai:h3";Types
Serving
type Serving = { fl2va: string; ref2va: string; text: string; spare: i64; state: string; host: string; port: i64; ffmpeg: string; }What serve serves: H3 FL2VA from the model folder fl2va and Ref2VA from ref2va (either "" for none), with the
text encoder text ("local" or HOST:PORT), spare bytes of the GPU left free, its jobs under state and on
host:port; ffmpeg the program that reads and muxes the uploads.
fl2va:stringref2va:stringtext:stringspare:i64state:stringhost:stringport:i64ffmpeg:string
Treatment
type Treatment = { e: V.Enhance; times: i64; effort: string; }What a job does to the frames: RTX Video e, or (times above 1) times - 1 frames made between each two (of
quality effort: V.interpolationQualities).
e:M42.Enhancetimes:i64effort:string
Source
type Source = { width: i64; height: i64; num: i64; den: i64; seconds: f64; frames: i64; bytes: i64; codec: string; pixels: string; turn: i64; }A video file's first video stream as ffprobe sees it: its size as shown (after the turn), frame rate num / den, length, frame count and file size (-1: unknown), codec, and the turn it asks for (degrees clockwise).
width:i64height:i64num:i64den:i64seconds:f64frames:i64bytes:i64codec:stringpixels:stringturn:i64
Functions
serve
function serve(sys: System, s: Serving): Result<i64, string>giz's worker for its H3 pools: video.generate of minimax_h3_fl2va_pruned (and the id giz names it by, minimax_h3_fl2va_pruned_int8_convrot) and of Ref2VA into output.mp4 (output.2x.mp4 by RTX Video, in the process, when the input asks upscale), and giz's enhance-video and interpolate-video models (enhanceRun). The kernels' tunings stay in STATE/tune. One process serves both of H3's models with one transformer on the GPU at a time (H3.use swaps it for a job of the other), as WanGP does on one card.
Effects: fail, read, write, console, io.
h3Upscale
function h3Upscale(): V.EnhanceThe 2x upscale of an H3 video (input upscale: true), as wgp-api's NVIDIA VSR asks it.
sourceOf
function sourceOf(sys: System, ffmpeg: string, path: string): Result<Source, string>The video stream of the file PATH as ffprobe (beside FFMPEG) reads it: its size, frame rate, length, codec and rotation.
Effects: fail, read, write, io.
enhanceFile
function enhanceFile(sys: System, gpu: Gpu, ffmpeg: string, source: string, s: Source, how: Treatment, codec: string, dir: string, progress: (f: i64, total: i64) => bool): Result<i64, W.Failure>source (s: sourceOf) through how into DIR/output.mp4 of codec, with the source's audio: NVDEC, the effect
or the interpolation, and NVENC on gpu, then ffmpeg times the track at the source's rate (times how.times)
beside the audio. progress takes the source frames done and expected each 8 frames and gives false to cancel.
Effects: fail, read, write, console, io.