Skip to content

MP4 decoding support

Saketh Sathuvalli edited this page Dec 12, 2022 · 3 revisions

Introduction

The libxaac workspace in the current form does not have support for decoding .mp4 files. It takes the audio elementary stream(es) data extracted from .mp4 using a special utility. The es audio data extracted from the .mp4 is usually passed to the decoder using the -ifile: option and the meta information is passed using -imeta: option. The meta information consists of the following details

  • Length of Audio Specific Configuration bytes / header bytes
  • Start play out offset expressed as number of audio samples.
  • Media scale information.
  • Size of each frame in bytes (usually referred to as samples or access units in MP4 terminology).

Integrating the libisomedia workspace as explained below eliminates the dependency on the additional MP4 utility and enables the decoder executable to directly pick .mp4 file as input.

Requirements

Build Procedure

The build procedure explained below is for Windows MSVS build using cmake.

  • libisomedia clone and build commands
git clone https://github.com/MPEGGroup/isobmff.git
cd isobmff
mkdir build && cd build
cmake libisomediafile  -G "Visual Studio 15 2017" ..
make
  • libxaac build procedure - check out mp4_support branch on cloned workspace
Go to the root directory(libxaac/) of the Ex-HEAAC Decoder.
Create a new folder in the project root directory and move to the newly created folder.

$ cd <path to libxaac>
$ mkdir bin
$ cd bin
$ cmake -G "Visual Studio 15 2017" ..

Notes on the ISO BMFF reference software implementation

The reference software implementation skips the start frames that fall under the "startOffset" bracket. Example:

  • startOffsetSamples = 1676 framesize = 768
  • Reference parser workspace skips 2 (floor(1676 / 768)) frames
  • Residual samples(140) skipping has to be taken care at test application level.
  • Since the initial states differ for decoding using raw meta format and .mp4 format, bit-exactness issue is expected at the start or through out the decoded file

Known Build issues

The MSVS workspace may have build failure issues. The following settings changes can help overcome these build failures.

  • Changing the warning level to 3 from 4
  • Set the "Treat warnings as errors" flag to "No"

Running the decoder

Syntax for running the decoder with MP4 support

<decoder executable name> -ifile:<input_file> -ofile:<output_file>

Example command

xaacdec.exe -ifile:input.mp4 -ofile:output.wav