Give it a compositor spec with a person cutout drawn over titles; get, per title, the largest share of its ink the person hides on any frame, and when. The rule it checks: type behind a person may be a little hidden (a shoulder over one letter, part of one), never a word. A still per effect catches the obvious cases; this catches the frame a head moves into a word between two stills.
Inputs
- The spec, with ids on the footage layer and on the person cutout drawn over the
titles (
python-track-face-and-hands, orbirefnet-mattefor a shot's cutout). - Its assets where the spec points.
Run it
Write references/occlusion.md's script into the job's scripts/ as occlusion.py,
as is, and run it with cwd the job folder:
exec python scripts/occlusion.py --spec titles/cut.json --footage footage --cutout person_cutout --every 2 --limit 0.2
--skip leaves out layers by id that are meant to sit on the person (a light spill).
It renders the cutout alone and each checked layer alone, each on black and on white, with the groups they sit in, so the cam punch-ins and shakes move both exactly as in the cut; the two backgrounds give every pixel's alpha. Each layer's frames are rendered once, at 2 browsers; a spec with 2 titles over 11 s took 46 s.
What you get
A line per layer (ok or OVER, the worst share and its time) and occlusion.json;
exit status 1 when any layer is over the limit.
Tips and traps
- 0.2 is the line. A title beside the head with its first letter behind the hair measured 11%; one across the face, 82%.
- Fix by moving, not by thinning the matte. A title that won't fit beside the head goes in front of the person, in the lower third over the body, or above the eyes over the hair. In an overscanned camera, keep a wide word's centre 400 px or more from the frame edges so a punch-in doesn't push it off.
- Fades in and out are skipped below 200 px of ink, so a title's first faint frame doesn't count as hidden.
- Only the layers between the footage and the cutout are checked; titles in front of the person can't be hidden by them.
Check it
Open the worst frame it names (hn4a-compositor still --at) and look: the share
should match what you see. Re-run after every change to the titles or the cut.


