Commit graph

3 commits

Author SHA1 Message Date
719946b3cd refactor/package-layout (#3)
All checks were successful
CI / backend-tests (push) Successful in 29s
CI / frontend-build (push) Successful in 9m48s
Reviewed-on: #3
Co-authored-by: pedro-bento <mail@pbento.pt>
Co-committed-by: pedro-bento <mail@pbento.pt>
2026-10-04 20:47:12 +01:00
juancarlos.cavero
38f37137ee fix(audio,punch): true-peak headroom and punch-in calibration
Two defects affecting EVERY clip, both measured on the corpus.

Audio: loudnorm hits the level target (median -14.2 LUFS, 13/14 inside the
band) but its true-peak ceiling is enforced BEFORE the AAC encode, and the
codec then adds inter-sample peaks on top. At TP=-1.5 one clip came out at
+0.2 dBTP, i.e. clipping. TP=-2.0 removes it at no cost to level (12/14 in
band); -3.0 does cost level (8/14). Tried and rejected: an alimiter afterwards
(limits sample peaks, not inter-sample, and measured WORSE at +0.7) and
two-pass loudnorm with linear=true (+0.4, still clipping).

Punch-in: the shipped defaults produced 8.4 punches per minute, one every seven
seconds. Swept both knobs over 20 clips; 18s/0.60 gives a median of 2.8 and a
max of 3.0, chosen for having the tightest spread rather than just the right
median.
2026-07-31 13:28:46 +02:00
juancarlos.cavero
094e13c2f9 feat(reframe): optional layouts, and a Gemini-picked layout per video
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.
2026-07-31 13:28:45 +02:00