-
Notifications
You must be signed in to change notification settings - Fork 0
MPEG–H support in Gstreamer
This page describes how to use the integrated MPEG-H decoding capability in the GStreamer framework.
The mpeghdec plugin is available in the main branch of the GStreamer repository and provides MPEG-H Audio decoding support based on Fraunhofer’s MPEG-H decoder.
audio/x-mpeg-h:
stream-format = { mhas, raw }
framed = true
stream-type = single
profile = baseline
level = { 1, 2, 3, 4 }
rate = 48000
Plugin input is either raw MPEG-H Access Units or the self-contained MPEG-H Audio Stream (MHAS). In case of raw input format, the codec_data data needs to be passed from a previous pipeline element.
Each gst_mpeghdec_handle_frame call contains either a complete MPEG-H Access Unit or a complete MHAS frame.
The mpeghdec plugin supports only MPEG-H Baseline Profile streams with levels 1 to 4.
audio/x-raw
format = S32
layout = interleaved
channels = [1, 24]
rate = 48000
The output of the mpeghdec plugin is interleaved PCM data in signed 32-bit integer format. The number of output channels depends on the set target-layout plugin parameter.
The mpeghdec plugin defines the following read/write parameters:
-
Target Layout
- defines desired target speaker layout.
- parameter name:
target-layout - parameter value: CICP index (see CICP table).
- allowed range: from 1 to 20
- default value: 6
-
Target Reference Level
- the target reference level is the target loudness to which the decoder normalizes the audio output-
- parameter name:
target-ref-level - parameter value: target reference level in LKFS
- allowed range: from -31.75 to -10.00
- default value: -24.0
-
MPEG-D DRC Effect Type
- the DRC effect type controls the selection of a DRC set.
- parameter name:
drc-effect-type - parameter value: DRC effect type
- allowed values: "off", "none", "night", "noisy", "limited", "lowlevel", "dialog", "general"
- default value: "general"
-
DRC Attenuation Factor
- The DRC attenuation factor is a scaling factor that is applied to attenuation DRC gains, i.e. to gains that are less than 0 dB.
- parameter name:
drc-cut-level - parameter value: attenuation factor
- allowed range: from 0.0 (i.e. don't apply) to 1.0 (i.e. full application of attenuation DRC gains)
- default value: 0.0
-
DRC Boost Factor
- The DRC boost factor is a scaling factor that is applied to amplification DRC gains, i.e. to gains that are greater than 0 dB.
- parameter name:
drc-boost-level - parameter value: boost factor
- allowed range: from 0.0 (i.e. don't apply) to 1.0 (i.e. full application of amplification DRC gains)
- default value: 0.0
-
Album Mode
- The album mode parameter should be set to enabled if songs of an album are played back in the original order of the album. The album mode parameter controls both the application of DRC sets for fading, and the usage of album loudness for normalization.
- parameter name:
album-mode - parameter value: enable/disable album mode
- allowed range: true|false
- default value: false
More information about the used MPEG-H parameters can be found here.
To enable MPEG-H decoding in a new GStreamer based application:
- Build and install the mpeghdec library (shared library and headers) according to the build instructions.
- additionally add
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)to mpeghdec root cmake file - to install built library call:
$>cmake install
- additionally add
- Checkout the GStreamer main branch.
- Build GStreamer according to the GStreamer build instructions. When
mpeghdecis found by the build system, the plugin is built automatically.
If Fraunhofer’s MPEG-H decoder is installed in a non-default location, make sure the build system can find it, e.g. by setting PKG_CONFIG_PATH or adjusting the compiler search paths.
After installation, verify the plugin is visible:
$ gst-inspect-1.0 mpeghdec
A GStreamer pipeline for mpeghdec decoding can be set up in the following way:
$ gst-launch-1.0 \
filesrc location=<path/to/source.mp4> \
! qtdemux name=demux demux.audio_0 \
! mpeghdec \
! wavenc \
! filesink location=<path/to/sink.wav>
Example command line to decode and play an MP4 file:
$ gst-launch-1.0 -v \
souphttpsrc location=https://github.com/Fraunhofer-IIS/
mpegh-test-content/raw/refs/heads/main/
TRI_Fileset_17_514H_D1_D2_D3_O1_24bit1080p50.mp4 \
! qtdemux name=demux demux.audio_0 \
! queue \
! mpeghdec \
! autoaudiosink