A splice keeps the stream's shape, so a media server keeps playing through filler and swaps #39

Closed
opened 2026-10-29 17:08:11 -04:00 by cmoriarty · 5 comments
Owner

Why

On 2026-10-29 Emby's player hung on "Stream interrupted - reconnecting" after the channel moved from filler to the real stream. Sports Breaker kept serving the stream, but Emby never recovered until the viewer re-tuned.

What we found (2026-10-29)

  • The two shapes differ completely:
    • The filler (backend/app/assets/filler.ts) is 1280×720 at 25 fps (H.264 Main, level 5.0) with AAC 48 kHz stereo.
    • The stream it covered (shd247.world) is 640×360 at 30 fps (level 3.1) with AAC 32 kHz mono.
  • Emby probed the filler, so it transcoded. It probed the filler at about 4 Mbps; Emby Web had asked for at most 3.8 Mbps (VideoBitrate=3808002). It chose to transcode, with h264_qsv.
  • Emby's ffmpeg died at the splice. At the filler-to-stream splice (20:57:16 UTC) it logged Impossible to convert between the formats supported by the filter 'scaler_out_0_0' and the filter 'auto_scale_0', Error reinitializing filters!, Conversion failed!.
  • The player never came back. Emby Web stayed on "reconnecting" and Emby started no new ffmpeg. Every playlist and segment request to Sports Breaker kept answering 200.
  • A re-tune worked. Emby probed the real 360p stream that time, direct-streamed it (copy), and it played.
  • Swaps carry the same risk. At 21:04:41 the channel recovered from shd247.world (640×360) onto its standby wildgames.bz (1280×720). Emby's direct-stream ffmpeg logged about 800 Non-monotonous DTS in output stream 0:1 (audio) messages around that splice and the earlier one at 21:00:44, and none in between.

What Changes

Pick one way to keep what the media server sees steady across a splice:

  • Filler made in the shape of the stream it covers: a few prepared shapes, chosen by the measured shape of the Ready or standby link.
  • The audio always re-encoded to one format, such as AAC 48 kHz stereo, which is cheap.
  • The video scaled to one size, which costs CPU.
  • A standby of the same shape as the playing link preferred when swapping.

Done when a tune that shows filler, and a swap between links of different shapes, both keep Emby playing without a re-tune, including when Emby transcodes.

## Why On 2026-10-29 Emby's player hung on "Stream interrupted - reconnecting" after the channel moved from filler to the real stream. Sports Breaker kept serving the stream, but Emby never recovered until the viewer re-tuned. ## What we found (2026-10-29) - **The two shapes differ completely:** - The filler (`backend/app/assets/filler.ts`) is 1280×720 at 25 fps (H.264 Main, level 5.0) with AAC 48 kHz stereo. - The stream it covered (shd247.world) is 640×360 at 30 fps (level 3.1) with AAC 32 kHz mono. - **Emby probed the filler, so it transcoded.** It probed the filler at about 4 Mbps; Emby Web had asked for at most 3.8 Mbps (`VideoBitrate=3808002`). It chose to transcode, with `h264_qsv`. - **Emby's ffmpeg died at the splice.** At the filler-to-stream splice (20:57:16 UTC) it logged `Impossible to convert between the formats supported by the filter 'scaler_out_0_0' and the filter 'auto_scale_0'`, `Error reinitializing filters!`, `Conversion failed!`. - **The player never came back.** Emby Web stayed on "reconnecting" and Emby started no new ffmpeg. Every playlist and segment request to Sports Breaker kept answering 200. - **A re-tune worked.** Emby probed the real 360p stream that time, direct-streamed it (`copy`), and it played. - **Swaps carry the same risk.** At 21:04:41 the channel recovered from shd247.world (640×360) onto its standby wildgames.bz (1280×720). Emby's direct-stream ffmpeg logged about 800 `Non-monotonous DTS in output stream 0:1` (audio) messages around that splice and the earlier one at 21:00:44, and none in between. ## What Changes Pick one way to keep what the media server sees steady across a splice: - Filler made in the shape of the stream it covers: a few prepared shapes, chosen by the measured shape of the Ready or standby link. - The audio always re-encoded to one format, such as AAC 48 kHz stereo, which is cheap. - The video scaled to one size, which costs CPU. - A standby of the same shape as the playing link preferred when swapping. **Done when** a tune that shows filler, and a swap between links of different shapes, both keep Emby playing without a re-tune, including when Emby transcodes.
Author
Owner

The same splice also slows the audio down (2026-10-29, 21:30 UTC)

The viewer heard the commentary slowed down and low-pitched, about half an hour after re-tuning.

  • What Emby set up at the re-tune. At 20:59:33 Emby probed shd247.world: AAC 32 kHz mono. It started a direct stream (-c:a copy). Its session still reports aac 32000 1 for the channel's audio, and that same ffmpeg was still running at 21:30 (output segment 592).
  • What changed underneath it. The channel moved on to wildgames.bz (recovery, 21:04:41), then topsurge.st and givemestreams.cfd (degrading swaps, 21:25:40 and 21:27:08). The audio served now is AAC 48 kHz stereo.
  • What the player does with it. It still decodes at the rate it was set up for, so 48 kHz audio plays at 32/48: two-thirds speed, about seven semitones low. Emby's ffmpeg logs Non-monotonous DTS in output stream 0:1 continuously.
  • The workaround is to stop and re-tune, so Emby probes the current audio.

