HLX.Track (HLS Reader and Writer v0.6.0)

View Source

Module describing a media track.

The following fields are required: id, type, codec, timescale.

Private Data

priv_data contains codec specific initialization data. The format of the field is:

  • h264 - For H.264 it's a tuple of sps and a list of pps
  • h265 - For H.265 or HEVC it's a tuple of vps, sps and a list of pps.
  • av1 - For AV1 it's a list of config OBUs (usually sequence header) as a bitstream.
  • aac - For AAC it's a binary describing the audio specific configuration.

The priv_data is not mandatory if:

  • H.264 samples have in-band parameter sets.
  • H.265 samples have in-band parameter sets.
  • AV1 samples have in-band sequence header OBU.

Summary

Functions

Creates a new track from an ex_mp4 track.

Creates a new track struct with the given options.

Converts a track to an ex_mp4 track.

Types

codec()

@type codec() :: :h264 | :h265 | :hevc | :aac | :unknown

id()

@type id() :: non_neg_integer()

t()

@type t() :: %HLX.Track{
  codec: codec(),
  height: non_neg_integer() | nil,
  id: id(),
  mime: String.t() | nil,
  priv_data: any(),
  timescale: non_neg_integer(),
  type: :video | :audio,
  width: non_neg_integer() | nil
}

Functions

from(track)

@spec from(ExMP4.Track.t()) :: t()

Creates a new track from an ex_mp4 track.

new(opts)

@spec new(keyword()) :: t()

Creates a new track struct with the given options.

to_mp4_track(track)

@spec to_mp4_track(t()) :: ExMP4.Track.t()

Converts a track to an ex_mp4 track.

update_priv_data(track, priv_data)

@spec update_priv_data(t(), any()) :: t()