Skip to main content

Encoder - AV

Encoder - AV - MistProcAV

This encoder is made by the MistServer team to handle a selection of known/good settings for various codecs to be used for encoding. By only allowing a small selection within the supported Codecs quality and performance can be assured. The main focus of this encoder is adding audio and video tracks as well as providing a JPG track for thumbnails.

This encoder directly integrates with the ffmpeg library allowing a much more efficient and faster pipeline rather than transmuxing twice.

This encoder requires ffmpeg to be installed in order to use and the following compile flag must be set while building Mistserver:

-DWITH_AV=true

codec support

TypeCodecs
AudioOpus, AAC, PCM
VideoH264, AV1, JPG, UYVY, YUYV, NV12

Default settings that always apply

  • Bframes will always be removed from outputs
  • Framerate will always be copied from the source
  • MistProcAV creates an audio or video pipeline per process
  • Sync is guaranteed between source and added tracks

Configuration

MistProcAV is best configured through the interface, it can be started manually by passing JSON to MistProcAV or it can be saved directly into the configuration. When not using the interface we recommend running MistProcAV -j to see all the available options and how to set them.

Interface

MistProcAV has different settings for audio and video. The interface makes the selection easier.

video

image

audio

image

Configuration file / API

The following would be setting up an H264/Opus encode using the defaults.

      "processes": [
{
"bitrate": 8000000,
"codec": "H264",
"exit_unmask": false,
"gopsize": 120,
"inconsequential": false,
"process": "AV",
"tags_inhibit": [],
"tune": "zerolatency-lq",
"x-LSP-kind": "video"
},
{
"bitrate": 192000,
"codec": "opus",
"exit_unmask": false,
"inconsequential": false,
"process": "AV",
"tags_inhibit": [],
"x-LSP-kind": "audio"
}
]

Command line

In order for MistProcAV to run command line you need to make sure you're also setting a source.

Example: Setting an opus encode for the stream example.

MistProcAV '{"bitrate":110000,"codec":"opus","exit_unmask":0,"inconsequential":false,"process":"AV","source":"example","x-LSP-kind": "audio"}'

Required options

You need to set the codec wanted for the end result. This is done through "codec":"SELECT_OPTION". The codec determines whether audio or video is used.

Anything between () should not get passed, it is a comment for readability

KeyNameTypeHelp / DescriptionSelect OptionsDefault / Value
processprocess selectorselectSelects the specific processAV
x-LSP-kindInput typeselectType of input to useVideo, Audiovideo
codec (video)Target codecselectWhich codec to encode toAV1, H264, JPEG, UYVYH264
codec (audio)Target codecselectWhich codec to encode toAAC, Opus, PCMopus

Optional options

Anything between () should not get passed, it is a comment for readability

KeyNameTypeDefault / ValueUnitHelp / DescriptionOptions (if applicable)
accelHardware accelerationselectAutomatic: attempt acceleration, fallback to softwareControl whether hardware acceleration is used or nothw (Force enabled), sw (Software-only)
bitrate (video)Bitrateuint8,000,000 (8 mbps)bit/s, kbit/s, Mbit/s, Gbit/sTarget bitrate for video; not used with JPEG or UYVY
bitrate (audio)Bitrateuint192,000 (192 kbps)bit/s, kbit/sTarget bitrate for audio; not used with PCM
crfConstant Rate Factor (software only)int23Software encoding quality (1–51, lower = better). Used for H264 only.
gopsize (video)GOP Sizeuint120Frames before new keyframe (except JPEG/UYVY)
gopsize (JPEG)GOP Sizeuint120Minimum frames between images (JPEG)
presetEncode presetselectfasterEncoding speed vs compression ratio (H264 only)ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow
profile (H264)Encode profileselecthighSelect encoding profilemain, baseline, high
profile (AAC)Encode profileselectlowSelect encoding profilelow, main, he
qualityQualityint20JPEG-only compression quality (1–31, lower = better)
resolutionResolutionstrkeep source resolutionOutput stream resolution (e.g., 1920x1080)
sample_rate (AAC)Sample rateuintHz, kHzOutput sample rate; copies input if possible
sample_rate (PCM)Sample rateuint48000Hz, kHzOutput sample rate for PCM audio
tuneEncode tuningselectzerolatency-lqH264 tuning for performance/qualityzerolatency, zerolatency-lq, zerolatency-hq, animation, film

General process options

KeyNameTypeDefault / ValueUnitHelp / DescriptionOptions (if applicable)
debugDebug leveldebugDebug message level for process
exit_unmaskUndo masks on process exit/failbooleanfalseResets input track masks to defaults on exit/fail
sinkTarget streamstringWhich stream the encoded track should be added to
sourceSource streamstringWhich stream the encoded track should pull from, defaults to the stream the process is added towards
source_maskSource track maskselectKeep original valueAccess permissions for source tracksEverything, Processing, Processing+Pushing, Processing+Viewing
target_maskOutput track maskselectKeep original valueAccess permissions for output tracksViewer, Pushing, Processing, combinations thereof
track_selectSource selector(s)stringaudio=all&video=allWhich tracks to select for input
start_controlProcess start behaviourgroupControls when and how process startssee below

start control options

SubkeyNameTypeDefaultUnitHelp / DescriptionOptions (if applicable)
inconsequentialInconsequential processboolfalseProcess not required for stream to be considered active
restart_delayRestart delayuint0msDelay between restarts
restart_typeRestart behaviourselectfixedWhat to do when the process exits/failsfixed, backoff, disabled
tags_inhibitTag inhibitor(s)inputlist""List of tags preventing process start
track_inhibitTrack inhibitor(s)stringaudio=none&video=none&subtitle=noneWhich tracks inhibit process start