MOQX.CMAF (moqx v0.8.1)

Copy Markdown View Source

Helpers for capturing and publishing catalog-advertised CMAF tracks.

Summary

Functions

Captures a catalog-selected H.264 CMAF track into a fragmented MP4 file.

Publishes a fragmented MP4 as catalog and media tracks.

Splits a fragmented MP4 into its initialization bytes and moof fragments.

Functions

capture(client, catalog, path, options \\ [])

@spec capture(MOQX.Client.t(), MOQX.Catalog.t(), Path.t(), keyword()) ::
  {:ok, MOQX.CMAF.Capture.t()} | {:error, term()}

Captures a catalog-selected H.264 CMAF track into a fragmented MP4 file.

The initialization segment is written first. Media objects are ordered by group, subgroup and object coordinates before being appended. Both temporary subscriptions are ended before this function returns.

publish_file(client, path, options)

@spec publish_file(MOQX.Client.t(), Path.t(), keyword()) ::
  {:ok, MOQX.CMAF.Publication.t()} | {:error, term()}

Publishes a fragmented MP4 as catalog and media tracks.

The file is prepared as retained content so a subscriber may arrive after namespace registration. Draft-16 publications carry initialization data in the CMSF catalog; draft-14 publications retain their separate initialization track. The caller remains responsible for finishing the returned namespace publication.

read_fragments(path)

@spec read_fragments(Path.t()) :: {:ok, binary(), [binary()]} | {:error, term()}

Splits a fragmented MP4 into its initialization bytes and moof fragments.