harry0703/MoneyPrinterTurbo · error · ElevenLabsMusicError

failed to generate ElevenLabs video proxy: {detail}

Error message

failed to generate ElevenLabs video proxy: {detail}

What it means

ElevenLabsMusicError raised after FFmpeg exits with a non-zero return code while building the video proxy. The message embeds the last 500 characters of stderr with newlines flattened, which is the authoritative reason: usually a corrupt/unsupported input, missing codec, or invalid filter options. The partial proxy file is removed before raising.

Source

Thrown at app/services/elevenlabs_music.py:256

            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"
        )
    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

View on GitHub (pinned to 1f9f19c202)

Solutions

  1. Read the stderr fragment in the message — it names the exact FFmpeg failure (e.g. 'Unknown encoder', 'Invalid data found').
  2. Verify the input plays locally (ffprobe video.mp4) and re-encode it once to a safe profile (H.264/AAC in MP4) before retrying.
  3. If the error names a missing encoder/decoder, install a full FFmpeg build.

Example fix

# normalize problematic input before submitting
ffmpeg -i input.mov -c:v libx264 -c:a aac -movflags +faststart normalized.mp4
Defensive patterns

Strategy: validation

Validate before calling

import subprocess

def video_decodes(path: str) -> bool:
    return subprocess.run(
        ['ffprobe', '-v', 'error', '-select_streams', 'v:0', '-show_entries', 'stream=codec_name', '-of', 'csv=p=0', path],
        capture_output=True,
    ).returncode == 0

Try / catch

try:
    generate_bgm(video_path, output_path, prompt)
except ElevenLabsMusicError as e:
    if 'failed to generate ElevenLabs video proxy' in str(e):
        log(e)  # stderr tail is embedded — it names the codec/filter failure
        reencode_to_h264(video_path); retry_once()

Prevention

When it happens

Trigger: Feeding a corrupted, truncated, or DRM-protected video; a codec/container the local FFmpeg build cannot decode (e.g. HEVC without libde265, or an .avi with an exotic codec); or a source that disappeared mid-run. Read the embedded stderr tail to identify which.

Common situations: Half-downloaded or remuxed files; distro FFmpeg builds without common codecs; HEVC/AV1 content hitting a minimal build; concurrent cleanup deleting the input while the job runs.

Related errors


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