Commit graph

104 commits

Author SHA1 Message Date
juancarlos.cavero
70260108cc feat(free): watermark lockup arriba-izquierda + modal de upgrade + star-ask durante el render
- La marca pasa de texto abajo-centrado a un lockup blanco (símbolo +
  OpenShorts) superpuesto arriba a la izquierda: el borde inferior es lo
  que se recorta al repostear, así que ahí la marca se quitaba gratis.
  PNG pre-renderizado en assets/ para no depender de fuentes del contenedor.
- WatermarkModal: aviso único al descargar en plan free (descargar igual /
  upgrade / no volver a mostrar), al estilo del de OpusClip.
- StarBanner también durante la generación, que es donde el usuario tiene
  minutos muertos esperando.
2026-07-20 18:58:00 +02:00
juancarlos.cavero
9fd1cacb0c feat(billing): free plan (20 min/mes sin tarjeta) + retirar trial + opt-in galería UGC
- Plan free resuelto en metering (sin fila Stripe): 20 min/mes para cuentas
  Google, período sintético de mes natural con reset automático
- TRIAL_DAYS=0 para nuevos checkouts; trials en curso grandfathered
- Watermark drawtext en clips free (pasada única post-render, sobrevive
  subtítulos/hooks); thumbnails IA solo de pago
- Anti-abuso: 3 jobs/día por cuenta, 5 por IP, rate-limit de probes,
  contador mensual de GB de proxy con alerta Telegram a 100 GB
- Clips free caducan a 7 días (purge_free_expired); purge_expired respeta
  a cancelados que ahora son free
- Galería UGC pública pasa a opt-in (share_to_gallery, antes publicaba
  producto+guion de todos los usuarios sin permiso)
- Emails: clips listos (con star-ask) y sin-minutos (cooldown 24h)
- Frontend: card Free en pricing, copy sin trial (landing/legal/gates),
  StarBanner en resultados y TopUpModal, upsell de watermark
2026-07-20 00:26:21 +02:00
juancarlos.cavero
36cf6d33b1 fix(reframe): robustify per-scene TRACK/GENERAL strategy
- Sample 5 evenly-spread frames clamped inside the scene (old start+5/end-5
  fell outside scenes shorter than ~10 frames)
- Skip near-black frames so fades stop dragging single-person scenes to GENERAL
- Hysteresis: a sub-2s scene flanked by agreeing neighbors adopts their
  strategy — each TRACK<->GENERAL flip is a full layout change on screen
