Repository navigation
feat(playback): package copy remuxes as MPEG-TS on request - #3026
Conversation
Add the hls delivery feature hls_copy_mpegts_v1, advertised on /api/v2 only. A client that lists it in client_playback_context.deliveries.hls .features gets its server_remux_hls plans that copy H.264 or HEVC packaged as MPEG-TS instead of fragmented MP4; other copied codecs keep fMP4. Roku's player plays the audio of some muxed fMP4 copies silently but plays the same remux in MPEG-TS. The plan carries effective_recipe.segment_container "mpegts" and no video_sample_entry. The container is part of the plan id and attempt key, and the frozen executable recipe records it at version 5. Remote transcode nodes echo copy_video_mpegts in the start response; a start or a move to another node refuses a node without it. .ts segments are served as video/mp2t. /api/v1 ignores the feature. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Caution Review failedThe pull request is closed. Walkthrough
Merge Risk:
|
There was a problem hiding this comment.
🧹 Nitpick comments: 1
internal/api/handlers/playback_v3_test.go: 1
2481-2542:Trivial · Maintainability & Code Quality · Quick win Add fresh-remote MPEG-TS refusal coverage.
No existing test combines a fresh remote start,
CopyVideoMPEGTS: true, and a missingcopy_video_mpegtsattestation. The stale-node test exercises the caller path but requests MPEG-TS false. The attestation test exercises only the validator, and the MPEG-TS refusal test covers rehome. Add a fresh-start test that asserts refusal and remote cleanup, or at least that no successful transport is returned.

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Organization UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
e4792f3d-63b1-4bb9-9f98-c14cc06cb532
Files selected for processing: 22-
contracts/api/v2/openapi.jsondocs/architecture/playback-protocol-v3.mddocs/design/schemas/playback-v3/v3/decision-response.schema.jsondocs/design/schemas/playback-v3/v3/fixtures/valid/hls-subtitle-rendition-decision_response.jsondocs/design/schemas/playback-v3/v3/fixtures/valid/learned-limit-decision_response.jsondocs/transcode-node-api.mdinternal/api/handlers/playback_transcode_rehome.gointernal/api/handlers/playback_transcode_rehome_test.gointernal/api/handlers/playback_v3.gointernal/api/handlers/playback_v3_test.gointernal/playback/executable_recipe_v3.gointernal/playback/plan_key_v3.gointernal/playback/plan_v3.gointernal/playback/protocol_v3.gointernal/playback/protocol_v3_test.gointernal/playback/testdata/protocol_v3/hls-subtitle-rendition-decision_response.jsoninternal/playback/testdata/protocol_v3/learned-limit-decision_response.jsoninternal/playback/transcode.gointernal/playback/transcode_args_test.gointernal/transcodenode/server.gointernal/transcodenode/server_test.goweb/src/api/v2/schema.ts
Included review availability: This review used your included allowance. 3 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 8 reviews per hour.
-
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
|
Added a test for CodeRabbit's "fresh-remote MPEG-TS refusal coverage" nitpick in 10f7198. |
# Conflicts: # docs/architecture/playback-protocol-v3.md # docs/design/schemas/playback-v3/v3/fixtures/valid/hls-subtitle-rendition-decision_response.json # docs/design/schemas/playback-v3/v3/fixtures/valid/learned-limit-decision_response.json # internal/api/handlers/playback_v3.go # internal/playback/protocol_v3.go # internal/playback/testdata/protocol_v3/hls-subtitle-rendition-decision_response.json # internal/playback/testdata/protocol_v3/learned-limit-decision_response.json Co-Authored-By: Claude Opus 5.5 <[email protected]>
A client that sends hls_copy_mpegts_v1 and hls_remux_subtitle_renditions_v1 gets both on one plan. The test pins the TS segment container, the rendition, the version-5 frozen recipe carrying both flags, the MPEG-TS cue offset, and a plan identity distinct from the fMP4 rendition plan. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Problem
Related issue: N/A
Validation tasks: none
Roku's player plays the audio of some fragmented MP4 copy remuxes silently, but plays the same remux when it is packaged as MPEG-TS. Protocol v3 always packages a video-copy HLS remux (
server_remux_hls) as fMP4, so the Roku client has no way to ask for MPEG-TS. This change adds an opt-in hls delivery feature,hls_copy_mpegts_v1. A client that sends it gets its H.264 and HEVC copy remuxes as MPEG-TS segments. Other clients see no change.The executor already supports MPEG-TS copy packaging (
TranscodeOpts.CopyVideoMPEGTS) for jellycompat; protocol v3 could not request it.Approach
hls_copy_mpegts_v1is advertised on/api/v2only (NativeServerFeaturesV3). The client sends it inclient_playback_context.deliveries.hls.features, notclient_features./api/v1drops it on start and replan.server_remux_hlsplan that copies H.264 or HEVC carrieseffective_recipe.segment_container: "mpegts"and novideo_sample_entry. Its video claims and dynamic range are unchanged. HLS carries only those two codecs in MPEG-TS, so a copy of any other codec, such as VP9 or AV1, keeps fMP4. Encoded video (server_transcode_hls) keeps its packaging too.copy_video_mpegtsat recipe version 5, and a recipe validates only for a plan with the same container. A seek reanchor treats a container change as an identity change.CopyVideoMPEGTS. A transcode node now echoescopy_video_mpegtsin its start response. On a start, a missing echo stops the transport and returns a retryabletranscode_start_failed. Moving the transport off an unreachable node refuses a candidate node without the echo in the same way. Recipe cards carry the flag, so reconstruction and moves keep the packaging, and the session's stream state reportsmpegtsas its output container..tsis pinned tovideo/mp2tin Go's MIME table. The server image's shared-mime-info database lists.tsastext/vnd.trolltech.linguistbeforevideo/mp2t. As a result, this also changes theContent-Typeof segments that were already MPEG-TS, namely H.264 HLS transcodes on both the native API and jellycompat, fromtext/vnd.trolltech.linguist; charset=utf-8tovideo/mp2t./api/v2OpenAPI document,web/src/api/v2/schema.ts, the playback v3 decision-response schema and fixtures.docs/architecture/playback-protocol-v3.mdanddocs/transcode-node-api.mddescribe the feature.Surfaces: the Roku client (
silo-roku) is the intended caller.silo-appleandsilo-androiddon't send the feature, so their plans and plan IDs are unchanged and they need no follow-up. jellycompat keeps its own MPEG-TS selection and needs no parity change.Design decisions a reviewer should weigh:
copy_video_mpegts. Until it is upgraded, the API refuses it for MPEG-TS starts and moves. An API server from before this change refuses a version-5 frozen recipe instead of reopening the transport as fMP4.-strict unofficial, under which the MPEG-TS muxer writes the DOVI video stream descriptor.AttemptStickyFeaturesV3. Each start or replan reads it from that request's hls delivery. A replan that drops it gets a separate fMP4 plan with its own plan ID, and never a reused MPEG-TS transport.Validation
make embed-stub,go build ./...,gofmt -l .(clean),go vet ./...,make lint-changed(0 issues),make lint-router-recovery(0 issues), andmake test-goall pass.pnpm install --frozen-lockfile,pnpm run lint(0 errors),pnpm run format:check,pnpm run build,pnpm run budget:check, andmake test-weball pass.TestCommittedArtifactMatchesRouter.actionlint1.7.12 passes when run directly. Themake verify-actionlintguard rejected thev1.7.12version string that ago installbuild prints.make verify-shellcheckwas not run: the local ShellCheck is 0.9.0 and the target requires 0.11.0. This branch changes no workflow or shell files./api/v2start: runs an MPEG-TS transport, and a seek reanchor keeps it./api/v1: ignores the feature.-strict unofficial..tsis served asvideo/mp2t.Evidence
Evidence: https://evidence.siloserver.org/r/silo-server/roku-ts-copy-remux/
Risks
.tsMIME pin changes theContent-Typeheader on existing H.264 HLS transcode segments for every client, including web and jellycompat clients. The new value is correct; a client that relied on the old header would notice.Checklist
AI Disclosure
fmp4for MPEG-TS sessions (fixed); a VP9 or AV1 copy could be packaged as MPEG-TS (now limited to H.264 and HEVC, with a test). No other issues found.🤖 Generated with Claude Code
Note
Add MPEG-TS packaging for HLS copy-remux playback on request
Clients that advertise the HLS copy-MPEG-TS delivery feature now get copied H.264/HEVC video packaged as MPEG-TS segments instead of fragmented MP4. The planner selects the container in
PlanPlaybackV3(plan_v3.go), and the choice is persisted through executable recipe version 5 and the effective recipe's newsegment-containerfield (executable_recipe_v3.go, protocol_v3.go).ExecutableRecipeV3.Valid; older persisted recipes without the field keep their previous identity and versions.Macroscope summarized 1cd341b.