5.1 Surround Sound Branch

Archive of historical development discussions
Discussions / Development has moved to GitHub
Forum rules
*******************************
Please be aware we are now using GitHub for issue tracking and feature requests.
- This section of the forum is now closed to new topics.

*******************************
Post Reply
dynaflash
Veteran User
Posts: 3820
Joined: Thu Nov 02, 2006 8:19 pm

5.1 Surround Sound Branch

Post by dynaflash » Mon Feb 12, 2007 4:23 pm

Just a quick fyi,
maurj is working on his 5.1 surround sound in this svn branch:
svn://multics.dynalias.com/HandBrake/branches/0.8.0_beta2_5.1/
Which is off of our 0.8.0_beta2 branch rev 307.

maurj
Regular User
Posts: 148
Joined: Thu Jan 11, 2007 5:31 pm

Post by maurj » Mon Feb 12, 2007 11:53 pm

Preliminary version just checked back in. Adds a new command line option to MediaForkCLI to preserve 5.1 audio as a 6-channel AAC when using FAAC to encode the audio. The option is "-6" or "--surround". See what you think!

jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Post by jbrjake » Tue Feb 13, 2007 12:37 am

Nice, maurj...you took care of another ticket (mono AAC) at the same time.

Beautiful first check-in. Very clear, good comments...

maurj
Regular User
Posts: 148
Joined: Thu Jan 11, 2007 5:31 pm

How the new 5.1 audio code works

Post by maurj » Tue Feb 13, 2007 2:53 pm

Thanks!

I've just checked in some amendments to the 5.1 code:

Minor amendments to 5.1 audio support:

* ensuring that non-AAC audio formats always use a stereo mix (rather than mono)
* ensuring that Dolby Surround (Pro Logic) source is passed through as Dolby Surround (Pro Logic), and not mixed down to Stereo
* storing the ac3 flags with the job for later reference

Note: this is still using the settings for the last selected soundtrack for *all* soundtracks. This needs improving, as they may not be of the same format!

Tested with mono, stereo, pro logic and 5.1 AC3 sources, to all output audio formats, with success all round :)

maurj
Regular User
Posts: 148
Joined: Thu Jan 11, 2007 5:31 pm

How the new 5.1 audio code works

Post by maurj » Tue Feb 13, 2007 2:53 pm

When AC-3 is selected as the audio output format:

All source AC-3 tracks are passed through in their original format. Dolby Digital 5.1 tracks and Dolby Surround (Pro Logic) 2.0 tracks should be automatically detected by most decoders.


When AAC is selected as the audio output format:

For 5.1 source tracks:

With the -6 option enabled, 5.1 audio is extracted to a 6-channel AAC track based on standard QuickTime channel mapping. This contains 6 separate audio channels in the following order:

1: Center
2: Left
3: Right
4: Left Surround
5: Right Surround
6: LFE (Low Frequency Effects)

Note that QuickTime 7.1.3 and earlier has a bug in the mp4 importer which only affects Intel processors. If you try and open an mp4 with a more-than-stereo AAC soundtrack in QuickTime Player 7.1.3 on an Intel Mac, the QuickTime Player will crash. To work around this, set QuickTime Player to open using Rosetta.

Without the -6 option enabled, 5.1 audio is downmixed to Dolby Surround (Pro Logic) as a 4.0 mix, matrix-encoded into a 2-channel stereo AAC track. You might need to manually set your audio decoder device to "Dolby Pro Logic" in order for it to correctly decode the 4.0 Dolby Surround mix from the stereo AAC track.

For 2.0 source tracks:

2.0 Dolby Surround (Pro Logic) audio is converted to a 2.0 Dolby Surround (Pro Logic) stereo AAC. You might need to manually set your encoder to "Dolby Pro Logic" in order for it to correctly decode the 4.0 Dolby Surround mix from the stereo AAC track.

2.0 stereo is preserved as a 2.0 stereo AAC track.

