{"record":{"id":"81f981fa4a2ede0d","repo":"harry0703/MoneyPrinterTurbo","slug":"elevenlabs-video-proxy-is-empty-or-exceeds-the-200","errorCode":null,"errorMessage":"ElevenLabs video proxy is empty or exceeds the 200 MB limit","messagePattern":"ElevenLabs video proxy is empty or exceeds the 200 MB limit","errorType":"exception","errorClass":"ElevenLabsMusicError","httpStatus":null,"severity":"error","filePath":"app/services/elevenlabs_music.py","lineNumber":262,"sourceCode":"        _remove_file(proxy_path)\n        raise ElevenLabsMusicError(\n            \"ElevenLabs video proxy generation timed out\"\n        ) from exc\n    except OSError as exc:\n        _remove_file(proxy_path)\n        raise ElevenLabsMusicError(\n            \"failed to run FFmpeg for ElevenLabs video proxy\"\n        ) from exc\n    if result.returncode != 0:\n        _remove_file(proxy_path)\n        detail = (result.stderr or \"\").strip().replace(\"\\n\", \" \")[-500:]\n        raise ElevenLabsMusicError(\n            f\"failed to generate ElevenLabs video proxy: {detail}\"\n        )\n    proxy_size = os.path.getsize(proxy_path) if os.path.isfile(proxy_path) else 0\n    if proxy_size <= 0 or proxy_size > MAX_PROXY_BYTES:\n        _remove_file(proxy_path)\n        raise ElevenLabsMusicError(\n            \"ElevenLabs video proxy is empty or exceeds the 200 MB limit\"\n        )\n    logger.info(\n        \"ElevenLabs video proxy prepared: \"\n        f\"source={video_path}, size={proxy_size} bytes\"\n    )\n    return proxy_path\n\n\ndef _stream_audio(response: requests.Response, temp_audio_path: str) -> int:\n    \"\"\"分块保存音频并限制最大体积，防止异常响应耗尽本机磁盘。\"\"\"\n    total_bytes = 0\n    with open(temp_audio_path, \"wb\") as output:\n        for chunk in response.iter_content(chunk_size=1024 * 1024):\n            if not chunk:\n                continue\n            total_bytes += len(chunk)\n            if total_bytes > MAX_GENERATED_AUDIO_BYTES:","sourceCodeStart":244,"sourceCodeEnd":280,"githubUrl":"https://github.com/harry0703/MoneyPrinterTurbo/blob/1f9f19c2021a68d04df228f33e9099a0c947f6f8/app/services/elevenlabs_music.py#L244-L280","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","solutions":["Reduce proxy size: lower resolution/bitrate or trim duration so the encoded proxy lands under 200 MB.","For the empty case, run the same FFmpeg command manually and read its stderr — usually a filter or codec issue producing zero frames.","Check disk space in the output directory; a full disk can truncate the proxy."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import os\nMAX_PROXY = 200 * 1024 * 1024\n\ndef proxy_will_fit(duration_s: int, bitrate_bps: int = 2_500_000) -> bool:\n    return duration_s * bitrate_bps / 8 < MAX_PROXY","typeGuard":null,"tryCatchPattern":"try:\n    generate_bgm(video_path, output_path, prompt)\nexcept ElevenLabsMusicError as e:\n    if 'empty or exceeds the 200 MB limit' in str(e):\n        trim_or_lower_bitrate(video_path)\n        generate_bgm(video_path, output_path, prompt)","preventionTips":["Cap video duration/bitrate at ingest so proxies stay well under 200 MB.","Run the proxy FFmpeg command manually once when tuning scale/bitrate settings.","Monitor output-dir disk space — full disks can also leave truncated proxies."],"tags":["elevenlabs","ffmpeg","size-limit","proxy"],"backgroundTag":null,"analyzedSha":"1f9f19c2021a68d04df228f33e9099a0c947f6f8","analyzedAt":"2026-08-14T19:41:05.568Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}