Reverts 1d3d20c (NVDEC decode + quarter-size blur): it changed the
delivered pixels (SSIM 0.998-0.9997, not identical), and clips must not
change. Replaces it with two fixes that leave every clip byte-identical.
- Parakeet's onnxruntime pool threads no longer spin
(transcribe_backends.parakeet_session_options). While the GPU did the
work they burned ~160 CPU-s per 9 min of audio, the biggest CPU cost of
a job. The VAD keeps load_vad's defaults: any options there make
onnx_asr drop its default providers and a word changes.
- analyze_scenes_strategy and split_layout read their sampled frames in
one forward pass (frame_sampler.read_at) instead of a seek per sample,
which re-decoded the GOP every time: 89 -> 6 CPU-s for one clip's
samples, same frames.
Bench on balrog, 3 Carlos Gracia videos (2.5/9/17 min, 15 clips), Gemini
decisions recorded once and replayed: every clip identical to the old
code (decoded-frame MD5s + audio). Serial stage profile of the 9 min
video: 629 -> 273 CPU-s per job; Python side 332 -> 57 CPU-s.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Benchmarked in the prod container on 10 real user videos (40 min of audio,
EN/ES/PT/FR-AR, 4,850 words) before changing anything:
config peak VRAM ASR time words != prod ts drift
prod (batch 8) 6.1 GB 32 s - -
batch 4 + lean arena 4.6 GB 38 s 1 (*) 0.1 ms
batch 2 + lean arena 4.1 GB 40 s dropped a sentence
int8 3.9 GB 350 s 11.7 % 168 ms
(*) outside the mixed-language clip, which goes to whisper in prod anyway.
Ship batch 4 with the arena growing only by what is requested and no max
cuDNN workspace (those two alone change nothing in the output).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On 22-sep-2026 30-60% of jobs failed per hour at peak with 8 concurrent
jobs on a 20 GB GPU: a job three clips into its render still held 5.9 GB.
- main.py releases the ASR models right after transcribing (Parakeet's
onnxruntime CUDA arena lived until the process exited); TransNetV2
empties torch's cache after each pass.
- Host-wide cap on GPU transcriptions (flock slots on the shared output
volume, ASR_HOST_SLOTS=2), across job processes and deploy containers.
- The queue only starts a job when nvidia-smi reports GPU_MIN_FREE_MB free
(an idle card always starts).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
30 minutes after 60fa37a reached prod the uvicorn process held 5.1 GB of
VRAM again, with the release counter at zero: saasshorts.generate_tiktok_subs
transcribes in-process through its own call to transcribe_media, a third
path next to the thumbnail studio and the dubbed-subtitle one. Same
finally-release there, and release_models() now also drops the TransNetV2
singleton that the same in-process pipeline leaves in torch.
Three failures measured in prod on 17-sep-2026, one deploy.
1. 5 of 12 jobs failed with "ffmpeg could not cut clip ... exit 187, 0 bytes".
Exit 187 is AVERROR_EXIT after "h264_nvenc: Could not open encoder":
VRAM was full. The uvicorn process itself held 7.7 GB of the 20 GB card
while idle: the thumbnail studio and /api/subtitle on a dubbed clip
transcribe in-process, and the whisper (ctranslate2) and parakeet
(onnxruntime CUDA) singletons then lived in the API for good. Both call
transcribe_backends.release_models() now; the loaders fetch their model
inside the ASR gate so a release can never pull it from under a running
transcription.
2. 26 of the 37 probes that reached the per-GB proxy in 10 days were
`watch?v=X&list=...` or mix links. Neither the probe nor the download set
`noplaylist`, so yt-dlp walked the whole list, died on its first private /
age-gated / bot-checked entry (a video nobody pasted), the probe read it
as an IP problem and paid the proxy to walk the same list again, and the
user got a 400 for a valid link. Reproduced in the prod container: the
same URL with noplaylist answers in 9.6 s on a static. The probe also
keeps every attempt's error per route now, so the anonymous retry's
bot-check cannot overwrite a "confirm your age" from the cookie attempt
into an escalation.
3. noplaylist does nothing for a search or a bare playlist URL: one
`results?search_query=` held the probe thread for 2220 s in the container
and still failed. Search, playlist, channel and feed URLs are refused by
path before any request, with a message that says what to paste.
El error del admin ('High download failure rate... rebuild image') era
engañoso: el fallo real no era descarga sino transcripción de un vídeo SUBIDO
sin pista de audio (un clip generado por IA, Gen-4 de Runway). faster-whisper
revienta dentro de libav con 'tuple index out of range' cuando el fichero no
tiene audio.
- transcribe_media detecta la ausencia de pista de audio (ffprobe) ANTES de
transcribir y lanza NoAudioError con mensaje claro; main.py lo convierte en
un fallo user-facing ('NO_AUDIO: este vídeo no tiene audio...') en vez de un
traceback. Verificado en contenedor con vídeo con/sin audio.
- La alerta de tasa de fallos ya no culpa siempre a la descarga: clasifica el
último error (proxy / youtube download / no audio / transcription / gemini /
ffmpeg) y lo pone en el título.
123 tests (nuevos: vídeo mudo + clasificación de fallos).