For 1.0 source tracks:

1.0 mono is encoded as a mono AAC track. Most decoders will upmix this across a stereo speaker setup.


When MP3 or Vorbis Audio is selected as the audio output format:

For 5.1 source tracks:

5.1 audio is downmixed to Dolby Surround (Pro Logic) as a 4.0 mix, matrix-encoded into a 2-channel stereo track. You might need to manually set your audio decoder device to "Dolby Pro Logic" in order for it to correctly decode the 4.0 Dolby Surround mix from the stereo track.

For 2.0 source tracks:

2.0 Dolby Surround (Pro Logic) audio is converted to a 2.0 Dolby Surround (Pro Logic) stereo MP3 or Vorbis Audio track. You might need to manually set your audio decoder device to "Dolby Pro Logic" in order for it to correctly decode the 4.0 Dolby Surround mix from the stereo track.

2.0 stereo is preserved as a 2.0 stereo MP3 or Vorbis Audio track.

For 1.0 source tracks:

1.0 mono is mixed up to a stereo MP3 or Vorbis Audio track.

wififun
Posts: 2
Joined: Sun Feb 25, 2007 9:55 am

Post by wififun » Sun Feb 25, 2007 10:06 am

I grabbed the SVN branch from this afternoon (2/24) and built it with no problem. I did a few encodes with 5.1 AAC and have a bit of feedback. First, iTunes will accept the .m4v or the .mov ran through MP4toMOV. However, in both cases you can not apply cover art to the video. For a non 5.1 video with the same settings just with stereo AAC works without a hitch, and you can set cover art on a M4V or MOV.

Here are my settings:
x264 (h.264 iPod)
2-pass
640x368
Avg. Bitrate 1450
44.1 @ 160 kbps
One with Extract 5.1, and one without.

iTunes accepts either 5.1 or not, in m4v or mov.
iTunes will not allow cover art assignment to either wrapper with the 5.1. However, the .m4v version iTunes lets you apply the cover art, but will not save the change. With the mov wrapper, it just won't let you do it.

So far looking good though, and I have tested the files with both PPC and Intel and have not seen the QT bug with the 5.1 m4v files. They worked fine on my MacBook Pro. Now 5.1 pass through over the Toslink though, but that was expected. I only bring this up since someone had mentioned that they did get it to work. However I suspect the surround sound receiver was in a simulated mode, or an all channel mode.

leon
Posts: 15
Joined: Fri Feb 16, 2007 6:58 pm

Post by leon » Thu Mar 01, 2007 3:28 am

Any work being done for converting DTS encodings to AAC 5.1?
Didn't see it in any of your use-cases, above, yet.

Elsewhere someone asked where DTS is seen that AC3 is not also present.
I just found a prime example:
http://www.amazon.com/This-Binary-Unive ... F8&s=music

This DTS surround on this is awesome! But no reason the tracks couldn't be AAC 5.1 encoded, instead...so I can retire the DVD.

Incidentally, go buy the CD/DVD physically -- this is one example where iTunes has less bang for buck... But now I'm off topic. <smile>

whimpers
Posts: 79
Joined: Mon Feb 19, 2007 1:03 pm

Post by whimpers » Thu Mar 01, 2007 9:08 am

You can convert DTS to AAC 5.1 with VLC's export wizard (using mpeg4 audio as a format), if that's of any help to the developers.

webjedi
Posts: 8
Joined: Mon Mar 05, 2007 4:08 am

current branch broken build

Post by webjedi » Tue Mar 06, 2007 5:25 am

Devs,

three directories for the Mac OS X build are horked in the source, "slightly" repairable by creating softlinks in the contrib directory and removing the "rm -r" from the contrib Jamfile

libdvdread
xvidcore
mpeg2dec

since the tar files extract with the version number, the build gets, at best, confused...

just an FYI to those with commit access to the svn tree.

