gemini-3.1-flash-lite intermittently emitted JSON the manual fence-strip +
json.loads couldn't parse ('Expecting value: line 16 ...'), so clip
detection failed and fell back to whole-video conversion -> 'No metadata
file generated'. Request response_mime_type=application/json so the API
guarantees a JSON body, and on a parse miss rescue the outermost {...}
object before giving up.
Re-encode passes (vertical render, hooks, subtitles, AI effects) ran at
CRF 22-23, stacking visible generation loss across steps (#13). Bump all
of them to CRF 18; post-process steps also move preset fast -> medium
(the realtime reframe pipe keeps fast to not slow the streamed encode).
OpenCV resizes now use INTER_LANCZOS4 for sharper scaling.
Adopted from PR #14 review (the good parts, rebased on current main).
- Retry transient Gemini errors (503/429/500) up to 3x with exponential
backoff before falling back to whole-video conversion (#27)
- Thread the hook Duration slider through /api/hook down to the FFmpeg
overlay enable filter so hooks can end after N seconds (#2)
- Read JOB_RETENTION_SECONDS from env so self-hosters can keep finished
jobs longer than the 1h default (#46)
- main.py / metering.py: try the HD (bgutil/720p) strategy first, fall back to
the conservative (360p) clients on any failure, so a YouTube/yt-dlp change
degrades gracefully instead of failing the whole job.
- cloud/alerts.py: in-memory tracking of managed-job outcomes; emails the admin
(ADMIN_EMAIL) when a proxy/credit error appears or when many jobs fail in a
row, with a 1h per-alert cooldown. Wired into run_job_wrapper.
- Email switched from Resend to SMTP (cloud/emails.py) for magic link + alerts
(Namecheap Private Email). Config via SMTP_* / EMAIL_FROM / ADMIN_EMAIL in the
mounted .env (kept out of compose so the password's $/* aren't mangled).
SMTP send verified from host and from the backend container.
VideoManager/SceneManager top-level imports were removed in 0.6+, causing
ImportError on job start. Switched to open_video() and SceneManager.detect_scenes(video=...).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
YouTube titles containing '#' (e.g. hashtags like #shorts) were saved to disk correctly, but the browser parses '#' as a URL fragment, so the frontend could never request the actual file and clips appeared missing. Add '#' to the regex in sanitize_filename().
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>