Repository navigation
feat: guard encoded true peak and add b-roll, contact sheets and storyboards - #10
Conversation
…yboards The render limiter now oversamples 4x and re-encodes audio until the encoded file is at or under -1 dBTP. --broll exports speech-free windows, --contact writes a PIL-labelled sheet, and --select writes a storyboard from optional section and note fields. Co-authored-by: Jack Arturo <info@verygoodplugins.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a6d2e32fb0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| gaps = speech_gaps(blocks, a.dur, a.gap, max(a.min_gap, 0.12), min(max(a.pad, MINPAD), MAXPAD) + hf, MAXPAD, MINPAD + hf, max(a.air, 0.0)) | ||
| clips, rows = select_moments(y.get("moments", []) if isinstance(y, dict) else y, gaps, blocks, a.dur, a.pre, a.post, a.max_clip, max(JOIN, 2 * a.air)) | ||
| windows = windows_of(gaps, a.pause) if a.broll else None | ||
| if a.broll: clips, rows = select_broll(moments, windows, blocks, a.dur) |
There was a problem hiding this comment.
Allow b-roll rendering without a subtitle input
With --broll --render, no moment captions, and no music caption, the kept windows contain no speech, so write_srt() produces an empty file. The render path in main() nevertheless passes that file as -i str(srt) and requires -map 2:s, causing the final mux to fail instead of producing the b-roll video. FFmpeg documents that an optional map is needed to ignore a missing stream “instead of failing” (stream mapping documentation); an empty SRT should be omitted as an input altogether. Please handle caption-free output when routing these windows through rendering.
Useful? React with 👍 / 👎.
| section and note are the caller's, and note on the row stays the reason an edge moved.""" | ||
| said = lambda x0, x1: " ".join(b["w"] for b in blocks if x0 <= (b["s"] + b["e"]) / 2 <= x1) # speech a clip contains | ||
| usable = [w for w in windows if w["hi"] - w["lo"] > 0.05] | ||
| if not moments: return [[w["lo"], w["hi"]] for w in usable], [] |
There was a problem hiding this comment.
Distinguish an empty selection from an omitted selection
When --select moments.yaml --broll receives an empty list (or moments: []), this branch keeps every usable window rather than keeping nothing. select_edl() initializes moments to [] both when --select is absent and when its file contains no moments, so an automatically generated empty selection can unexpectedly render all b-roll and produce an empty shot list describing none of it. Preserve the distinction between no selection requested and an explicitly empty selection.
AGENTS.md reference: AGENTS.md:L9-L12
Useful? React with 👍 / 👎.
A silent --broll window writes an empty SRT. Mapping that file as a subtitle stream made the final ffmpeg mux fail, so the caption input is left out when there are no cues. Co-authored-by: Jack Arturo <info@verygoodplugins.com>
--broll without --select still keeps every speech-free window. --select with an empty list keeps nothing, instead of rendering all of them under a blank shot list. Co-authored-by: Jack Arturo <info@verygoodplugins.com>
Summary
Four additions from a music-video edit that had to script around vidtight.
--rendernow measures the encoded file and re-encodes the audio until the true peak is at or under −1 dBTP. Silent footage can be kept as speech-free windows, contact sheets are labelled without ffmpegdrawtext, and--selectwrites a storyboard before the render.Changes
--renderruns the limiter at 4× (192 kHz), measures the encoded AAC with ebur128 (loudnorm JSON if that summary is missing), and re-encodes the audio only at a lower ceiling until the true peak is at or under −1 dBTP. The final LUFS and dBTP are printed. Integrated loudness is left alone (alimiterlevel=false).--brollwriteswindows.json(start,end,duration) from the existing speech-block and gap logic, instead of pause-cutting. A clip with no speech is one window, the whole file. With--select, a moment keeps the silent window it falls in. The rendered edge stays on the usual pad. An empty moments file keeps nothing; omitting--selectis what keeps every window.--broll --renderwith no captions no longer fails the final mux. An empty SRT stays on disk and is left out of the ffmpeg inputs, instead of being mapped as a subtitle stream that is not there. A cut that still has speech or a caption keeps the soft subtitle track.--contact Nwritescontact.pngbeside the analysis outputs: a frame every N seconds, scaled to one width, padded to one height, labelled with source timecode. Labels are drawn with Pillow. Paths passed to ffmpeg are absolute.--selectmoments take optionalsectionandnote. The run writesstoryboard.mdandshots.jsonnext toselect.csv.--contactruns.Test plan
ruff check .pytest(102 passed)vidtight clip.mov --renderand confirm the printed line is at or under −1 dBTP. CI cannot runaac_at. The guard, the ebur128 summary parser, the loudnorm fallback, and the audio-only re-encode are unit-tested. Contact-sheet tiling is tested with mixed frame sizes; frame extraction is tested with absolute paths and stubbed ffmpeg.--broll --renderomits the empty SRT from the mux; a cut that contains speech still maps-map 2:s.--selectwith[]ormoments: []plus--brollkeeps nothing.--brollalone still keeps every speech-free window.Notes for reviewers
Please don't merge this. Jack merges.
The starting limiter ceiling is still 0.83. On the music-video master, 4× oversampling at 0.83 measured about −0.5 dBTP, and about 0.76 cleared −1 dBTP at the same LUFS. The guard steps the ceiling down from the measured overshoot and stops at 0.5 if it cannot get there.