invoke-ai/InvokeAI · error · ValueError

Concatenation produced zero output frames.

Error message

Concatenation produced zero output frames.

What it means

After encoding, video_concat checks that at least one frame was written. If the writer loop appended zero frames (e.g. all inputs were empty or unreadable), it raises ValueError rather than emitting a corrupt/empty MP4.

Source

Thrown at invokeai/app/invocations/video_concat.py:160

        tmp = tempfile.NamedTemporaryFile(prefix="invokeai_video_concat_", suffix=".mp4", delete=False)
        tmp.close()
        tmp_path = Path(tmp.name)
        try:
            # Frames stream from the decoders straight into the encoder; only the
            # transition windows are buffered. See _iter_joined_frames.
            writer = make_mp4_writer(tmp_path, output_fps)
            num_frames = 0
            try:
                clip_iters = [iter_video_frames(p, is_canceled=context.util.is_canceled) for p in paths]
                for frame in self._iter_joined_frames(clip_iters, is_canceled=context.util.is_canceled):
                    writer.append_data(frame)
                    num_frames += 1
            finally:
                writer.close()

            if num_frames == 0:
                raise ValueError("Concatenation produced zero output frames.")

            duration = num_frames / output_fps
            context.logger.info(
                f"Encoded concatenated MP4: {num_frames} frames @ {output_fps:.2f} fps "
                f"({duration:.2f}s) at {width}x{height}"
            )
            video_dto = context.videos.save(
                source_path=tmp_path,
                width=width,
                height=height,
                duration=duration,
                fps=output_fps,
            )
            context.logger.info(f"Saved concatenated video: {video_dto.video_name}")
            return VideoOutput.build(video_dto)
        finally:
            try:
                tmp_path.unlink(missing_ok=True)

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Verify each input video plays and has frames (ffprobe -count_frames) before concatenating
  2. Regenerate or re-export the upstream video nodes
  3. Replace corrupt input files
Defensive patterns

Strategy: validation

Validate before calling

for p in paths:
    n = count_frames(p)  # e.g. ffprobe -count_frames -select_streams v:0 -show_entries stream=nb_read_frames
    if n == 0:
        raise ValueError(f"input {p} has zero frames; regenerate before concat")

Type guard

def has_frames(path) -> bool:
    return count_frames(path) > 0

Try / catch

try:
    output = concat.invoke(context)
except ValueError as e:
    if "zero output frames" in str(e):
        regenerate_upstream_videos()
        output = concat.invoke(context)
    else:
        raise

Prevention

When it happens

Trigger: All input video files exist but contain zero decodable frames (empty/corrupt files), so the per-frame read loops never append data and num_frames stays 0.

Common situations: Upstream video generation produced empty files; truncated downloads; container metadata present but no frames; disk issues during writes.

Related errors


AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29). Data as JSON: /api/errors/cf859fd9109e9a23. Report an issue: GitHub.