MainConcept MPEG-H Encoder Plug-in for FFmpeg 3.2.0
MPEG-H Encoder plug-in usage

The following briefly describes how to use the MainConcept MPEG-H Encoder plug-in for FFmpeg.

The command line format should follow the structure below, depending on which operating system you are using.

Note
This plug-in is not supported on Linux ARM.

On Windows

ffmpeg <ffmpeg-params> \
-c:a omx_enc_mpegh \
-omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mpegh.audio \
-omx_param "<mc-general-params>" \
<ffmpeg-output-parameters> \

Below is a basic command-line example:

ffmpeg -i Audio_input_MPF_16ch.wav -c:a omx_enc_mpegh -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mpegh.audio -omx_param "usecase=streaming:profile=baseline:profile_level=level_4:bitrate_settings_mode=automatic_high_bitrate:rap_interval=2048" 524943577_ffmpeg_output.mpegh -y

On Linux

Note
The modified FFmpeg executable is installed in /opt/mainconcept/ffmpeg-omx/bin/. Ensure this folder is in your search path for the following examples.

ffmpeg <ffmpeg-params> \
-c:a omx_enc_mpegh \
-omx_core libomxil_core.so -omx_name OMX.MainConcept.enc_mpegh.audio \
-omx_param "<mc-general-params>" \
<ffmpeg-output-parameters> \

Below is a basic command-line example:

ffmpeg -i Audio_input_MPF_16ch.wav -c:a omx_enc_mpegh -omx_core libomxil_core.so -omx_name OMX.MainConcept.enc_mpegh.audio -omx_param "usecase=streaming:profile=baseline:profile_level=level_4:bitrate_settings_mode=automatic_high_bitrate:rap_interval=2048" 524943577_ffmpeg_output.mpegh -y

FFmpeg options mapped to the MainConcept MPEG-H Encoder

The following FFmpeg options are mapped from the command-line to the MainConcept MPEG-H Encoder:

FFmpeg option Usage example
bit_rate -b:a 192k

omx_param parameters (mc-general-params)

All settings below are optional parameters for omx_param (mc-general-params):

Function Description
usecase Preset configuration and output format for the MPEG-H Audio encoding use-case.
input_metadata_type Production Meta Data (PMD) type to be used for MPEG-H Audio encoding.
pmd_preset Selection of PMD presets that can be specified when choosing pmd_preset for input_metadata_type.
pmd_loudness_levels Loudness level in LKFS according to ITU-R BS.1770-3 for selected PMD preset.
pmd_content_languages Language code(s) defined in ISO 639-2.
profile MPEG-H encoding profile.
bitrate_settings_mode Bitrate setting mode for the main MPEG-H Audio Stream (MHAS).
profile_level MPEG-H 3D Audio level as defined in ISO/IEC 23008-3.
rap_interval Controls the RAP (Random Access Point) distance in milliseconds. A value of 0 disables RAPs. RAPs are required for streaming purposes and seeking.
fallback_mode_behavior Channel layout to be used in Fallback mode.
fallback_mode_bitrate Total bitrate (in kbps) of the Fallback mode bitstream.
fallback_mode_loudness_level Loudness level in LKFS of the Fallback mode bitstream according to ITU-R BS.1770-3.

Command line examples

Note
The command line examples below are Windows specific. To run examples on Linux, you must slightly modify them. Instead of -omx_core omxil_core.dll, you need to specify -omx_core libomxil_core.so on Linux.

