Skip to main content

Stream processes

Within MistServer a stream process is an optional processes that you can use to manipulate media data. This could simply be an encoding process to add an additional video quality to a stream, but also a method of adding meta-data, replacing tracks or even sending a track to a completely different process seperate of MistServer.

There's several processes added to MistServer and a few free-form methods to choose from.

When a process starts

Processes within MistServer are currently only available for live streams.

A stream process will immediately start when a stream becomes live. However you can determine when a process should start by selecting what type of media tracks should be available (or unavailable) before beginning.

If no form of selection is done for a process it will use the same default selection as a viewer, which means the last added video and/or audio track that will be compatible with the selection.

Start control

The start control determines when a process should start, what happens if a process fails and how a process should restart.

Inhibitors / Source/Input selection

Inhibitors

Inhibitors are a method of telling MistServer to not start a process if a track with certain data is available. This can be used to prevent a process from activating if whatever it is supposed to add to a stream is already available. For example preventing the creation of an 720p video track or an opus audio track if there is one available.

You can select video, audio and meta in a similar fashion as track selectors

Source/Input selection

Source selection and Input selection are both responsible for selecting the track to input into the stream process. The main difference is that source selection allows for selecting audio, video and meta-data, while input will only select either video or audio.

Once again you can select them in a similar fashion as track selectors.

Input selection The selection will only apply to either video or audio track depending on what you're encoding. Other tracks will automatically not be selected.

Source selection You can select audio, video and metadata. By default all are passed, but you can limit or remove the selection. If you leave an audio, video or meta unspecified all will be used.

Inconsequential flag

Normal behaviour within MistServer is to not provide stream playback unless all tracks are available. Should a process fail to start this could mean the source of the stream stays unavailable as long as the process is attempted.

The inconsequential flag is there to tell MistServer to provide the rest of the available tracks for playback even if this process fails or is considered booting.

Target Stream

The target stream is the stream that will receive the outcome of the process you're setting up. By default this will be the stream you're currently configuring, however you can fill in another valid stream name within MistServer to send it towards that stream instead.

Restart behaviour

Restart behaviour determines how a process should behave if the stream process cannot start or fails.

Restart delay: amount of time in ms between restart attempts, this is the default and set to 0ms. Exponential backoff: will increase the delay up to max the configured delay for each restart Disabled: do not restart the stream process

Masks

Masks can be used to determine whether a track is visible for other tasks within MistServer. By default a track is visible for any task within MistServer and a track created through a stream process will inherit the mask of the track it is based on.

Masks can impact both the source/input or sink/output track. The source track is the track that is used to create the sink track the stream process generates.

The source mask has one additional option to Undo masks on process exit/fail, which will reset the source track masks should an sink process fail and become unavailable. This allows tasks previously forbidden to re-use the source track.

To give examples of why you would use a mask:

  • To ensure only source qualities are used for processes
  • To only serve transcoded qualities to viewers
  • To only record source qualities

Both source and sink masks are a bitmask

Lowest bit (1) - Viewers
Second bit (2) - Outgoing pushes/recordings
Third bit (4) - Processes
Default: all 8 bits are set to true, including the 5 unused bits

Current available stream processes

While below is a list of stream processes currently available within MistServer one should note not all of these will be available within every version of MistServer. Whether a process is available depends both on the version of MistServer as well as the Operating System it is running on.

libAV

  • Type: video, audio
  • Codecs: H264, JPEG, UYVY, OPUS, AAC, PCM
  • Requirements: MistServer build with libAV process included.

This is the libAV library implemented by the MistServer team. While more limited than other process options for encoding it will be far more efficient in comparison. The current focus for LibAV is H264/JPG encode/decode for video and AAC or OPUS for audio.

FFmpeg

  • Type: video, audio
  • Codecs: *
  • Requirements: FFmpeg installed on your system

This uses a very minimal configuration capable of using a locally installed FFmpeg binary to do encoding.

Matroska In/Out

  • Type: video, audio, metadata
  • Codecs: *
  • Requirements: Any application capable of MKV input/output

This process is meant as an entry point for encoders. MistServer will run the given command and will push stream data in Matroska format towards its standard in & will catch the standard out expecting Matroska again. This allows both hardware and software encoders capable of Matroska to take & input media to MistServer.

Livepeer network encoding

  • Type: video
  • Codecs: H264
  • Requirements: A Livepeer key

The Livepeer network allows users to use cloud encoding through Livepeer. For more information about Livepeer, their mission and benefits we recommend visiting their website!