harry0703/MoneyPrinterTurbo · error · ElevenLabsMusicError
failed to run FFmpeg for ElevenLabs video proxy
Error message
failed to run FFmpeg for ElevenLabs video proxy
What it means
ElevenLabsMusicError raised when subprocess.run cannot even launch or manage the FFmpeg process — OSError (e.g. FileNotFoundError when the ffmpeg binary is missing from PATH, or PermissionError). The half-written proxy file is removed and the original OS error is chained. This is an environment problem, not a video problem: FFmpeg was never successfully executed.
Source
Thrown at app/services/elevenlabs_music.py:250
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"
)
logger.info(
"ElevenLabs video proxy prepared: "
f"source={video_path}, size={proxy_size} bytes"
)View on GitHub (pinned to 1f9f19c202)
Solutions
- Install FFmpeg in the runtime environment (apt-get install ffmpeg / apk add ffmpeg) and verify `ffmpeg -version` runs as the same user.
- If launching from an IDE/service manager, ensure PATH includes the FFmpeg location or use an absolute binary path configuration.
- Check execute permissions on the binary in custom images.
Example fix
# Dockerfile fix # before: FROM python:3.12-slim # after FROM python:3.12-slim RUN apt-get update && apt-get install -y --no-install-recommends ffmpeg && rm -rf /var/lib/apt/lists/*
Defensive patterns
Strategy: validation
Validate before calling
import shutil, subprocess
def ffmpeg_ready() -> bool:
path = shutil.which('ffmpeg')
if not path:
return False
return subprocess.run([path, '-version'], capture_output=True).returncode == 0 Try / catch
try:
generate_bgm(video_path, output_path, prompt)
except ElevenLabsMusicError as e:
if 'failed to run FFmpeg' in str(e):
raise EnvironmentError('FFmpeg not runnable; install it and retry') from e Prevention
- Include ffmpeg in the deployment image and verify `ffmpeg -version` as the app user in CI.
- Use absolute FFmpeg paths or ensure PATH is inherited by the service.
- Fail fast at startup with an FFmpeg readiness check instead of mid-generation.
When it happens
Trigger: ffmpeg (or the configured FFmpeg executable) is not installed or not on PATH in the running process's environment; the binary lacks execute permission; resource limits (fork failure) on constrained containers.
Common situations: Slim Docker images without the ffmpeg package; virtualenvs/IDE launches that scrub PATH; images where ffmpeg was copied without +x; cgroup pids/memory limits causing process spawn failure.
Related errors
- ElevenLabs video proxy generation timed out
- failed to generate ElevenLabs video proxy: {detail}
- ElevenLabs video proxy is empty or exceeds the 200 MB limit
- ElevenLabs returned audio that FFmpeg cannot decode
- failed to run FFmpeg for Sonilo video proxy
AI-assisted analysis of harry0703/MoneyPrinterTurbo@1f9f19c202 (2026-08-14).
Data as JSON: /api/errors/ffbb6d7ba750e8a5.
Report an issue: GitHub.