The ffmpeg command line for a conversion: pure, so what is run can be read and tested without running it.
Video copied as it is; audio copied when it is AAC already, else AAC
stereo (a browser plays stereo regardless, and TrueHD 7.1 cannot be put
in AAC as it is). Fragments at keyframes, at least two seconds long, in
the MP4 muxer's own form. One audio track goes into media.mp4 with the
video; several each get their own audioN.mp4, so the player can switch
between them as HLS renditions. Text subtitles come out as WebVTT files.
HEVC goes through MPEG-TS on the way: a release often keeps the parameter
sets inside the video rather than in the container, and an MP4 written
straight from it has an empty hvcC that nothing decodes. Read back from
TS, ffmpeg's parser puts them where hvc1 needs them.
delay_moov holds the header back until the first fragment: the AAC
decoder configuration comes out of the TS stream with its first packet,
and a header written before that has none, which Safari refuses to decode
(ffmpeg plays it anyway, so a local check does not show it).
A part begun later in the file (-ss, which lands on the keyframe
before) keeps the file's own clock: -copyts leaves the times as they
are and frag_discont makes the first fragment carry them, so the video,
each audio file and the subtitles all agree on where they are — without
it the MP4 muxer counts each file from its own first packet, and audio
that begins a second after the keyframe comes out a second early. The TS
stage would add its usual 1.4 s to everything; -muxdelay 0 stops it.
Summary
Functions
The audio tracks in the file's order, named for the player's menu:
[%{index: 1, codec: "eac3", lang: "fre", file: "audio0", name: "French"}].
Two tracks of one language (a commentary, a second mix) are told apart by number.
The shell command (one pipeline) converting url into dir, from part seconds in.
The text subtitle streams, as files subN.vtt (image subtitles are left out).
A track's name from its language code, or Track N without one.
Tracks with the same name numbered apart (Russian 1, Russian 2), in index order.
Functions
The audio tracks in the file's order, named for the player's menu:
[%{index: 1, codec: "eac3", lang: "fre", file: "audio0", name: "French"}].
Two tracks of one language (a commentary, a second mix) are told apart by number.
@spec build(String.t(), Path.t(), [Direct.Probe.stream()], non_neg_integer()) :: String.t()
The shell command (one pipeline) converting url into dir, from part seconds in.
The text subtitle streams, as files subN.vtt (image subtitles are left out).
A track's name from its language code, or Track N without one.
Tracks with the same name numbered apart (Russian 1, Russian 2), in index order.