microsoft/VibeVoice · error · RuntimeError

Failed to load audio

Error message

Failed to load audio: {e}

What it means

Catch-all wrapper in the demo's ffmpeg loader: any exception raised inside load_audio (including the 'ffmpeg returned empty audio data' RuntimeError at line 219, or np.frombuffer/min/max errors on malformed output) is re-raised as RuntimeError('Failed to load audio: {e}'). The original exception text is preserved as the suffix, so read the tail of the message to find the root cause.

Solutions

  1. Read the text after 'Failed to load audio:' — it names the actual inner failure; fix that root cause (e.g. 'ffmpeg returned empty audio data' means see that error).
  2. Validate the uploaded file before decode: exists, non-zero size, has an audio stream via ffprobe.
  3. Convert problematic uploads to 24 kHz mono wav before feeding the demo.
  4. If building on this script, re-raise with traceback (raise ... from e) to keep the original stack.

Example fix

# before
except Exception as e:
    raise RuntimeError(f"Failed to load audio: {e}")

# after
except Exception as e:
    raise RuntimeError(f"Failed to load audio: {e}") from e  # keep original stack for diagnosis
Defensive patterns

Strategy: try-catch

Validate before calling

import os

def can_load(path: str) -> bool:
    return os.path.isfile(path) and os.path.getsize(path) > 0

Try / catch

try:
    audio_data, sr = load_audio(path)
except RuntimeError as e:
    msg = str(e)
    if "empty audio data" in msg:
        handle_empty_or_silent(path)        # re-encode or reject file
    elif "No such file" in msg or "not exist" in msg:
        fix_path_and_retry(path)            # path resolution bug
    else:
        raise                                # unknown cause: surface it

Prevention

When it happens

Trigger: Any failure of the ffmpeg subprocess decode path: empty output (inner line-219 error), file-not-found on the input path, numpy errors from truncated float32 buffers, or OSError on malformed path objects — all surface here.

Common situations: Gradio demo uploads of corrupt/unsupported media; path handling bugs (relative paths resolved against the server's cwd); transient failures from partially-uploaded files in the UI.

Related errors


AI-assisted analysis of microsoft/VibeVoice@94da20d98b (2026-08-15). Data as JSON: /api/errors/1eff278872271bab. Report an issue: GitHub.

Appendix: source

Thrown at vllm_plugin/scripts/gradio_asr_demo_api_video.py:225

        ]
        process = subprocess.Popen(
            cmd, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL
        )
        audio_bytes, _ = process.communicate()
        audio_data = np.frombuffer(audio_bytes, dtype=np.float32)
        
        print(f"[DEBUG] ffmpeg loaded: shape={audio_data.shape}, sr={target_sr}")
        print(f"[DEBUG] audio range: min={audio_data.min():.6f}, max={audio_data.max():.6f}")
        
        # Check for silent audio
        if len(audio_data) == 0:
            raise RuntimeError("ffmpeg returned empty audio data")
        if audio_data.max() == 0 and audio_data.min() == 0:
            print(f"[WARNING] Audio appears to be completely silent!")
        
        return audio_data, target_sr
    except Exception as e:
        raise RuntimeError(f"Failed to load audio: {e}")


def get_file_size_mb(file_path: str) -> float:
    """Get file size in MB."""
    try:
        return os.path.getsize(file_path) / (1024 * 1024)
    except Exception:
        return 0.0


def is_video_file(file_path: str) -> bool:
    """Check if the file is a video file based on extension."""
    ext = os.path.splitext(file_path)[1].lower()
    return ext in COMMON_VIDEO_EXTS


def format_srt_time(seconds: float) -> str:
    """Convert seconds to SRT time format (HH:MM:SS,mmm)."""

View on GitHub (pinned to 94da20d98b)