Panniantong/Agent-Reach · error · TranscribeError
ffmpeg produced no chunks
Error message
ffmpeg produced no chunks
What it means
Raised by chunk_audio (transcribe.py:349-351) when ffmpeg's segment command exits 0 (or at least ran) but no chunk_*.m4a files match the out_dir glob. The pipeline expects at least one segment for any valid input, so zero chunks means the input had no usable audio stream or was empty.
Source
Thrown at agent_reach/transcribe.py:351
str(src),
"-t",
str(MAX_AUDIO_SECONDS),
"-f",
"segment",
"-segment_time",
str(segment_seconds),
"-ac",
"1",
"-ar",
"16000",
"-b:a",
"32k",
str(pattern),
]
)
chunks = sorted(out_dir.glob("chunk_*.m4a"))
if not chunks:
raise TranscribeError("ffmpeg produced no chunks")
return chunks
def _provider_key(provider: str, config: Config) -> Optional[str]:
field = PROVIDERS[provider]["key_field"]
val = config.get(field)
return val or None
def transcribe_chunk(
chunk: Path,
provider: str,
*,
config: Optional[Config] = None,
timeout: int = 120,
) -> str:
"""Transcribe one chunk via the named provider. Raises TranscribeError on failure."""
if provider not in PROVIDERS:View on GitHub (pinned to 93ae1d18c3)
Solutions
- Inspect the input: ffprobe -show_streams compressed.m4a — check duration and that an audio stream exists
- Check file sizes in out_dir: a ~0-byte compressed.m4a points upstream (bad source media); re-download or pick another source
- Test the ffmpeg segment command manually with -loglevel warning to surface decode errors
Example fix
# before
chunks = chunk_audio(compressed, out_dir) # ffmpeg produced no chunks
# after: guard on stream viability first
import subprocess, json
info = subprocess.run(["ffprobe", "-v", "error", "-show_streams", "-select_streams", "a", "-of", "json", str(compressed)], capture_output=True, text=True)
streams = json.loads(info.stdout).get("streams", [])
if not streams or float(streams[0].get("duration", 0)) <= 0:
raise ValueError("source has no decodable audio")
chunks = chunk_audio(compressed, out_dir) Defensive patterns
Strategy: validation
Validate before calling
import subprocess, json
from pathlib import Path
def has_decodable_audio(path: Path) -> bool:
out = subprocess.run(
["ffprobe", "-v", "error", "-select_streams", "a", "-show_streams",
"-of", "json", str(path)],
capture_output=True, text=True,
)
if out.returncode != 0:
return False
streams = json.loads(out.stdout).get("streams", [])
return bool(streams) and float(streams[0].get("duration") or 0) > 0 Try / catch
from agent_reach.transcribe import TranscribeError
try:
chunks = chunk_audio(compressed, out_dir)
except TranscribeError as e:
if "produced no chunks" in str(e):
raise ValueError("source media has no decodable audio stream") from None
raise Prevention
- ffprobe for an audio stream with positive duration before chunking
- Reject ~0-byte compressed outputs right after compress_audio
- Prefer well-formed media sources; re-download partial transfers
When it happens
Trigger: Feeding compress_audio output that is zero-length (upstream media with audio track but no samples), a corrupt m4a that ffmpeg reads as 0s, or an input whose audio stream failed to decode while -loglevel error suppressed warnings. Note ffmpeg itself already caps output with -t 14400, so overlong input truncates rather than yielding nothing.
Common situations: Silent/black videos where yt-dlp still produced a file; partially downloaded files after a retried transfer; unusual codecs where the aac encoder gets no frames. Usually preceded by a compress_audio step that produced a tiny or 0-byte compressed.m4a.
Related errors
- chunk segment duration must be positive
- audio produced {len(chunks)} chunks; safety limit is {MAX_CH
- {label} exceeds safety limit of {limit_mib:g} MiB
- ffprobe timed out while reading audio duration after {FFPROB
- chunk generation safety limit is {MAX_CHUNKS}; segment durat
AI-assisted analysis of Panniantong/Agent-Reach@93ae1d18c3 (2026-08-14).
Data as JSON: /api/errors/1f77ac810dd59eb9.
Report an issue: GitHub.