calesthio/OpenMontage · error · ValueError

all local reference audio clips together must be at most {ma

Error message

all local reference audio clips together must be at most {max_reference_seconds} seconds

What it means

Raised when the actual decoded durations of local/file or data-URI audio refs (measured via _local_or_data_audio_duration) sum above the model's total budget (15s standard, 30s on 2.5). Unlike the durations-hint checks, this inspects the real files, so it fires even without reference_audio_durations.

Source

Thrown at tools/video/seedance_ark.py:852

                    sum(float(value) for value in audio_durations)
                    > max_reference_seconds
                ):
                    raise ValueError(
                        "all reference audio clips together must be at most "
                        f"{max_reference_seconds} seconds"
                    )
            local_audio_durations = [
                duration
                for ref in audio_refs
                if (
                    duration := self._local_or_data_audio_duration(
                        str(ref), max_seconds=max_reference_seconds
                    )
                )
                is not None
            ]
            if sum(local_audio_durations) > max_reference_seconds:
                raise ValueError(
                    "all local reference audio clips together must be at "
                    f"most {max_reference_seconds} seconds"
                )
            if audio_refs and not (image_refs or video_refs):
                raise ValueError(
                    "reference audio requires at least one reference image or video"
                )
            if not (image_refs or video_refs):
                raise ValueError(
                    "reference_to_video requires at least one image or video"
                )

            content.extend(
                self._image_content(ref, role="reference_image") for ref in image_refs
            )
            content.extend(
                {
                    "type": "video_url",

View on GitHub (pinned to 95e1c3d0ab)

Solutions

  1. Trim local audio files (e.g. with ffmpeg -t) so total referenced audio is within 15s (30s on 2.5)
  2. Reduce the number of local clips referenced
  3. Use model_variant='2.5' when longer combined audio is required

Example fix

# before: two 10s local clips, standard variant
inputs = {"reference_audio_paths": ["a.wav", "b.wav"]}

# after
subprocess.run(["ffmpeg", "-y", "-i", "a.wav", "-t", "7", "a7.wav"])
subprocess.run(["ffmpeg", "-y", "-i", "b.wav", "-t", "8", "b8.wav"])
inputs = {"reference_audio_paths": ["a7.wav", "b8.wav"]}
Defensive patterns

Strategy: validation

Validate before calling

import subprocess

def probe_seconds(path: str) -> float:
    out = subprocess.run(["ffprobe", "-v", "error", "-show_entries",
                          "format=duration", "-of", "csv=p=0", path],
                         capture_output=True, text=True, check=True).stdout.strip()
    return float(out)

max_s = 30 if str(inputs.get("model_variant", "standard")).lower() == "2.5" else 15
local = [r for r in audio_refs if not str(r).startswith(("http://", "https://"))]
assert sum(probe_seconds(r) for r in local) <= max_s

Prevention

When it happens

Trigger: Passing local paths or data: URIs in reference_audio_paths/url whose probed lengths total more than 15 (or 30) seconds.

Common situations: Believing that omitting reference_audio_durations bypasses duration limits; long local music files referenced for mood; the hint list passing while the real files exceed the cap.

Related errors


AI-assisted analysis of calesthio/OpenMontage@95e1c3d0ab (2026-08-15). Data as JSON: /api/errors/6d9bfdb53026524e. Report an issue: GitHub.