- POST /api/billing/cancel: closed-list reason, optional detail, 1-5 rating and
review; cancels at period end in Stripe with cancellation_details, then stores
cancellation_feedback. Account page opens CancelPlanModal (3 steps).
- Portal cancellations: churn alert now carries Stripe's feedback value.
- POST /api/onboarding/survey + /api/me onboarding_survey_pending: accounts under
7 days get one skippable screen before the clip tutorial (what they want to
make, where they heard of us, who they are). Stored in onboarding_surveys and
tracked as SignupSurveyAnswered with per-goal props.
- Both new tables are user-owned and erased with the account.
A stack of Google accounts from one IP used to get a 60-minute first video
each. first_video_grants keeps an HMAC of the client IP (never the IP), not
tied to the user row, counting only grants whose reservation is live; a
network that already had one gets the first-N-minutes cut instead.
- Free source past the balance: first video (<= 60 min) clipped whole for the
balance, any other clipped to the first N minutes. No 402 wall for free
accounts with >= PARTIAL_MIN_MINUTES left.
- cloud/lifecycle.py: welcome, first-clip nudge, win-back (optional
WINBACK_PROMO_CODE from env) and abandoned-checkout recovery via
after_expiration.recovery + checkout.session.expired.
- Commercial emails go through send_commercial_email: opt-out honoured,
unsubscribe footer and List-Unsubscribe headers (out-of-minutes too).
The audio track is fetched on its own, in parallel with the video (same
m4a format the merged mp4 gets), and transcription + the Gemini pick start
as soon as it lands. By the time the video is in, the clips are usually
already chosen and the render starts right away.
- download_youtube_video(on_audio=): background audio-only fetch from the
already extracted info; never on the per-GB proxy.
- main: uses the early transcript/clips when they are ready; any failure,
capped sources (the cut is done on the video), checkpoints and
--transcript keep the old sequential path. EARLY_AUDIO=0 turns it off.
Bench (real downloads, alternating runs): render starts 2-17 s sooner
with fast downloads and replayed Gemini; the transcript is identical.
Also drops internal details from comments and CLAUDE.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
At peak (8 jobs x 3 clip workers) balrog sat at load ~100 on 20 threads
while the RTX 4000's decoder stayed at 0%: NVENC only took the encode, and
decoding plus the filter graphs ran on the CPU, starving the Coolify builds
and every other service on the box.
- ffmpeg_utils.video_decode_args(): -hwaccel cuda before the video input
whenever the encode is on nvenc (FFMPEG_HWDECODE=0 turns it off). Used in
the cut, the reframe v2 segments, watermark, hook and caption passes.
- ffmpeg_utils.blurred_backdrop(): the GENERAL and INSET blurred fill blurs
at a quarter of the output size and scales up, instead of a full-size
gblur on 1080x1920.
Measured in the prod container on a real 1080p source, 10 s GENERAL
segment: ~16-18 s of CPU before, ~5-7 s after, SSIM 0.994 against the old
output. All four hwaccel passes checked end to end on the prod GPU.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Free tools (no login), linked from nav and footer via /tools:
- /youtube-transcript-generator: reads the captions a video already has on
YouTube (free_tools.py, yt-dlp over the flat-rate static proxies only, never
the per-GB proxy, never the GPU). Per-IP limits, global daily cap, 24 h
cache, honest "no captions" answer with a CTA to the clip generator.
Copy / TXT / SRT export in the browser.
- /youtube-tag-generator: tags, 10 titles or a description from a brief, one
Gemini text call, rules taken from YouTube's own docs (sourced on the page).
- /video-aspect-ratio-converter: 16:9 to 9:16 in the browser with mediabunny
and WebCodecs (blur / crop / bars), nothing uploaded.
Tool pages keep the form in the static HTML; the behaviour is a Vite entry
(dashboard/tools) that vite-plugin-seo resolves by name.
New pages /auto-clip and /youtube-automation with real, blurred screenshots
of the Autopilot tab and the connect-an-agent card, Autopilot rules from
cloud/autopilot.py, plan prices from the billing API and aggregate usage
from the ledger (dated).
SEO fixes: titles/metas for /how-openshorts-works, /podcast-to-shorts, /mcp
and /free-ai-clip-generator (brand queries at pos 1-2 with <1% CTR); a free
AI clipper / free clipping website section and FAQ, and contextual "free AI
clip generator" anchors from sibling pages and the homepage.
Attribution: static pages now write the same first-touch os_attrib key the
app writes, so the signup is credited to the page the visit started on
(7,481 of 7,481 signups in 30 days said "/"). Signup, CheckoutStarted and
Subscribed carry landing_path / referrer_host / utm props in OpenPanel.
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>
A 9:10 source delivered 3 clips in prod where the pipeline had asked
itself for 6-12. Two independent leaks, both in the chain that derives
the clip count.
The scoring pass SELECTED instead of ranking: "choose up to 3 windows
from this batch" put the shortlist ceiling at 3 * n_batches rather than
shortlist_target, so 9 windows batched 8 + 1 shortlisted 4 of a target
of 8, and clip_count_targets then asked the detail pass for 4-8 clips
instead of 6-12. Every source under ~30 min was starved the same way,
which is the mechanism behind "95% of jobs deliver 3 clips or fewer" —
the clip count D2 retention hangs on (0.4% for 1-3 clips, 16.1% for
4-9). It also discarded the ranking it was computing: a batch holding
five great moments could still contribute only three, while a batch of
filler contributed its own three. The prompt now scores every window it
is given and the shortlist is the global top N.
Batches are near-equal instead of "full ones plus the remainder": a
trailing batch of one window came back with that window whatever its
score, because a cap of 3 cannot filter a batch of 1, so the tail of the
video entered the shortlist by arithmetic. Same call count as before.
And the floor was only a sentence in the detail prompt, with nothing in
code checking it, so a pass that returned half shipped half. When it
comes back under min_clips the shortlist windows that produced nothing
get one more call for the difference; an empty answer is accepted,
because padding is worse than a short list.
Measured on that source, same transcript, three runs: shortlist 4 -> 8,
clips 4 -> 6, cost unchanged (~$0.005, 3 calls).
- A job that fails for a reason on our side (CUDA/OOM, NVENC, cublas,
Gemini 5xx, no clip rendered) is re-queued once after 30 s, keeping its
reservation and transcript checkpoint. Content failures stay final.
- main.py renders clips best-score first and retries each failed clip once.
- A deploy's drain timeout no longer fails and refunds running jobs: the
child is killed, the manifest kept, and the next instance resumes it
(22-sep-2026: 6 jobs failed at once this way). Mid-render manifests are
resumed instead of being recovered as completed.
- /api/status returns the queue position and an ETA; the dashboard shows
it with a 'paid plans skip the line' upsell.
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>
From the EU prod servers every /shorts/<id> HEAD is first a 302 to
consent.youtube.com, which read as 'not a Short' and let a 53 s Short
through to the pipeline. With SOCS/CONSENT set, a Short answers 200 and a
regular video 303 to /watch (checked from the prod container).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Most subscribers use OpenShorts on one day and cancel. Autopilot makes the
value recur: once switched on, every new upload on the user's YouTube channel
(listed through the existing Upload-Post connection, no scraping) is sent
through the normal /api/process pipeline, the user gets an email when the
clips are ready, and with autopublish on the best clips are scheduled on
their socials, one a day.
- cloud/autopilot.py: poller, in-process job submission as the user,
completion hook, autopublish, and /api/autopilot{,/videos,/run}
- guard rails: only videos published after switching on, max 3 days old,
1 automatic job per user per day, first N minutes per video, Shorts skipped,
paid plans only, dedupe by (user, video) across the deploy handover
- dashboard: new Autopilot tab (sidebar + mobile menu, #app?tab=autopilot)
- connect page can return to the Autopilot tab
- analytics: ClipsDelivered/JobFailed now report source=url and the plan
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The guard named the pages it knew (search, playlist, channel, @handle)
and let everything else through. A hashtag page and the legacy /<vanity>
channel URL are neither, so yt-dlp paginated the browse: on 20-sep-2026
one of them walked to page 23 on the static pool, the "Unable to
download API page" errors that produced read as an IP problem, and the
per-GB proxy was paid to walk the same pages again until YouTube
rate-limited it.
The set of pages that fan out is open-ended, so invert it: allow only
the paths that carry a video id (watch?v=, youtu.be/<id>, shorts, live,
embed, v, e, clip) and refuse the rest before any request. A
single-video shape we forgot costs the user one clear error message; a
browse we forgot costs a paginated crawl on three IPs plus the paid one.
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.
93 of the 99 quota walls sampled on 16-sep-2026 were shown to accounts with
their 20 free minutes untouched that had pasted a 21-90 min video: asked to
pay before seeing one clip, most left Stripe without paying.
The 402 now carries partial_minutes (the floored balance, at least
PARTIAL_MIN_MINUTES and shorter than the source). The wall shows 'clip the
first N min' next to the plans and resubmits with max_minutes; the server
reserves min(asked, balance) and sets MAX_SOURCE_MINUTES, and main.py cuts
the source in place before anything reads it, so every later stage and the
editor see a short video. The cut travels in the resume manifest so a
redeploy cannot re-run the whole video on a partial reservation. Status and
the results view say which part of the video the clips came from.
get_visual_clips was named once in passing, in the local-LLM section, and
nowhere explained. Nothing said that it exists, that main.py routes to it
on its own, or that speech_is_sparse() triggers it as well as a missing
audio track. Writing the /gta-5-clips page off the CLAUDE.md I had, I
stated on a live marketing page that silent gameplay could not be clipped
at all, which is the opposite of what the code does.
So: both triggers and their thresholds, why the sparse test exists at all
(music-only and a muted mic transcribe to stray words, which is worse than
silence), what the pass returns and why those clips have no subtitles, and
the ceiling that comes with being the one stage that uploads footage
instead of sampling frames, including the fact that no guard enforces it.
With YOUTUBE_COOKIES attached, YouTube answers UNPLAYABLE for every client
(web_embedded, tv_downgraded, web AND mweb) on a share of videos, and yt-dlp
reports that as "Video unavailable". Measured in prod on 9-sep-2026 with
e_04ZrNroTo, same static IP minutes apart: cookies -> UNPLAYABLE on all three
statics; anonymous -> 1080p (137+140). The 6-sep default,mweb fix is no longer
enough on its own.
The download already recovers from this through its anonymous fallback-static
attempt. The probe carried the cookies on every route including the paid one,
so it read a cookie problem as an IP problem ("video unavailable" is in
_IP_SPECIFIC_HINTS) and escalated to DataImpulse, which fails identically with
the same cookies. That is what fired the two paid-proxy alerts that morning,
and a probe that dies outright 400s a video the download would have fetched.
Probe strategies are now (extractor_args, use_cookies): first attempt on a
route authenticated, second anonymous, mirroring the download. With no HD path
(self-host without a PO token provider) the fallback keeps the operator's
cookies, since it is then the only attempt.
Claude-Session: https://claude.ai/code/session_01Qfgs1gca8UeEEZ2pvjjC8i
Some MCP hosts never speak HTTP to a server: they run it as a command and
talk over stdin/stdout. Glama's Dockerfile deployments wrap exactly that
(and a local self-host user can now skip the web server entirely), so the
directory could not introspect our tools at all — mcp.openshorts.app 401s
without a key, by design.
mcp_stdio.py is transport only: mcp_server keeps the protocol, and tool
calls go through the same call_tool -> ASGITransport path, so stdio and
HTTP cannot answer differently. Two things it has to get right, both
covered by the test: stdout is swapped for stderr before app is imported,
because the pipeline prints everywhere and one stray line corrupts the
JSON-RPC stream; and the app's lifespan is entered explicitly, which
ASGITransport does not do on its own.
glama.json declares the maintainer, one of the listing gaps the directory
reports.
Claude-Session: https://claude.ai/code/session_01PkWCDoMsdmSxGXXh4jqF1m
With account cookies yt-dlp's authed defaults are tv_downgraded + web, and on
a share of videos both come back UNPLAYABLE / SABR-only, reported as "Video
unavailable" with no formats. That happened on every static IP too, so it was
mistaken for an IP ban and fed ~26 downloads a week to the per-GB proxy,
which then fetched 360p through the same dead client list. Measured in the
prod container on 6-sep-2026, same static proxy, same video: cookies +
defaults -> unavailable; cookies + default,mweb (+ PO token) -> 1080p; no
cookies -> 1080p.
- yt_clients.py: one client list (default,mweb + bgutil provider) shared by
the download and the duration probe. Never player_skip=webpage: it drops
the Data Sync ID and mweb loses its PO token (360p only).
- main.py: the fallback list (tv_embed, android) is gone from yt-dlp; the
fallback now runs anonymously when the cookie attempt already failed on
that route, and every attempt asks for the 1080p spec (the fallback's
best[ext=mp4] was itself the 360p progressive file).
- metering: an uploader's country block is a content error; the residential
pool failed identically in 5 of 6 paid probes (3-5 sep). The probe alert
now says when the paid proxy failed too.
Claude-Session: https://claude.ai/code/session_013ubPhpBw8kAUcLXCCfH4C5
Ten probes in one hour on 4-sep paid the per-GB proxy 1.8 MB each because
all three static IPs answered 'Sign in to confirm you are not a bot' to the
ANONYMOUS probe, while the same IPs served the cookie-authenticated
download of those very videos without a complaint: a datacenter IP's
anonymous rate limit is low and we make ~400 YouTube hits a day from three
of them. The probe now writes YOUTUBE_COOKIES to a temp file and passes it
as cookiefile, exactly as download_youtube_video does, and removes it in a
finally (the chain walk moved into _probe_with_proxies so that file has one
obvious lifetime).
Claude-Session: https://claude.ai/code/session_014i9z6mLTy978uRCfSsMfBq
Since the static IPs moved to three countries, every remaining paid rescue
had the same shape: all three statics answer 'Video unavailable' and the
paid fallback then downloads the video fine. Tested on the morning's case
(2eCIMQMy0AQ): the video is fine from a residential IP, the HD/web client
gets the fake unavailable on all three statics, and the conservative
clients (tv_embed/android) pass on those very same IPs. So it is the
client, not the IP, and the fix is free: try the fallback strategy through
a static before spending a per-GB byte. No quality trade: the paid path
was capped at 720p anyway.
Claude-Session: https://claude.ai/code/session_014i9z6mLTy978uRCfSsMfBq
PAID_PROXY_DAILY_MB (default 500): past it, the per-GB proxy is dropped
from the duration probe and from every new job's env until UTC midnight,
with one Telegram note per day. A repeat of 28-aug (statics refused by
YouTube for hours) now costs $0.50 at worst instead of $14.
The watcher probed the statics against google.com/generate_204, which kept
answering 204 that whole day while YouTube served the static IPs fake
'Video unavailable'. A static now has to return a real watch page with a
playable player response; the paid probe keeps the cheap plain-HTTP 204
(HTTPS through DataImpulse breaks in httpx even when healthy).
Claude-Session: https://claude.ai/code/session_014i9z6mLTy978uRCfSsMfBq
DataImpulse showed ~0.2 $/day with the static pool healthy, and $14 on
28-aug that nothing on the server could explain: the monthly counter is
in-memory and the container log rotates within the hour. The panel's
per-host rows for 31-aug/1-sep pointed at two leaks.
The duration probe (cloud/metering.probe_url_minutes) walked every URL that
failed on the statics through the paid proxy with both extractors, ~1.7 MB
a time: private, removed and members-only videos, live streams with no
duration, and every non-YouTube URL (Twitch, Kick, Rumble, product pages,
drive links) that the download plan itself never sends there. It now
reaches the paid proxy only for a failure another IP can fix (bot-check,
403/429, proxy or network errors) and never for a non-YouTube URL.
main.py prints PROXY_ROUTE=<json> after every download: the winning
attempt, paid bytes summed over every attempt that used the per-GB proxy
(failed ones included; a paid attempt that died after three fragments was
billed for them), and each free attempt's error text. app.py persists it as
a proxy_usage row at job end and pages Telegram whenever the paid proxy
carried bytes, folding a burst into one message per 5 min; a probe that
reached the paid proxy is recorded the same way.
Claude-Session: https://claude.ai/code/session_014i9z6mLTy978uRCfSsMfBq
First prod run of hook grounding on a product-update video: the layout
picker said screencast (0.95) but the render emitted only track/general
ranges, because the width gate did not upgrade the stats cards, so the
grounding never fired and every clip kept its topic-summary hook. A
GENERAL scene on a screencast video is a face-less full-screen slide or
dialog, not a group shot (checked frame by frame), so it now counts as
screen when screencast_layout is enabled for the job.
Claude-Session: https://claude.ai/code/session_014i9z6mLTy978uRCfSsMfBq
The hook and title come from the detail pass, which only reads the
transcript, so a clip whose meaning is on the screen shipped with a topic
summary ("I automated my clips with AI") while the viewer watched an MCP
connector being configured.
Two halves. The detail prompt now carries the rule that hook and title name
the concrete thing happening inside the clip, never the video's topic. And
after the render, when the layout sidecar says at least 25% of a clip is
screencast / wide / inset, hook_grounding sends three frames from those
stretches at 1024px plus the clip's own words to Gemini and rewrites hook
and title in place before auto_hook_clip burns them; the originals stay
under hook_grounding.before. Gemini-only (frames): a local-LLM install logs
one line and keeps the transcript hook. HOOK_GROUNDING=0 disables it.
Verified live on the reported frame: on_screen "Configuración del conector
del servidor MCP de OpenShorts", hook "Configura el servidor MCP de
OpenShorts paso a paso", stable across three runs.
Claude-Session: https://claude.ai/code/session_014i9z6mLTy978uRCfSsMfBq
Self-hosters asked for a pipeline that never calls Google. LLM_BASE_URL (+
LLM_MODEL, LLM_API_KEY) routes the transcript scoring and detail passes of
get_viral_clips to a /chat/completions endpoint; the answer is validated with
the same pydantic schemas Gemini enforces server-side, so main.py sees one
shape. json_schema is requested first and the request falls back to
json_object and then to free text when a server rejects the field.
Scoring batches drop from 8 to 3 windows on the local path: Ollama's default
4k context truncates silently and a truncated prompt scores garbage.
Self-host /api/process now accepts a request without X-Gemini-Key when the
backend is configured, /api/config exposes localLlm and the dashboard stops
demanding the key. Frame-based stages (layout picker, on-screen content,
silent videos) stay on Gemini and degrade as before without a key; the
silent-video path says so instead of failing generically.
Verified end to end with Ollama 0.13.5 + qwen2.5:7b on an M1 Pro: a 15-min
talk, 14 windows, 6 clips with usable hooks and titles, six local calls and
zero requests to Google.
Claude-Session: https://claude.ai/code/session_014i9z6mLTy978uRCfSsMfBq
The scene classifier sends every face-less shot to GENERAL, and GENERAL scales
the content to 42% of the frame height. That ratio buys presence on a LANDSCAPE
source by overflowing the sides; on a 1080x1920 upload the same number is a
shrink, leaving a 453px sliver floating over a blurred copy of itself. A user's
already-vertical video came back with its screen-recording scenes rendered that
way while its talking-head scenes (TRACK, whose crop is the whole frame) looked
right, so a single clip alternated between correct and ruined.
source_already_fits() gates the whole thing: a source at or past the target
aspect has no width to buy back, so the classifier, the SPLIT detection and the
screencast/inset upgrades are all skipped and every scene renders TRACK. The
layout picker is skipped too, saving a Gemini call per upload that the render
would have ignored anyway.
general_filtergraph() additionally floors the foreground at the height where the
source fills the output width, so the editor's explicit GENERAL override on a
portrait clip cannot reproduce the shrink. A 16:9 source keeps the 0.42 ratio
untouched.
Two siblings of the same bug, both only reachable on a source TALLER than the
target: the TRACK crop pinned y=0 and threw away the bottom of the frame instead
of trimming both ends, and v1's create_general_frame indexed the output with a
negative offset, which raises rather than renders.
Claude-Session: https://claude.ai/code/session_01KeQYCfUX2E9Q2fDgZMKEaJ
process_video now takes captions:false for sources that already carry
burned-in subtitles (maps to AUTO_CAPTIONS=0 for that job only) and
accepts upload_id as an alternative to source_url. create_upload reserves
a slot (POST /api/uploads) and returns a PUT URL the agent streams the raw
bytes to (curl -T works from any runtime); the owner recorded at reserve
time is checked at process time, files sit in UPLOAD_DIR under the usual
sweep, slots expire after 24 h. Tool count is 8 everywhere it is quoted.
Same transcript, three models: 3.5-flash 34 s, 3.7-flash 14 s, 3.1-pro 105 s.
3.7 gave the most specific thumbnail hooks (the ones that quote a figure from
the video rather than a stock phrase) at the lowest latency.
Titles: transcript + 10 frames instead of uploading the whole video (an hour
was ~1M tokens), a brainstorm across fixed styles then a critic that scores,
dedupes by angle and pairs each title with a 1-4 word thumbnail hook. Mobile
rules: payoff inside 50 chars, keyword first. Text model moves to
GEMINI_MODEL_THUMBNAIL (default gemini-3.5-flash); flash-lite is the weakest
tier and this is the one creative step.
Thumbnails: a text call designs N different concepts, one image call each in
parallel. Default burns the hook text with PIL (Anton, black stroke) over
negative space the image model is told to leave, so accents are never wrong;
'AI painted' toggle keeps the old behaviour. Outputs cover-cropped to
1280x720 under YouTube's 2 MB. GET /api/thumbnail/frames/{session} picks
frames with a large, sharp face spread across the runtime and the dashboard
offers them as the person reference. Phone-size preview row in the UI.
JSON parsing now uses raw_decode: flash appended a stray ]} once.
claude.ai and ChatGPT connect to a remote MCP server by URL and expect the
server to run the login: RFC 9728/8414 discovery under /.well-known/,
dynamic client registration (public clients, PKCE S256 mandatory), an
authorization endpoint and a token endpoint. The consent screen is the
dashboard (#/oauth/authorize) because the session JWT lives in localStorage
on the frontend host; the API bounces there and mints the code on a
session-authenticated POST. Redeeming the code mints an ordinary osk_ API
key named after the client and returns it as the access token, so every
existing auth, quota and ownership rule applies unchanged and the user
disconnects an app by revoking that key. The /mcp 401 now carries
WWW-Authenticate: Bearer resource_metadata=... so clients find the flow.
Dashboard: a "Connect an agent" card (Account in cloud, Settings when
self-hosted) with copy-ready setup for claude.ai, ChatGPT, Claude Code,
Claude Desktop, Cursor, n8n and curl; the clip generator links to it. The
/mcp page, README and CLAUDE.md describe the URL-only connection.
- Advanced options gain "vertical layout": auto (server default, AI picks
per video), two speakers stacked, screen over presenter, or single crop
only. Only a deliberate choice travels as `layouts`; remembered in
localStorage like the hook settings.
- `layouts=none` switches the picker off for one job even though the
deployment runs AUTO_LAYOUT=1.
- The fast rerender (cut without reframe) wrote no layout sidecar, so a
stacked clip fell back to bottom captions after a trim. It now carries the
canonical clip's ranges through the new cut (layout_ranges.remap).
- PROXY_DRAIN_SECONDS (20): after the jobs are drained, keep the socket
open with /health/ready at 503 so Traefik pulls the instance out of
rotation while it can still answer. Coolify builds the container's
HEALTHCHECK from its own interval*retries, so closing earlier was up to
60 s of alternating 502/200 per deploy (retries lowered to 3 as well).
- HARD_EXIT_SECONDS (30): uvicorn finishing does not end the interpreter
while an executor thread hangs in a network probe (a /api/process cut
off mid-shutdown left yt-dlp running), which kept a drained container
alive for the full 900 s grace and the deploy in "Removing old
containers". Exit outright a little after handing uvicorn the signal.
On a stacked two-shot the seam between the halves is the one place the
text covers nobody (OpusClip does the same), so every word event inside a
SPLIT stretch is anchored mid-frame with an inline \an5; other layouts keep
the style's alignment, and the text moves with the cut.
The render records which stretches use which layout in a <clip>.layout.json
sidecar (layout_ranges.py). The job pipeline, rerender and manual reframe
copy it into the clip's metadata as layout_ranges, so /api/subtitle finds it
on a restyle too. auto_caption_clip reads the sidecar when not told, which
is how recut hands it over.
Only the ASS path can do this; SRT burns keep one alignment per file.
Checked on the 45-clip corpus with SPLIT on: 45/45 render, 0 caption
errors, 42 with no split at all, and the 3 that split are real two-shots.
With health checks enabled Coolify swaps the Dockerfile HEALTHCHECK for its
own curl/wget probe; without either binary deploy 10856 reported unhealthy
on every attempt and rolled back.
- uvicorn --timeout-graceful-shutdown 15: after the drain, stop waiting
forever on open range downloads. The old container lived the full 900 s
stop grace with its port already closed, so Traefik alternated 502/200
for 15 minutes on 2026-08-25.
- /health/ready answers 503 once SIGTERM arrives, and a Dockerfile
HEALTHCHECK on it lets Traefik drop the instance within ~10 s while it
can still serve. Coolify's health check now waits on the same path
before stopping the old container. The marker drain does not flip it:
the new container is still booting at that point.
- ignore .worktrees
Coolify starts the new container before stopping the old one and both share
output/, so the new one used to re-enqueue at startup the very jobs the old
one was still rendering, and the old one had 30 s to live regardless.
- Each instance stamps output/.instance; an instance that sees another id
drains: finishes what it runs, starts nothing, leaves queued manifests.
- A running job heartbeats its manifest every 10 s; the resume scan (startup
and every 30 s) adopts only manifests nobody heartbeated for 60 s, so no
job runs twice and none is lost. Reservations of live-elsewhere jobs are
kept out of the orphan refund; poison jobs stay refundable.
- SIGTERM drains too (up to DRAIN_TIMEOUT_SECONDS, default 840) before the
signal reaches uvicorn, so the socket stays open and Traefik keeps getting
answers. The app's Coolify stop grace period is now 900 s.
- /api/status answers from disk for a job this instance never held, so a
poll landing on either container during the handover works.
Verified in the local stack: SIGTERM mid-job -> job finished its clips,
'Drained', exit 0; status polled 200 throughout an 8 min drain; a job
submitted during the drain was left for, and resumed by, the next instance.
A job interrupted by a container restart is re-enqueued from its resume
manifest and re-run from scratch in the same output directory. Transcription
is the slow, paid stage that had already finished, so main.py now leaves it
there as .transcript_checkpoint.json and the re-run picks it up (same shape
and validation as --transcript). Removed when the job completes so a later
run in a reused directory never inherits it.
Verified locally: run killed after transcription, re-run in the same
directory logged 'Reusing the transcript from the interrupted run' and
delivered both clips.
Eight findings from re-reading the erasure path, each one something that would
have shown up in production rather than in a test:
- The local purge missed two stores. SaaSShorts outputs (output/saas_<id>) and
generated thumbnails record ownership in their own in-memory dicts, not in
the .owner file, so neither was erased. Thumbnails are the serious half: the
hourly sweep deliberately skips their directory, so a deleted user's
generated images stayed on disk forever, publicly served at /thumbnails/.
- The purge ran on the event loop. rmtree over gigabytes of video stalled every
other request on the process; it goes through asyncio.to_thread now.
- Paths from those dicts are now resolved through _safe_under, so a session id
or output_dir containing ".." deletes nothing.
- Deleting a user made a webhook path reachable that never was: _apply_topup
takes the user id from Stripe metadata, so a top-up completing around the
deletion inserted a row pointing at a user that no longer exists. The FK
violation 500s the webhook, and since the event is only recorded after
handle_event returns, Stripe retries the same doomed insert for three days.
It confirms the row exists first.
- The "why are you leaving" box was free text stored in a record that
deliberately outlives the account, which is how personal data ends up in one
by accident. It is a closed list now, which also makes twenty deletions a
month countable instead of readable.
- Two concurrent deletes wrote two erasure records and sent two goodbye emails.
The DELETE's rowcount now decides which call is the real one; the UI holds a
ref so a double click doesn't fire a second Stripe cancel and R2 purge.
- The delete button armed itself when the confirm box was empty, if the page
ever rendered before /api/me resolved.
- The goodbye email claimed we keep "a one-way hash of your email and nothing
else", which was not true of the Stripe reference beside it. Fixed in the
email and in the privacy policy, EN and ES.
Also: skip the Upload-Post call when no managed key is configured, and say
plainly in the in-flight comment that it covers metered work only.
tests/test_account_local_purge.py covers tenant isolation across all three
stores and both traversal attempts; test_account_erasure.py gains the
confirmation gate, the API-key refusal, and the already-cancelled-at-Stripe
case that would otherwise trap a user forever.
The privacy policy already told users that "deleting your account from the
dashboard removes your content" — there was no way to do it. This adds one:
Account -> Delete account in the dashboard, DELETE /api/account on the server.
The endpoint refuses API-key auth (a leaked osk_ must not destroy the account
it was issued from) and requires the caller to retype the account email; the UI
does the same, collapsed behind a danger zone that itemises what actually goes.
Erasure is immediate and irreversible, because after it there is nothing left
to authenticate a recovery request against.
The order of the steps is the design, each one a failure mode:
- Stripe cancel first, aborting everything if it fails, so we never erase a
user we are still billing. An InvalidRequestError is treated as already
cancelled: a portal cancellation whose webhook never landed leaves our row
reading "active" forever, and the one account that could not be deleted
would be the one Stripe already stopped charging.
- R2 before the database, because those rows are the only index of which
objects belong to the user; dropping them first turns a failed purge into
permanent orphans.
- The DB delete is one transaction over an explicit table list, not the
declared ON DELETE CASCADEs: create_all never ALTERs an existing table, so a
constraint added after a table shipped lives in the models and not in
production. tests/test_account_erasure.py fails if a new table references
users.id without joining that list.
- A reserved usage_ledger row blocks the delete: erasing under a running job
would pull the output from beneath it and leave the reservation unsettled.
What survives, and why: the Stripe customer and its invoices (six years,
Spanish commercial law) and one account_deletions row holding a sha256 of the
email as proof the erasure happened, itself purged after five years by the
retention sweeper. app.py registers a callback so the working files in output/
and uploads/ go too instead of waiting for the hourly sweep.
Privacy policy sections 6 (EN + ES) now point at the button and name both
survivors; the Legal hub summary says the same in one line.
New static pages, each re-housing demand GSC already shows landing on the
homepage: no-watermark clip generator (the AI-answer gap: unwatermarked
free clipping only exists self-hosted), open-source AI video generator
(splits the text-to-video intent honestly), podcast-to-shorts (the SPLIT
layout as the capability no competitor page can show), YouTube-to-Shorts
converter (link import is free here, paid at Opus Clip), and an
automation recipe page (API + signed webhooks + n8n shape).
/mcp gains a checked comparison table: Opus Clip shipped MCP in July
2026, so the claim that survives is flat-minute billing and self-hosted
agent access with no meter, not MCP existence. All competitor claims
carry checked dates.
Agents don't forget to come back; humans do. Make the whole pipeline
drivable without the dashboard:
- API keys (osk_...): sha256-stored tokens minted from the account page.
get_current_user_optional resolves them like a session, so metering,
entitlement, priority and job ownership apply to agents with zero
endpoint changes. Key management refuses API-key auth (a leaked key
cannot mint replacements).
- MCP server at /mcp: stateless Streamable-HTTP JSON-RPC, no SDK
dependency. Six tools (process_video, get_job_status, list_clips,
get_quota, add_subtitles, publish_clip) that call back into this same
app in-process via ASGITransport with the caller's auth headers, so
MCP can never drift from REST behavior. Cloud requires a key;
self-host stays BYOK-open.
- Completion webhooks: webhook_url (+ optional HMAC webhook_secret) on
/api/process, SSRF-checked at submit AND delivery, fired once after
the R2 archive so payloads carry durable links, survives redeploys
via the resume manifest.
- Dashboard: API keys card in the account page (create once-shown key,
list, revoke).
- Tests pin BILLING_ENABLED=0 in conftest so the suite no longer
depends on the developer's personal .env.
Tried first as a fourth option for the classifier, and it does not work: on the
5 corpus clips that have a composited webcam, Gemini answered "screencast" on
all 5, in both runs, and overall accuracy fell from 92% to 85% and 83%.
3 options 44/48 92% screen preserved 17/20 none intact 27/28
4 options c1 41/48 85% 18/20 28/28
4 options c2 40/48 83% 18/20 28/28
Read that carefully: the fourth option did no HARM (zero regressions across the
28 that must not be touched, and it actually preserved the screen on one more).
It simply never got the new class right. Whether a webcam rectangle is present
is a geometric question, and the detector answers it 5 of 5 with no false
positives.
So the split is: Gemini decides what the video is, geometry decides the framing.
If the decision is "screencast" and camera_inset finds a rectangle, that layout
is used; otherwise full width.
Verified end to end: figma -> screencast + inset on 4 scenes; excel (presenter
composited full-screen, no rectangle) -> full width, as before.
Gemini bills video at ~300 tokens per second. An hour of source is ~1.08M
tokens (past a 1M context window) and a 1-2GB upload to get one word back. This
pipeline ingests hour-long podcasts, so uploading the file failed in exactly the
normal case.
Measured over the same 48 clips against the hand-checked labels:
whole video 94% / 92% / 96% 18,17,18 of 20 found
12 frames @ 640px 90% / 90% 15,16 of 20
12 frames @ 1024px 92% 17 of 20
24 frames @ 1024px 90% 16 of 20
Resolution was the gap, not frame count: at 640px a spreadsheet is unreadable,
and doubling the frames made it slightly worse. At 1024px the difference from
sending the whole video sits inside the run-to-run variance the whole-video mode
already has (92-96%), at 2.2s per clip instead of ~15s, with a cost that no
longer depends on the source duration.
It also removes the Files API dance: no upload, no waiting for ACTIVE.
Four new layouts, all off by default, plus a picker that decides which one a
video gets.
- SPLIT (split_layout.py): two speakers stacked. The test is COEXISTENCE in the
same frame, not presence measured separately: BlazeFace loses faces in
profile, which is how someone sits while listening, so a presence test
rejects conversations for looking like conversations. Coexistence also
separates a two-shot from a shot/reverse-shot, where stacking would show the
same person twice.
- SCREENCAST / WIDE (screencast_layout.py): content over the presenter, or full
width when the content fills the frame and the presenter is composited on top
of it (stacking there shows the same thing twice).
- ALTERNATE (active_speaker.py): hard cuts to whoever is talking. Mouth activity
must be normalised per speaker against their own resting state; raw magnitude
scales with contrast and lighting and handed one person 90-100% of the scene.
- Punch-in (punch_in.py): a 12% push on the beats, riding the TRACK path by
widening its per-frame crop command from x-only to w/h/x/y.
layout_picker.py chooses between none/screencast/split with one Gemini call per
source video. Measured over the 48-clip corpus against hand-checked labels:
94/92/96% across three runs, 0-1 false positives out of 28, and 2 clips of 48
changing answer between runs. The key is asking for a DECISION between closed
options rather than a measurement: the four previous attempts (Canny, MSER,
coverage, width) all asked for a number and none separated a spreadsheet from a
corner scoreboard.
app.py exposes all of it per job through `layouts` on /api/process. Without that
field the pipeline behaves exactly as before.
83 new tests, 315 green.
The browser reports the funnel, but not what decides whether this product
retains: on 26-jul-2026, 491 of the 564 users who ever processed a video did it
exactly once. Every clip-quality fix that shipped that day — 1080p delivery,
captions by default, loudness normalisation — was aimed at that 87%, and
nothing in the stack could measure whether it moved.
Client-side cannot answer it. A render finishes minutes later, often after the
tab is gone, and ad-blockers eat a share of the rest. So the backend now emits
ClipsDelivered / JobFailed with the user's profileId and a `job_index` — the
count of process jobs that user has run. Counting distinct users at index 1
versus index >= 2, before and after today, answers the question directly.
Failures carry the same reason classification the Telegram alerts use, so the
"did it break or did they just not come back" split is visible too.
Fire-and-forget throughout: no config means a silent no-op (the normal state
for self-hosted), every send is a background task, and every failure is
swallowed. Analytics must never slow down or break a job.
Needs OPENPANEL_CLIENT_ID and OPENPANEL_CLIENT_SECRET in the environment — a
WRITE client, which is a different credential from the read/root client the MCP
needs. Verified against the live instance: the write path returns 200 and the
module no-ops cleanly when unconfigured.