enzo1982 / freac

The fre:ac audio converter project
https://www.freac.org/
GNU General Public License v2.0
1.42k stars 75 forks source link

AAC High Efficiency v2 crashes when encoding mono audio files #572

Closed emailGnq closed 8 months ago

emailGnq commented 10 months ago

Describe the bug fre:ac crashes and closes if a mono audio file is encoded using the bundled AAC High Efficiency version 2 codec

To Reproduce Steps to reproduce the behavior:

  1. Add a MP3 or WAV audio file with a single mono channel
  2. Choose "FDK-AAC Encoder 4.0.1"
  3. Configure selected encoder to use "MPEG AAC High Efficiency v2" codec
  4. Select the file format as MP4.
  5. Run the encoder. After creating an .MP4 file with a short header, fre:ac will exit abruptly.

System

Additional context The crash occurs with all variants of the v2 codec, but older versions (not HE v2) are fine. Tested with MP3 and WAV as input files. The crash is the same. If the output file format is chosen as AAC, fre:ac's behaviour is slightly different: an empty AAC file is created then the encoder hangs (or loops). Parts of the fre:ac UI remain responsive, but ultimately fre:ac needs to be closed by the OS.

enzo1982 commented 8 months ago

Thank you for reporting this! The issue is now fixed in the latest continuous builds.

HEv2 AAC supports stereo only (HEv2 is HE + Parametric Stereo) and the FDK-AAC encoder fails to initialize when trying to encode non-stereo material with it in that mode. The new builds now fall back to HE AAC when HEv2 is configured while encoding non-stereo material.

There was a related issue affecting the Core Audio encoder on macOS. When trying to encode non-stereo material in ELDv2 AAC, invalid files with no audio content were created. The new builds fall back to ELD SBR AAC in that case.