harry0703/MoneyPrinterTurbo · error · ElevenLabsMusicError

ElevenLabs video proxy is empty or exceeds the 200 MB limit

Error message

ElevenLabs video proxy is empty or exceeds the 200 MB limit

What it means

ElevenLabsMusicError raised after a successful FFmpeg run when the produced proxy is missing/0 bytes or exceeds MAX_PROXY_BYTES (200 MB, app/services/elevenlabs_music.py:23). The upload endpoint rejects oversized videos, so the code pre-checks locally and removes the offending proxy. An empty proxy despite returncode 0 usually means the encode produced no output stream (video-only filter chain on an audio-less file, or output path unwritable in a subtle way).

Source

Thrown at app/services/elevenlabs_music.py:262

        _remove_file(proxy_path)
        raise ElevenLabsMusicError(
            "ElevenLabs video proxy generation timed out"
        ) from exc
    except OSError as exc:
        _remove_file(proxy_path)
        raise ElevenLabsMusicError(
            "failed to run FFmpeg for ElevenLabs video proxy"
        ) from exc
    if result.returncode != 0:
        _remove_file(proxy_path)
        detail = (result.stderr or "").strip().replace("\n", " ")[-500:]
        raise ElevenLabsMusicError(
            f"failed to generate ElevenLabs video proxy: {detail}"
        )
    proxy_size = os.path.getsize(proxy_path) if os.path.isfile(proxy_path) else 0
    if proxy_size <= 0 or proxy_size > MAX_PROXY_BYTES:
        _remove_file(proxy_path)
        raise ElevenLabsMusicError(
            "ElevenLabs video proxy is empty or exceeds the 200 MB limit"
        )
    logger.info(
        "ElevenLabs video proxy prepared: "
        f"source={video_path}, size={proxy_size} bytes"
    )
    return proxy_path


def _stream_audio(response: requests.Response, temp_audio_path: str) -> int:
    """分块保存音频并限制最大体积,防止异常响应耗尽本机磁盘。"""
    total_bytes = 0
    with open(temp_audio_path, "wb") as output:
        for chunk in response.iter_content(chunk_size=1024 * 1024):
            if not chunk:
                continue
            total_bytes += len(chunk)
            if total_bytes > MAX_GENERATED_AUDIO_BYTES:

View on GitHub (pinned to 1f9f19c202)

Solutions

  1. Reduce proxy size: lower resolution/bitrate or trim duration so the encoded proxy lands under 200 MB.
  2. For the empty case, run the same FFmpeg command manually and read its stderr — usually a filter or codec issue producing zero frames.
  3. Check disk space in the output directory; a full disk can truncate the proxy.
Defensive patterns

Strategy: validation

Validate before calling

import os
MAX_PROXY = 200 * 1024 * 1024

def proxy_will_fit(duration_s: int, bitrate_bps: int = 2_500_000) -> bool:
    return duration_s * bitrate_bps / 8 < MAX_PROXY

Try / catch

try:
    generate_bgm(video_path, output_path, prompt)
except ElevenLabsMusicError as e:
    if 'empty or exceeds the 200 MB limit' in str(e):
        trim_or_lower_bitrate(video_path)
        generate_bgm(video_path, output_path, prompt)

Prevention

When it happens

Trigger: A source so long/large that even the downscaled proxy stays over 200 MB (e.g. 600s at high bitrate); or FFmpeg writing a 0-byte file because the encode silently produced no frames.

Common situations: Long 10-minute videos at the duration limit with high bitrate targets; users bypassing the proxy scale-down by config; disk-full conditions leaving a truncated file.

Related errors


AI-assisted analysis of harry0703/MoneyPrinterTurbo@1f9f19c202 (2026-08-14). Data as JSON: /api/errors/81f981fa4a2ede0d. Report an issue: GitHub.