feat(hls): carry a held media playlist over --remote and export, inflate gzip segments, add own_stream_only mux opt-in

This commit is contained in:
imSp4rky
2026-12-02 11:12:02 -07:00
parent ccdd14c845
commit 9842a61d3f
27 changed files with 404 additions and 62 deletions
+16
View File
@@ -295,6 +295,13 @@ track that it downloads. Over `--remote`, the client asks the server for the URL
each track it downloads, and the server calls the callable then. A track whose callable
fails gets no URL, and its download fails.
When the service has the media playlist of an HLS track as text and no playlist URL, set
`track.data["hls"]["playlist_text"]` to the text, and set `url` to a URL that its segment URIs
resolve against. unshackle downloads from the text and does not fetch a playlist. A `from_file`
playlist works the same way. Over `--remote` and in an export, the text goes with the track,
but a `file:` URL does not. The client accepts the text only as a media playlist whose segment
URIs are absolute `http` or `https` URLs, and drops the track otherwise.
### `Video`
`Video` adds `codec`, `range`, `bitrate`, `width`, `height`, `fps`, `scan_type`, and
@@ -310,6 +317,12 @@ closed-caption descriptors. The relevant enums:
Both `Video` and `Audio` store `bitrate` in **bits per second** (rounded up). The
string form displays kb/s, and `--vbitrate` and `--abitrate` compare in kb/s.
When the file of a track also holds a track of another kind, set `track.data["own_stream_only"] = True`
on the track. The mux then takes from that file only the track of the same kind: the video of a video
track, or the audio of an audio track. Use it for a video file with in-band audio that the
service also gives as audio tracks, or for an audio version that comes as a whole video file.
The value also goes to a `--remote` client. A track without it muxes everything in its file.
### `Audio`
`Audio` adds `bitrate`, `channels`, `joc` (Joint Object Coding, the Atmos indicator),
@@ -413,6 +426,9 @@ least one and no track is left.
- **HLS** re-fetches the media playlist at download time, recovers `SUPPLEMENTAL-CODECS`
from raw text (python-m3u8 drops it) to detect Dolby Vision composite streams, and uses
the media-sequence-number IV for AES-128 keys that have no explicit IV.
- **Segments** of each format: unshackle inflates a segment body that is one whole gzip member
before the merge, up to a size limit. A CDN can send such a body with no `Content-Encoding`
header. Any other body stays as it is, such as AES-128 ciphertext that starts with the gzip magic.
- **ISM** has no list of segments and no init segments: the parser synthesizes segment URLs
from the `<c>` fragment timeline, and rebuilds a `moov`/`ftyp` init box from `CodecPrivateData`
(supported for AVC, HEVC, DV-over-HEVC, AAC, EC-3, and TTML). A track id covers the manifest