Page 1 of 2

Export to Mono AAC

Posted: Thu Sep 25, 2014 2:15 pm
by tomreid
Hi

I have a number of recordings I made on my phone. The app on my phone records mono AAC files.

I'm pulling them into Audacity to edit and improve them.

I pulled them in as stereo, but chose "Tracks", "stereo to mono" to change to mono.

When I export the edited sections to AAC (I want to do this to use the same codec as the original recording) when I chose "File, Properties" in the file manager, the file seems to be stereo. When I do a similar export to OGG it produces a mono file. So for roughly the same compression I'm getting much better quality on the OGG as the AAC is still trying to compress 2 channels. The OGG is obviously not perfect though, as it compresses in a different way to the AAC and therefore I may get getting two different lossy compromises on top of each other.

http://manual.audacityteam.org/index.ph ... rt_Options seems to say AAC will always produce a stereo file,not sure I understand why.

Can anyone tell me how to export to mono AAC?

cheers

I'm using Audacity 2.0.5 on Ubuntu 14.4

Re: Export to Mono AAC

Posted: Thu Sep 25, 2014 9:34 pm
by Gale Andrews
Unfortunately this is a way more complex answer than you probably want.

The Manual is misleading - the behaviour depends on the FFmpeg version and the AAC encoder that version was built with.

There is probably no easy answer. All the AAC encoders that FFmpeg can be built with have different issues, or different issues if used in Audacity.

I assume you mean Ubuntu 14.04 and that you are using FFmpeg supplied by Ubuntu. You can run that FFmpeg standalone from the terminal and it will list the codecs it was built with. It is probably using the built-in FFmpeg AAC encoder. I have not tested that standalone but it may possibly only save as stereo AAC.

The best answer is probably not to encode AAC with Audacity at all. Build the VisualOn AAC encoder library (libvo-aacenc) which will export mono AAC. Then build FFmpeg configured to use it. See the FFmpeg documentation . Make your edits in Audacity, export as mono WAV then convert the WAV to mono AAC using your self-built FFmpeg. Of course you can try doing that first with the current Ubuntu-supplied FFmpeg you have now, just in case the stereo export is an Audacity problem.

You could recompile Audacity and link it to your custom-built FFmpeg, then export AAC from Audacity which will use libvo-aacenc, but the AAC quality slider in Audacity has no effect with that encoder. So you may get larger mono files than you want.

Also what are the edits? If they are just cut and paste edits, it's possible to edit AAC files losslessly, but I think that is not easy on Linux. MP3DirectCut (a Windows tool) would do lossless cut and paste AAC edits if you ran it under Wine . See http://sergey.marechek.com/blog/2012/07/15/241/ .


Gale

Re: Export to Mono AAC

Posted: Fri Sep 26, 2014 1:50 am
by steve
For what it's worth, exporting a mono track from Audacity as M4A (AAC) on Debian Wheezy, produces a mono file.

You could perhaps try exporting as WAV, then converting with "avconv".
The command is:

Code: Select all

avconv -i input-file-name.wav output-file-name.aac
If that works for you, then you will probably be able to use the "external program" export option and use avconv to do the encoding.

Re: Export to Mono AAC

Posted: Fri Sep 26, 2014 7:12 am
by Gale Andrews
steve wrote:For what it's worth, exporting a mono track from Audacity as M4A (AAC) on Debian Wheezy, produces a mono file.
I tried it with the Audacity 2.0.5 package on Ubuntu 14.04. Nautilus properties says the exported file is stereo, and MediaInfo says is it is 2 channels "originally mono". FFmpeg's ffprobe says it is unequivocally mono. It imports back into the 2.0.5 package and 2.0.6 as mono.

I am guessing this is a quirk with the AAC encoder in the system FFmpeg that comes with Ubuntu, and the file is actually mono. But we don't know yet whether tomreid has self-compiled FFmpeg and Audacity.

Ubuntu 14.04 doesn't seem to come with avconv installed, so you would have to install it. 14.04 isn't supplied with a system ffmpeg binary either where you could check easily what the AAC encoder was, though Ubuntu 13.10 supplied this.



Gale

Re: Export to Mono AAC

Posted: Fri Sep 26, 2014 9:49 am
by tomreid
Thanks guys. I have not self compiled and am using the packages as presented by the Ubuntu Software Centre.

cheers

Re: Export to Mono AAC

Posted: Fri Sep 26, 2014 12:50 pm
by steve
Gale Andrews wrote:Nautilus properties says the exported file is stereo
Nautilus seems to say that for all mono AAC files, even this one which was encoded with Nero AAC codec 1.5.4.0 (I've ZIP'd the file because .aac files are not allowed).
mono-test-file.zip
(242.54 KiB) Downloaded 42 times
I think we can deduce that AAC support on Linux is still a "work in progress".
I've seen it suggested that the best AAC encoder available for Linux at the present time is the closed source Nero encoder, available here: http://www.nero.com/eng/company/about-n ... -codec.php

My recommendation would be to use open formats (such as WAV, Ogg, Flac, ...) wherever possible.

Re: Export to Mono AAC

Posted: Fri Sep 26, 2014 1:21 pm
by steve
steve wrote:I've seen it suggested that the best AAC encoder available for Linux at the present time is the closed source Nero encoder
Actually, I'm not so sure about that.
I've run some tests using FFmpeg (Debian Wheezy version), and some of the results show better sound quality than the Nero encoder :o

Unfortunately, using Audacity's built in export options provide no control over the quality settings for AAC export (the quality slider in "Options" does nothing). The version of FFmpeg in Debian Wheezy is rather old and not officially supported by Audacity 2.0.6, but if "98 kbps mono" / "192 kbps stereo" is OK, then the quality is pretty good (though, as for all AAC files, Nautilus reports the mono file to be stereo).

Re: Export to Mono AAC

Posted: Fri Sep 26, 2014 2:19 pm
by steve
The FFmpeg page about AAC encoding has moved. The current page is here: https://trac.ffmpeg.org/wiki/Encode/AAC

Re: Export to Mono AAC

Posted: Fri Sep 26, 2014 3:18 pm
by tomreid
Thanks all. Even though it's not best practice to compress an already compressed audio file in a different codec, the .ogg mono files I have created from the AAC originals sound just fine - so I'm going to stick with them for now. It's giving me a nice small file size with no noticeable quality loss.

cheers

Re: Export to Mono AAC

Posted: Fri Sep 26, 2014 4:06 pm
by steve
tomreid wrote:Even though it's not best practice to compress an already compressed audio file in a different codec
I don't think that it actually makes much difference if you use the same or a different codec. Encoding in a lossy format always loses some sound quality. Re-encoding in a lossy format always reduces the sound quality a bit more. Depending on the codecs used, there may be subtle differences in what that quality loss sounds like, but there will always be losses.