ffmpeg AAC "Can not resample 6 channels..."

When you try to encode with ffmpeg and you end up with such an error

Resampling with input channels greater than 2 unsupported.
Can not resample 6 channels @ 48000 Hz to 6 channels @ 48000

you are probably trying to encode from AAC with 5.1 audio to less than 6 channels or different audio sampling rate.

There are three solutions:

  1. As a solution either do not reduce the audio channels and change the audio sampling rate or do convert the audio with faad first.
  2. Apply one of the available ffmpeg patches to fix the AAC 6 channel issue...
  3. Split video and audio and convert audio separately.

The third solution can be done as following:

  1. Extract audio with ffmpeg:
    ffmpeg -y -i source.avi -acodec copy source.6.aac
  2. Convert audio with faad:
    faad -d -o source.2.pcm source.6.aac
  3. Merge video and audio again with ffmpeg:
    ffmpeg -y -i source.avi -i source.2.pcm -map 0:0 -map 1:0 -vcodec copy -acodec copy output.avi

Update: As hinted by a fellow commenter the big disadvantage is the quality loss as faad can only convert into PCM 16bit.


FAAD outputs WAV instead of AAC

Might want to mention that FAAD only outputs PCM stereo audio instead of AAC. At least I expected it to do the latter, which obviously fails when trying to mux the output file into a restrictive container like MP4.

So, "source.2.aac" should actually be "source.2.wav".

Re: FAAD outputs WAV instead of AAC

Hi slhck!

Thanks for pointing this out. The file extensions were misleading. I renamed then and added a warning about the quality loss.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

To prevent automated spam submissions leave this field empty.
Syndicate content