mdawg4624
Posts: 2
Joined: Wed Mar 28, 2007 5:36 pm

Progress

Post by mdawg4624 » Wed Mar 28, 2007 5:38 pm

Hi all, I'm new to these boards, but am very interested in what your doing. I'm no dev, but am very interested in the progress that you have been making so far. I was just curious, how long do you think it will be before you add this feature (ac-3 -> aac 5.1 conversion) to the media fork app (or the beta)?

hawkman
Veteran User
Posts: 609
Joined: Sat Feb 17, 2007 9:46 pm

Re: Progress

Post by hawkman » Wed Mar 28, 2007 10:10 pm

mdawg4624 wrote:Hi all, I'm new to these boards, but am very interested in what your doing. I'm no dev, but am very interested in the progress that you have been making so far. I was just curious, how long do you think it will be before you add this feature (ac-3 -> aac 5.1 conversion) to the media fork app (or the beta)?
Well, it works in svn, so I assume it'll be in the next release.

mdawg4624
Posts: 2
Joined: Wed Mar 28, 2007 5:36 pm

sweeeeeeeet

Post by mdawg4624 » Thu Mar 29, 2007 2:27 pm

that is music to my ears! then i guess i'll be visiting my local apple store for a shiny new apple tv the day the next beta is released. Thanks again so much, you guys do an awesome job!!

cvk_b
Veteran User
Posts: 527
Joined: Sun Mar 18, 2007 2:11 am

Re: How the new 5.1 audio code works

Post by cvk_b » Tue Apr 17, 2007 11:06 am

maurj wrote: Dolby Surround (Pro Logic) source is passed through as Dolby Surround (Pro Logic), and not mixed down to Stereo
This is good too know, but unclear in documentation & GUI. It is probably just a superficial GUI change but people might be worried to select "stereo" when they know they have a ProLogic Lt/Rt 2-channel source.

Just trying to be helpful with the documentation.

c

golias
Regular User
Posts: 105
Joined: Wed Jan 03, 2007 7:29 pm

Post by golias » Thu Apr 26, 2007 12:16 pm

whimpers wrote:You can convert DTS to AAC 5.1 with VLC's export wizard (using mpeg4 audio as a format), if that's of any help to the developers.
If VLC can do it, there must be an open-source tool floating around out there which they used to build that feature. Maybe we should be talking to those guys and/or checking out their code to see what libraries were used to make this happen.

I have a total of 22 DVDs in my library which I would *love* to rip to h.264, but lack of DTS input support in HB is the one thing stopping me.

Even if converting wasn't an option, I would be okay with plain old DTS pass-through... but the option of AAC 5.1 would be even better!

maurj
Regular User
Posts: 148
Joined: Thu Jan 11, 2007 5:31 pm

Post by maurj » Fri Apr 27, 2007 8:15 am

Golias,

Don't your DTS DVDs have an equivalent AC3 track too? I wouldn't have thought you'd see much improvement by using a DTS source over AC3...

- maurj.

golias
Regular User
Posts: 105
Joined: Wed Jan 03, 2007 7:29 pm

Post by golias » Fri Apr 27, 2007 11:06 am

maurj wrote:Golias,

Don't your DTS DVDs have an equivalent AC3 track too? I wouldn't have thought you'd see much improvement by using a DTS source over AC3...

- maurj.
No. The ones I'm talking about are either DTS-only, or a choice between 5.1 DTS and stereo AC3.

For example, in the case of Samurai Champloo (the hit anime series from the creators of Cowboy Bebop and the anime section of Kill Bill), the English track is in 5.1 Dolby or stereo, but the Japanese track (which is the only way I can stand to watch it) is exclusively on DTS.

maurj
Regular User
Posts: 148
Joined: Thu Jan 11, 2007 5:31 pm

Post by maurj » Fri Apr 27, 2007 11:13 am

Fair enough. It should be possible to add DTS decoding support to HandBrake - there is an open-source library out there:

