Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > General > Audio encoding

Reply
 
Thread Tools Search this Thread Display Modes
Old 20th April 2015, 15:52   #1  |  Link
Loomes
Registered User
 
Join Date: Nov 2003
Location: Germany, Berlin
Posts: 48
AC3 to AAC conversion

What I have:
- A fine working streaming environment at home /w Synology NAS Server DS413j + Synology Apps on iPad, TV, PC etc.
- Loads of MP4 (h264 video + AC3 track) on my NAS, made from my DVD movies and DVD series boxes.

What I did:
- Converted DVDs to h264 video with 576p to 2000 kbps (fine for me) + AC3 track as it comes originally from the DVD (mostly 386 or even 640 kbps /w constant bitrate).

What I wanna do:
- Save even more space on my NAS by converting these AC3 tracks to AAC tracks while keeping the audio quality of the AC3 track.

My Question:
What is technically the right compression setting with NeroAACEnc to do conversion from AC3 to AAC? How is the technical background, what is the theoretical approach?

As far as I have read, AAC is way better than AC3 by saving space and quality in 2.0 and 5.1 audio tracks but I am unsure how to do it right and how far I can go re-compressing the AC3 tracks. I did some experiments with NeroAACEnc by doing "eac3to.exe mytrack.ac3 mytrack.m4a -quality=0.5 -2pass" meaning that the (already lossy) AC3 is deflated to WAV first, then compressed to M4A. I found out that a 348kbps constant AC3 will become a ~400kbps variable MP4 with slightly higher file size. Since AAC is the better compresser 0.5 cant be the right quality setting. The WAV originating from the AC3 is no better than the AC3, since AC3 is already lossy, so it makes no sense producing a bigger M4A.

What I want is to preserve the audio quality from the AC3, not loosing any more quality by doing the AAC compression. And of course I want the resulting M4A to be much smaller in file size than the AC3. Is there a trick or anything to do this properly?

Thanks in advance!
Loomes is offline   Reply With Quote
Old 20th April 2015, 15:58   #2  |  Link
Ghitulescu
Registered User
 
Ghitulescu's Avatar
 
Join Date: Mar 2009
Location: Germany
Posts: 5,772
You won't save too much space. Save your time. For 90€ for an external HDD you can have (or save yourself) 2500 processing hours (or 14 months at your current paygrade).
The only advantage is when you have to play them on devices that do not accept AC3 (like some Androids - although vlc can solve this too).
__________________
Born in the USB (not USA)
Ghitulescu is offline   Reply With Quote
Old 20th April 2015, 16:03   #3  |  Link
Loomes
Registered User
 
Join Date: Nov 2003
Location: Germany, Berlin
Posts: 48
- I am not spending any time, batch scripts are doing this
- a NAS can only accept a limited amount of hard drives
- AAC playback is much more compatible with the synology apps
- filesize saved does barely count on a few files but on 3TB with movies and series it counts in large amounts
Loomes is offline   Reply With Quote
Old 20th April 2015, 17:44   #4  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,103
You will have to conduct some listening tests to compare the quality of your AC3 sources with AAC at different quality levels (using some high quality audio sources).

In my experience using the Nero encoder you can go as low as 0.30 for the quality level. This translates roughly to an average bitrate of 96 kbps for stereo and 192 kbps for 6-ch audio. (You should use quality based conversions, not bitrate based).

You might get better quality by replacing Nero with Qaac. There seems to be consensus that Qaac delivers slightly higher quality at lower bitrates. The quality values for Qaac do not match the Nero settings, a Nero setting of 0.30 is roughly equivalent to a Qaac setting of 37.


Cheers
manolito

Last edited by manolito; 20th April 2015 at 18:35.
manolito is offline   Reply With Quote
Old 20th April 2015, 18:13   #5  |  Link
Loomes
Registered User
 
