A re-encoded thetvapp stream loses a second about every 10 s, and the channel still reads Healthy #155

Closed
opened 2026-11-10 21:47:48 -05:00 by cmoriarty · 1 comment
Owner

Seen 2026-11-11, Duke vs. Michigan St on Emby. The picture skipped at a regular interval from 01:55 to 02:10Z while the admin page said healthy.

What happened

  • At 01:55:02Z the channel recovered onto thetvapp.plus after starting on another stream, so videonorm.reencode began re-encoding each segment to the channel's shape.
  • Log, on alternate segments until 02:09:55Z: seq N lost 30 of its 150 frames in the re-encode to 1280x720@29.97. That was 92 segments, about 92 s of video.
  • Emby's direct-stream log shows 27.0 fps from then on, against 29.97 before it.

Why
thetvapp's segments are 5 s long with a keyframe every 2 s, so every second segment starts 1 s before a keyframe. Each segment is re-encoded alone, so those first 30 frames cannot be decoded: non-existing PPS 0 referenced.

Reproduced on a live thetvapp channel (Blue Jackets vs. Panthers, 2026-11-11), with the re-encode's settings:

  • A segment that starts on a keyframe, alone: 150 frames out.
  • The next segment, alone: 120 frames out of 150 packets.
  • Those two joined: 300 frames out.

Copied segments are fine, because the player's decoder carries over from the segment before. The loss only happens when a thetvapp stream joins a channel that started on a stream of another shape. A smaller loss of the same look (1 to 3 frames of 91 to 93, 62 + 47 + 37 segments) was logged on this game from 00:57Z, re-encoding to 1280x720@30; its cause was not checked.

Why it read Healthy
dropped_frames only reaches the channel's video snapshot and the Playing card. Nothing in the grade counts it.

Work

  • Give the re-encode what it needs to decode the segment's start (the previous segment, or from its last keyframe) and keep only this segment's frames in the output. Keep the timestamps and the #122 grid behaviour.
  • Count frames lost in a re-encode against the channel's health, so sustained loss does not read Healthy, and consider it as a reason to prefer the standby.

Done when a thetvapp stream re-encoded into a channel of another shape loses no frames, and a channel that does lose frames steadily no longer reads Healthy.

**Seen 2026-11-11, Duke vs. Michigan St on Emby.** The picture skipped at a regular interval from 01:55 to 02:10Z while the admin page said healthy. **What happened** - At 01:55:02Z the channel recovered onto thetvapp.plus after starting on another stream, so `videonorm.reencode` began re-encoding each segment to the channel's shape. - Log, on alternate segments until 02:09:55Z: `seq N lost 30 of its 150 frames in the re-encode to 1280x720@29.97`. That was 92 segments, about 92 s of video. - Emby's direct-stream log shows 27.0 fps from then on, against 29.97 before it. **Why** thetvapp's segments are 5 s long with a keyframe every 2 s, so every second segment starts 1 s before a keyframe. Each segment is re-encoded alone, so those first 30 frames cannot be decoded: `non-existing PPS 0 referenced`. Reproduced on a live thetvapp channel (Blue Jackets vs. Panthers, 2026-11-11), with the re-encode's settings: - A segment that starts on a keyframe, alone: 150 frames out. - The next segment, alone: 120 frames out of 150 packets. - Those two joined: 300 frames out. Copied segments are fine, because the player's decoder carries over from the segment before. The loss only happens when a thetvapp stream joins a channel that started on a stream of another shape. A smaller loss of the same look (1 to 3 frames of 91 to 93, 62 + 47 + 37 segments) was logged on this game from 00:57Z, re-encoding to 1280x720@30; its cause was not checked. **Why it read Healthy** `dropped_frames` only reaches the channel's video snapshot and the Playing card. Nothing in the grade counts it. **Work** - Give the re-encode what it needs to decode the segment's start (the previous segment, or from its last keyframe) and keep only this segment's frames in the output. Keep the timestamps and the #122 grid behaviour. - Count frames lost in a re-encode against the channel's health, so sustained loss does not read Healthy, and consider it as a reason to prefer the standby. **Done when** a thetvapp stream re-encoded into a channel of another shape loses no frames, and a channel that does lose frames steadily no longer reads Healthy.
Author
Owner

Fixed in PR #157 (merge 9d57161), deployed from main at ff67045 on 2026-11-11 03:09Z.

  • A segment that does not start on a keyframe is now re-encoded with the previous segment's video, from its last keyframe on, ahead of it, and only its own frames are kept. On a real segment cut 1 s before a keyframe: 120 of 152 frames alone, 152 of 152 with the lead-in.
  • Three re-encoded segments short of frames within a minute make the stream degrading: the card says "Losing frames" and the swap rule applies.

Not seen on a live thetvapp stream yet. The smaller loss noted here (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. A segment a player asks for after the buffer dropped it is still re-encoded alone.

Fixed in PR #157 (merge 9d57161), deployed from main at ff67045 on 2026-11-11 03:09Z. - A segment that does not start on a keyframe is now re-encoded with the previous segment's video, from its last keyframe on, ahead of it, and only its own frames are kept. On a real segment cut 1 s before a keyframe: 120 of 152 frames alone, 152 of 152 with the lead-in. - Three re-encoded segments short of frames within a minute make the stream degrading: the card says "Losing frames" and the swap rule applies. Not seen on a live thetvapp stream yet. The smaller loss noted here (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. A segment a player asks for after the buffer dropped it is still re-encoded alone.
Sign in to join this conversation.
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#155
No description provided.