http://www.videolan.org/developers/libdca.html

By their own admission it's in its early days, but libdca is what VLC uses. Since libdca is based on a52dec, which HandBrake already uses, it should be possible to integrate reasonably easily. It would probably be necessary to patch our DPLII downmixing into libdca in the same way that we did for a52dec.

Note that libdts doesn't handle anything higher than a 5.1 DTS source at present, so 7.1 sources wouldn't be extractable.

- maurj.

golias
Regular User
Posts: 105
Joined: Wed Jan 03, 2007 7:29 pm

Post by golias » Fri Apr 27, 2007 11:28 am

maurj wrote:Fair enough. It should be possible to add DTS decoding support to HandBrake - there is an open-source library out there:

http://www.videolan.org/developers/libdca.html

By their own admission it's in its early days, but libdca is what VLC uses. Since libdca is based on a52dec, which HandBrake already uses, it should be possible to integrate reasonably easily. It would probably be necessary to patch our DPLII downmixing into libdca in the same way that we did for a52dec.

Note that libdts doesn't handle anything higher than a 5.1 DTS source at present, so 7.1 sources wouldn't be extractable.

- maurj.
Holy crap. If you can pull that off, that would make me so amazingly happy! Numfar, do the dance of joy!!!

Image

nightstrm
Veteran User
Posts: 1887
Joined: Fri Mar 23, 2007 5:43 am

Post by nightstrm » Fri Apr 27, 2007 12:54 pm

I tend to agree unless we are talking about a full-bitrate DTS soundtrack. Unfortunately, those were rather rare on DVDs, and the noticeable differences in many DTS soundtracks over their DD equivalent were due to different mixes being performed.

That said, some DTS-only discs do not have a DD5.1 soundtrack; they only put a DD2.0 one on to comply with the guideline that every DVD is able to be played through any receiver/TV.

jxlh999
Posts: 3
Joined: Fri Feb 01, 2008 7:25 am

Re: 5.1 Surround Sound Branch

Post by jxlh999 » Fri Feb 01, 2008 7:31 am

Thank you in advance

1charmedlife
Posts: 1
Joined: Sat Mar 08, 2008 6:31 pm

Re: 5.1 Surround Sound Branch

Post by 1charmedlife » Sat Mar 08, 2008 6:37 pm

Just a note on DTS vs. AC3 encoding on NTSC DVD's - DTS in most cases will have better sound reproduction (on the DVD) due to simple sampling rate differences.

In the DVD spec and in most encoding, AC3 is encoded at minimum bit rate of 448kb/s (though some releases drop this down to 384 for stereo tracks, 448 is the minimum in the spec for 5.1). DTS, if included is encoded at a minimum bitrate of 1024kb/s. That make a pretty big difference on the disc.

In theaters, I prefer the Dolby Digital track to the DTS track (DTS always seemed a bit overbright for my tastes, in the screening rooms) but on DVD's the DTS track is almost always far better.

(I used to work in post-production at New Line where I A-B'd a lot of tracks in screening rooms over and over again, and later for Universal's Home Video division where I worked in DVD production:)

jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Re: 5.1 Surround Sound Branch

Post by jbrjake » Sat Mar 08, 2008 8:50 pm

1charmedlife wrote:DTS, if included is encoded at a minimum bitrate of 1024kb/s.
If that's true, how do I have so many DVDs with a 768kb/s DTS track?

dynaflash
Veteran User
Posts: 3820
Joined: Thu Nov 02, 2006 8:19 pm

Re: 5.1 Surround Sound Branch

Post by dynaflash » Sat Mar 08, 2008 9:02 pm

jbrjake wrote:
1charmedlife wrote:DTS, if included is encoded at a minimum bitrate of 1024kb/s.
If that's true, how do I have so many DVDs with a 768kb/s DTS track?
Myself as well. Maurj indicated the same.

Post Reply