A stalled stream keeps a media server playing: filler before the player runs dry, and a card with the stream's H.264 settings #50

Closed
opened 2026-10-29 20:36:09 -04:00 by cmoriarty · 2 comments
Owner

Why

On 2026-10-29 Pelicans vs. Kings froze on the living-room Shield (Emby for Android 3.5.55) about 30 s after tuning, and Emby then dropped back to the game screen. Sports Breaker recovered the stream within 40 s, and the Admin card said "Let it work" throughout. The player had already given up, and the card could not see it.

What we found (2026-10-29, times local)

  1. 20:22:47: shd247.world stopped sending new segments. Emby was direct-streaming: video and audio copied, 640×360 at 30 fps.
  2. 20:23:02: the Shield's player ran dry and restarted playback with EnableDirectPlay=false, so Emby switched to transcoding. Sports Breaker's first filler card was appended 2 s later (seq 15, 20:23:04). Filler only starts once recovery is running, that is after the channel counts as failed (two target durations without a new segment).
  3. 20:23:06–07: the transcode (-hwaccel vaapi -hwaccel_output_format vaapi, then hwmap … derive_device=qsv, h264_qsv) died at the game-to-card splice: Error reinitializing filters! / Failed to inject frame into filter network: Function not implemented.
  4. 20:23:27: the Shield's retry transcoded again and died the same way at the card-to-game splice (the recovery onto shd247.world, 20:23:17).
  5. 20:23:45: the Shield reported playback stopped.

The card did not match the stream's H.264 settings. Its picture size and frame rate did (640×360 at 30 fps, from the probe after landing):

Profile Level B-frames (has_b_frames) Refs Aspect ratio
Stream Main 31 2 1 1:1
Card Constrained Baseline 30–31 0 1 none

The card is made with x264 ultrafast, which drops CABAC and B-frames, from a PNG that carries no aspect ratio. A VAAPI decode rebuilds its frame pool when the SPS changes, and the QSV hwmap cannot follow the new pool. Locally, ffmpeg 7 on software decoding does not rebuild its filters for the aspect ratio alone; the hardware decode is what makes the settings matter.

What Changes

  • Filler before the player runs dry. The channel appends filler once its live edge has been dry for 1.5 target durations, whether or not recovery has started, so a player gets filler before its buffer runs out and stays on direct play. Direct play survived the evening's other swaps, including 360p to 720p. A segment arriving after a filler splices back in as today.
  • A card with the stream's own H.264 settings.
    • The probe after a landing also reads the stream's profile, level, reference frames, B-frames (has_b_frames) and aspect ratio.
    • The card is encoded to match: x264 at a preset that allows CABAC and B-frames, -profile:v, -level, -refs, -bf, and setsar.
    • It falls back to Main, 3.1, refs 1, 2 B-frames and 1:1 when unknown.
  • Known limit: a recovery or swap onto another site's stream still changes the H.264 settings. A transcoding session can still break at that splice, short of re-encoding the video, which is out of scope.

Done when a stall on a direct-streaming Emby session shows the card before the client falls back. The card's ffprobe matches the stream's profile, level, B-frames and aspect ratio. A transcoding session with VAAPI and QSV, or a local stand-in, crosses game, card and game without Error reinitializing filters.

