Avidemux Forum

Avidemux => Windows => Topic started by: EEMcGee on September 10, 2016, 07:57:38 AM

Title: Problem with AAC audio recode on 2.6.13
Post by: EEMcGee on September 10, 2016, 07:57:38 AM
I'm trying to recode the 384kbs AC3 6 channel in an MP4 file down to 128kbs AAC.  I get an error message when I try to save it.  Cannot setup audio encoder, make sure your stream is compatable with audio encoder (number of channels, bitrate, format).  It recodes when using AAC (FAAC)  but the audio part of the MP4 file is the same large size wheather I set it at 384kbs or 128kbs.  Is it Avidemux or do I have something else in the system messed up (FFD Show setting).
Title: Re: Problem with AAC audio recode on 2.6.13
Post by: Jan Gruuthuse on September 10, 2016, 09:09:26 AM
Avidemux menu: Audio: Select track:
AC3 track: change [copy] to [AAC (lav)]
then in same pop-up window:

[Filters] -> Audio Filters window
Mixer [v] Remix
Mixer: Stereo
Title: Re: Problem with AAC audio recode on 2.6.13
Post by: eumagga0x2a on September 10, 2016, 12:54:36 PM
Quote from: EEMcGee on September 10, 2016, 07:57:38 AM
I'm trying to recode the 384kbs AC3 6 channel in an MP4 file down to 128kbs AAC.  I get an error message when I try to save it.  Cannot setup audio encoder, make sure your stream is compatable with audio encoder (number of channels, bitrate, format).

IMHO, it is worth trying again: [Lav/AAC/Encoder] Bump max number of channels to 6 (https://github.com/mean00/avidemux2/commit/b464a481b3f88293f4a84cd361495898f753c2c9). If you don't build Avidemux yourself, you will have to wait till the next nightly build is out.
Title: Re: Problem with AAC audio recode on 2.6.13
Post by: EEMcGee on September 10, 2016, 01:14:11 PM
Thanks I will try that.
Title: Re: Problem with AAC audio recode on 2.6.13
Post by: mean on September 10, 2016, 01:16:22 PM
I might revert it, the channel mapping is probably incorrect
Title: Re: Problem with AAC audio recode on 2.6.13
Post by: Jan Gruuthuse on September 10, 2016, 02:05:39 PM
you got PM regarding AC3, just in case.
Title: Re: Problem with AAC audio recode on 2.6.13
Post by: mean on September 10, 2016, 02:21:20 PM
Thanks, but it's about the encoder setup
The decoder is already ok
Title: Re: Problem with AAC audio recode on 2.6.13
Post by: Jan Gruuthuse on September 10, 2016, 02:44:10 PM
probably you already have this: https://www.ffmpeg.org/ffmpeg-codecs.html#ac3-and-ac3_005ffixed
Title: Re: Problem with AAC audio recode on 2.6.13
Post by: eumagga0x2a on September 10, 2016, 02:56:01 PM
Quote from: Jan Gruuthuse on September 10, 2016, 02:44:10 PM
probably you already have this: https://www.ffmpeg.org/ffmpeg-codecs.html#ac3-and-ac3_005ffixed

This topic is about aac encoder. Not ac3.
Title: Re: Problem with AAC audio recode on 2.6.13
Post by: Jan Gruuthuse on September 10, 2016, 03:07:55 PM
To long behind the screen: bundled info https://en.wikipedia.org/wiki/Advanced_Audio_Coding#Container_formats
Title: Re: Problem with AAC audio recode on 2.6.13
Post by: eumagga0x2a on September 10, 2016, 03:35:00 PM
As you wrote 4 years ago in http://avidemux.org/smif/index.php/topic,10957.msg58738.html#msg58738 (http://avidemux.org/smif/index.php/topic,10957.msg58738.html#msg58738), the default channel mapping for 5.1 channel audio differs between AC3 and AAC. I haven't checked if the Lavcodec AAC encoder in Avidemux, since a few hours capable of encoding 6 channels, correctly remaps the channels when using 5.1 channel AC3 audio as input. This is the problem Mean is speaking about.
Title: Re: Problem with AAC audio recode on 2.6.13
Post by: Jan Gruuthuse on September 10, 2016, 03:51:52 PM
did forget about that.
perhaps something useful in here https://trac.ffmpeg.org/wiki/AudioChannelManipulation
Title: Re: Problem with AAC audio recode on 2.6.13
Post by: mean on September 10, 2016, 04:00:53 PM
It looks ok, but i'm not 100 % sure
Title: Re: Problem with AAC audio recode on 2.6.13
Post by: eumagga0x2a on September 10, 2016, 04:10:03 PM
I think it is really OK. I reencoded the audio using ffmpeg

ffmpeg -i ChID-BLITS-EBU.mp4 -c:v copy -c:a ac3 ChID-BLITS-EBU-ffmpeg-ac3-reenc.mp4

confirmed with mplayer that channels are mapped correctly, loaded the new mp4 file in Avidemux and reencoded the audio as 5.1 AAC. The resulting video plays in mplayer still with correct mapping.
Title: Re: Problem with AAC audio recode on 2.6.13
Post by: EEMcGee on September 10, 2016, 04:25:14 PM
I didn't realize the options were in the select track menu option.  I just set tjhe mode from copy to AAC lav and set the bit rate out in the main window.  That's when it gave me the problem.
Title: Re: Problem with AAC audio recode on 2.6.13
Post by: eumagga0x2a on September 10, 2016, 04:38:40 PM
If you have more than one audio track then you have to pick one you'd like to encode unless you use copy and the target container supports multiple audio tracks. If your source mp4 file contains only a single 5.1 channel ac3 audio track alongside video, there is no point in selecting a track ;)

Prior to the aforementioned git commit you had to downmix to stereo as all the AAC encoder in Avidemux supported was 2ch audio. Now it can encode 6ch as well and the chances are good that the channel mapping is correct.