AC3 Encoder Quality in nightlies

Discuss encoding for devices and presets.
Forum rules
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
Post Reply
JootecFromMars
Posts: 2
Joined: Thu Sep 16, 2010 4:12 pm

AC3 Encoder Quality in nightlies

Post by JootecFromMars »

Unencrypted blu-ray support is awesome and so is the ability to extract the AC3 core from a TrueHD track and to encode an AC3 track from the DTS core of a DTS Master HD track.

This gives those of us ripping our blu-rays a change to our ripping process. Once I've extracted my blu-ray to my HD, I've been using Clown BD (which in turn uses eac3to and libAften), to extract the AC3 core or to re-encode the DTS core to AC3. This leads me to 2 questions:

1. I've noticed that many times when encoding an AC3 track from the DTS core track Clown BD states 'Clipping detected, a 2nd pass will be required'. Does handbrake's AC3 encoder handle this?

2. On a Mac you will get a better sounding stereo track if you use core audio over faac. So, is there any difference in quality between using Clown BD to encode the AC3 track and handbrake doing it?

I've just thought of an off topic question:

3. On some blu-rays, the movie is made up of a number of .m2ts files. Is handbrake able to handle this?

Thanks. And the work you guys do is awesome.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5726
Joined: Sat Feb 09, 2008 7:21 pm

Re: AC3 Encoder Quality in nightlies

Post by JohnAStebbins »

JootecFromMars wrote:Unencrypted blu-ray support is awesome and so is the ability to extract the AC3 core from a TrueHD track and to encode an AC3 track from the DTS core of a DTS Master HD track.

This gives those of us ripping our blu-rays a change to our ripping process. Once I've extracted my blu-ray to my HD, I've been using Clown BD (which in turn uses eac3to and libAften), to extract the AC3 core or to re-encode the DTS core to AC3. This leads me to 2 questions:

1. I've noticed that many times when encoding an AC3 track from the DTS core track Clown BD states 'Clipping detected, a 2nd pass will be required'. Does handbrake's AC3 encoder handle this?
I can only guess what Clown BD is doing here. But my guess would be that it is adjusting (boosting) audio levels as it encodes and during the encoding, it found a section where the boost caused the signal to saturate. So they do a second pass where they readjust the level such that saturation doesn't happen. HandBrake does not adjust audio levels, so clipping will not happen.
2. On a Mac you will get a better sounding stereo track if you use core audio over faac. So, is there any difference in quality between using Clown BD to encode the AC3 track and handbrake doing it?
It appears that Clown BD uses Aften for encoding ac3. Aften is a fork of the ffmpeg ac3 encoder which handbrake uses. And the maintainer seems to occasionally contribute back to ffmpeg. Here is what the author says about it.
Aften is a simple, open-source, A/52 (AC-3) audio encoder.

The name, Aften, is an acronym for:
A / Fifty-Two ENcoder
It is also Danish and Norwegian for 'evening'.

This program started as a simple cutting-out of the AC3 encoder from FFmpeg, but then I reworked the structure of the encoder a bit. Most of the basic code is still the same though. Here are some of the things I've changed so far.

* Implemented my own wav reader and bitwise file writer
* Converted the fixed-point algorithms to floating-point
* Rearranged the methods and structures
* Added stereo rematrixing (mid/side)
* Added short block MDCT and block switching
* Added VBR encoding mode
So from the sound of it, the quality should still be about the same. VBR mode is an enhancement that could be used to give better quality, but handbrake doesn't allow for VBR mode in any audio encoder yet.
I've just thought of an off topic question:

3. On some blu-rays, the movie is made up of a number of .m2ts files. Is handbrake able to handle this?
Yes. HandBrake uses libbluray for BD access http://www.videolan.org/developers/libbluray.html
TedJ
Veteran User
Posts: 5388
Joined: Wed Feb 20, 2008 11:25 pm

Re: AC3 Encoder Quality in nightlies

Post by TedJ »

JohnAStebbins wrote:So from the sound of it, the quality should still be about the same. VBR mode is an enhancement that could be used to give better quality, but handbrake doesn't allow for VBR mode in any audio encoder yet.
There's also the possibility that any device expecting a DVD compliant AC3 stream would choke on a VBR stream, as variable bitrate was never added to the DVD specification. Even now, I have yet to see a commercial DVD audio encoder that uses VBR.

EDIT: Woot! 3000 posts! :D
nightstrm
Veteran User
Posts: 1887
Joined: Fri Mar 23, 2007 5:43 am

Re: AC3 Encoder Quality in nightlies

Post by nightstrm »

One big advantage of eac3to (ClownBD is simply a GUI frontend) is that it can be configured to use the reference Dolby/DTS decoders from vendors like Nero and Sonic. The one thing I haven't been able to completely figure out is why eac3to removes dialog normalization from AC3, E-AC3, DTS and TrueHD tracks by default and how this compares to the new behavior in Handbrake.
BucksSaddler
Novice
Posts: 60
Joined: Thu Jun 28, 2007 7:17 am

Re: AC3 Encoder Quality in nightlies

Post by BucksSaddler »

I've been doing some testing of the DTS -> AC3 conversion between eac3to (via ClownBD) and with my latest nightly build of HandBrake (3602) and the soundtrack provided by eac3to is significantly louder than the conversion done by HandBrake. My test subject is the opening few chapters of T2 (the future war battle), however you can even hear the difference in the opening Carolco signature tune. Everything from dialog to the obvious battle explosions are louder.

I let eac3to create a 640 kbps AC3 track from the DTS core (not using any of the reference decoders), and obviously have the same 640kbps selected when HandBrake is doing the conversion. Now, i'm no expert in this field (to say the least) and whether any of the changes the Aften author highlights could produce this behaviour but to my ears it certainly is louder. The suspicion about it boosting the levels maybe a correct one (hence the clipping message, which I also see) but like i said - i'm no expert. It's also not to say though that is is necessarily correct, and eac3to may be producing a soundtrack to loud - it's just that i've never had anything else to reference it to.

I'm all for simple workflows, and this extra step you guy's have put into HandBrake (along with the reading of unencrypted Blu-Rays) just makes everything a lot easier. Great job.
omni
Posts: 29
Joined: Wed May 21, 2008 12:31 am

Re: AC3 Encoder Quality in nightlies

Post by omni »

couldn't find a better thread so i figured I would ask in here:

Converting True Blood Season 1 on Blu Ray and using a nightly from maybe a week or ago or so? ripped with os x makemkv

For audio i have the DTS track and trying to encode for ATV1 and my options for codec are AC3 and 6-channel discrete. Is this correct? I'm assuming it would not be AC3 pass thru but just want to double check.
TedJ
Veteran User
Posts: 5388
Joined: Wed Feb 20, 2008 11:25 pm

Re: AC3 Encoder Quality in nightlies

Post by TedJ »

Correct.

DTS -> AC3, 6 channel discrete, bitrate 448-640 kbps would be your best option.
omni
Posts: 29
Joined: Wed May 21, 2008 12:31 am

Re: AC3 Encoder Quality in nightlies

Post by omni »

thank you sir!
Post Reply