Restructure the 37 root-level Python modules into a proper package:
clipwright/{core,api,pipeline,layouts,media,integrations,tools}
- Rewrite every local import (module-level and deferred) to absolute
clipwright.<group>.<mod> form; no legacy root shims or re-exports.
- Add clipwright/core/paths.py and route fonts/assets/cookies through it.
- Entry points: uvicorn clipwright.api.app:app; jobs run as
python -m clipwright.pipeline.main; probe as -m ...quality_probe.
- child_env() appends REPO_ROOT to PYTHONPATH so the -m workers work.
- transcribe_backends: sys.modules key now clipwright.media.scene_detection.
- Tooling: root pyproject.toml (pytest pythonpath=[.], ruff), shared
requirements-test.txt, CI installs it, Docker PYTHONPATH=/app.
- Tests: all imports/fakes/source-scans repointed; new tests/test_package_layout.py
enforces no root modules, docstring-only __init__, and no legacy imports.
- Docs/comments updated for the new layout.
Backend: 744 passed, 19 skipped. Frontend lint+build green.
One source: the whole screen (a game, a desktop) with the person composited
into a corner. It is how OBS records and how any stream VOD looks, and it is
the case screencast_layout got wrong: there the speaker band is a large crop
taken AROUND the face, which on a full-screen source means more screen. On the
measured Excel clip the output showed the same spreadsheet twice, whole and
enlarged.
What is needed is the inset's own rectangle, and finding it has three traps,
each of which cost an iteration:
- The inset does not touch two edges. YOLO returns an upper-body box that stops
at the chest, so a webcam pinned to the right side measured 18% clear of the
bottom and the "corner" filter threw it away. The test that works is subject
SMALL and OFF-CENTRE.
- A presenter standing in front of a screen passes any geometric filter. What
separates them is that a composited inset DOES NOT MOVE: 3-11px between
samples versus 316px for a person. With a plain min-max range the filter was
too brittle (one lost sample killed three good detections), so it clusters
around the median and requires a majority.
- The height cannot be scaled from the detection: for a webcam of about 325x180
YOLO returned 246x86, and growing that shape still cut the head off. It is
derived from the width assuming 16:9 and pinned to the edge the inset touches.
The filtergraph keeps the screen at full width (the HUD and the edges are the
content) and the camera band takes its height from the inset's real aspect:
forcing a fixed ratio stretched faces 12% horizontally.
Verified on 10 clips: finds the 4 with a composited camera and rejects the 6
without one (presenter in front of a screen, talking heads, presenter
composited full-screen). The miss is a 720p clip whose webcam is too small for
either detector.