Note
There is currently no native multiplexing support such as MP4 or Transport Stream for MPEG-H audio available in FFmpeg. Multiplexing to MP4, TS, MPEG-DASH or HLS will result in invalid output files. The MainConcept MPEG-H Encoder plug-in only outputs MPEG-H audio Elementary Streams (*.mpegh) that can be externally multiplexed. See MPEG-H audio multiplexing for more information on this topic.
ffmpeg -i Audio_input_MPF_16ch.wav -c:v omx_enc_mpegh -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mpegh.audio ffmpeg_output.mpegh
ffmpeg -i Audio_input_MPF_16ch.wav -c:a omx_enc_mpegh -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mpegh.audio -omx_param "profile=baseline" ffmpeg_output.mpegh
ffmpeg -i Audio_input_MPF_16ch.wav -c:a omx_enc_mpegh -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mpegh.audio -omx_param "profile=lc" ffmpeg_output.mpegh
ffmpeg -i Audio_input_MPF_16ch.wav -c:a omx_enc_mpegh -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mpegh.audio -omx_param "rap_interval=2048" ffmpeg_output.mpegh
ffmpeg -i Audio_input_MPF_16ch.wav -c:a omx_enc_mpegh -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mpegh.audio -omx_param "usecase=streaming" ffmpeg_output.mpegh
ffmpeg -i Audio_input_MPF_16ch.wav -c:a omx_enc_mpegh -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mpegh.audio -omx_param "bitrate_settings_mode=maximum_total_bitrate" ffmpeg_output.mpegh
ffmpeg -i Audio_input_MPF_16ch.wav -c:a omx_enc_mpegh -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mpegh.audio -omx_param "bitrate_settings_mode=bitrate_per_signal" ffmpeg_output.mpegh
ffmpeg -i Audio_input_MPF_16ch.wav -c:a omx_enc_mpegh -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mpegh.audio -omx_param "bitrate_settings_mode=automatic_medium_bitrate" ffmpeg_output.mpegh
ffmpeg -i Audio_input_MPF_16ch.wav -c:a omx_enc_mpegh -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mpegh.audio -omx_param "bitrate_settings_mode=automatic_high_bitrate" ffmpeg_output.mpegh
ffmpeg -i Audio_input_MPF_16ch.wav -c:a omx_enc_mpegh -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mpegh.audio -omx_param "profile_level=level_1" ffmpeg_output.mpegh
ffmpeg -i Audio_input_MPF_16ch.wav -c:a omx_enc_mpegh -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mpegh.audio -omx_param "profile_level=level_2" ffmpeg_output.mpegh
ffmpeg -i Audio_input_MPF_16ch.wav -c:a omx_enc_mpegh -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mpegh.audio -omx_param "profile_level=level_3" ffmpeg_output.mpegh
ffmpeg -i Audio_input_MPF_16ch.wav -c:a omx_enc_mpegh -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mpegh.audio -omx_param "profile_level=level_4" ffmpeg_output.mpegh
ffmpeg -i Audio_input_MPF_16ch.wav -c:a omx_enc_mpegh -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mpegh.audio -omx_param "usecase=streaming:profile=lc:profile_level=level_4:bitrate_settings_mode=automatic_high_bitrate:rap_interval=2048" ffmpeg_output.mpegh
ffmpeg -i Audio_input_MPF_16ch.wav -c:a omx_enc_mpegh -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mpegh.audio -omx_param "usecase=streaming:profile=baseline:profile_level=level_3:bitrate_settings_mode=automatic_high_bitrate:rap_interval=2048" ffmpeg_output.mpegh
ffmpeg -i Audio_input_MPF_16ch.wav -vn -c:a omx_enc_mpegh -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mpegh.audio -y -omx_param "input_metadata_type=ct" ffmpeg_output.mpegh
ffmpeg -i Audio_input_MPF_16ch.wav -vn -c:a omx_enc_mpegh -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mpegh.audio -y -omx_param "input_metadata_type=pmd_preset" ffmpeg_output.mpegh
ffmpeg -i Audio_input_MPF_16ch.wav -vn -c:a omx_enc_mpegh -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mpegh.audio -y -omx_param "input_metadata_type=pmd_preset:pmd_preset=cicp_2:pmd_loudness_levels=-5.0:pmd_content_languages=eng" ffmpeg_output.mpegh
ffmpeg -i Audio_input_MPF_16ch.wav -vn -c:a omx_enc_mpegh -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mpegh.audio -y -omx_param "input_metadata_type=pmd_preset:pmd_preset=cicp_2:pmd_loudness_levels=-5.0,-2.0:pmd_content_languages=eng,deu" ffmpeg_output.mpegh
ffmpeg -i Audio_input_MPF_16ch.wav -vn -c:a omx_enc_mpegh -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mpegh.audio -y -omx_param "fallback_mode_behavior=cicp_6:fallback_mode_bitrate=128000:fallback_mode_loudness_level=-5.0" ffmpeg_output.mpegh
ffmpeg -i Audio_input_MPF_16ch.wav -vn -c:a omx_enc_mpegh -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mpegh.audio -y -b:a 196000 -omx_param "bitrate_settings_mode=maximum_total_bitrate" ffmpeg_output.mpegh
ffmpeg -i Audio_input_MPF_16ch.wav -vn -c:a omx_enc_mpegh -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mpegh.audio -y -b:a 64000 -omx_param "bitrate_settings_mode=bitrate_per_signal" ffmpeg_output.mpegh
ffmpeg -i Audio_input_MPF_16ch.wav -vn -c:a omx_enc_mpegh -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mpegh.audio -y -omx_param "bitrate_settings_mode=automatic_medium_bitrate" ffmpeg_output.mpegh

