Export to Mono AAC

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.php?title=AAC_Export_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

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

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:

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.

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

Thanks guys. I have not self compiled and am using the packages as presented by the Ubuntu Software Centre.

cheers

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 (243 KB)
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: Nero Software

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

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 :astonished:

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).

The FFmpeg page about AAC encoding has moved. The current page is here: https://trac.ffmpeg.org/wiki/Encode/AAC

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

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.

Interesting they consider there that libvo-aacenc is the worst quality of all the AAC encoders and the native FFmpeg AAC encoder almost the best. A few years ago the native encoder was regarded as the worst (which I can confirm from tests at the time).

The Zeranoe builds of FFmpeg for Windows use libvo-aacenc, but I have not tested recently against other encoders for sound quality.

If anyone reading this wants to encode low sample rate AAC in Audacity, perhaps for ringtones or speech, note that rates below 22050 Hz will produce a zero bytes file with the native FFmpeg encoder or libfaac, but libvo-aacenc does not have that problem. It’s an Audacity bug.


Gale

I think the “unsupported FFmpeg version” must be the problem. In Ubuntu 14.04, the Audacity AAC quality slider does work with FFmpeg 2.2.3 configured with the native FFmpeg AAC encoder. It works on Mac too with the native encoder in FFmpeg 2.2.2.

I suppose your FFmpeg might be using libfaac. I’ll test libfaac if there is any fix for the slider not working with libvo-aacenc. Perhaps the latter only being CBR is something to do with it?


Gale

According to: Encode/AAC – FFmpeg

Which encoder should I use? What provides the best quality?
For AAC-LC the likely answer is: libfdk_aac > libfaac > Native FFmpeg AAC encoder (aac) > libvo_aacenc

It’s using libvo_aacenc (and it does not seem as bad at the above quote might suggest. I’ve not done any careful comparisons (I don’t normally use AAC), but it doesn’t sound bad, and I don’t see any nasty quirks (which I did notice with the Nero encoder).