Commit Graph

10 Commits

Author SHA1 Message Date
JSLMPR 3652cefacc feat(vision): pluggable llama.cpp/GGUF Tier-2 VLM backend (stronger judge)
The director's vision JUDGE is only as good as its model, and moondream2 can't
perceive some actions on hard footage (R15 ceiling). Make the captioner backend a
config choice so a stronger local VLM drops in with no code change:

- tools/vision_caption_llamacpp.py: same manifest->JSON contract as
  tools/vision_caption.py, but backed by llama.cpp `llama-mtmd-cli` (GGUF). Runs on
  this x86 CPU via AVX and bypasses the torch==2.2.2 / transformers 4.x trap
  entirely (no PyTorch). Model/mmproj/binary paths come from env vars; fully
  offline, serverless (per-frame CLI, mmap stays warm).
- editing.vision-caption-script selects the worker (default: moondream). The Java
  HighlightVisionDirector now reads the configured script instead of a hardcoded
  path -- nothing else changes.
- docs/LOCAL-MODELS.md: provisioning + enablement for Qwen2.5-VL-3B (Apache-2.0)
  via llama.cpp; alternatives (Qwen3-VL, Gemma 3 4B). Honest note: likely improves
  the bowling case but unverified until tested with real weights.

mvn verify: 293 tests green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-25 19:11:54 +02:00
JSLMPR 9e401870a1 feat(cinematic): R10–R14 grade/cadence/edit rules + 420p compat fix
Add five source-adaptive cinematic rules, all content-agnostic and
  fail-soft, derived from a web review of the film look and how consumer
  AI editors (DJI LightCut, Insta360) auto-edit:

  - R10: 24fps cinematic cadence (output frame rate 30 -> 24)
  - R11: filmic tone-curve grade (lifted toe + highlight roll-off);
         optional licensed film LUT via lut3d, gated on a .license.txt
         sidecar (fails closed, no unlicensed asset applied)
  - R12: shutter-angle motion blur (tmix), toggle
  - R13: beat-synced cuts — snap cut boundaries onto the score's beat
         grid (HighlightBeatSync + tools/beat_detect.py, librosa)
  - R14: subject-tracking reframe — follow the detected subject instead
         of a static crop (HighlightSubjectTracker + tools/subject_track.py,
         YOLO/AGPL, non-commercial); renderer subjectFollowFilter
  - Fix: pin -pix_fmt yuv420p on every encode pass (was yuv444p, which
         browsers/QuickTime reject)

  R13/R14 are opt-in flags, on in localpoc. mvn verify: 288 tests green.
  E2e bowling re-render verified: 24fps, yuv420p, -16.0 LUFS, 3 cut
  boundaries beat-snapped, all 5 shots subject-followed.
  Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-25 12:36:18 +02:00
JSLMPR 1da0661eea Automatic two-tier highlight director + source-adaptive rendering
Rendering (whole service, driven by source measurements, not constants):
- Orientation-aware geometry: FfmpegClipInspector reads display rotation and
  stores effective dims; HighlightFfmpegRenderer.outputGeometry renders portrait
  sources portrait and skips the 2.39 letterbox on portrait (landscape unchanged).
- Dynamic exposure: probeSourceLuma measures the frames; exposureNormalizationFilter
  maps the mean toward a target; the grade is now exposure-preserving (no crushed
  subjects: bowling final went ~63 -> ~100 mean luma).
- Motion-adaptive in-shot push-in (zoompan), amount from per-shot YDIF.
- Audio mix ducks source audio under the generated score so it leads.
- Highlight duration is no longer capped (validator + config).

Automatic director (plans were hand-authored before):
- Tier 1 HighlightMontageDirector: composes the montage from measured motion (YDIF)
  and audio-energy (RMS) curves -- setup, continuous action/tension, slow-mo payoff
  on the audio climax, resolution button, camera-whip tail trimmed.
- Tier 2 HighlightVisionDirector + tools/vision_caption.py: a local, offline
  vision-language model (moondream2) captions the payoff frame and augments the
  montage with a semantic overlay ("STRIKE") and scene-informed music; fails soft.
- Wired into the scheduler behind auto-director-enabled / vision-director-enabled
  (on in the localpoc profile).

Docs: cinematic-quality-rules.md (R1-R5, R9 both tiers), poc-plan milestones.
Tests: mvn -o verify -> 262 passing, 0 failures.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MPuJXQyAeWpFcTtcnxo1UN
2026-07-23 22:49:05 +02:00
JSLMPR a95d1fa0ac Wire local generative audio models into the highlight asset worker
Replace the unusable audiocraft path (requires xformers, which has no Intel-Mac
build) with runtimes proven to work offline on this machine:
- music: transformers MusicGen (facebook/musicgen-small)
- sfx:   diffusers AudioLDM2 (cvssp/audioldm2), resampled 16k -> 48k
- voiceover: Piper (unchanged), normalized to 48 kHz mono

The worker CLI contract and exit codes are preserved, so the Java
LocalAssetSynthesizer license gate and fail-closed behavior are unchanged.
Add tools/provision_local_models.py to materialize models into models/ from the
local HF cache with no network. Models and their license sidecars live under the
git-ignored models/ dir; both audio models are non-commercial (CC-BY-NC-4.0 /
CC-BY-NC-SA-4.0), recorded for later production review.

Add docs/cinematic-highlight-poc-plan.md tracking the PoC plan and milestones.
mvn -o verify: 245 tests, 0 failures/errors/skips (unchanged).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bg76sLc43Wc3j5ZcLkboYR
2026-07-21 23:00:57 +02:00
JSLMPR f6dc6b8a83 Harden cinematic highlight planning and rendering
- require explicit approval and skip ineligible highlight projects
  - validate timing and deduplicate candidate ranges
  - enforce licensed local assets and fail-closed generation
  - preserve video duration when mixing generated audio
  - refresh skill runbooks and regression coverage
2026-07-21 18:32:35 +02:00
JSLMPR 97ba827d50 add asset generation 2026-07-21 10:03:27 +02:00
JSLMPR adc979eea8 Add local CV worker readiness checks 2026-07-11 17:46:40 +02:00
JSLMPR 8195b58552 Add rich video editing diagnostics 2026-07-11 17:11:35 +02:00
JSLMPR 9dc720b0cc Add runnable local CV model worker 2026-07-11 16:40:59 +02:00
JSLMPR 82e557905e Add local CV visual analysis provider 2026-07-11 10:49:11 +02:00