Parameters

The MainConcept MPEG-H Encoder plug-in for FFmpeg comes with the following encoder settings and parameters that can be specified on the command-line using -omx_param.

usecase

Specifies the preset configuration and output format for the MPEG-H Audio encoding use-case.
  • streaming: Preset for all MP4-based workflows, such as MMT/ROUTE or MPEG-DASH/HLS streaming.
Note
When you select streaming, the rap_interval parameter is set to 1024 by default.

input_metadata_type

Specifies which Production Meta Data (PMD) type should be used for MPEG-H encoding.
  • ct: Use the PMD from the Control Track for encoding. The Control Track - created by an MPEG-H authoring tool - is an audio signal that comes with the modulated PMD. It is the last signal fed into the encoder, e.g. when you have an input stream or broadcast environment with a maximum of 16 audio channels or signals, the Control Track would always be present in the last, i.e. 16th signal. The Control Track is always strictly tied to its accompanying audio content, i.e. the information is specific to this specific audio footage.
  • pmd_preset: Use a PMD preset for encoding. If no Control Track is available or delivered on the ingest side for encoding, a fixed PMD preset can be applied. You can select a preset using the pmd_preset parameter.

pmd_preset

Depending on the source, you can select a PMD preset here after specifying pmd_preset for input_metadata_type.
  • cicp_1: Basic preset for CICP loudspeaker layout index 1 according to ISO/IEC 23091-3 (mono); Num streams: 1; Num required loudness levels: 1 (Program loudness in LKFS according to ITU-R BS.1770-3); Optional: 1 content language.
  • cicp_2: Basic preset for CICP loudspeaker layout index 2 according to ISO/IEC 23091-3 (stereo); Num. streams: 1; Num required loudness levels: 1 (Program loudness in LKFS according to ITU-R BS.1770-3); Optional: 1 content language.
  • cicp_6: Basic preset for CICP loudspeaker layout index 6 according to ISO/IEC 23091-3 (5.1); Num streams: 1; Num required loudness levels: 1 (Program loudness in LKFS according to ITU-R BS.1770-3); Optional: 1 content language.
  • cicp_12: Basic preset for CICP loudspeaker layout index 12 according to ISO/IEC 23091-3 (7.1); Num. streams: 1; Num required loudness levels: 1 (Program loudness in LKFS according to ITU-R BS.1770-3) Optional: 1 content language.
  • cicp_13: Basic preset for CICP loudspeaker layout index 13 according to ISO/IEC 23091-3 (22.2); Num streams: 1; Num required loudness levels: 1 (Program loudness in LKFS according to ITU-R BS.1770-3); Optional: 1 content language.
  • cicp_15: Basic preset for CICP loudspeaker layout index 15 according to ISO/IEC 23091-3 (10.2); Num streams: 1; Num required loudness levels: 1 (Program loudness in LKFS according to ITU-R BS.1770-3); Optional: 1 content language.
  • cicp_16: Basic preset for CICP loudspeaker layout index 16 according to ISO/IEC 23091-3 (5.1p4); Num streams: 1; Num required loudness levels: 1 (Program loudness in LKFS according to ITU-R BS.1770-3); Optional: 1 content language.
  • cicp_19: Basic preset for CICP loudspeaker layout index 19 according to ISO/IEC 23091-3 (7.1p4); Num streams: 1; Num required loudness levels: 1 (Program loudness in LKFS according to ITU-R BS.1770-3); Optional: 1 content language.

pmd_loudness_levels

Specifies the loudness level in LKFS (Loudness, K-weighted, relative to full scale, dB) according to ITU-R BS.1770-3. The corresponding value that needs to be set is specified in the declaration of each PMD preset enum value declaration. If you have more than one float value, these strings can be separated by comma on the command-line.

