a re-encode that keeps every frame, and can be stopped (#155, #156) #157

Merged
cmoriarty merged 1 commit from reencode-whole-and-stoppable into main 2026-11-10 22:06:46 -05:00
Owner

Closes #155 and #156. Both are about the re-encode that keeps a channel in one video shape (#39).

#155: frames lost on every second thetvapp segment, and the card said Healthy

  • The lead-in. A segment that does not start on a keyframe is re-encoded with the video of the stream's previous segment, from its last keyframe on, ahead of it, and only the segment's own frames are kept. Timestamps, audio and the #122 grid are as before; a segment that starts on a keyframe goes alone, as now. On a real segment cut 1 s before a keyframe: 120 of 152 frames alone, 152 of 152 with the lead-in, each at its own timestamp. The channel waits up to 4 s for a previous segment still downloading.
  • The loss counts. Three re-encoded segments of the stream playing short of frames within a minute make it degrading. The card says "Losing frames", and the swap rule may move to a better standby.

#156: a way to stop a game's re-encode

  • POST /api/channels/{game_id}/shape: the channel takes the shape of the stream it is playing and serves it as it comes. The buffer, clock and history stay; a later stream of another shape is re-encoded to the new one.
  • On the Playing card, a dashed chip beside the picture names the shape the stream is re-encoded to. Pressing it stops the re-encode.

Decided without the owner (the issue left both open), easy to reverse

  • Reset, not close: closing loses the buffer, and the background round would reopen the channel at once.
  • Allowed with a viewer connected, behind a second press: the chip turns amber and says the player may need re-tuning.

Not covered

  • A segment a player asks for after the buffer dropped it is still re-encoded alone.
  • The smaller loss in #155 (1 to 3 frames a segment at 1280x720@30) was not reproduced. The lead-in covers it if those segments start on a non-IDR keyframe.
  • Not seen on a live thetvapp stream yet.

Lanes run locally: 1257 backend, 264 frontend, e2e. The control tried in a browser over a snapshot of production's admin data. OpenSpec change reencode-whole-and-stoppable.

🤖 Generated with Claude Code

Closes #155 and #156. Both are about the re-encode that keeps a channel in one video shape (#39). **#155: frames lost on every second thetvapp segment, and the card said Healthy** - **The lead-in.** A segment that does not start on a keyframe is re-encoded with the video of the stream's previous segment, from its last keyframe on, ahead of it, and only the segment's own frames are kept. Timestamps, audio and the #122 grid are as before; a segment that starts on a keyframe goes alone, as now. On a real segment cut 1 s before a keyframe: 120 of 152 frames alone, 152 of 152 with the lead-in, each at its own timestamp. The channel waits up to 4 s for a previous segment still downloading. - **The loss counts.** Three re-encoded segments of the stream playing short of frames within a minute make it degrading. The card says "Losing frames", and the swap rule may move to a better standby. **#156: a way to stop a game's re-encode** - `POST /api/channels/{game_id}/shape`: the channel takes the shape of the stream it is playing and serves it as it comes. The buffer, clock and history stay; a later stream of another shape is re-encoded to the new one. - On the Playing card, a dashed chip beside the picture names the shape the stream is re-encoded to. Pressing it stops the re-encode. **Decided without the owner (the issue left both open), easy to reverse** - Reset, not close: closing loses the buffer, and the background round would reopen the channel at once. - Allowed with a viewer connected, behind a second press: the chip turns amber and says the player may need re-tuning. **Not covered** - A segment a player asks for after the buffer dropped it is still re-encoded alone. - The smaller loss in #155 (1 to 3 frames a segment at 1280x720@30) was not reproduced. The lead-in covers it if those segments start on a non-IDR keyframe. - Not seen on a live thetvapp stream yet. Lanes run locally: 1257 backend, 264 frontend, e2e. The control tried in a browser over a snapshot of production's admin data. OpenSpec change `reencode-whole-and-stoppable`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
#155: thetvapp's 5 s segments have a keyframe every 2 s, so every second
one starts 1 s before a keyframe. Re-encoded alone it lost those 30
frames, a skip every 10 s, and the card read Healthy.

- A segment that does not start on an IDR picture is re-encoded with the
  video of the stream's previous segment, from its last keyframe on,
  ahead of it; a select filter keeps only the segment's own frames. The
  channel keeps the last raw segments for this and waits up to 4 s for
  one still downloading.
- Three re-encoded segments of the stream playing short of frames in a
  minute make it degrading ("Losing frames"), so the swap rule applies.

#156: POST /api/channels/{game_id}/shape stops the re-encode: the
channel takes the playing stream's shape and serves it as it comes, the
buffer and history kept. The Playing card has the control beside the
picture; with a viewer the first press only arms it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
cmoriarty deleted branch reencode-whole-and-stoppable 2026-11-10 22:06:46 -05:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
cmoriarty/sports-breaker!157
No description provided.