Direct.Playlist (direct v0.1.0)

Copy Markdown View Source

HLS master playlists: for a multi-audio conversion, for ffmpeg's own multi-audio TS output made fit for a player, and subtitle renditions added to either.

Summary

Functions

The master playlist of a multi-audio conversion: every track as a switchable rendition of one group. The default is the first track in the first preferred language the release has (:prefer, a code or a list in order), else the first track. Without a CODECS attribute on purpose — hls.js on Firefox stops at the HEVC string. The playlists named are those of :part; :subs are listed as subtitle renditions.

The #EXT-X-MEDIA lines for subtitle tracks (of part); none shown unless picked.

ffmpeg's master playlist for a multi-audio TS conversion, made fit for the player: ffmpeg names every rendition audio_N, and tracks of one language can all point at one rendition file, so the list is cut down to one entry per file, named by its language, with the preferred language the default. Options as master/3 (:prefer, :subs).

A master playlist with subtitle renditions added: their #EXT-X-MEDIA lines before the variant, which gets SUBTITLES="subs". Nothing changes without tracks.

A single media playlist under a master, so subtitle renditions can ride along.

Functions

master(tracks, bandwidth, opts \\ [])

@spec master([map()], pos_integer(), keyword()) :: String.t()

The master playlist of a multi-audio conversion: every track as a switchable rendition of one group. The default is the first track in the first preferred language the release has (:prefer, a code or a list in order), else the first track. Without a CODECS attribute on purpose — hls.js on Firefox stops at the HEVC string. The playlists named are those of :part; :subs are listed as subtitle renditions.

subtitle_renditions(subs, part \\ 0)

The #EXT-X-MEDIA lines for subtitle tracks (of part); none shown unless picked.

tidy_master(content, opts \\ [])

@spec tidy_master(String.t(), keyword()) :: String.t()

ffmpeg's master playlist for a multi-audio TS conversion, made fit for the player: ffmpeg names every rendition audio_N, and tracks of one language can all point at one rendition file, so the list is cut down to one entry per file, named by its language, with the preferred language the default. Options as master/3 (:prefer, :subs).

with_subtitles(master, subs)

A master playlist with subtitle renditions added: their #EXT-X-MEDIA lines before the variant, which gets SUBTITLES="subs". Nothing changes without tracks.

wrap_media(media_name, subs, bandwidth \\ 8_000_000)

A single media playlist under a master, so subtitle renditions can ride along.