Join Date: Nov 2003
Location: Germany, Berlin
Posts: 48
Thanks for your reply, manolito. I will check Qaac, havent heard of it yet. Ofc listening to the conversion results is mandatory but I was hoping for some more technical advice, e.g. like "AC3 640kbps is like Nero 0.4 and AC3 384kbps is like Nero 0.3". But that would be too easy I guess...
Loomes is offline   Reply With Quote
Old 20th April 2015, 18:34   #6  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,103
Quote:
Originally Posted by Loomes View Post
But that would be too easy I guess...
Yes, much too easy...

First of all these are two very different compression formats, the only thing you can count on is that usually AAC is more effective than AC3. By how much depends a lot on the source material.

Also you are comparing AC3 with constant bitrate (this is what DVDs use) to AAC with variable bitrate. Of course you can also convert to AAC using constant bitrate, but this is not recommended, you would be wasting bitrate (sure would make it easier to establish a rule of thumb relation between AC3 bitrate and the equivalent AAC bitrate).


Cheers
manolito
manolito is offline   Reply With Quote
Old 20th April 2015, 19:01   #7  |  Link
Loomes
Registered User
 
Join Date: Nov 2003
Location: Germany, Berlin
Posts: 48
There is one thing I dont really get: Lets say we have a AC3 of about 96kbps, which is rather poor quality. Now I decompress this AC3 to WAV and compress the WAV with a Nero quality setting of 0.5, which is rather high. The resulting M4A is way more bigger in file size but of same quality as the AC3 -- since AAC cant bring back what was lost during the original AC3 compression.

Why is the resulting M4A bigger? As I understand, audio compression is (roughly said) leaving out data you dont really need. This originally left out data does not exist anymore in the WAV. So how can a M4A be bigger when the WAV comes from a strongly compressed AC3? Naivly, I imagine that Nero's algorithm is supposed to recognize that a quality of 0.5 cant be done anymore with this WAV and instead sticks with the original quality of the AC3 (because this is the highest quality it can get from the WAV). Instead, Nero produces even a bigger file.

Last edited by Loomes; 20th April 2015 at 19:29.
Loomes is offline   Reply With Quote
Old 20th April 2015, 23:33   #8  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,103
After you have decompressed the 96 kbps AC3 file to WAV, no encoder will be able to tell that this WAV comes from a heavily compressed AC3. This WAV will of course have all the artifacts and low bitrate precision problems, but to the encoder it means that it will do the best it can to encode all these artifacts and deficiencies.

Use a still picture JPG as an example. At a very high compression you will see plenty of the typical blocking, but if you try to recompress this JPG to another JPG, the converter will try to compress these blocking artifacts as faithfully as it can. And the decoded file will not be any easier to compress than a high quality file without any blocking artifacts.


Cheers
manolito
manolito is offline   Reply With Quote
Old 21st April 2015, 11:29   #9  |  Link
kypec
User of free A/V tools
 
kypec's Avatar
 
Join Date: Jul 2006
Location: SK
Posts: 826
I agree with manolito here. I also convert all audio in my encodings to AAC, originally I was using eac3to+NeroAACEnc but switched to eac3to+qaac about 2 years ago.
This is my typical command for stereo audio in TV shows:
Code:
set eac3to="%PROGRAMFILES(X86)%\AVTools\eac3to\eac3to.exe"
set qaac="%PROGRAMFILES(X86)%\AVTools\qaac\qaac.exe"

for %%a in (*.mkv) do (
	%eac3to% "%%a" 2: stdout.wav -downStereo -normalize -log="%%~na_dec.log" | %qaac% --abr 80 --quality 2 -o "%%~na.m4a" --log "%%~na_enc.log" -
)
Filesize savings are quite nice, especially when you strip off multichannel AC3 384kbps -> AAC 80kbps for entire series (10 seasons * 24 episodes) without noticeable audio quality loss.

Last edited by kypec; 21st April 2015 at 11:32.
kypec is offline   Reply With Quote
Old 21st April 2015, 12:43   #10  |  Link
Loomes
Registered User
 