So this issue covers the audio as well as the video. Re-encoding the audio to one fixed format (for example AAC 48 kHz stereo) on every segment would prevent this for any swap or recovery, and it's cheap. The video side still needs a choice: matching filler, as in #41, or preferring a standby of the same shape.

## The same splice also slows the audio down (2026-10-29, 21:30 UTC) The viewer heard the commentary slowed down and low-pitched, about half an hour after re-tuning. - **What Emby set up at the re-tune.** At 20:59:33 Emby probed shd247.world: AAC **32 kHz mono**. It started a direct stream (`-c:a copy`). Its session still reports `aac 32000 1` for the channel's audio, and that same ffmpeg was still running at 21:30 (output segment 592). - **What changed underneath it.** The channel moved on to wildgames.bz (recovery, 21:04:41), then topsurge.st and givemestreams.cfd (degrading swaps, 21:25:40 and 21:27:08). The audio served now is AAC **48 kHz stereo**. - **What the player does with it.** It still decodes at the rate it was set up for, so 48 kHz audio plays at 32/48: two-thirds speed, about seven semitones low. Emby's ffmpeg logs `Non-monotonous DTS in output stream 0:1` continuously. - **The workaround** is to stop and re-tune, so Emby probes the current audio. So this issue covers the audio as well as the video. Re-encoding the audio to one fixed format (for example AAC 48 kHz stereo) on every segment would prevent this for any swap or recovery, and it's cheap. The video side still needs a choice: matching filler, as in #41, or preferring a standby of the same shape.
Author
Owner

Decided 2026-10-29 for the batch: fixed audio plus matching filler.

  • Audio: every segment the channel serves has its audio re-encoded to AAC 48 kHz stereo by a short ffmpeg step in the segment path, with the video copied. An encrypted segment has to be decrypted first (the channel already fetches its key) and is then served in the clear. This ends the slowed audio after any swap or recovery.
  • Filler: the filler is drawn in the playing stream's video size (#41).
  • Swaps: a swap prefers a standby with the same video size.
  • Verification: it measures each link's audio rate and channels as well as its picture.
  • fMP4 channels: fragmented-MP4 channels are out of scope unless the step handles them simply; they can't take filler today either.
**Decided 2026-10-29 for the batch: fixed audio plus matching filler.** - **Audio:** every segment the channel serves has its audio re-encoded to AAC 48 kHz stereo by a short ffmpeg step in the segment path, with the video copied. An encrypted segment has to be decrypted first (the channel already fetches its key) and is then served in the clear. This ends the slowed audio after any swap or recovery. - **Filler:** the filler is drawn in the playing stream's video size (#41). - **Swaps:** a swap prefers a standby with the same video size. - **Verification:** it measures each link's audio rate and channels as well as its picture. - **fMP4 channels:** fragmented-MP4 channels are out of scope unless the step handles them simply; they can't take filler today either.
Author
Owner

Decided 2026-10-30 for the Steady streaming batch: re-encode to match.

