-
Notifications
You must be signed in to change notification settings - Fork 8
MPEG H decoder example
ameci-iis edited this page Jun 21, 2024
·
2 revisions
The mpeghdec repository provides a command-line program as an example for MPEG-H decoding implementation.
The example program:
- takes an MP4 file, containing an MPEG-H audio track, as input and extracts the MPEG-H Audio frames from MP4 file format (using the mmtisobmff project).
- decodes the extracted MPEG-H Audio frames to the PCM format according to the desired target speaker layout and optionally sets DRC and loudness decoding parameters.
- stores the decoded PCM data into a WAV file.
To build the MPEG-H decoder command-line example program set mpeghdec_BUILD_BINARIES
variable while configuring the project using CMake :
$ cmake -S mpeghdec -B build -DCMAKE_BUILD_TYPE=Release -Dmpeghdec_BUILD_BINARIES=ON
Read build instructions to learn how to configure and build the project.
If the build process is successfully finished, the MPEG-H decoder command-line tool mpeghDecoder can be found:
- in the build/bin folder
- in the build/bin/Release folder on Windows
$ build/bin/mpeghDecoder [options] -if <path to input file> -of <path to output file>
- -if <path to input file>
- relative or absolute path to an input MP4 file containing an MPEG-H audio track (in MHM1 or MHA1 format) to decode.
- -of <path to output file>
- relative or absolute path to an output WAV file which will contain the decoded PCM data.
Options are:
- -tl <idx>
- <idx> : CICP index of the desired target layout (default: 6).
- -rl <level>
- <level> : DRC target loudness (reference level) in steps of -0.25 LU using values [40..127].
- -dse <effect type>
- <effect type> : MPEG-D DRC effect type request, e.g.: 0 = None (default), 6 = General.
- -db <scale factor>
- <scale factor> : DRC boost scale factor, where 0 is no boost and 127 is max boost.
- -dc <scale factor>
- <scale factor> : DRC attenuation scale factor, where 0 is no compression and 127 is max compression.
- -dam <album mode>
- <album mode> : MPEG-D DRC album mode, 0: disabled (default), 1: enabled.
- -y <sample number>
- <sample number> : start decoding at ISOBMFF/MP4 sample number.
- NOTE: The decoding will start at the nearest sync sample!
- -z <sample number>
- <sample number> : stop decoding at the provided ISOBMFF/MP4 sample number.
- -sf <sample number>
- <sample number> : seek in the bitstream from the provided sample number to the ISOBMFF/MP4 sample number provided with '-st'.
- NOTE: '-st' must be set!
- -st <sample number>
- <sample number> : seek in the bitstream from the ISOBMFF/MP4 sample number provided with '-sf' to the provided ISOBMFF/MP4 sample number.
- NOTE: '-sf' must be set!
- -h
- show help.
To test MPEG-H decoding with the provided command-line program example or with your own implementation please use test material from the test content repository.
Additionally you can:
- visit www.mpegh.com to get further test material and information about Fraunhofer MPEG-H trademark program .
- create your own test content using the MPEG-H Authoring Suite.
Example to test MPEG-H decoding for files provided in test content repository:
$ build/bin/mpeghDecoder -tl 19 -if TRI_Fileset_17_514H_D1_D2_D3_O1_24bit2160p50.audio.mp4 -of out.wav
Example above:
- takes the TRI_Fileset_17_514H_D1_D2_D3_O1_24bit2160p50.audio.mp4 test item as input.
- This MPEG-H test item contains:
- 5.1+4 channel bed
- 3 dialogue objects
- 1 dynamic object
- 3 presets
- This MPEG-H test item contains:
- sets the output target layout to CICP 19 which maps to 7.1+4 speaker layout as defined in supported MPEG-H decoder target layout table.
- writes the decoded PCM data to out.wav file.
- The default output format written is 24-bit signed int PCM WAV (library outputs 32-bit signed int).
- Only the first MPEG-H Audio track will be processed, other MPEG-H Audio tracks will be ignored/skipped.
- Other tracks than MPEG-H Audio track will be ignored/skipped.