Join Date: Nov 2003
Location: Germany, Berlin
Posts: 48
Manolito, Kypec, thanks for your replies, very interesting and useful so far.

Kypec, thanks for sharing your command line, I have some questions:
- Why do you choose abr and not tvbr, whats the difference? As I understand, --tvbr 82 would bring same results, no?
- Is the option -normalize for adjusting the volume? If yes, any normalization I know costs quality. Is that not right?
- What settings do you use for AC3 640kbps, TrueHD, DTS and DTS-HD?
- As I am planning to get a 5.1 system in near future I would not get down to 2.0. Would you recommend other settings for AC3 384kbps 5.1 -> AAC 5.1?
Loomes is offline   Reply With Quote
Old 21st April 2015, 17:36   #11  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,922
Normalising won't cost you quality, It's adjusts the volume so the peaks are at maximum. As different audio tracks have different peak levels, it means they'll be adjusted by different amounts. Mostly not much, but sometimes by more than not much.

I don't normalise when converting stereo to stereo or multi-channel to multi-channel, but when downmixing it's advisable to normalise to prevent clipping.

ABR gives you the requested average bitrate. The encoder needs to guess and adjust as the encode progresses. TVBR doesn't require any of that, but you don't know what the bitrate will be. Think of ABR as being VBR with more bitrate constraints. I think for a specific bitrate ABR is generally better than CBR (unless it's a very high CBR) and TVBR should theoretically be betterer.

I don't get the concept of surround sound with the sound surrounding you as a constant reminder the picture doesn't. I find it distracting. Give me stereo any day.

I just finished writing a post on AAC encoding at VideoHelp. You might find some of the info useful. The main reason I switched from Nero to Apple/QAAC is the (fairly) new "no delay" option.
I don't re-encode AC3 myself as I use q.50 (Nero) which doesn't reduce the bitrate enough to make it worthwhile as a rule (unless you downmix) but DTS to AAC saves me around 1GB per movie on average, so I convert DTS. I've not experimenting with lower quality settings but it wouldn't surprise me if they sounded fine. Foobar2000's stereo bitrate estimation is similar to manolito's experience. It says around 86kbps for Q0.30 and for 96kbps it says Q0.34. I'd assume 96kbps should sound reasonable but I'd probably stick to a quality that gives you around 128kbps for stereo and foobar2000 says for Nero that's roughly Q0.40. For AAC, around 128kbps is heading into "transparent" territory, apparently. That's why all the listening tests are done at lower bitrates. I recall reading a thread at HydrogenAudio a while back where a couple of people were debating what bitrates are "transparent". I'm pretty sure the poster who was advocating around 196kbps returned to say he listened again and decided he really couldn't tell the difference between 196kbps and 128kbps.

Oh.... and all AAC encoders encode at around the same speed for quality based encoding except FhGAAC. It's fast. Up to twice the speed depending on the audio.

Last edited by hello_hello; 22nd April 2015 at 18:10. Reason: spelling
hello_hello is offline   Reply With Quote
Old 21st April 2015, 21:10   #12  |  Link
Rumbah
Registered User
 
Join Date: Mar 2003
Posts: 481
Well, in the latest listening test Apple AAC was sounding good with cvbr set to 96kbit/s ( http://listening-test.coresv.net/results.htm ). And that's for stereo audio listened with headphones.

With speakers or 5.1 sound I cannot hear a difference so I use qaac with tvbr set to 45. That's the rough equivalent to 96kbit/s.

And I use tvbr as movie sound tracks often have moments of silence or low volume sounds so you can save some bits this way. But you'll have to test it for yourself, I guess.
Rumbah is offline   Reply With Quote
Old 22nd April 2015, 01:21   #13  |  Link
kuchikirukia
Registered User
 
Join Date: Oct 2014
Posts: 478
I don't really see a reason to skimp to the point that AAC is going to have some noticeable quality loss. If it was a 500kbps video I could see sweating the difference between 128 and 96k, but at 2000kbps it's a 1.5% difference in filesize (3% 6ch) to give it 33% more audio bitrate.
I'd QAAC tvbr 63, which should put you between 120 and 140k.

I've heard Opus ear-bleedingly artifact at 128k stereo (Miku's voice may be heavenly, but a heavily synthesized Vocaloid live in concert is a sound that God never intended to exist), so I'm hesitant to recommend anything below that bitrate without knowing that the source doesn't have much but dialogue and pleb-tier music.

Last edited by kuchikirukia; 22nd April 2015 at 01:23.
kuchikirukia is offline   Reply With Quote
Old 22nd April 2015, 01:36   #14  |  Link
Motenai Yoda
Registered User
 
Motenai Yoda's Avatar
 
Join Date: Jan 2010
Posts: 709
You can use a custom ffmpeg/avconv build with fdkaac to convert in aac vbr~4
__________________
powered by Google Translator
Motenai Yoda is offline   Reply With Quote
Old 22nd April 2015, 12:45   #15  |  Link
kypec
User of free A/V tools
 
kypec's Avatar
 
Join Date: Jul 2006
Location: SK
Posts: 826
Quote:
Originally Posted by Loomes View Post
Why do you choose abr and not tvbr, whats the difference? As I understand, --tvbr 82 would bring same results, no?
I want to have predictable size, especially when encoding entire TV show season for instance. Audio quality on my equipment (standard TV set built-in speakers) is sufficient for me at these AAC bitrates.
Quote:
Originally Posted by Loomes View Post
Is the option -normalize for adjusting the volume? If yes, any normalization I know costs quality. Is that not right?
Normalized volume doesn't hurt overall quality in my opinion. On the other hand, it helps me and my family members to avoid unnecessary adjustments of the sound volume after we switch from one movie to another, to sitcom episode or to kids' cartoon throughout the day.
Quote:
Originally Posted by Loomes View Post
What settings do you use for AC3 640kbps, TrueHD, DTS and DTS-HD?
- As I am planning to get a 5.1 system in near future I would not get down to 2.0. Would you recommend other settings for AC3 384kbps 5.1 -> AAC 5.1?
For 5.1 audio I use 320kbps vbr AAC. I don't have 5.1 sound system (yet) but I doubt that I would notice any quality loss with my ears. I care more for visual quality than for audio in my BD & DVD rips. Reducing DTS-HD MA to multichannel AAC can save few gigabytes on every movie for me while not hearing any audible degradation on my current (stereo only) speakers.
kypec is offline   Reply With Quote
Old 22nd April 2015, 19:43   #16  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,922
One more thought......

Quote:
Originally Posted by Loomes View Post
I did some experiments with NeroAACEnc by doing "eac3to.exe mytrack.ac3 mytrack.m4a -quality=0.5 -2pass" meaning that the (already lossy) AC3 is deflated to WAV first, then compressed to M4A.
How does 2 pass mode make sense for VBR encoding and is it actually possible? I assume so, given you seem to have it working, but I can't coax foobar2000 into combining 2 pass and VBR yet, although it'll happily use ABR encoding with 2 pass. Maybe I'm missing something. I wanted to see if 2 pass VBR produced a different bitrate to single pass VBR.

Normally when you specify a 2 pass encode and a bitrate you're effectively specifying a VBR encode but also the number of bits to use in total. The encoder runs the first pass to work out how to distribute the bits and the second pass encodes to output the requested average bitrate. VBR just encodes without the same bitrate limitation so I'm not sure what the point of 2 passes would be. Anyone know? Does it improve the audio quality?

Last edited by hello_hello; 22nd April 2015 at 19:45.
hello_hello is offline   Reply With Quote
Old 22nd April 2015, 19:49   #17  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,922
Quote:
Originally Posted by kypec View Post
I want to have predictable size, especially when encoding entire TV show season for instance. Audio quality on my equipment (standard TV set built-in speakers) is sufficient for me at these AAC bitrates.
I'd do it the other way around but I guess it depends on your workflow.
If the audio bitrate deviates too much from what's required for acceptable quality (ie lower bitrate) you might start to hear it, so if the audio bitrate has to be higher on occasion, but you lowered the video bitrate by a similar amount to compensate, I'd imagine it wouldn't be noticeable unless you're using an awfully low video bitrate to begin with (the audio/video bitrate adjustment wouldn't need to be more than 50kbps).

Rather than being wasteful by always using a higher average audio bitrate, even better would be to use a VBR quality setting you find transparent. That'd probably be more work unless you use an encoder GUI capable of encoding the audio first and then calculating the video bitrate to output the requested file size, but most of them do, don't they?
hello_hello is offline   Reply With Quote
Old 22nd April 2015, 20:28   #18  |  Link
Loomes
Registered User
 
Join Date: Nov 2003
Location: Germany, Berlin
Posts: 48
Meanwhile I did some hearing tests and would use --tvbr 63 with qaac when the source is lossless Stereo. I cant hear any difference when encoding with higher quality than 63. I tested some Stereo Audio CD Rips.

Still, the question remains what quality setting in qaac makes sense when coming from lossy AC3 384kpbs 5.1. As I understand so far, you have 5 full channels and 1 channel at 1/3 the bit rate of the full channels. That would mean for 384kbps 5.1 there are 5 channels /w 72 kbps and 1 channel with 24 kbps. Is that correct? If so, how does it relate to the choosen quality setting in qaac? --tvbr 63 means about 128 kbps. Does it mean 128 are devided by 5.1 channels, meaning 5x 24kbps and 1x 8kbps? Well, I just did a test with an AC3 384kpbs 5.1 (135 MB) and

eac3to.exe my.ac3 my.wav -normalize
qaac64 my.wav --ignorelength --no-optimize --no-delay --tvbr 63 --quality 2

which resulted in a M4A 5.1 (100 MB) for which MediaInfo claims to find an overall bitrate of 296 kbps. Makes me wonder, I'm still trying to get the big picture here.
Loomes is offline   Reply With Quote
Old 22nd April 2015, 20:48   #19  |  Link
filler56789
SuperVirus
 
filler56789's Avatar
 
Join Date: Jun 2012
Location: Antarctic Japan
Posts: 1,397
Quote:
Originally Posted by Loomes View Post
Still, the question remains what quality setting in qaac makes sense when coming from lossy AC3 384kbps 5.1. As I understand so far, you have 5 full channels and 1 channel at 1/3 the bit rate of the full channels. That would mean for 384kbps 5.1 there are 5 channels /w 72 kbps and 1 channel with 24 kbps. Is that correct?
5.1 AC3 at 384kbps is "low-quality" IMHO, so (in theory at least) you could choose a qaac TVBR level even lower than 63

But no, that's not correct. The ".1 channel" is supposed to contain only very-low frequencies, which makes it require a VERY-LOW bitrate for itself in a lossy compression scheme.
filler56789 is offline   Reply With Quote
Old 22nd April 2015, 21:39   #20  |  Link
detmek
Registered User
 
Join Date: Aug 2009
Posts: 463
Encoding low quality audio with, again, low quality settings will result in even worse audio. Source bitrate has nothing to do with output bitrate. If you encode 32kbs mp3 with 320kbs aac you will preserve that very bad quality. If you encode 32kbs mp3 with 32kbs aac you will make audio with even worse quality.

Encoding 384kbs 5.1 AC3 does not make much sence if you want to keep 5.1 sound, even if you use AAC encoder al even AAC encoder needs over 256kbs to preserve transparency. With 640kbs 5.1 AC3 you could save some space by re-encoding into AAC with 256-320kbs.
detmek is offline   Reply With Quote
Reply

Tags
aac, ac3, neroaacenc, qaac

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:06.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.