fix(digest): handle silent (no-audio) videos instead of failing them (#57)#64
Merged
Conversation
…57) Diagnosis: a large share of "transcription failed" videos are simply SILENT — no audio track at the source (muted clips, GIFs, screencasts; confirmed with yt-dlp that no audio format exists, ruling out separate audio streams). parakeet -mlx writes no output file for them, which xbrain's transcribe contract treats as a hard failure — even though xbrain's own design wants them attached as has_speech=false ("silent video" note). - scripts/xbrain-transcribe: wraps parakeet-mlx; when parakeet exits 0 but wrote no file, `ffprobe`-checks the media — no audio stream → emit the empty-speech JSON (silent video); HAS audio but no output → surface as a real failure (not masked as silent). Non-zero parakeet exit propagates. Local, no API. - docs: README "Transcriber wrapper" note + config.toml.example [transcribe]. - tests/test_xbrain_transcribe.py: locks the 4 branches (speech pass-through, silent→empty-speech, audio-but-empty→fail, parakeet-nonzero→propagate) + the no-ffprobe fallback. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…nscribe wrapper (PR #64 review) Review (python-bug-finder) surfaced that xbrain reads the first NON-EMPTY *.json by content (transcribe.py glob), not <stem>.json by name. Hardened accordingly: - Detect "parakeet produced a transcript" as any non-empty *.json (mirrors xbrain), not `<stem>.json`.exists(). Fixes: an empty/stub file no longer fools the wrapper into skipping silent-classification (finding #1), and output under an unexpected filename is still detected (removes stem coupling, finding #4). - `_confirmed_no_audio`: classify silent ONLY when ffprobe positively confirms no audio (returncode 0 + no audio stream). Unknown (no ffprobe / probe error) → real failure, never masked as silent (finding #3). - `XBRAIN_PARAKEET` is shlex-split so a multi-token wrapper command works. - Tests: empty-stub-not-output, non-stem output name, confirm-silence truth table (no-audio / audio / probe-error / no-ffprobe), + the four main() branches. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Diagnosis
Many "transcription failed" videos in the corpus are simply silent — no audio track at the source (muted clips, GIFs, screencasts). Verified rigorously:
ffprobeon the complete download shows only a video stream, andyt-dlp -f bestaudioerrors ("no audio format") on 4/4 checked videos — ruling out the "audio is a separate HLS/DASH stream that xbrain's raw-mp4 fetch missed" hypothesis. parakeet-mlx writes no output file for these, which xbrain's transcribe contract treats as a hard failure — even though xbrain's own design wants them attached ashas_speech=false("silent video" note).Fix
scripts/xbrain-transcribewraps parakeet-mlx. When parakeet exits 0 but wrote no file, itffprobe-checks the media:has_speech=false(silent video).Non-zero parakeet exit propagates unchanged. Local, no API.
Validated on real data: the 5 videos that failed before now land as
sin voz 5, fallidos 0, and 3 of them still got slide-frame descriptions.Tests
tests/test_xbrain_transcribe.pylocks all 4 branches + the no-ffprobe fallback.