pmd_content_languages

Specifies the appropriate language codes defined in ISO 639-2, e.g. eng, deu, fra, etc.

profile

Specifies the MPEG-H encoding profile.
  • baseline: Bitstream is compliant with MPEG-H 3D Audio Baseline profile. This is the preferred profile in use today.
  • lc: Bitstream is compliant with MPEG-H 3D Audio Low Complexity profile with channels and objects only. Backward compliant with Baseline profile (e.g. flagged "LC@L3", "BL@L3").

bitrate_settings_mode

Specifies the bitrate setting mode and the bitrate for the main MPEG-H stream:
  • maximum_total_bitrate: This option allows you to set a user-defined total bitrate that should be used for encoding. The actual bitrate value needs to be specified separately via the b:a parameter.
  • bitrate_per_signal: This option allows you to set a user-defined bitrate per mono signal, e.g. setting a bitrate per signal of 48000 bps will lead to a total bitrate of 96000 bps for stereo and a total bitrate of 288000 bps for 5.1 content. The actual bitrate value needs to be specified separately via the b:a parameter.
  • automatic_medium_bitrate: Using this parameter, the actual, optimum bitrate will be chosen and set to the medium value automatically by the encoder. See Typical Loudspeaker Layout Bitrates for more information.
  • automatic_high_bitrate: Using this parameter, the actual, optimum bitrate will be chosen and automatically set to the maximum value by the encoder.

profile_level

Specifies the maximum MPEG-H 3D audio level as defined in ISO/IEC 23008-3 for both Baseline and Low Complexity Profile.
  • level_1
  • level_2
  • level_3 (default)
  • level_4

rap_interval

For streaming purposes, it is required to add RAPs (Random Access Points) to the encoded stream. RAPs enable the receiver of the encoded stream to start decoding as soon as it receives a RAP. Moreover, it allows seeking within the stream. Enter the RAP interval in milliseconds. A value of 0 means that RAPs will be disabled in the stream.
Note
If a value does not correspond to the RAP granularity grid, the plug-in takes the input and rounds it up to the next RAP position on this grid.

fallback_mode_behavior

Specifies the channel layout to be used in fallback mode. The encoder switches to fallback mode when the Control Track is corrupted or missing or if no PMD Preset is applied.
  • cicp_1: Sets the fallback mode channel layout to 1.0 (Mono)
  • cicp_2: Sets the fallback mode channel layout to 2.0 (Stereo)
  • cicp_6: Sets the fallback mode channel layout to 5.1

fallback_mode_bitrate

Specifies the total bitrate (in kbps) of the fallback mode bitstream.

fallback_mode_loudness_level

Specifies the loudness level in LKFS (Loudness, K-weighted, relative to full scale, dB) of the fallback mode bitstream according to ITU-R BS.1770-3.

Appendix

This appendix contains information on the following:

Typical Loudspeaker Layout Bitrates

The following is an overview of the MPEG-H current minimum/maximum total bitrates and the automatic bitrates for the most significant loudspeaker layouts.

Loudspeaker layout Minimum bitrate (bps) autoMedium bitrate (bps) autoHigh bitrate (bps) Maximum bitrate (bps)
Mono 32000 48000 64000 128000
Stereo 48000 64000 96000 256000
5.1 96000 160000 224000 768000
7.1 128000 224000 288000 1024000
5.1 + 4H 160000 256000 320000 1280000
7.1 + 4H 192000 288000 384000 1536000
22.2 372000 512000 768000 3072000

MPEG-H audio multiplexing

FFmpeg does not yet support MPEG-H 3D Audio multiplexing (e.g. into MP4), so it must be carried out in a separate post-processing step.

Currently, multiplexing to MP4 file format is supported by the MP4Box packager that comes with the GPAC open source multimedia framework. You can download and install it from the GPAC website (https://gpac.wp.imt.fr/downloads/). Once installed, you can run MP4Box from the command-line to multiplex your video and audio Elementary Streams to MP4 as follows:

mp4box -add ffmpeg_16ch_output.mpegh+Germany_vs_Brazil_2014_hdr.vvc "Semi_Final_2014_hdr.mp4"