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 software—Control 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)int23—Software encoding quality (1–51, lower = better). Used for H264 only.—
gopsize (video)GOP Sizeuint120—Frames before new keyframe (except JPEG/UYVY)—
gopsize (JPEG)GOP Sizeuint120—Minimum frames between images (JPEG)—
presetEncode presetselectfaster—Encoding speed vs compression ratio (H264 only)ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow
profile (H264)Encode profileselecthigh—Select encoding profilemain, baseline, high
profile (AAC)Encode profileselectlow—Select encoding profilelow, main, he
qualityQualityint20—JPEG-only compression quality (1–31, lower = better)—
resolutionResolutionstrkeep source resolution—Output stream resolution (e.g., 1920x1080)—
sample_rate (AAC)Sample rateuint—Hz, kHzOutput sample rate; copies input if possible—
sample_rate (PCM)Sample rateuint48000Hz, kHzOutput sample rate for PCM audio—
tuneEncode tuningselectzerolatency-lq—H264 tuning for performance/qualityzerolatency, zerolatency-lq, zerolatency-hq, animation, film

General process options​

KeyNameTypeDefault / ValueUnitHelp / DescriptionOptions (if applicable)
debugDebug leveldebug——Debug message level for process—
exit_unmaskUndo masks on process exit/failbooleanfalse—Resets input track masks to defaults on exit/fail—
sinkTarget streamstring——Which stream the encoded track should be added to—
sourceSource streamstring——Which stream the encoded track should pull from, defaults to the stream the process is added towards—
source_maskSource track maskselectKeep original value—Access permissions for source tracksEverything, Processing, Processing+Pushing, Processing+Viewing
target_maskOutput track maskselectKeep original value—Access permissions for output tracksViewer, Pushing, Processing, combinations thereof
track_selectSource selector(s)stringaudio=all&video=all—Which tracks to select for input—
start_controlProcess start behaviourgroup——Controls when and how process startssee below

start control options​

SubkeyNameTypeDefaultUnitHelp / DescriptionOptions (if applicable)
inconsequentialInconsequential processboolfalse—Process not required for stream to be considered active—
restart_delayRestart delayuint0msDelay between restarts—
restart_typeRestart behaviourselectfixed—What 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=none—Which tracks inhibit process start—