Repository navigation
Replies: 1 comment
|
I have implemented this for the next release. A file that ffprobe can read, with an audio track, is stored as it arrived, and the upload is answered at once. The file is then converted in a convert job on its own workers ( |
Uh oh!
There was an error while loading. Please reload this page.
Description
When
AUDIO_COMPRESS_UPLOADSis enabled,ingest_uploaded_recordingprobes the uploaded file and runs ffmpeg conversion synchronously inside the request thread.Under concurrent uploads this conversion consumes CPU on the request path and adds latency variance, even though the upload itself has already been accepted.
The conversion result is needed before the recording is stored and enqueued, but the work does not have to block the HTTP response.
Moving this work off the request thread would keep upload responses fast and predictable under burst load.
Affected Version
v0.10.18-alpha
Requested Feature
Move the probe and ffmpeg conversion step in
ingest_uploaded_recording(src/api/recordings.py:2323) off the HTTP request thread, so that uploads return promptly and conversion runs as a background or queued step before storage and enqueue.Proposed Implementation
ingest_uploaded_recording(src/api/recordings.py:2560-2692), which callsget_codec_info,convert_if_needed(src/api/recordings.py:2659) and related probe/repair helpers, and extract it into a pre-processing step that can run outside the request thread.src/api/recordings.py:2476-2480) and the duplicate-hash computation (src/api/recordings.py:2481-2522) in the request path, since both are cheap and the hash must be computed on the original bytes before any re-encoding.audio_converter_missing(500),audio_conversion_timeout(500),audio_decode_failed(400) and the video retention/passthrough branches.AUDIO_COMPRESS_UPLOADS(src/config/app_config.py:92) andAUDIO_CODEC/AUDIO_BITRATEbehavior unchanged; only the execution location changes._discard_staging).Expected Behavior
Root Cause Analysis
ingest_uploaded_recording(src/api/recordings.py:2323) saves the uploaded file, computes its hash, then performsget_codec_infoandconvert_if_needed(src/api/recordings.py:2659) synchronously before committing the recording and enqueuing transcription.convert_if_neededinvokes ffmpeg, which is CPU-bound and can take seconds for large files. Under concurrent uploads this conversion runs on the request threads and competes with the ASR and embedding work for CPU, increasing upload latency variance.The current behavior deviates from the desired one because conversion is coupled to the HTTP response even though its result is only needed before enqueue.
All reactions