Why it's needed: on 2026-10-30 at 18:53 a degrading swap on Wizards vs. Hornets went from 1152×648 at 59.94 fps to 1280×720 at 30 fps. Emby's VAAPI→QSV transcode died at that splice (Error reinitializing filters!), and the Shield left the stream. The fixed audio and the matching filler card held; the change of video shape did not. A remote viewer always transcodes (ContainerBitrateExceedsLimit), and the Shield falls back to transcoding after any stall, so every swap to another shape can end a session.

  • The channel keeps one video shape for its life: the one the media server probed at the tune, meaning picture size, frame rate, and the H.264 profile, level, B-frames, refs and aspect ratio (the card already copies these, #50).
  • A stream of another shape is re-encoded to that shape for as long as it plays. A stream that matches is copied untouched, as today.
  • CPU is spent only while a mismatched stream plays. Measure it on the VM, including whether the encode keeps up with a 60 fps source.
  • The design decides:
    • whether the 60 s wait before a swap to another shape can go, once the swap is safe;
    • whether a same-shape standby is still preferred, since it costs nothing to play;
    • what happens if the encode can't keep up.
**Decided 2026-10-30 for the Steady streaming batch: re-encode to match.** Why it's needed: on 2026-10-30 at 18:53 a degrading swap on Wizards vs. Hornets went from 1152×648 at 59.94 fps to 1280×720 at 30 fps. Emby's VAAPI→QSV transcode died at that splice (`Error reinitializing filters!`), and the Shield left the stream. The fixed audio and the matching filler card held; the change of video shape did not. A remote viewer always transcodes (`ContainerBitrateExceedsLimit`), and the Shield falls back to transcoding after any stall, so every swap to another shape can end a session. - **The channel keeps one video shape for its life:** the one the media server probed at the tune, meaning picture size, frame rate, and the H.264 profile, level, B-frames, refs and aspect ratio (the card already copies these, #50). - **A stream of another shape is re-encoded to that shape** for as long as it plays. A stream that matches is copied untouched, as today. - **CPU is spent only while a mismatched stream plays.** Measure it on the VM, including whether the encode keeps up with a 60 fps source. - **The design decides:** - whether the 60 s wait before a swap to another shape can go, once the swap is safe; - whether a same-shape standby is still preferred, since it costs nothing to play; - what happens if the encode can't keep up.
Author
Owner

Closing: deployed 2026-10-31 (PR #60). The channel keeps one video shape, the first stream's, and re-encodes any stream of another shape to it.

Seen live on Lakers vs. Warriors:

  • The run: the channel tuned on topsurge.st at 1152×648, 59.94 fps. It then moved through givemestreams.cfd twice (1280×720 at 29.97), iohit.st, s2watch.cyou and resports.cfd.
  • What the reader received: a Jellyfin-style ffmpeg reader got 20,667 frames after the first stream landed, every one 1152×648. It never stopped.
  • Cost: each re-encode took 0.6–1.0 s per 4 s segment on the VM.

A same-shape swap is copied: on Kent State vs. Sacramento State, s2watch.cyou into a 1280×720, 59.94 channel needed no re-encode.

Not tested live: an Emby transcode across such a swap, since no one was transcoding during the run. Emby now sees one shape throughout. Reopen if a transcoding session still breaks at a swap.

Known limit: a cold tune of a game with no verified measurement draws its first filler card at the default 1280×720, 30 fps, before the first stream lands. Emby's lineup lists only Ready games, which carry a measurement.

Closing: deployed 2026-10-31 (PR #60). The channel keeps one video shape, the first stream's, and re-encodes any stream of another shape to it. **Seen live on Lakers vs. Warriors:** - **The run:** the channel tuned on topsurge.st at 1152×648, 59.94 fps. It then moved through givemestreams.cfd twice (1280×720 at 29.97), iohit.st, s2watch.cyou and resports.cfd. - **What the reader received:** a Jellyfin-style ffmpeg reader got 20,667 frames after the first stream landed, every one 1152×648. It never stopped. - **Cost:** each re-encode took 0.6–1.0 s per 4 s segment on the VM. **A same-shape swap is copied:** on Kent State vs. Sacramento State, s2watch.cyou into a 1280×720, 59.94 channel needed no re-encode. **Not tested live:** an Emby transcode across such a swap, since no one was transcoding during the run. Emby now sees one shape throughout. Reopen if a transcoding session still breaks at a swap. **Known limit:** a cold tune of a game with no verified measurement draws its first filler card at the default 1280×720, 30 fps, before the first stream lands. Emby's lineup lists only Ready games, which carry a measurement.
Author
Owner

Seen live on a real Emby player, 2026-10-31. Chelsea vs. Man Utd, played from Emby for Android on the living-room Shield (direct play, so no Emby transcode).

The channel's shape came from iohit.st: 720×576 at 25 fps.

  • 09:18:57, a swap by hand: to shd247.world, 640×360 at 30 fps, re-encoded to the channel's shape. Re-encodes took 0.5–1.4 s per segment, and the buffer stayed between 6 and 16 s.
  • 09:19:04, a degrading stream: shd247.world was dropping frames, and the card said Dropping frames, Let it work.
  • 09:19:33, a swap on its own: to topsurge.st (1152×648 at 29.97 fps) as soon as it verified as a standby. It was re-encoded down to 720×576 at 25, at 0.5–1.2 s per segment.

The card's record: no stalls, no dry spells, no filler, no game skipped, no failed re-encodes. Served at 0.93–1.23× real time.

The Shield: it played directly throughout and never froze or left the stream. The viewer saw only a few small skips, which fits the splices: the two sites are seconds apart in the game. shd247.world's own dropped frames also show.

Still not seen: an Emby transcode across a swap.

**Seen live on a real Emby player, 2026-10-31.** Chelsea vs. Man Utd, played from Emby for Android on the living-room Shield (direct play, so no Emby transcode). The channel's shape came from iohit.st: 720×576 at 25 fps. - **09:18:57, a swap by hand:** to shd247.world, 640×360 at 30 fps, re-encoded to the channel's shape. Re-encodes took 0.5–1.4 s per segment, and the buffer stayed between 6 and 16 s. - **09:19:04, a degrading stream:** shd247.world was dropping frames, and the card said Dropping frames, Let it work. - **09:19:33, a swap on its own:** to topsurge.st (1152×648 at 29.97 fps) as soon as it verified as a standby. It was re-encoded down to 720×576 at 25, at 0.5–1.2 s per segment. **The card's record:** no stalls, no dry spells, no filler, no game skipped, no failed re-encodes. Served at 0.93–1.23× real time. **The Shield:** it played directly throughout and never froze or left the stream. The viewer saw only a few small skips, which fits the splices: the two sites are seconds apart in the game. shd247.world's own dropped frames also show. Still not seen: an Emby transcode across a swap.
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#39
No description provided.