Repository navigation
fix(api): bound transcribe_audio's ffmpeg calls with QWEN_MM_FFMPEG_TIMEOUT - #71
Merged
JJJYmmm merged 2 commits intoOct 1, 2026
Merged
Conversation
…IMEOUT _get_duration() ran ffprobe with no `timeout` argument at all, so a media read that stalls -- a dead network mount, a truncated stream -- hangs the transcribe_audio tool indefinitely with nothing the operator can do about it. _extract_audio()'s hardcoded 600 ignored the knob in both directions, so raising QWEN_MM_FFMPEG_TIMEOUT could not widen it either. shared/env.py documents QWEN_MM_FFMPEG_TIMEOUT as "ffmpeg/ffprobe timeout seconds", and every media subprocess in shared/video.py and in omni-video2note's pipeline passes it; asr.py was the only ffprobe/ffmpeg call site in the api capability that did not. The probe now takes the knob directly, like the other probes. Extraction takes max(FFMPEG_TIMEOUT, 600), the shape media.py already uses for long transcodes: a chunk of a one-hour recording legitimately outlives the 120s default, so the knob widens this budget without ever shortening the 600s it already had. The regression test stubs asr.subprocess rather than shelling out, so it also runs on hosts with no ffmpeg binary (the reason behind QwenLM#59).
Collaborator
|
TY! (btw you just need to fix the bugs, I'll handle the plugin version😃 |
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.
Closes #70
What changed
transcribe_audiowas the only ffprobe/ffmpeg call site in theapicapability that ignoredQWEN_MM_FFMPEG_TIMEOUT, whichsrc/shared/env.py:252documents as "ffmpeg/ffprobe timeoutseconds".
Two lines in
src/capabilities/api/qwen_mm_plugins_api/others/asr.py:_get_duration()now passestimeout=FFMPEG_TIMEOUT, so the duration probe is bounded the wayevery probe in
shared/video.py:76,124,213andomni-video2note'spipeline/media.pyalreadyis. Before this,
subprocess.rungot notimeoutargument, so a media read that stalls — adead mount, a truncated stream — hung the tool with nothing an operator could do.
_extract_audio()now passestimeout=max(FFMPEG_TIMEOUT, 600)instead of a bare600, soraising the knob widens this call too.
Why the 600 floor on extraction: a chunk of a one-hour recording legitimately outlives the 120 s
probe default, so handing the transcode the bare knob would silently cut a budget it never had and
break working setups.
max()is the shapepipeline/media.py:269,433already use for longtranscodes: the knob can only widen this call, never narrow it.
Why the scope stops at this file. The unbounded renders in
omni-chatcut'smusic_to_mv/pipeline.pyand thevideo-editskill scripts are a different decision — several ofthem (
-count_frames,blackdetect,silencedetect) are expected to run for many minutes, sothey need per-site floors rather than a probe default. That belongs in its own issue, not folded
in here.
Verification
tests/test_api_tools.py::test_asr_media_calls_honour_ffmpeg_timeout(2 params) records thekwargs reaching
subprocess.run:mainat 7f7ca38:2 failed— actual[('ffprobe', 'NO TIMEOUT'), ('ffmpeg', 600)]against expected
[('ffprobe', 42|900), ('ffmpeg', 600|900)].2 passed;tests/test_api_tools.pyas a whole53 passed, 6 skipped.python -m pytest -q -m "not reachability", same host (Windows, no ffmpeginstalled), both trees run sequentially: pristine main
32 failed, 1028 passed, 97 skipped, 2 errors; this branch32 failed, 1030 passed, 97 skipped, 2 errors. The two failure listsdiffer by exactly two entries —
test_isolated_worker_timeout(fails on either tree when runalone, with
PermissionError) andtest_mhs_adapter_server::…[application/json](passes oneither tree alone) — which swap places between the runs. Neither file imports
asr.ruff checkandruff format --checkon both changed files: clean.The test stubs
asr.subprocessrather than shelling out, so it also holds on a runner with noffmpeg binary — the same constraint behind #59.
Not tested: no live ffmpeg run and no DashScope call was made here (this machine has no ffmpeg
installed, so the numbers above come from the stub, and the
TimeoutExpiredpath has not beenobserved against real media).
Compatibility
transcribe_audio's schema and success output are untouched; the only new outcome is asubprocess.TimeoutExpiredon a probe that previously hung forever — the same failure shape asthe existing
RuntimeError("ffprobe failed: …")from this function, whichhandle()does notcatch either.
included.
plugin-versions.jsonis untouched — tell me if a bugfix like this should carry a version bump.