## Why On 2026-10-29 Pelicans vs. Kings froze on the living-room Shield (Emby for Android 3.5.55) about 30 s after tuning, and Emby then dropped back to the game screen. Sports Breaker recovered the stream within 40 s, and the Admin card said "Let it work" throughout. The player had already given up, and the card could not see it. ## What we found (2026-10-29, times local) 1. **20:22:47:** shd247.world stopped sending new segments. Emby was direct-streaming: video and audio copied, 640×360 at 30 fps. 2. **20:23:02:** the Shield's player ran dry and restarted playback with `EnableDirectPlay=false`, so Emby switched to transcoding. Sports Breaker's first filler card was appended 2 s later (seq 15, 20:23:04). Filler only starts once recovery is running, that is after the channel counts as failed (two target durations without a new segment). 3. **20:23:06–07:** the transcode (`-hwaccel vaapi -hwaccel_output_format vaapi`, then `hwmap … derive_device=qsv`, `h264_qsv`) died at the game-to-card splice: `Error reinitializing filters!` / `Failed to inject frame into filter network: Function not implemented`. 4. **20:23:27:** the Shield's retry transcoded again and died the same way at the card-to-game splice (the recovery onto shd247.world, 20:23:17). 5. **20:23:45:** the Shield reported playback stopped. **The card did not match the stream's H.264 settings.** Its picture size and frame rate did (640×360 at 30 fps, from the probe after landing): | | Profile | Level | B-frames (`has_b_frames`) | Refs | Aspect ratio | |---|---|---|---|---|---| | Stream | Main | 31 | 2 | 1 | 1:1 | | Card | Constrained Baseline | 30–31 | 0 | 1 | none | The card is made with x264 `ultrafast`, which drops CABAC and B-frames, from a PNG that carries no aspect ratio. A VAAPI decode rebuilds its frame pool when the SPS changes, and the QSV `hwmap` cannot follow the new pool. Locally, ffmpeg 7 on software decoding does not rebuild its filters for the aspect ratio alone; the hardware decode is what makes the settings matter. ## What Changes - **Filler before the player runs dry.** The channel appends filler once its live edge has been dry for 1.5 target durations, whether or not recovery has started, so a player gets filler before its buffer runs out and stays on direct play. Direct play survived the evening's other swaps, including 360p to 720p. A segment arriving after a filler splices back in as today. - **A card with the stream's own H.264 settings.** - The probe after a landing also reads the stream's profile, level, reference frames, B-frames (`has_b_frames`) and aspect ratio. - The card is encoded to match: x264 at a preset that allows CABAC and B-frames, `-profile:v`, `-level`, `-refs`, `-bf`, and `setsar`. - It falls back to Main, 3.1, refs 1, 2 B-frames and 1:1 when unknown. - **Known limit:** a recovery or swap onto another site's stream still changes the H.264 settings. A transcoding session can still break at that splice, short of re-encoding the video, which is out of scope. **Done when** a stall on a direct-streaming Emby session shows the card before the client falls back. The card's ffprobe matches the stream's profile, level, B-frames and aspect ratio. A transcoding session with VAAPI and QSV, or a local stand-in, crosses game, card and game without `Error reinitializing filters`.
Author
Owner

Deployed 2026-10-29 22:56 local (PR #54).

  • Filler now starts when the channel's buffer is empty and the next segment is half a target duration overdue, whether or not recovery has started.
  • While the stream still plays, the card is headed "Waiting for the stream".
  • The card is encoded with the stream's own H.264 profile, level, reordering depth, reference frames and aspect ratio, probed after each landing. test_fillercard.py checks real encodes with ffprobe at Main 3.1, High 4.0 and Constrained Baseline.

Still open: a VAAPI-to-QSV transcode crossing card splices in Emby, which only shows up on a real stall.

**Deployed 2026-10-29 22:56 local** (PR #54). - Filler now starts when the channel's buffer is empty and the next segment is half a target duration overdue, whether or not recovery has started. - While the stream still plays, the card is headed "Waiting for the stream". - The card is encoded with the stream's own H.264 profile, level, reordering depth, reference frames and aspect ratio, probed after each landing. `test_fillercard.py` checks real encodes with ffprobe at Main 3.1, High 4.0 and Constrained Baseline. **Still open:** a VAAPI-to-QSV transcode crossing card splices in Emby, which only shows up on a real stall.
Author
Owner

Closing: deployed 2026-10-29 (PR #54), and its last open check passed live on 2026-10-30 at 18:51. Emby's VAAPI→QSV transcode crossed game → card → game (seq 40, 41, 42) without Error reinitializing filters. The same evening, filler was held back while a download was in flight; that is #57.

Closing: deployed 2026-10-29 (PR #54), and its last open check passed live on 2026-10-30 at 18:51. Emby's VAAPI→QSV transcode crossed game → card → game (seq 40, 41, 42) without `Error reinitializing filters`. The same evening, filler was held back while a download was in flight; that is #57.
Sign in to join this conversation.
No labels
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#50
No description provided.