Skip to main content

How the Packager works

A Packager pipeline is a graph of tasks wired together. Each task brings media in, processes it, combines it, or sends it out. Understanding that shape makes the configuration reference and example configurations easier to read.

The four task types​

TaskSectionWhat it does
Source[[sources]]Brings media in: RTMP, SRT, SDI, NDI, HLS, MoQ, a file, an image, or a web page.
Transcoder[[transcoders]]Decodes, processes and re-encodes tracks into one or more renditions. Can also pass tracks through untouched.
Compositor[[compositors]]Combines several decoded sources into one: video layers blended or tiled, audio tracks mixed.
Sink[[sinks]]Sends media out: to Vindral Live, an RTMP or SRT endpoint, SDI, HLS storage, or MoQ.

Not every configuration uses all four. A proxy is just a source and a sink. Compositing is a common case for separate decoding and encoding transcoders; the graph itself has no cycle.

Tasks are wired by id​

Every task has an id. A downstream task names its inputs in source_ids:

toml
[[sources]]
id = "my-source"

[[transcoders]]
id = "my-transcoder"
source_ids = ["my-source"] # reads from the source

[[sinks]]
id = "my-sink"
source_ids = ["my-transcoder"] # reads from the transcoder

This is the single most important thing to understand about the format: the order of sections in the file does not matter. The graph is defined entirely by id and source_ids. Sinks are frequently written before the transcoders they consume.

source_ids is a list, so a task can consume several upstream tasks. That is how a sink muxes video from one transcoder with audio from another. Equally, several tasks can name the same upstream id, which is how one source fans out to multiple sinks.

IDs can be any unique string. Readable names such as main-decoder make the graph easier to follow and identify in API responses and logs.

Every task has a target state​

Each task carries a target_state of started or stopped, defaulting to started. Tasks can also be started and stopped individually at runtime through the HTTP API, which is how a sink is brought up or taken down without restarting the Packager.

Selecting tracks​

A source usually carries several tracks. A transcoder does not consume a whole source. Each of its tracks entries uses a track_selector to pick which one it wants:

toml
[[transcoders.tracks]]
type = "video"

[transcoders.tracks.track_selector]
type = "track-kind"
kind = "video"
criteria = "best"

track-kind picks by kind (video, audio, subtitle, data) with criteria of best or all. track-id picks a specific track by its id, which is how individual language tracks are selected. See Multi-language audio.

Passthrough versus transcoding​

Each track sets passthrough:

  • passthrough = true: the track is forwarded without being decoded or re-encoded. Cheap, and lossless. Use it whenever the incoming format is already what you want to send out.
  • passthrough = false: the track is decoded and re-encoded into the renditions listed under it. This is how an ABR ladder is produced: one track, several renditions at different sizes and bitrates.

A track can also set passthrough = true and define renditions: its original stream and the new renditions are both forwarded. A configuration commonly passes audio through while transcoding video into a ladder. See Track selection.

Common shapes​

Most configurations are one of a few recognisable topologies.

Proxy without transcoding​

The cheapest shape: media in, same media out. No transcoder at all, so the sink reads straight from the source.

See RTMP to RTMP proxy and SRT proxy.

Transcode to a ladder​

One source, one transcoder producing several renditions, one sink publishing them.

See the SDI encoding ladder.

Fan-out: one source, several destinations​

Several sinks naming the same upstream id.

See RTMP to multiple RTMP sinks and Upload recordings to S3.

Combining sources​

Two sources, each with its own transcoder, feeding one sink. Use it to take video from one feed and audio from another.

See Mux two feeds.

Compositing​

A shape where media commonly passes through separate decoding and encoding transcoders. Each source is decoded to raw frames by its own transcoder, the compositor combines them, and further transcoders encode the result.

The decoding transcoders use the wrapped_avframe rendition codec, which means "produce raw frames" rather than an encoded format. They are optional: a compositor can also read sources directly and decode them itself, as in Commentary mix. Use decoding transcoders when you want to control decoding or scaling. See Browser overlay on a live source.

Where to go next​