Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

feat: align MiniMax H3 output controls

[._.]/ Adam Eivybf95feb7091e
diff --git a/.changelog/next/changed-agent-1d1d117e.md b/.changelog/next/changed-agent-1d1d117e.md
new file mode 100644
index 0000000000..fd07992182
--- /dev/null
+++ b/.changelog/next/changed-agent-1d1d117e.md
@@ -0,0 +1 @@
+- Align MiniMax H3 video duration and native resolution controls with the upstream model, including prompt-steered audio.
diff --git a/client/src/components/videoGen/AdvancedParamsPanel.jsx b/client/src/components/videoGen/AdvancedParamsPanel.jsx
index a6fe92b788..11bc700068 100644
--- a/client/src/components/videoGen/AdvancedParamsPanel.jsx
+++ b/client/src/components/videoGen/AdvancedParamsPanel.jsx
@@ -22,7 +22,7 @@ import { ChevronDown, Dice5 } from 'lucide-react';
import { FormField } from '../ui/FormField';
import {
frameOptionsForModel, fpsOptionsForModel, CHUNK_OPTIONS,
- isModelAllowedForMode, supportsVideoAudioControls,
+ isModelAllowedForMode, supportsVideoAudioControls, supportsVideoAudioPromptControls,
CONTEXT_FRAME_OPTIONS, supportsContextWindow,
} from '../../lib/videoGenParams.js';
import { VIDEO_TILING_OPTIONS } from '../../lib/videoTilingOptions';
@@ -49,7 +49,9 @@ export default function AdvancedParamsPanel({
// a2v derives its length + audio track from the uploaded audio, so chunking
// and the audio flags don't apply there.
const showAudioFlags = mode !== 'a2v';
- const showModelAudioControls = showAudioFlags && supportsVideoAudioControls(currentModel);
+ const showDisableAudio = showAudioFlags && supportsVideoAudioControls(currentModel);
+ const showPromptAudioControls = showAudioFlags && supportsVideoAudioPromptControls(currentModel);
+ const audioDisabled = showDisableAudio && disableAudio;
// Chunk chaining seeds chunk N+1 from chunk N's last frame, so it needs i2v —
// the same predicate the picker uses, not a second reading of supportedModes.
const showChunks = mode !== 'a2v' && isModelAllowedForMode(currentModel, 'image');
@@ -84,7 +86,11 @@ export default function AdvancedParamsPanel({
onChange={(e) => onNumFramesChange(Number(e.target.value))}
className={inputCls}
>
- {frameOptions.map((f) => <option key={f} value={f}>{f} ({(f / fps).toFixed(1)}s @ {fps}fps)</option>)}
+ {frameOptions.map((f) => (
+ <option key={f} value={f}>
+ {f} ({(f / fps).toFixed(1)}s @ {fps}fps){f === currentModel?.defaultFrames ? ' · default' : ''}
+ </option>
+ ))}
</select>
{numFrames > 241 && isModelAllowedForMode(currentModel, 'extend') && (
<p className="text-[10px] text-gray-500 leading-snug mt-1">
@@ -276,7 +282,7 @@ export default function AdvancedParamsPanel({
</FormField>
)}
- {showModelAudioControls && (
+ {showDisableAudio && (
<label className="col-span-2 sm:col-span-3 flex items-center gap-2 text-xs text-gray-400 cursor-pointer">
<input
type="checkbox"
@@ -287,19 +293,19 @@ export default function AdvancedParamsPanel({
Disable audio (LTX-2 only — speeds up generation)
</label>
)}
- {showModelAudioControls && (
+ {showPromptAudioControls && (
<label
- className={`col-span-2 sm:col-span-3 flex items-center gap-2 text-xs cursor-pointer ${disableAudio ? 'text-gray-600 cursor-not-allowed' : 'text-gray-400'}`}
- title="LTX-2 conditions audio on the prompt — appending 'no music, no soundtrack' at submit time pushes the model toward ambient/diegetic sound only"
+ className={`col-span-2 sm:col-span-3 flex items-center gap-2 text-xs cursor-pointer ${audioDisabled ? 'text-gray-600 cursor-not-allowed' : 'text-gray-400'}`}
+ title="The model conditions generated audio on the prompt — appending 'no music, no soundtrack' at submit time pushes it toward ambient/diegetic sound only"
>
<input
type="checkbox"
checked={noMusic}
- disabled={disableAudio}
+ disabled={audioDisabled}
onChange={(e) => onNoMusicChange(e.target.checked)}
className="rounded"
/>
- No music — keep ambient/diegetic sound only (LTX-2)
+ No music — keep ambient/diegetic sound only
</label>
)}
</div>
diff --git a/client/src/components/videoGen/AdvancedParamsPanel.test.jsx b/client/src/components/videoGen/AdvancedParamsPanel.test.jsx
index a8982bc003..738f7d89db 100644
--- a/client/src/components/videoGen/AdvancedParamsPanel.test.jsx
+++ b/client/src/components/videoGen/AdvancedParamsPanel.test.jsx
@@ -147,7 +147,7 @@ describe('AdvancedParamsPanel', () => {
expect(screen.getByLabelText(/No music/).disabled).toBe(true);
});
- it('hides LTX audio controls and Extend advice for a text-only joint-A/V model', () => {
+ it('keeps prompt-audio steering but hides muting and Extend advice for H3', () => {
renderPanel({
numFrames: 362,
currentModel: {
@@ -159,7 +159,7 @@ describe('AdvancedParamsPanel', () => {
});
fireEvent.click(toggle());
expect(screen.queryByText(/Disable audio/)).toBeNull();
- expect(screen.queryByText(/No music/)).toBeNull();
+ expect(screen.getByLabelText(/No music/)).not.toBeDisabled();
expect(screen.queryByText(/use Extend/i)).toBeNull();
});
diff --git a/client/src/hooks/useVideoGenForm.js b/client/src/hooks/useVideoGenForm.js
index 63c87c2a62..816326d1a3 100644
--- a/client/src/hooks/useVideoGenForm.js
+++ b/client/src/hooks/useVideoGenForm.js
@@ -5,14 +5,16 @@ import { extractLastFrame } from '../services/api';
import { composeStyledPrompt } from '../lib/composeStyledPrompt';
import { videoLoraFamily, isVideoLoraFamily, loraFamilyOf, VIDEO_LORA_FAMILIES } from '../lib/runnerFamilies';
import { randomSeed } from '../lib/genUtils';
-import { VIDEO_RESOLUTIONS, snapAspectToImage } from '../lib/videoGenResolutions';
+import {
+ resolutionOptionsForModel, defaultResolutionForModel, snapAspectToImage,
+} from '../lib/videoGenResolutions';
import { clampImageEdge } from '../lib/imageGenResolutions';
import { GROK_VIDEO_DEFAULT_DURATION } from '../lib/grokVideoClip.js';
import { VIDEO_TILING_ENUM_SET } from '../lib/videoTilingOptions';
import {
- VIDEO_EDGE_BOUNDS, MAX_CHUNKS, DEFAULT_CONTEXT_FRAMES,
+ VIDEO_EDGE_BOUNDS, videoEdgeBoundsForModel, MAX_CHUNKS, DEFAULT_CONTEXT_FRAMES,
videoModelMemoryGb, computeFflfSafeFrames, isModelAllowedForMode,
- supportsVideoAudioControls,
+ supportsVideoAudioControls, supportsVideoAudioPromptControls,
normalizeFramesForModel, normalizeFpsForModel,
icLoraSpecForMode, icResolutionIssue,
} from '../lib/videoGenParams.js';
@@ -87,11 +89,10 @@ export function useVideoGenForm({ models, status, availableLoras, grokEnabled })
// LoraPicker owns; `availableLoras` is the full installed library filtered
// by the picker to the model's video family. See videoLoraFamily().
const [selectedLoras, setSelectedLoras] = useState([]);
- // "No music" appends a soundscape constraint at submit time. LTX-2
- // conditions audio on prompt text — adding "no music, no soundtrack"
- // pushes the model toward ambient/diegetic sound (footsteps, room tone)
- // and away from generated background music, which is hard to remove
- // cleanly in post. Source: phosphene LTX-2 prompting guide.
+ // "No music" appends a soundscape constraint at submit time. LTX-2 and
+ // MiniMax H3 both steer generated audio from prompt text — adding "no music,
+ // no soundtrack" pushes them toward ambient/diegetic sound (footsteps, room
+ // tone) and away from generated background music.
const [noMusic, setNoMusic] = useState(false);
const [sourceImageFile, setSourceImageFile] = useState(incomingSourceImage || null);
const [sourceImageUpload, setSourceImageUpload] = useState(null);
@@ -242,7 +243,7 @@ export function useVideoGenForm({ models, status, availableLoras, grokEnabled })
// local.js#resizeImage) doesn't silently cut the subject out of a mismatched
// frame. Only fires while the user hasn't taken the size into their own hands
// (sizeManuallySetRef) — the inputs stay fully editable for power users, and
- // the server keeps its own 64-grid clamp. Gallery picks resolve to
+ // the server keeps its own model-aware grid clamp. Gallery picks resolve to
// /data/images/<file>; uploads reuse the object URL built above. The load is
// async, so guard the apply against a newer pick (cancelled) and a late-
// arriving manual size change (the ref re-check).
@@ -254,12 +255,17 @@ export function useVideoGenForm({ models, status, availableLoras, grokEnabled })
const img = new Image();
img.onload = () => {
if (cancelled || sizeManuallySetRef.current) return;
- const snapped = snapAspectToImage(VIDEO_RESOLUTIONS, img.naturalWidth, img.naturalHeight);
+ const activeModel = models.find((model) => model.id === modelId);
+ const snapped = snapAspectToImage(
+ resolutionOptionsForModel(activeModel),
+ img.naturalWidth,
+ img.naturalHeight,
+ );
if (snapped) { setWidth(snapped.w); setHeight(snapped.h); }
};
img.src = src;
return () => { cancelled = true; };
- }, [sourceImageFile, sourceUploadUrl]);
+ }, [sourceImageFile, sourceUploadUrl, modelId, models]);
// ?lora=<filename> preselects a video LoRA when the user clicks "Test" on a
// video LoRA card in /media/loras. Mirrors the ImageGen ?lora= handoff:
@@ -382,6 +388,18 @@ export function useVideoGenForm({ models, status, availableLoras, grokEnabled })
const currentModel = models.find((m) => m.id === modelId);
+ // Until the user deliberately chooses a size, model changes carry their own
+ // native default canvas. This is material for H3: the shared 768x512 default
+ // is an off-distribution wiring-test size, while its trained 16:9 canvas is
+ // 1344x768. A source image still wins through the aspect-snap effect above,
+ // and Remix/Continue/user edits set sizeManuallySetRef so they are preserved.
+ useEffect(() => {
+ if (!currentModel || sizeManuallySetRef.current || sourceImageFile || sourceUploadUrl) return;
+ const next = defaultResolutionForModel(currentModel);
+ setWidth(next.w);
+ setHeight(next.h);
+ }, [currentModel, sourceImageFile, sourceUploadUrl]);
+
// Remix/deep-link/resume paths set model + sampler fields independently.
// Reconcile them once the model is known so a legacy LTX 8n+1 frame count
// cannot reach a Wan 4n+1 runner (and a model-specific fps stays selectable).
@@ -1069,6 +1087,10 @@ export function useVideoGenForm({ models, status, availableLoras, grokEnabled })
const buildGeneratePayload = () => {
const composed = composeStyledPrompt(prompt, negativePrompt, stylePreset);
+ // A hidden mute checkbox from a prior model must not suppress H3's visible
+ // prompt-audio steering. Treat mute as effective only on a model that can
+ // actually disable its generated audio track.
+ const effectiveDisableAudio = supportsVideoAudioControls(currentModel) && disableAudio;
// The style preset and the no-music constraint are ENVELOPE, not content —
// they have to wrap a per-chunk beat exactly as they wrap the main prompt.
// Shipping a beat raw would render the chunks the user steered in a
@@ -1078,7 +1100,7 @@ export function useVideoGenForm({ models, status, availableLoras, grokEnabled })
// Idempotent on "no music": if the text already says it, don't double-append.
const withEnvelope = (text) => {
const c = composeStyledPrompt(text, negativePrompt, stylePreset);
- return (supportsVideoAudioControls(currentModel) && noMusic && !disableAudio && !/no music/i.test(c.prompt))
+ return (supportsVideoAudioPromptControls(currentModel) && noMusic && !effectiveDisableAudio && !/no music/i.test(c.prompt))
? `${c.prompt}\n\nno music, no soundtrack`
: c.prompt;
};
@@ -1114,6 +1136,7 @@ export function useVideoGenForm({ models, status, availableLoras, grokEnabled })
// with multi-keyframe mode on the server, so its image fields only ride
// along when keyframes aren't active.
const legacyFflf = mode === 'fflf' && !keyframesActive;
+ const localEdgeBounds = videoEdgeBoundsForModel(currentModel);
return {
// The page's backend toggle IS an explicit choice — send it so the
// server's #3231 video pin ladder can't reroute a Local render to a
@@ -1125,15 +1148,15 @@ export function useVideoGenForm({ models, status, availableLoras, grokEnabled })
// Clamp/floor to the runner's edge bounds so a transient 0 (field cleared
// mid-edit) or off-grid value can't 400 the server — mirrors ImageGen's
// submit-time clampImageEdge guard.
- width: clampImageEdge(width, VIDEO_EDGE_BOUNDS),
- height: clampImageEdge(height, VIDEO_EDGE_BOUNDS),
+ width: clampImageEdge(width, localEdgeBounds),
+ height: clampImageEdge(height, localEdgeBounds),
numFrames,
fps,
steps: steps || '',
guidanceScale: guidanceScale || '',
seed: seed || '',
tiling: currentModel?.supportsTiling === false ? 'auto' : tiling,
- disableAudio: supportsVideoAudioControls(currentModel) ? (disableAudio ? 'true' : 'false') : 'false',
+ disableAudio: effectiveDisableAudio ? 'true' : 'false',
mode,
imageStrength: imageStrength || '',
// ltx2-extend bypasses the last-frame i2v path: we send the source
diff --git a/client/src/hooks/useVideoGenForm.test.jsx b/client/src/hooks/useVideoGenForm.test.jsx
index ac6ed09839..5bbae88d4d 100644
--- a/client/src/hooks/useVideoGenForm.test.jsx
+++ b/client/src/hooks/useVideoGenForm.test.jsx
@@ -26,7 +26,12 @@ const WAN_TI2V = { id: 'wan-ti2v', name: 'Wan TI2V', runtime: 'wan22', supported
const H3 = {
id: 'minimax-h3', name: 'MiniMax H3', runtime: 'minimax_h3', supportedModes: ['text', 'image', 'fflf'],
lastFrameAnchored: true,
- frameOptions: [124, 141, 158], fpsOptions: [24], defaultFrames: 124,
+ frameOptions: [107, 124, 141, 158], fpsOptions: [24], defaultFrames: 124,
+ defaultWidth: 1344, defaultHeight: 768, resolutionStep: 32,
+ resolutionOptions: [
+ { label: '1344x768', w: 1344, h: 768 },
+ { label: '768x1344', w: 768, h: 1344 },
+ ],
supportsNegativePrompt: false, supportsTiling: false, supportsDisableAudio: false,
};
const MODELS = [MLX, LTX2];
@@ -275,8 +280,23 @@ describe('useVideoGenForm', () => {
fps: 24,
tiling: 'auto',
disableAudio: 'false',
+ width: 1344,
+ height: 768,
});
- expect(payload.prompt).toBe('a fox watches the rain');
+ expect(payload.prompt).toBe('a fox watches the rain\n\nno music, no soundtrack');
+ });
+
+ it('preserves a deliberately chosen custom resolution when switching to H3', async () => {
+ const { result } = render({
+ models: [MLX, H3],
+ status: { connected: true, defaultModel: MLX.id },
+ });
+ await waitFor(() => expect(result.current.modelId).toBe(MLX.id));
+ act(() => result.current.handleResolutionChange(640, 384));
+ act(() => result.current.handleModelChange(H3.id));
+ await waitFor(() => expect(result.current.modelId).toBe(H3.id));
+ expect(result.current.width).toBe(640);
+ expect(result.current.height).toBe(384);
});
// H3's fl2va path anchors keyframes at the first/last latent frame, so image
diff --git a/client/src/lib/README.md b/client/src/lib/README.md
index e50d1c1710..ba77c97546 100644
--- a/client/src/lib/README.md
+++ b/client/src/lib/README.md
@@ -64,8 +64,8 @@ grep -i "what you want to do" client/src/lib/README.md
| `importerDeepLink.js` | The Importer deep-link contract both ways: `buildImporterLink({ universeId, seriesId, seriesName })` builds the `/importer?…` URL a Series Pipeline page navigates to; `resolveImporterDeepLink(...)` reads those params back into the universe + series names the importer matches on. |
| `muscriptorModels.js` | `MUSCRIPTOR_MODELS` (audio → MIDI size tiers `small`/`medium`/`large`) + `DEFAULT_MUSCRIPTOR_MODEL`. Single source consumed by the transcribe `<select>`s in `MusicVideo.jsx` and `ReferenceAnalysis.jsx`. Mirrors the server's `MUSCRIPTOR_MODELS` in `server/services/audioMidiTranscription.js`. |
| `videoFinish.js` | Finish-a-draft gate (#3696). `isReproducibleTextToVideo(record)` is true only for a single text-to-video render whose history record already carries everything a re-render needs — `renderInputsVersion` (the positive marker that its conditioning inventory is trustworthy, so legacy records degrade to not-finishable rather than reading as unconditioned), an empty `conditioning` array, a resolved seed, a real prompt, and no stitched/chained/upscaled provenance. `finishTargetForRecord(record, models)` additionally resolves the draft model's server-declared `finishModelId` against the models this install can actually run, returning the delivery model entry or `null`. Mirrors `finishTargetForModel` in `server/lib/videoFinishProfiles.js`; the pair table itself stays server-side. |
-| `videoGenParams.js` | Pure VideoGen param helpers: `FRAME_OPTIONS`/`FPS_OPTIONS`/`VIDEO_EDGE_BOUNDS`/`MAX_CHUNKS`/`CHUNK_OPTIONS`/`DEFAULT_CONTEXT_FRAMES`/`CONTEXT_FRAME_OPTIONS` constants, `supportsContextWindow(model)` (does this runtime have an extend pipeline to feed a continuation window to — display mirror of `server/lib/videoContinuity.js`, pinned by `server/lib/videoContinuity.parity.test.js`), `videoModelMemoryGb()` (model memory footprint), `computeFflfSafeFrames()` (FFLF/ltx2 pixel-budget back-solve, mirrors `server/services/videoGen/local.js`), and `isModelAllowedForMode()` (a2v + IC-remix → ltx2 gate). Also mirrors the IC-LoRA remix registry (`IC_LORA_MODES`/`IC_LORA_MODE_VALUES`/`isIcLoraMode()`/`icLoraSpecForMode()`/`icResolutionIssue()`) from `server/lib/icLoraWeights.js` so the form validates a reference render pre-submit — pinned by `server/lib/icLoraWeights.parity.test.js`. |
-| `videoGenResolutions.js` | Shared resolution presets for video generation (companion to image side; LTX-2 latent-friendly sizes) + `snapAspectToImage()` to pick the closest-aspect preset for an I2V source. |
+| `videoGenParams.js` | Pure VideoGen param helpers: `FRAME_OPTIONS`/`FPS_OPTIONS`/`VIDEO_EDGE_BOUNDS`/`MAX_CHUNKS`/`CHUNK_OPTIONS`/`DEFAULT_CONTEXT_FRAMES`/`CONTEXT_FRAME_OPTIONS` constants, model-aware frame/fps/resolution-grid normalization, separate mute vs prompt-audio capability checks, `supportsContextWindow(model)` (does this runtime have an extend pipeline to feed a continuation window to — display mirror of `server/lib/videoContinuity.js`, pinned by `server/lib/videoContinuity.parity.test.js`), `videoModelMemoryGb()` (model memory footprint), `computeFflfSafeFrames()` (FFLF/ltx2 pixel-budget back-solve, mirrors `server/services/videoGen/local.js`), and `isModelAllowedForMode()` (a2v + IC-remix → ltx2 gate). Also mirrors the IC-LoRA remix registry (`IC_LORA_MODES`/`IC_LORA_MODE_VALUES`/`isIcLoraMode()`/`icLoraSpecForMode()`/`icResolutionIssue()`) from `server/lib/icLoraWeights.js` so the form validates a reference render pre-submit — pinned by `server/lib/icLoraWeights.parity.test.js`. |
+| `videoGenResolutions.js` | Shared resolution presets/default for video generation, model-specific preset/default resolvers (for native canvases such as MiniMax H3), and `snapAspectToImage()` to pick the closest-aspect preset for an I2V source. |
| `videoTilingOptions.js` | `VIDEO_TILING_OPTIONS` (the `<select>` rows) + `VIDEO_TILING_ENUM_SET` (the value-only Set). Single source consumed by `VideoGen.jsx` and the Remix URL builder in `useMediaPreviewActions`. Mirrors the server's `z.enum` in `server/routes/videoGen.js`. |
## Graph & sim
diff --git a/client/src/lib/videoGenParams.js b/client/src/lib/videoGenParams.js
index 1d22db4429..b050ef7857 100644
--- a/client/src/lib/videoGenParams.js
+++ b/client/src/lib/videoGenParams.js
@@ -69,17 +69,30 @@ export const normalizeFramesForModel = (value, model) => isValidFrameCountForMod
: nearestOption(value, frameOptionsForModel(model));
export const normalizeFpsForModel = (value, model) => nearestOption(value, fpsOptionsForModel(model));
-// One capability predicate for both the Advanced audio controls and prompt
-// shaping. A model that cannot disable its jointly-generated audio (MiniMax
-// H3) also cannot honor LTX's "No music" prompt-envelope control; hidden state
-// must never continue altering the payload after a model switch.
+// Muting and prompt-audio steering are separate capabilities. Hidden mute state
+// from a prior model must never alter a model (such as MiniMax H3) whose joint
+// audio track cannot be disabled.
export const supportsVideoAudioControls = (model) => model?.supportsDisableAudio !== false;
+// Prompt steering is independent from muting. MiniMax H3 always emits a joint
+// audio track, but its documented prompt format explicitly supports
+// soundscape/music direction, so "No music" remains useful even though the
+// Disable audio checkbox must stay hidden.
+export const supportsVideoAudioPromptControls = (model) => model?.supportsAudioPrompting !== false;
// Per-edge bounds for video: mirrors the videoGen route (64..2048) and the
// server's floor-to-multiple-of-64 (generateVideo in local.js). Shared by the
// ResolutionField control and the submit-time clamp so a hand-typed / mid-edit
// value can never POST an out-of-range or 0 dimension.
export const VIDEO_EDGE_BOUNDS = { min: 64, max: 2048, step: 64 };
+export const videoEdgeBoundsForModel = (model) => {
+ const step = Number(model?.resolutionStep);
+ return {
+ ...VIDEO_EDGE_BOUNDS,
+ step: Number.isInteger(step) && step > 0 && step <= VIDEO_EDGE_BOUNDS.step
+ ? step
+ : VIDEO_EDGE_BOUNDS.step,
+ };
+};
// Resolve a video model's memory footprint in GB. Prefers the explicit
// `memoryGb` field, falling back to a "~NN GB/GiB" hint in the display name, then
diff --git a/client/src/lib/videoGenParams.test.js b/client/src/lib/videoGenParams.test.js
index e20b557bd0..8312d81ade 100644
--- a/client/src/lib/videoGenParams.test.js
+++ b/client/src/lib/videoGenParams.test.js
@@ -1,10 +1,10 @@
import { describe, it, expect } from 'vitest';
import {
videoModelMemoryGb, computeFflfSafeFrames, isModelAllowedForMode,
- VIDEO_EDGE_BOUNDS, FRAME_OPTIONS, FPS_OPTIONS,
+ VIDEO_EDGE_BOUNDS, videoEdgeBoundsForModel, FRAME_OPTIONS, FPS_OPTIONS,
WAN_FRAME_OPTIONS, frameOptionsForModel, fpsOptionsForModel,
normalizeFramesForModel, normalizeFpsForModel,
- supportsVideoAudioControls,
+ supportsVideoAudioControls, supportsVideoAudioPromptControls,
IC_LORA_MODES, IC_LORA_MODE_VALUES, isIcLoraMode, icLoraSpecForMode,
icResolutionIssue,
} from './videoGenParams.js';
@@ -90,6 +90,8 @@ describe('isModelAllowedForMode', () => {
describe('constants', () => {
it('VIDEO_EDGE_BOUNDS mirrors the server 64..2048 grid', () => {
expect(VIDEO_EDGE_BOUNDS).toEqual({ min: 64, max: 2048, step: 64 });
+ expect(videoEdgeBoundsForModel({ resolutionStep: 32 })).toEqual({ min: 64, max: 2048, step: 32 });
+ expect(videoEdgeBoundsForModel({ resolutionStep: 0 })).toEqual(VIDEO_EDGE_BOUNDS);
});
it('frame/fps option lists are on the expected boundaries', () => {
expect(FRAME_OPTIONS[0]).toBe(25);
@@ -114,9 +116,11 @@ describe('constants', () => {
expect(normalizeFramesForModel(140, h3)).toBe(141);
expect(normalizeFpsForModel(30, h3)).toBe(24);
});
- it('uses one explicit capability for visible and submitted audio controls', () => {
+ it('keeps muting separate from prompt-audio steering', () => {
expect(supportsVideoAudioControls({ runtime: 'mlx_video' })).toBe(true);
expect(supportsVideoAudioControls({ supportsDisableAudio: false })).toBe(false);
+ expect(supportsVideoAudioPromptControls({ supportsDisableAudio: false })).toBe(true);
+ expect(supportsVideoAudioPromptControls({ supportsAudioPrompting: false })).toBe(false);
});
});
@@ -182,4 +186,3 @@ describe('IC-LoRA remix modes (#3100)', () => {
expect(icLoraSpecForMode('ic-colorize').uploadLabel).toMatch(/B&W/);
});
});
-
diff --git a/client/src/lib/videoGenResolutions.js b/client/src/lib/videoGenResolutions.js
index 0ddc07010d..fb5176be9e 100644
--- a/client/src/lib/videoGenResolutions.js
+++ b/client/src/lib/videoGenResolutions.js
@@ -18,6 +18,27 @@ export const VIDEO_RESOLUTIONS = [
{ label: '768×768 (1:1)', w: 768, h: 768 },
];
+export const DEFAULT_VIDEO_RESOLUTION = { w: 768, h: 512 };
+
+// A few runtimes have a trained canvas that materially differs from LTX's
+// shared preset list. MiniMax H3, for example, expects a 768px short edge and
+// resolves 16:9 to 1344x768. Keep those options on the model registry (beside
+// its frame/fps capabilities) and fall back to the shared LTX-friendly list for
+// every existing/custom model that does not declare one.
+export const resolutionOptionsForModel = (model) => (
+ Array.isArray(model?.resolutionOptions) && model.resolutionOptions.length > 0
+ ? model.resolutionOptions
+ : VIDEO_RESOLUTIONS
+);
+
+export const defaultResolutionForModel = (model) => {
+ const width = Number(model?.defaultWidth);
+ const height = Number(model?.defaultHeight);
+ return width > 0 && height > 0
+ ? { w: width, h: height }
+ : { ...DEFAULT_VIDEO_RESOLUTION };
+};
+
// Pick the preset whose aspect ratio is closest to a source image's, so an I2V
// default doesn't cover-crop the subject out of a mismatched frame (the server
// resizes the source with force_original_aspect_ratio=increase,crop). Every
diff --git a/client/src/lib/videoGenResolutions.test.js b/client/src/lib/videoGenResolutions.test.js
index 56014e2ce1..e8b2b95772 100644
--- a/client/src/lib/videoGenResolutions.test.js
+++ b/client/src/lib/videoGenResolutions.test.js
@@ -1,5 +1,9 @@
import { describe, it, expect } from 'vitest';
-import { VIDEO_RESOLUTIONS, snapAspectToImage } from './videoGenResolutions.js';
+import {
+ VIDEO_RESOLUTIONS, DEFAULT_VIDEO_RESOLUTION,
+ resolutionOptionsForModel, defaultResolutionForModel,
+ snapAspectToImage,
+} from './videoGenResolutions.js';
describe('snapAspectToImage', () => {
it('snaps a 16:9 landscape source to the 16:9 preset', () => {
@@ -47,3 +51,22 @@ describe('snapAspectToImage', () => {
expect(snapAspectToImage(presets, 1920, 1080)).toEqual({ w: 1024, h: 576 });
});
});
+
+describe('model-specific video resolutions', () => {
+ const native = [{ label: '1344x768', w: 1344, h: 768 }];
+
+ it('uses declared native presets and dimensions', () => {
+ const model = {
+ resolutionOptions: native,
+ defaultWidth: 1344,
+ defaultHeight: 768,
+ };
+ expect(resolutionOptionsForModel(model)).toBe(native);
+ expect(defaultResolutionForModel(model)).toEqual({ w: 1344, h: 768 });
+ });
+
+ it('falls back to the shared Video Gen presets and default', () => {
+ expect(resolutionOptionsForModel({})).toBe(VIDEO_RESOLUTIONS);
+ expect(defaultResolutionForModel({})).toEqual(DEFAULT_VIDEO_RESOLUTION);
+ });
+});
diff --git a/client/src/pages/VideoGen.jsx b/client/src/pages/VideoGen.jsx
index dc3d74c154..5c47fc9a02 100644
--- a/client/src/pages/VideoGen.jsx
+++ b/client/src/pages/VideoGen.jsx
@@ -86,10 +86,10 @@ import {
listLorasFull,
} from '../services/api';
import LoraPicker from '../components/imageGen/LoraPicker';
-import { VIDEO_RESOLUTIONS } from '../lib/videoGenResolutions';
+import { VIDEO_RESOLUTIONS, resolutionOptionsForModel } from '../lib/videoGenResolutions';
import { GROK_VIDEO_DURATIONS, GROK_VIDEO_DEFAULT_DURATION } from '../lib/grokVideoClip.js';
import ResolutionField from '../components/media/ResolutionField';
-import { VIDEO_EDGE_BOUNDS, IC_LORA_MODES } from '../lib/videoGenParams.js';
+import { VIDEO_EDGE_BOUNDS, videoEdgeBoundsForModel, IC_LORA_MODES } from '../lib/videoGenParams.js';
import { finishTargetForRecord } from '../lib/videoFinish.js';
import { safeReadStorage, safeWriteStorage } from '../lib/safeStorage.js';
import useVideoModelTerms from '../hooks/useVideoModelTerms.js';
@@ -169,6 +169,8 @@ export default function VideoGen() {
icStrength, setIcStrength, icSkipStage2, setIcSkipStage2,
applyRemix, applyFinish, applyResumedParams, buildGeneratePayload,
} = useVideoGenForm({ models, status, availableLoras, grokEnabled });
+ const localResolutionOptions = resolutionOptionsForModel(currentModel);
+ const localResolutionBounds = videoEdgeBoundsForModel(currentModel);
// Restricted model terms are accepted per exact reviewed license id, and the
// acceptance is recorded server-side so it authorizes every other render
@@ -1084,17 +1086,18 @@ export default function VideoGen() {
)}
{/* Preset dropdown + free-form custom W×H for exact I2V sizing beyond
- the preset list. The server accepts 64..2048 and rounds each dim
- DOWN to the 64-grid, so an off-grid size renders at the next-lower
- multiple of 64 — ResolutionField's blur-snap reflects that. */}
+ the preset list. Most runners use the shared 64px grid; models
+ such as H3 declare their native 32px grid and trained presets. */}
<ResolutionField
- presets={VIDEO_RESOLUTIONS}
+ presets={localResolutionOptions}
width={width}
height={height}
onChange={handleResolutionChange}
- {...VIDEO_EDGE_BOUNDS}
+ {...localResolutionBounds}
snapOnBlur
- note="Each edge 64–2048px; the server rounds each down to the nearest multiple of 64."
+ note={currentModel?.runtime === 'minimax_h3'
+ ? 'H3 quality presets follow its trained 768px short-edge, area-capped canvas. Smaller custom sizes are off-distribution but useful for faster wiring tests; each edge snaps to 32px.'
+ : 'Each edge 64–2048px; the server rounds each down to the nearest multiple of 64.'}
/>
</div>
diff --git a/data.reference/media-models.json b/data.reference/media-models.json
index 7e7ed252f4..3a683af55d 100644
--- a/data.reference/media-models.json
+++ b/data.reference/media-models.json
@@ -91,6 +91,7 @@
],
"defaultFrames": 124,
"frameOptions": [
+ 107,
124,
141,
158,
@@ -110,6 +111,41 @@
"fpsOptions": [
24
],
+ "defaultWidth": 1344,
+ "defaultHeight": 768,
+ "resolutionStep": 32,
+ "resolutionOptions": [
+ {
+ "label": "1536x672 (21:9 H3 native)",
+ "w": 1536,
+ "h": 672
+ },
+ {
+ "label": "1344x768 (16:9 H3 default)",
+ "w": 1344,
+ "h": 768
+ },
+ {
+ "label": "1024x768 (4:3 H3 native)",
+ "w": 1024,
+ "h": 768
+ },
+ {
+ "label": "768x768 (1:1 H3 native)",
+ "w": 768,
+ "h": 768
+ },
+ {
+ "label": "768x1024 (3:4 H3 native)",
+ "w": 768,
+ "h": 1024
+ },
+ {
+ "label": "768x1344 (9:16 H3 native)",
+ "w": 768,
+ "h": 1344
+ }
+ ],
"memoryGb": 128,
"steps": 8,
"guidance": 0,
diff --git a/scripts/generate_minimax_h3.py b/scripts/generate_minimax_h3.py
index b913f60588..6c6a922fba 100644
--- a/scripts/generate_minimax_h3.py
+++ b/scripts/generate_minimax_h3.py
@@ -28,7 +28,7 @@ from _runner_common import emit_runtime_fingerprint, heartbeat, register_source_
FPS = 24
-MIN_FRAMES = 124 # first 17n+5 grid point at or above 5 seconds
+MIN_FRAMES = 107 # first 17n+5 grid point at or above the upstream 4-second minimum
MAX_FRAMES = 362 # first 17n+5 grid point at or above 15 seconds
FRAME_MODULUS = 17
FRAME_REMAINDER = 5
@@ -196,7 +196,7 @@ def validate_args(args: argparse.Namespace) -> None:
if args.width <= 0 or args.height <= 0 or args.width % 32 or args.height % 32:
raise SystemExit(f"MiniMax H3 dimensions must be positive multiples of 32; got {args.width}x{args.height}.")
if not MIN_FRAMES <= args.num_frames <= MAX_FRAMES:
- raise SystemExit(f"MiniMax H3 supports approximately 5-15 seconds ({MIN_FRAMES}-{MAX_FRAMES} aligned frames).")
+ raise SystemExit(f"MiniMax H3 supports approximately 4-15 seconds ({MIN_FRAMES}-{MAX_FRAMES} aligned frames).")
if args.num_frames % FRAME_MODULUS != FRAME_REMAINDER:
raise SystemExit(f"MiniMax H3 frame count must be 17n+5; got {args.num_frames}.")
if args.steps < 2:
diff --git a/scripts/generate_minimax_h3.test.js b/scripts/generate_minimax_h3.test.js
index 337690dba5..b7e93a4cd2 100644
--- a/scripts/generate_minimax_h3.test.js
+++ b/scripts/generate_minimax_h3.test.js
@@ -85,6 +85,16 @@ describe('generate_minimax_h3.py', () => {
expect(output).toMatch(/dimensions must be positive multiples of 32/i);
});
+ it('accepts the upstream 4-second aligned frame count and native 32px canvas grid', () => {
+ const output = runPython(`${importRunner}\n${[
+ 'from types import SimpleNamespace',
+ 'args = SimpleNamespace(fps=24, width=1536, height=672, num_frames=107, steps=8, lora=[], lora_scale=[], image=[], anchor=[])',
+ 'runner.validate_args(args)',
+ 'print("ok")',
+ ].join('\n')}`);
+ expect(output.trim()).toBe('ok');
+ });
+
// An unpaired or repeated anchor would silently mis-place a keyframe in the
// packed sequence, so both fail at the boundary rather than rendering.
it.each([
diff --git a/scripts/migrations/267-minimax-h3-native-output-controls.js b/scripts/migrations/267-minimax-h3-native-output-controls.js
new file mode 100644
index 0000000000..b294ac2c9a
--- /dev/null
+++ b/scripts/migrations/267-minimax-h3-native-output-controls.js
@@ -0,0 +1,76 @@
+/**
+ * Bring existing MiniMax H3 registry rows onto the model's published output
+ * contract. Fresh installs receive these values from data.reference.
+ *
+ * Conservative customization rules:
+ * - only the shipped PipeNetwork row is eligible;
+ * - frameOptions changes only when it is byte-for-byte the prior shipped list;
+ * - the native default-size pair is added only when both fields are absent;
+ * - other resolution fields are added individually only when absent, so an
+ * explicit custom value (including an empty options list) remains user-owned.
+ */
+
+import { readMediaRegistry, writeMediaRegistry } from './_lib.js';
+
+const REL_PATH = 'data/media-models.json';
+const H3_ID = 'minimax_h3_8bit';
+const SHIPPED_REPO = 'pipenetwork/MiniMax-H3-MLX-8bit';
+const OLD_FRAME_OPTIONS = [124, 141, 158, 175, 192, 209, 226, 243, 260, 277, 294, 311, 328, 345, 362];
+const NEW_FRAME_OPTIONS = [107, ...OLD_FRAME_OPTIONS];
+const NATIVE_RESOLUTIONS = [
+ { label: '1536x672 (21:9 H3 native)', w: 1536, h: 672 },
+ { label: '1344x768 (16:9 H3 default)', w: 1344, h: 768 },
+ { label: '1024x768 (4:3 H3 native)', w: 1024, h: 768 },
+ { label: '768x768 (1:1 H3 native)', w: 768, h: 768 },
+ { label: '768x1024 (3:4 H3 native)', w: 768, h: 1024 },
+ { label: '768x1344 (9:16 H3 native)', w: 768, h: 1344 },
+];
+
+const sameValues = (left, right) => (
+ Array.isArray(left)
+ && left.length === right.length
+ && left.every((value, index) => value === right[index])
+);
+
+export default {
+ async up({ rootDir }) {
+ const { ok, config, entries: macos, path } = await readMediaRegistry({ rootDir });
+ if (!ok) return;
+
+ const entry = macos.find((model) => model?.id === H3_ID);
+ if (!entry) {
+ console.log(`✅ ${REL_PATH}: no '${H3_ID}' entry — user removed it, nothing to migrate`);
+ return;
+ }
+ if (entry.repo !== SHIPPED_REPO) {
+ console.log(`✅ ${REL_PATH}: '${H3_ID}' points at ${entry.repo} — user-repointed, leaving it alone`);
+ return;
+ }
+
+ let changed = false;
+ if (sameValues(entry.frameOptions, OLD_FRAME_OPTIONS)) {
+ entry.frameOptions = [...NEW_FRAME_OPTIONS];
+ changed = true;
+ }
+ if (!Object.hasOwn(entry, 'defaultWidth') && !Object.hasOwn(entry, 'defaultHeight')) {
+ entry.defaultWidth = 1344;
+ entry.defaultHeight = 768;
+ changed = true;
+ }
+ if (!Object.hasOwn(entry, 'resolutionStep')) {
+ entry.resolutionStep = 32;
+ changed = true;
+ }
+ if (!Object.hasOwn(entry, 'resolutionOptions')) {
+ entry.resolutionOptions = structuredClone(NATIVE_RESOLUTIONS);
+ changed = true;
+ }
+
+ if (changed) {
+ await writeMediaRegistry(path, config);
+ console.log(`📝 ${REL_PATH}: added MiniMax H3's 4-second option and native 768p canvases`);
+ } else {
+ console.log(`✅ ${REL_PATH}: MiniMax H3 output controls already current or customized`);
+ }
+ },
+};
diff --git a/scripts/migrations/267-minimax-h3-native-output-controls.test.js b/scripts/migrations/267-minimax-h3-native-output-controls.test.js
new file mode 100644
index 0000000000..2d0a99accc
--- /dev/null
+++ b/scripts/migrations/267-minimax-h3-native-output-controls.test.js
@@ -0,0 +1,112 @@
+import { describe, it, expect, beforeEach, afterEach } from 'vitest';
+import { mkdtempSync, readFileSync, rmSync, writeFileSync, mkdirSync } from 'fs';
+import { tmpdir } from 'os';
+import { dirname, join } from 'path';
+import { fileURLToPath } from 'url';
+import migration from './267-minimax-h3-native-output-controls.js';
+
+const H3_ID = 'minimax_h3_8bit';
+const REFERENCE_PATH = join(
+ dirname(fileURLToPath(import.meta.url)), '..', '..', 'data.reference', 'media-models.json',
+);
+const OLD_FRAMES = [124, 141, 158, 175, 192, 209, 226, 243, 260, 277, 294, 311, 328, 345, 362];
+const h3 = () => ({
+ id: H3_ID,
+ repo: 'pipenetwork/MiniMax-H3-MLX-8bit',
+ defaultFrames: 124,
+ frameOptions: [...OLD_FRAMES],
+});
+const registryWith = (entry) => ({
+ video: { macos: entry ? [entry] : [], windows: [] },
+ image: [],
+});
+const writeJson = (path, value) => writeFileSync(path, `${JSON.stringify(value, null, 2)}\n`);
+const readJson = (path) => JSON.parse(readFileSync(path, 'utf-8'));
+
+describe('migration 267 — MiniMax H3 native output controls', () => {
+ let rootDir;
+ let path;
+
+ beforeEach(() => {
+ rootDir = mkdtempSync(join(tmpdir(), 'migration-267-'));
+ mkdirSync(join(rootDir, 'data'), { recursive: true });
+ path = join(rootDir, 'data', 'media-models.json');
+ });
+
+ afterEach(() => rmSync(rootDir, { recursive: true, force: true }));
+
+ it('adds the 4-second grid point and exact native canvas contract', async () => {
+ writeJson(path, registryWith(h3()));
+ await migration.up({ rootDir });
+
+ const migrated = readJson(path).video.macos[0];
+ expect(migrated.defaultFrames).toBe(124);
+ expect(migrated.frameOptions).toEqual([107, ...OLD_FRAMES]);
+ expect(migrated).toMatchObject({
+ defaultWidth: 1344,
+ defaultHeight: 768,
+ resolutionStep: 32,
+ });
+ expect(migrated.resolutionOptions).toEqual([
+ { label: '1536x672 (21:9 H3 native)', w: 1536, h: 672 },
+ { label: '1344x768 (16:9 H3 default)', w: 1344, h: 768 },
+ { label: '1024x768 (4:3 H3 native)', w: 1024, h: 768 },
+ { label: '768x768 (1:1 H3 native)', w: 768, h: 768 },
+ { label: '768x1024 (3:4 H3 native)', w: 768, h: 1024 },
+ { label: '768x1344 (9:16 H3 native)', w: 768, h: 1344 },
+ ]);
+ const seeded = JSON.parse(readFileSync(REFERENCE_PATH, 'utf-8'))
+ .video.macos.find((entry) => entry.id === H3_ID);
+ expect({
+ defaultFrames: migrated.defaultFrames,
+ frameOptions: migrated.frameOptions,
+ defaultWidth: migrated.defaultWidth,
+ defaultHeight: migrated.defaultHeight,
+ resolutionStep: migrated.resolutionStep,
+ resolutionOptions: migrated.resolutionOptions,
+ }).toEqual({
+ defaultFrames: seeded.defaultFrames,
+ frameOptions: seeded.frameOptions,
+ defaultWidth: seeded.defaultWidth,
+ defaultHeight: seeded.defaultHeight,
+ resolutionStep: seeded.resolutionStep,
+ resolutionOptions: seeded.resolutionOptions,
+ });
+ });
+
+ it('is idempotent', async () => {
+ writeJson(path, registryWith(h3()));
+ await migration.up({ rootDir });
+ const once = readJson(path);
+ await migration.up({ rootDir });
+ expect(readJson(path)).toEqual(once);
+ });
+
+ it('preserves customized frames and resolution fields', async () => {
+ const custom = {
+ ...h3(),
+ frameOptions: [124, 243],
+ defaultWidth: 1024,
+ defaultHeight: 576,
+ resolutionStep: 64,
+ resolutionOptions: [],
+ };
+ writeJson(path, registryWith(custom));
+ await migration.up({ rootDir });
+ expect(readJson(path)).toEqual(registryWith(custom));
+ });
+
+ it('skips a user-repointed or deleted entry and a missing registry', async () => {
+ const forked = { ...h3(), repo: 'example-org/h3-fork' };
+ writeJson(path, registryWith(forked));
+ await migration.up({ rootDir });
+ expect(readJson(path)).toEqual(registryWith(forked));
+
+ writeJson(path, registryWith(null));
+ await migration.up({ rootDir });
+ expect(readJson(path)).toEqual(registryWith(null));
+
+ rmSync(path);
+ await expect(migration.up({ rootDir })).resolves.toBeUndefined();
+ });
+});
diff --git a/server/lib/mediaModels.js b/server/lib/mediaModels.js
index 9dbcd11c92..90ea472a0b 100644
--- a/server/lib/mediaModels.js
+++ b/server/lib/mediaModels.js
@@ -9,6 +9,9 @@
*
* Schema (see seed defaults below for the full picture):
* - video.macos[], video.windows[]: { id, name, repo?, steps, guidance, broken?, disclosure? }
+ * Models may also declare `defaultWidth` / `defaultHeight`,
+ * `resolutionStep`, and `resolutionOptions[]` when their native canvas
+ * differs from the shared Video Gen presets.
* `disclosure` is optional provenance/licensing metadata (issue #3674):
* { modelCardUrl?, weightsLicense?: { name, url }, runtimeLicense?: { name, url },
* estimatedDownloadGb?, reviewedAt? }. Every key is optional and an
@@ -88,9 +91,28 @@ const DEFAULT_REGISTRY = {
// at the first / last latent frame. 'image' anchors one at 'first',
// 'fflf' anchors both.
supportedModes: ['text', 'image', 'fflf'],
+ // The upstream model supports 4-15 seconds. H3's VAE snaps duration
+ // UP to a 17n+5 frame grid, so 4s becomes 107 frames and the port's
+ // recommended 5s default becomes 124. Keep the shortest recommended
+ // run as the default: dense attention already makes it a multi-hour
+ // render on current Apple Silicon.
defaultFrames: 124,
- frameOptions: [124, 141, 158, 175, 192, 209, 226, 243, 260, 277, 294, 311, 328, 345, 362],
+ frameOptions: [107, 124, 141, 158, 175, 192, 209, 226, 243, 260, 277, 294, 311, 328, 345, 362],
fpsOptions: [24],
+ // H3-Base was trained on a native 768px short edge. Its canvas resolver
+ // caps area at 768x1344 and rounds each edge to 32px; these are the
+ // exact outputs for the aspect ratios MiniMax documents.
+ defaultWidth: 1344,
+ defaultHeight: 768,
+ resolutionStep: 32,
+ resolutionOptions: [
+ { label: '1536x672 (21:9 H3 native)', w: 1536, h: 672 },
+ { label: '1344x768 (16:9 H3 default)', w: 1344, h: 768 },
+ { label: '1024x768 (4:3 H3 native)', w: 1024, h: 768 },
+ { label: '768x768 (1:1 H3 native)', w: 768, h: 768 },
+ { label: '768x1024 (3:4 H3 native)', w: 768, h: 1024 },
+ { label: '768x1344 (9:16 H3 native)', w: 768, h: 1344 },
+ ],
memoryGb: 128,
steps: 8,
guidance: 0,
diff --git a/server/lib/mediaModels.test.js b/server/lib/mediaModels.test.js
index 7cb064b7ad..5c2f47209c 100644
--- a/server/lib/mediaModels.test.js
+++ b/server/lib/mediaModels.test.js
@@ -66,12 +66,23 @@ describe('mediaModels registry', () => {
revision: '3ac52081470b0488921c3ec3ba84a39097bf2361',
supportedModes: ['text', 'image', 'fflf'],
defaultFrames: 124,
+ defaultWidth: 1344,
+ defaultHeight: 768,
+ resolutionStep: 32,
fpsOptions: [24],
memoryGb: 128,
samplerLocked: true,
steps: 8,
});
- expect(h3.frameOptions).toEqual([124, 141, 158, 175, 192, 209, 226, 243, 260, 277, 294, 311, 328, 345, 362]);
+ expect(h3.frameOptions).toEqual([107, 124, 141, 158, 175, 192, 209, 226, 243, 260, 277, 294, 311, 328, 345, 362]);
+ expect(h3.resolutionOptions).toEqual([
+ { label: '1536x672 (21:9 H3 native)', w: 1536, h: 672 },
+ { label: '1344x768 (16:9 H3 default)', w: 1344, h: 768 },
+ { label: '1024x768 (4:3 H3 native)', w: 1024, h: 768 },
+ { label: '768x768 (1:1 H3 native)', w: 768, h: 768 },
+ { label: '768x1024 (3:4 H3 native)', w: 768, h: 1024 },
+ { label: '768x1344 (9:16 H3 native)', w: 768, h: 1344 },
+ ]);
expect(h3.requiredWeights[0]).toMatchObject({
repo: 'MiniMaxAI/MiniMax-H3',
revision: '6818f6c32d12b210915e44ad56a4228c2608f160',
diff --git a/server/services/videoGen/local.js b/server/services/videoGen/local.js
index daf571d377..750df332e1 100644
--- a/server/services/videoGen/local.js
+++ b/server/services/videoGen/local.js
@@ -664,7 +664,7 @@ const buildMiniMaxH3Args = ({ model, prompt, negativePrompt, width, height, numF
}
if (!Array.isArray(model.frameOptions) || !model.frameOptions.includes(Number(numFrames))) {
throw new ServerError(
- `MiniMax H3 requires a 17n+5 frame count between 124 and 362; got ${numFrames}.`,
+ `MiniMax H3 requires a 17n+5 frame count between 107 and 362; got ${numFrames}.`,
{ status: 400, code: 'MINIMAX_H3_INVALID_FRAME_COUNT' },
);
}
@@ -891,7 +891,7 @@ export const DEFAULT_NUM_FRAMES = 121;
// a still regardless of how many frames carry it.
export const IC_STILL_REFERENCE_FRAMES = 9;
-export async function generateVideo({ pythonPath, prompt, negativePrompt = '', modelId = defaultVideoModelId(), width = 768, height = 512, numFrames = null, fps = 24, steps, guidanceScale, seed, tiling = 'auto', disableAudio = false, sourceImagePath = null, uploadedTempPath = null, uploadedTempPaths = [], lastImagePath = null, keyframes = null, extendFromVideoPath = null, audioFilePath = null, audioStartSec = null, mode = null, imageStrength = null, loras = null, icReferencePaths = null, icStrength = null, icAttentionStrength = null, icSkipStage2 = false, hidden = false, jobId: providedJobId = null }) {
+export async function generateVideo({ pythonPath, prompt, negativePrompt = '', modelId = defaultVideoModelId(), width = null, height = null, numFrames = null, fps = 24, steps, guidanceScale, seed, tiling = 'auto', disableAudio = false, sourceImagePath = null, uploadedTempPath = null, uploadedTempPaths = [], lastImagePath = null, keyframes = null, extendFromVideoPath = null, audioFilePath = null, audioStartSec = null, mode = null, imageStrength = null, loras = null, icReferencePaths = null, icStrength = null, icAttentionStrength = null, icSkipStage2 = false, hidden = false, jobId: providedJobId = null }) {
uploadedTempPaths = Array.isArray(uploadedTempPaths) ? uploadedTempPaths : [];
if (!prompt?.trim()) throw new ServerError('Prompt is required', { status: 400, code: 'VALIDATION_ERROR' });
// Single-flight is now enforced by the mediaJobQueue worker upstream — only
@@ -934,6 +934,8 @@ export async function generateVideo({ pythonPath, prompt, negativePrompt = '', m
audioStartSec,
icReferencePaths,
});
+ width = width ?? model.defaultWidth ?? 768;
+ height = height ?? model.defaultHeight ?? 512;
numFrames = numFrames ?? model.defaultFrames ?? DEFAULT_NUM_FRAMES;
let wanModelPath = null;
const wanRequiredWeights = [];
@@ -1040,8 +1042,17 @@ export async function generateVideo({ pythonPath, prompt, negativePrompt = '', m
const jobId = providedJobId || randomUUID();
const filename = `${jobId}.mp4`;
const outputPath = join(PATHS.videos, filename);
- const w = Math.floor(Number(width) / 64) * 64;
- const h = Math.floor(Number(height) / 64) * 64;
+ // Most local runners use PortOS's shared 64px grid. H3's released canvas
+ // resolver is explicitly 32px-aligned, including its native 21:9 height of
+ // 672px; honor a model-declared step so that valid preset is not silently
+ // floored to 640px at the final execution boundary.
+ const declaredResolutionStep = Number(model.resolutionStep);
+ const resolutionStep = Number.isInteger(declaredResolutionStep)
+ && declaredResolutionStep > 0 && declaredResolutionStep <= 64
+ ? declaredResolutionStep
+ : 64;
+ const w = Math.floor(Number(width) / resolutionStep) * resolutionStep;
+ const h = Math.floor(Number(height) / resolutionStep) * resolutionStep;
const actualSeed = seed != null && seed !== '' ? Number(seed) : Math.floor(Math.random() * 2147483647);
let actualSteps = model.samplerLocked ? model.steps : (steps ? Number(steps) : model.steps);
let actualGuidance = model.samplerLocked
diff --git a/server/services/videoGen/local.test.js b/server/services/videoGen/local.test.js
index 9a107a0dc2..76ef2194ad 100644
--- a/server/services/videoGen/local.test.js
+++ b/server/services/videoGen/local.test.js
@@ -56,7 +56,8 @@ vi.mock('../../lib/mediaModels.js', () => ({
repo: 'pipenetwork/MiniMax-H3-MLX-8bit',
revision: '3ac52081470b0488921c3ec3ba84a39097bf2361',
supportedModes: ['text', 'image', 'fflf'], defaultFrames: 124,
- frameOptions: [124, 141, 158], fpsOptions: [24],
+ frameOptions: [107, 124, 141, 158], fpsOptions: [24],
+ defaultWidth: 1344, defaultHeight: 768, resolutionStep: 32,
steps: 8, guidance: 0, samplerLocked: true,
termsGate: { id: 'minimax-h3-community-license-2026-08-02' },
requiredWeights: [{
@@ -2135,7 +2136,7 @@ describe('generateVideo — MiniMax H3 MLX contract', () => {
modelId: 'minimax_h3_8bit',
prompt: 'a fox watches the rain',
- width: 512, height: 320, numFrames: 141, fps: 24,
+ width: 1536, height: 672, numFrames: 107, fps: 24,
steps: 99, guidanceScale: 12, mode: 'text',
});
} finally {
@@ -2155,6 +2156,9 @@ describe('generateVideo — MiniMax H3 MLX contract', () => {
expect(args[args.indexOf('--runtime-revision') + 1]).toBe('fcd9e9b79a1d6018d91ac477c0968de1fa067e49');
expect(args[args.indexOf('--checkpoint-repo') + 1]).toBe('MiniMaxAI/MiniMax-H3');
expect(args[args.indexOf('--checkpoint-revision') + 1]).toBe('6818f6c32d12b210915e44ad56a4228c2608f160');
+ expect(args[args.indexOf('--width') + 1]).toBe('1536');
+ expect(args[args.indexOf('--height') + 1]).toBe('672');
+ expect(args[args.indexOf('--num-frames') + 1]).toBe('107');
expect(args[args.indexOf('--steps') + 1]).toBe('8');
expect(args.flatMap((arg, i) => arg === '--checkpoint-file' ? [args[i + 1]] : []))
.toEqual(['LICENSE', 'FL2VA/vae/video/config.json']);
@@ -2169,6 +2173,26 @@ describe('generateVideo — MiniMax H3 MLX contract', () => {
expect(options.env).not.toHaveProperty('HUGGING_FACE_HUB_TOKEN');
expect(hfChildEnv).not.toHaveBeenCalled();
});
+
+ it('uses H3 native dimensions when an internal caller omits resolution', async () => {
+ const { spawnDetached } = await import('../../lib/detachedSpawn.js');
+ const spawnMock = vi.mocked(spawnDetached);
+ spawnMock.mockClear();
+
+ await generateVideo({
+ jobId: 'h3-native-default',
+ modelId: 'minimax_h3_8bit',
+ prompt: 'a fox watches the rain',
+ mode: 'text',
+ });
+
+ const [, args] = spawnMock.mock.calls.find(([, childArgs]) => (
+ Array.isArray(childArgs) && childArgs.some((arg) => String(arg).endsWith('/generate_minimax_h3.py'))
+ ));
+ expect(args[args.indexOf('--width') + 1]).toBe('1344');
+ expect(args[args.indexOf('--height') + 1]).toBe('768');
+ expect(args[args.indexOf('--num-frames') + 1]).toBe('124');
+ });
});
// H3's DiT is quantized, so LoRAs ride along only if the installed runner
diff --git a/server/services/videoGen/prepareParams.js b/server/services/videoGen/prepareParams.js
index eb207933aa..0f713dd634 100644
--- a/server/services/videoGen/prepareParams.js
+++ b/server/services/videoGen/prepareParams.js
@@ -462,7 +462,7 @@ async function resolvePreparedParams({
if (!Array.isArray(effectiveModel.frameOptions) || !effectiveModel.frameOptions.includes(frames)) {
await cleanupStaged();
throw new ServerError(
- `MiniMax H3 requires a 17n+5 frame count between 124 and 362; got ${frames}.`,
+ `MiniMax H3 requires a 17n+5 frame count between 107 and 362; got ${frames}.`,
{ status: 400, code: 'MINIMAX_H3_INVALID_FRAME_COUNT' },
);
}
diff --git a/server/services/videoGen/prepareParams.test.js b/server/services/videoGen/prepareParams.test.js
index 2c3657e437..4f480e292d 100644
--- a/server/services/videoGen/prepareParams.test.js
+++ b/server/services/videoGen/prepareParams.test.js
@@ -72,7 +72,7 @@ const H3_MODEL = {
runtime: 'minimax_h3',
supportedModes: ['text', 'image', 'fflf'],
defaultFrames: 124,
- frameOptions: [124, 141, 158],
+ frameOptions: [107, 124, 141, 158],
fpsOptions: [24],
termsGate: { id: H3_TERMS },
};