Skip to content

Watch the take while it records - #10

Merged
Tom-R-Main merged 3 commits into
mainfrom
improve/take-monitor
Sep 24, 2026
Merged

Tom-R-Main merged 3 commits into
mainfrom
improve/take-monitor

Conversation

@Tom-R-Main

Copy link
Copy Markdown
Owner

Stacked on #9.

Why: in the Siftable demo, we only found out about Chrome's audio and the blank 0×0 capture from ffprobe after the take. The monitor catches both while recording.

What

  • Client: subscribeHighVolume(EventSubscription.InputVolumeMeters) adds a high-volume event with Reidentify (op 3).
    • Callers share the subscription; the last release removes it.
    • The subscription is restored after a reconnect.
    • Fixes a bug this would have caused: OBS's Identified acknowledgement of a Reidentify no longer clears the "output settings not applied yet" flag.
  • TakeMonitor (src/tools/take-monitor.ts) watches three things:
    • Audio: the loudest level per input after volume and mute. It warns once when an input on a recorded track rises above −60 dBFS and silence was expected. Muted and off-track inputs are ignored, and track changes during the take are followed.
    • Frames: polls GetStats every 2 s and warns (rate-limited) when frames are missed rendering or skipped encoding.
    • Picture: a 32px PPM screenshot of the program scene every second. Two black samples raise a warning. Unchanged stretches of 3 s or more are recorded as stills, which Trim dead time from a take; contact sheets #12 will use to trim dead time. If OBS can't return PPM, picture checks switch off and the log says so.
    • It also logs OBS events (scene switches, mutes, record state) and warns if the recording stops unasked.
  • obs-record-clip runs the monitor. It reports the findings, treats blank or audio warnings (with expectSilent) as problems, and writes <name>.take.json next to a local recording.
  • New obs://take/current resource, which sends an update notification on each warning or chapter.
  • frame-sample.ts: a dependency-free P6 PPM decoder, plus black and unchanged-frame checks.

Tests

  • npm run check passes: 142 unit, 11 e2e.
  • New tests cover the decoder; the monitor (subscribe and release, audio gating, track changes, frames, blank and still spans, PPM unsupported, unexpected stop, take log); obs-record-clip flagging an input unmuted mid-take; and the resource.
  • The timing-based tests passed 6 repeated runs.

Live, read-only (OBS 32.2.2, no recording started):

  • Reidentify turned meters on (about 19 events/s) and off again.
  • supportedImageFormats includes ppm.
  • A 6 s monitor run decoded 5 real PPM samples, counted 182 rendered frames with 0 skipped, and recorded the static page as one still. It saw "ChatGPT Window" at −9.2 dB behind its mute and correctly didn't warn.

A live recording test (unmute Chrome for 5 s mid-take, cover the window) is still gated on approval.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Vjn8uBEa4mJshaQU3pFuqX

TakeMonitor subscribes to InputVolumeMeters for the length of a take and
records each input's loudest level after volume and mute, warning when an
input on a recorded track is audible and silence was expected. It polls
GetStats for skipped frames, and samples the program output as a 32px PPM
screenshot once a second to flag black picture and to record unchanging
stretches for trimming. obs-record-clip runs it, reports its findings, and
writes them next to a local recording as <name>.take.json. obs://take/current
serves the running take.

The client can now add high-volume event subscriptions with Reidentify,
shared between callers and restored after a reconnect. A Reidentify
acknowledgement no longer clears the unapplied-output-settings flag.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vjn8uBEa4mJshaQU3pFuqX
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-24T00:50:39.906777Z 350cea4 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 350cea4b79

ℹ️ 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".

Comment thread src/tools/resources.ts
Comment on lines +97 to +98
description: "While obs-record-clip or a recording session runs: audio levels on recorded tracks, skipped "
+ "frames, black or unchanging picture, chapters, and warnings; updates when a warning is raised",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Start a monitor for ordinary recording sessions

When a recording is started through obs-start-record—the path obs-record-clip recommends for takes over 50 seconds—nothing creates a TakeMonitor; the only construction is inside recordClip. Consequently this resource returns { "running": false } throughout such a recording despite explicitly advertising support for a recording session. Wire the monitor into the general start/stop recording flow or narrow the resource contract to obs-record-clip.

Useful? React with 👍 / 👎.

Comment thread src/tools/take-monitor.ts
Comment on lines +161 to +164
this.listen("RecordStateChanged", (data) => {
if (data.outputActive === false && !this.stopExpected && data.outputState === "OBS_WEBSOCKET_OUTPUT_STOPPED") {
this.warn("output", "The recording stopped before it was asked to");
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Stop monitoring when OBS stops the recording early

When OBS or an operator stops the recording before the requested duration, this handler only adds a warning. stoppedAtMs remains null and the timers and volume-meter subscription remain active, so obs://take/current continues reporting running: true and polling OBS until the original clip duration expires, even though no take is being recorded. The stopped event should terminate the monitor or otherwise mark the take inactive.

Useful? React with 👍 / 👎.

Comment thread src/tools/take-monitor.ts
Comment on lines +226 to +227
stills: [...this.stills, ...this.openSpan(this.stillSince)],
blanks: [...this.blanks, ...this.openSpan(this.blankSince)],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Enforce the still-duration threshold in live summaries

While a take is running, openSpan(this.stillSince) exposes an in-progress still immediately after two matching samples, without checking stillAfterSeconds. With the default settings, obs://take/current can therefore report roughly one-second unchanged spans even though the public contract says only stretches of at least three seconds are recorded; completed summaries later discard the same span in closeStill, making live and final results inconsistent.

Useful? React with 👍 / 👎.

@Tom-R-Main
Tom-R-Main changed the base branch from improve/batch to main September 24, 2026 05:11
@Tom-R-Main
Tom-R-Main merged commit 076307d into main Sep 24, 2026
4 checks passed
@Tom-R-Main
Tom-R-Main deleted the improve/take-monitor branch September 24, 2026 05:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant