harry0703/MoneyPrinterTurbo · error · SoniloError
Sonilo video proxy is empty or exceeds the 300 MB limit
Error message
Sonilo video proxy is empty or exceeds the 300 MB limit
What it means
Raised after a successful FFmpeg run when the produced proxy file is 0 bytes or larger than MAX_PROXY_BYTES (300 MB). FFmpeg exiting 0 with an empty output usually means the command produced no frames (bad filter graph), and the size cap prevents uploading absurdly large intermediates to Sonilo. The proxy is deleted before raising.
Source
Thrown at app/services/sonilo.py:196
capture_output=True,
text=True,
timeout=600,
check=False,
)
except subprocess.TimeoutExpired as exc:
_remove_file(proxy_path)
raise SoniloError("Sonilo video proxy generation timed out") from exc
except OSError as exc:
_remove_file(proxy_path)
raise SoniloError("failed to run FFmpeg for Sonilo video proxy") from exc
if result.returncode != 0:
_remove_file(proxy_path)
detail = (result.stderr or "").strip().replace("\n", " ")[-500:]
raise SoniloError(f"failed to generate Sonilo 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 SoniloError("Sonilo video proxy is empty or exceeds the 300 MB limit")
logger.info(
f"Sonilo video proxy prepared: source={video_path}, size={proxy_size} bytes"
)
return proxy_path
def _parse_event(raw_line: bytes) -> dict[str, Any]:
"""严格解析单条 NDJSON,禁止静默忽略截断或非对象响应。"""
try:
event = json.loads(raw_line.decode("utf-8"))
except (UnicodeDecodeError, json.JSONDecodeError) as exc:
raise SoniloError("Sonilo returned malformed streaming data") from exc
if not isinstance(event, dict) or not isinstance(event.get("type"), str):
raise SoniloError("Sonilo returned an invalid streaming event")
return event
def _stream_audio(response: requests.Response, temp_audio_path: str) -> tuple[int, str]:View on GitHub (pinned to 1f9f19c202)
Solutions
- If size was exceeded: increase compression in the proxy command (lower CRF or cap bitrate) so the worst-case 360-second output stays under 300 MB, or raise MAX_PROXY_BYTES if Sonilo accepts larger uploads.
- If the file was empty: reproduce the exact ffmpeg command manually and inspect warnings; typically the result of a bad filter or a zero-duration stream.
- Check free space on the task temp volume.
- Validate the source video with ffprobe (duration, streams) before proxy generation.
Example fix
# before (proxy can exceed 300 MB for long clips) "-c:v", "libx264", "-crf", "18" # after (bounded bitrate keeps worst case under cap) "-c:v", "libx264", "-crf", "23", "-maxrate", "6M", "-bufsize", "12M"
Defensive patterns
Strategy: validation
Validate before calling
proxy_size = os.path.getsize(proxy_path) if os.path.isfile(proxy_path) else 0
if not (0 < proxy_size <= sonilo.MAX_PROXY_BYTES):
raise ValueError(
f"proxy {proxy_size} bytes outside (0, {sonilo.MAX_PROXY_BYTES}]"
) Try / catch
try:
proxy = generate_video_proxy(video)
except SoniloError as exc:
if "empty or exceeds" in str(exc):
re_encode_with_stricter_settings(video) # bounded bitrate, see exampleFix
raise Prevention
- Encode proxies with maxrate and bufsize caps so the 360-second worst case mathematically stays under 300 MB.
- For empty outputs, always reproduce the exact ffmpeg command manually before changing code.
When it happens
Trigger: A filter or graph configuration that writes no frames (for example zero-duration output after trimming a source whose duration was misdetected); a proxy encode of a near-360-second high-bitrate clip with quality settings high enough to exceed 300 MB; a full disk where FFmpeg silently truncates but still exits 0.
Common situations: Tweaked proxy arguments (CRF, preset, bitrate) that balloon output size; a source video whose header lies about duration causing FFmpeg to emit an empty file; disk-full conditions producing a truncated file.
Related errors
- uploaded file must contain a decodable audio stream
- background music file exceeds the 30 MB limit
- ElevenLabs video proxy is empty or exceeds the 200 MB limit
- ElevenLabs returned audio that FFmpeg cannot decode
- Sonilo video proxy generation timed out
AI-assisted analysis of harry0703/MoneyPrinterTurbo@1f9f19c202 (2026-08-14).
Data as JSON: /api/errors/cd20a60d52c4aba1.
Report an issue: GitHub.