2026-07-18 03:51:50 +02:00
juancarlos.cavero
101a467c34 feat(reframe): TransNetV2 neural scene detection with PySceneDetect fallback
New scene_detection module: TransNetV2 (small 3D-CNN, runs on 48x27 frames)
as the primary shot-boundary detector — far more accurate than the fixed
ContentDetector threshold on fast motion, flashes and gradual transitions.
Adds a min-scene-length merge (SCENE_MIN_SEC, default 1s) to stop camera-snap
bursts. Legacy PySceneDetect path is preserved untouched as automatic
fallback and selectable via SCENE_ENGINE=pyscenedetect.
2026-07-18 03:49:01 +02:00
juancarlos.cavero
dd867f098a feat(reframe): parallel clip processing (CLIP_WORKERS, default 3) with detector lock; fix v2 Fraction fps 2026-07-18 03:08:34 +02:00
juancarlos.cavero
7ff41735a6 feat(reframe): v2 engine — downscaled analysis pass + native ffmpeg render (sendcmd dynamic crop, per-scene segments, stream-copy concat), auto-fallback to v1 2026-07-18 03:05:36 +02:00
juancarlos.cavero
aeca9dbf98 perf(cut): stream-copy remux in passthrough finalize — the cut is already freshly encoded, re-encoding only added time and generation loss 2026-07-18 02:57:39 +02:00
juancarlos.cavero
402e585af7 perf(reframe): downscaled detection (640px), stride 2->4, throttled YOLO fallback, linear resize, quarter-res background blur, per-stage timing 2026-07-18 02:48:53 +02:00
juancarlos.cavero
b9aeaac692 security: never print cookie-file content; scrub credential URLs from worker-appended error log lines 2026-07-18 02:38:16 +02:00
juancarlos.cavero
719d444139 feat: GPU pipeline — Parakeet ASR backend with whisper fallback + NVENC encoder helper
- transcribe_backends.py: parakeet-tdt-0.6b-v3 (onnx-asr, VAD+timestamps) as
  selectable backend (TRANSCRIBE_BACKEND), token->word reconstruction keeping
  the leading-space convention, absolute timestamps, native floats, language
  detection via py3langid, and automatic whisper fallback (errors, empty
  output, or language outside parakeet's 25).
- whisper singleton + ASR GPU semaphore (model stays resident; GPU decodes
  serialized; CPU path behavior unchanged).
- ffmpeg_utils.py: central encoder args (FFMPEG_ENCODER=x264|nvenc|auto with
  cached probe + fallback); migrated the 9 hardcoded libx264 call sites.
- saasshorts now honors WHISPER_* config instead of hardcoded base/cpu/int8.
- Dockerfile: ARG GPU=1 installs CUDA user-space libs (cuBLAS/cuDNN9) +
  onnx-asr/onnxruntime-gpu; LD_LIBRARY_PATH + NVIDIA_DRIVER_CAPABILITIES.
- Validated on prod GPU (RTX 4000 Ada, driver 580): 94s clip transcribed in
  6.5s, word timestamps within ~0.1s of whisper, fallback path exercised.
2026-07-18 01:38:11 +02:00
juancarlos.cavero
b3e44643cc feat: 2-pass Gemini clip pipeline (score windows -> detail shortlist)
Replaces the single whole-transcript call with windowed scoring + focused
detailing (from PR #50), for better clip coverage on long videos:

- clip_selection.py: build_transcript_windows (sentence-aligned overlapping
  windows), snap_clip_to_words (cuts land in pauses, not mid-word), model
  price table.
- gemini_worker.py: score/detail prompts + Pydantic response schemas + robust
  JSON parsing and multi-stage cost accounting (incl. thinking tokens).
- main.py get_viral_clips: pass 1 scores windows in batches and shortlists the
  top (scaled by duration); pass 2 details the shortlist; every clip is snapped
  to word boundaries. Cost is summed across both passes. Falls back to
  whole-video conversion (caller) if it yields nothing.
- 13 clip_selection unit tests (63 total).
2026-07-17 22:32:04 +02:00
juancarlos.cavero
861134f8fe feat: quality gate, output-format selection, whisper small (PR #50)
- Quality gate: quality_probe.py probes the offered YouTube resolution before
  starting; /api/process returns needs_confirmation below QUALITY_GATE_MIN_HEIGHT
  (720p) and the UI shows a 'process anyway' modal that resends with
  force_low_quality. Fail-open on any probe error. URL sources only.
- Output format: MediaInput picks 9:16 / 1:1 / 16:9; threaded through
  /api/process -> main.py --format. render_clip() routes vertical/square to the
  reframe (aspect_ratio param) and horizontal to a passthrough (keep landscape).
- Whisper: main pipeline defaults to 'small' (better non-English) with
  vad_filter + no cross-segment conditioning; env-overridable.
2026-07-17 22:21:46 +02:00
juancarlos.cavero
880efb4d12 fix(gemini): force JSON output + rescue parse for clip detection
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.
2026-07-17 21:26:04 +02:00
juancarlos.cavero
6a3b1e58ab fix(cost): price table with prefix match instead of hardcoded 2.5-flash rates 2026-07-17 21:26:04 +02:00
juancarlos.cavero
e5d88999cf config: default all Gemini text/analysis calls to gemini-3.1-flash-lite
Unified via GEMINI_MODEL (plus per-task overrides GEMINI_MODEL_EDITOR /
GEMINI_MODEL_SAAS / GEMINI_MODEL_THUMBNAIL). The thumbnail image model stays
on gemini-3.1-flash-image-preview — flash-lite cannot generate images.
2026-07-17 21:26:04 +02:00
juancarlos.cavero
f791a74807 quality: CRF 18 on all encode steps, Lanczos resampling on resizes
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).
2026-07-17 17:11:14 +02:00
juancarlos.cavero
b1113d7a3f fix: Gemini retry with backoff, hook overlay duration, configurable job retention
- 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)
2026-07-17 16:47:38 +02:00
juancarlos.cavero
c32d579675 chore: scrub infra hints from repo
- Remove vendor name (proxy provider) and strategy-revealing comments across
  Dockerfile, docker-compose.cloud.yml, main.py, cloud/metering.py, cloud/alerts.py
- Stop tracking .env.cloud.example (kept local only; added to .gitignore)

Functional references (yt-dlp helper plugin, env var names) necessarily remain.
2026-07-16 18:31:55 +02:00
juancarlos.cavero
d298f69f12 feat(cloud): bake bgutil 720p into image, profile menu, video-URL info, trial→pricing
- Dockerfile: bake bgutil PO-token provider in script mode (no sidecar); 720p verified
- main.py / cloud/metering.py: support BGUTIL_SCRIPT_PATH (script mode) alongside HTTP
- docker-compose.cloud.yml: drop bgutil sidecar; .env.cloud.example documents script mode
- docker-compose.e2e.local.yml: local FRONTEND_URL/ALLOWED_ORIGINS/VITE_API_URL for testing
- AuthContext: new/non-entitled sign-ins land on pricing to start the trial
- ProfileMenu: header account dropdown (email, account & billing, sign out)
- MediaInput: "YouTube URL" → "Video URL" + supported-platforms info popover
2026-07-16 02:07:53 +02:00
juancarlos.cavero
12d423d739 feat: 720p->360p download fallback + SMTP email alerts
- 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.
2026-07-14 14:00:02 +02:00
juancarlos.cavero
ebe876c497 feat: unlock 720p/1080p YouTube downloads (Deno + bgutil PO tokens)
YouTube now forces SABR streaming, capping downloads at 360p without a GVS PO
token. Adds the full recipe (cloud mode only):
- Dockerfile: Deno JS runtime (nsig challenge) + latest yt-dlp[default] nightly
  + bgutil-ytdlp-pot-provider plugin
- docker-compose.cloud.yml: bgutil PO-token sidecar + BGUTIL_BASE_URL
- main.py / metering.py: when BGUTIL_BASE_URL is set, use yt-dlp default clients
  + the bgutil HTTP provider (→ 720p); self-host keeps the conservative fallback

Verified E2E through the container: managed user -> YouTube -> DataImpulse
residential proxy + Deno + bgutil -> real 720p (format 136) download, no 403.
2026-07-14 13:42:07 +02:00
juancarlos.cavero
05578c5456 feat: add hosted paid mode (managed keys, Stripe trial, metering)
Adds an optional cloud/paid mode behind a BILLING_ENABLED flag. With the flag
off the app is byte-identical to today's self-hosted BYOK build (regression-zero).

Backend (cloud/ package, only imported when BILLING_ENABLED):
- Auth: magic link (Resend) + Google OAuth (authlib) + JWT sessions
- Stripe: hosted Checkout with 3-day card trial, Customer Portal, idempotent
  order-safe webhooks; 3 plans (Starter/Creator/Pro) resolved by lookup_key
- Postgres + SQLAlchemy async; atomic minute metering (reserve/commit/release,
  plan->topup FIFO, restart-safe) with sweeper
- Managed keys: Gemini + Upload-Post server-side for entitled users; paid-only
  (BYOK core header ignored on hosted); Upload-Post white-label per-user profiles
- Metering wired into /api/process (probe->reserve->402, priority queue) and
  thumbnail image generation (3 min/batch)
- yt-dlp residential PROXY_URL support + 720p cap for hosted YouTube downloads

Frontend:
- AuthContext, LoginModal, PricingSection (3-day trial), AccountPage, UsageMeter,
  TopUpModal, TrialGate/AdvancedBanner
- Paid-only UI: hide BYOK core inputs, trial prompts per tool
- Included (Clip Generator, YouTube Studio) vs BYOK (AI Shorts/dubbing: fal.ai +
  ElevenLabs) clearly separated; ThumbnailStudio + SaaShortsTab managed-aware
- Landing: free-self-host vs paid-hosted messaging

Verified end-to-end against real Postgres + Stripe test mode.
2026-07-14 13:04:43 +02:00
juancarlos.cavero
771d7da552 fix: Migrate scene detection to PySceneDetect 0.6+ API
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>
2026-05-06 10:36:50 +02:00
juancarlos.cavero
6a83ebdcd7 fix: Strip '#' from sanitized filenames to prevent broken clip URLs
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>
2026-04-30 07:05:27 +02:00
juancarlos.cavero
3946c49ad1 added youtube studio 2026-02-20 01:11:27 +01:00
juancarlos.cavero
bf577494b7 Update hooks, fix captions, and ignore uploads 2026-01-23 14:53:57 +01:00
juancarlos.cavero
207f1aa8e3 fix upload video 2025-12-23 09:55:39 +01:00
juancarlos.cavero
9d767897b3 try fix youtube download 2025-12-23 00:10:35 +01:00
juancarlos.cavero
d3ef8ccd26 try fix youtube download 2025-12-22 23:43:18 +01:00
juancarlos.cavero
e8debfa0e8 try fix youtube download 2025-12-22 23:07:42 +01:00
juancarlos.cavero
79d672b918 try fix youtube download 2025-12-22 22:46:39 +01:00
juancarlos.cavero
479ef8a188 try fix youtube download 2025-12-22 22:30:31 +01:00
juancarlos.cavero
c5e2d4818f try fix youtube download 2025-12-22 22:18:15 +01:00
juancarlos.cavero
c381c624be added subtitles 2025-12-22 18:21:17 +01:00
juancarlos.cavero
6913e74f84 fix downloads 2025-12-21 23:38:50 +01:00
juancarlos.cavero
f9b43b3648 improve video preview and added new recognition system MediaPipe lib 2025-12-21 03:09:34 +01:00
juancarlos.cavero
3c92d6ce67 improve video preview 2025-12-21 01:59:15 +01:00
juancarlos.cavero
5be810d606 added video cost to executions 2025-12-21 00:06:59 +01:00
juancarlos.cavero
1121b7940f reafactor readme added instructions and texts 2025-12-20 13:48:22 +01:00
juancarlos.cavero
3ab5404fbe fix yt-dlp error in prod 2025-12-19 22:42:53 +01:00
juancarlos.cavero
6e005d7398 fix yt-dlp error in prod 2025-12-19 22:37:51 +01:00
juancarlos.cavero
ba8a46740f fix yt-dlp error in prod 2025-12-19 21:56:52 +01:00
juancarlos.cavero
8ad6ad0912 fix yt-dlp error in prod 2025-12-19 21:50:48 +01:00
juancarlos.cavero
f724e537cc fix yt-dlp error in prod 2025-12-19 21:46:10 +01:00
juancarlos.cavero
f8f2f476b9 fix yt-dlp error in prod 2025-12-19 21:43:50 +01:00
juancarlos.cavero
51592d0ffa fix yt-dlp error in prod 2025-12-19 21:36:36 +01:00
juancarlos.cavero
99eb1b19ce fix yt-dlp error in prod 2025-12-19 21:30:53 +01:00
juancarlos.cavero
fbe2871ed0 fix yt-dlp error in prod 2025-12-19 21:25:59 +01:00
juancarlos.cavero
e5dd902e8a added upload to social networks and change to fast-whisper 2025-12-19 20:30:13 +01:00
juancarlos.cavero
892383acc3 added generate clips from video with gemini 2025-12-19 16:00:44 +01:00
juancarlos.cavero
a5649a3987 added docker compose, and youtube url process 2025-12-19 13:47:23 +01:00
kamil
adf614ae24 feat: Enhance video processing script with argparse for input/output handling and add progress indicators 2025-08-19 12:52:43 +02:00
kamil
77af869412 feat: Refactor video processing script to use FFmpeg for output and remove moviepy dependency 2025-08-19 12:38:05 +02:00
kamil
946c9f51ba feat: Initial implementation of smart video cropping script 2025-08-19 11:47:53 +02:00