harry0703/MoneyPrinterTurbo · error · ElevenLabsMusicError

ElevenLabs video proxy generation timed out

Error message

ElevenLabs video proxy generation timed out

What it means

ElevenLabsMusicError raised when the FFmpeg subprocess that builds the downscaled video proxy exceeds its hard 600-second timeout: subprocess.run raises TimeoutExpired, the partially written proxy file is removed, and the error is chained. The proxy step exists because ElevenLabs Video-to-Music has duration (max 600s) and size (MAX_PROXY_BYTES = 200 MB) limits, so long/high-bitrate sources need re-encoding first.

Source

Thrown at app/services/elevenlabs_music.py:245

        "-pix_fmt",
        "yuv420p",
        "-movflags",
        "+faststart",
        "-fs",
        str(MAX_PROXY_BYTES),
        proxy_path,
    ]
    try:
        result = subprocess.run(
            command,
            capture_output=True,
            text=True,
            timeout=600,
            check=False,
        )
    except subprocess.TimeoutExpired as exc:
        _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"

View on GitHub (pinned to 1f9f19c202)

Solutions

  1. Reduce CPU load or give the container more CPU so the proxy encodes within 600s.
  2. Pre-downscale very large sources before submitting (e.g. ffmpeg -vf scale=1280:-2) so the proxy step is fast.
  3. Trim the video to the needed length — proxy cost scales with duration (limit is 600s anyway).

Example fix

# before: submit 4K source directly
generate_bgm(video_path='input_4k.mov', ...)

# after: pre-downscale
subprocess.run(['ffmpeg', '-i', 'input_4k.mov', '-vf', 'scale=1280:-2', '-c:v', 'libx264', 'input_hd.mp4'])
generate_bgm(video_path='input_hd.mp4', ...)
Defensive patterns

Strategy: retry

Validate before calling

import subprocess

def ffmpeg_available() -> bool:
    return subprocess.run(['ffmpeg', '-version'], capture_output=True).returncode == 0

Try / catch

try:
    generate_bgm(video_path, output_path, prompt)
except ElevenLabsMusicError as e:
    if 'timed out' in str(e):
        pre_downscale(video_path)  # cheaper proxy encode
        generate_bgm(video_path, output_path, prompt)

Prevention

When it happens

Trigger: Feeding a long or high-resolution video into the ElevenLabs BGM flow on a slow machine: re-encoding to the proxy profile takes more than 600s. CPU-starved containers, software-only FFmpeg, or 4K sources are typical.

Common situations: Docker containers limited to a fraction of one CPU; CI runners; 4K/60fps source videos; machines where FFmpeg lacks hardware acceleration and falls back to slow software x264.

Understand the failure class

Related errors


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