Apple TV and 5.1 support - some definitive answers

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.
Locked
maurj
Regular User
Posts: 148
Joined: Thu Jan 11, 2007 5:31 pm

Post by maurj »

Hi numbers987654321,

TBH, I'd initially considered adding this for a future version, but the filesize (1gb for audio?!), due to the lack of an open-source Apple Lossless implementation, makes it a fairly low priority. Of course, this being open-source, you could always have a go at coding it yourself!

- maurj.

numbers987654321
Posts: 18
Joined: Sat Apr 14, 2007 5:34 am

Assuming I can get BeSweet up on OS X

Post by numbers987654321 »

If I can get a BeSweet module compiled and working on OS X, then maybe there could be a solution. Also, can Handbrake call Quicktime plugings? Can you have it pass something to the Apple Lossless plugin, or do you try to not do that type of thing? Might be a cool option to do dd-wav audio.

deckeda
Regular User
Posts: 138
Joined: Thu Feb 22, 2007 8:38 am

Re: So... Do you think this may make a future verson of HB?

Post by deckeda »

numbers987654321 wrote: ... or if the hope is that Apple will somehow enable the AAC 5.1 to transcode on-the-fly to DD or DTS. ...
I hope not. Or rather, I'd never want that. You'd be starting with lossy then converting to another lossy then converting back to another lossy stream. Just Say No™.

My own wet dream goes something like this: the unmodified AC-3 or DTS wedged into the .mp4 or .m4v container, doesn't interfere with metadata, playable with help from an enhanced Perian and a miracle from Cupertino.

ragboy
Regular User
Posts: 82
Joined: Mon Apr 09, 2007 4:03 pm

Post by ragboy »

maurj wrote:TBH, I'd initially considered adding this for a future version, but the filesize (1gb for audio?!), due to the lack of an open-source Apple Lossless implementation, makes it a fairly low priority. Of course, this being open-source, you could always have a go at coding it yourself!

- maurj.
Well, I have been ripping a bunch of movies with HB, and adding ddwav for audio for ATV, and there are a few things I have learned.

1. There are many ac3 to dd-wav apps out there, like besweet, and headAC3he. The great thing about the latter, is that it does the conversion without transcoding, so its a lossless conversion. However, I have found at least ATV, or maybe its a limitation of DD-WAV, that DD-WAV only likes ac3 files mastered at 44.1 khz. If you use headAC3ch, since most or all of dvd ac3 streams are 48khz, head incorectly sets at 44.1 on output, and it plays slow, and you can't fix by adjusting headers. So the only way to get a valid DD-WAV file, is to use besweet, which transcodes and outputs a DD-WAV with 44.1khz.
2. Uncompressed DD-WAVs are unrecognized in ATV. So far, I have only seen them work with apple lossless.
3. The problem of audio sync comes in. I get around it, by using another pc program DGMPGDec. So what I do, is I use an app on the PC, called dvddecrypter to make a full disc video folder of the DVD on my server. I then start ripping with handbrake on this. I have always done this, because many newer dvds, handbrake can't handle, but dvddecrypter, gets em all. While handbrake is ripping, I do a quick open and save project in DGMPGDec, which saves the AC3 streams with a filename, that tells you the audio sync offset, like -177ms, or 0ms or whatever. I stop the process right away, I just want this setting. On my mac I use mplayer to dump ac3 file of the movie. Then I have to make a dd-wav on pc using besweet, and besweet has a field to enter delay value. This outputs a dd-wav, that will sync perfectly. I have tried on about 7 movies, all with diff values, and it works. Of course, I have to take the dd-wav and export from QTPRO as apple lossless. What a PITA, huh? But when you hear the full DD sound, you can't go back to DPLII, or stereo.

So to get this done in handbrake, either ffmpeg will have to output dd-wav, or besweet becomes crossplatform. And ffmpeg doesn't encode apple lossless, so don't know about that either.

I have no idea what the solution is, I love how simple HB made this for me in the past, but I hope apple comes out with some DD-Live solution from AAC 5.1.

We will see.

realityking
Veteran User
Posts: 680
Joined: Tue Apr 24, 2007 12:36 pm

Post by realityking »

I haven't read the whole theard but I'm wondering if anybody tried to output a six channel aac track over HDMI to receiver that supports 5.1 PCM input. In theory would that be easiest way to output six discrete channel with AppleTV - I'm wondering if they used it.

numbers987654321
Posts: 18
Joined: Sat Apr 14, 2007 5:34 am

ac3enc

Post by numbers987654321 »

maurj-

I'm going to give it a shot and see what I come up with. Are there any issues in using pieces of ffmpeg within Handbrake?

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

Post by maurj »

numbers987654321,

None at all - in fact, we use bits of ffmpeg already :)

Good luck!

- maurj

Anamonde
Regular User
Posts: 71
Joined: Fri Mar 16, 2007 11:11 pm

Post by Anamonde »

numbers987654321,

if you do get that working, im sure a lot of us would love to have that version... I know I would!

Thanks,
Ana

Anamonde
Regular User
Posts: 71
Joined: Fri Mar 16, 2007 11:11 pm

Post by Anamonde »

Maybe this would be useful... someone ask him for his code.

http://craz.net/programs/itunes/alac.html

aswick
Posts: 1
Joined: Wed May 02, 2007 4:40 pm

AC3 using multiple tools

Post by aswick »

Process steps using HandBrake, mplayer, BeSweet, and Quicktime Pro (along with another sample AC3):

http://www.garcias.com/TheGarcias/Dad%2 ... 6FE4E.html

loyalty_anchored
Bright Spark User
Posts: 183
Joined: Wed Mar 14, 2007 1:49 pm

Re: AC3 using multiple tools

Post by loyalty_anchored »

aswick wrote:Process steps using HandBrake, mplayer, BeSweet, and Quicktime Pro (along with another sample AC3):

http://www.garcias.com/TheGarcias/Dad%2 ... 6FE4E.html
honestly you guys, why make the encode process such a pain? why not just hack the ATV to passthrough AC3?

mine works and i did not have to open the ATV, and i can use the original AC3 stream from my original DVD.

i dont understand why some are pursuing this, i believe it is easier to hack the atv to do passthrough then to encode 100+ movies with this process...

dont get me wrong, its cool that you guys have another solution, but i dont think processing and reprocessing the audio over and over is the right solution.

gbooker
Posts: 43
Joined: Sat Apr 07, 2007 8:38 pm

Post by gbooker »

Since I played with passthrough, let me explain exactly how it works. There are two different ways that audio is passed over the optical link. The first is raw PCM (wav format) and the second is encoded audio (AC3 or DTS). In addition, the optical link supports a variety of data rates, which correspond to sample rates (ex, 32 KHz, 44.1Khz, 48KHz, etc) Encoded audio is passed in the following manner:
  • The optical link is set at same samplerate as the decompressed encoded audio
  • The audio frame is packaged in a way such that the data is presented in the correct order on the optical link (this means that little endian machines *cough* intel *cough* have to reverse the order of all pairs of bytes, so that when the hardware reverses it again, it will be in the correct order).
  • The audio frame is preceded by a specific header which the audio decoder can identify and thus know that the data is encoded audio instead of PCM
  • The rest of the duration of the audio frame is ignored and the next frame starts exactly where the previous frame's decompressed size would end
So, what does this mean? If you want passthrough, you have to either create PCM audio in the format I described above, or have something else convert it on the fly (like the next version of a52codec does). That is what these tools are doing for you.

In addition, the sample rates must match. So, if you want to rip 48KHz audio (which means most DVDs), good luck. The ATV's default output is 44.1KHz, which means you are screwed unless you change it. It then means that you cannot play 44.1KHz AC3 files without changing it back. I have asked the author of ATVFiles to implement this piece and it is coming in version 0.3.

ejbeckner
Posts: 2
Joined: Fri May 04, 2007 6:10 am

Re: AC3 using multiple tools

Post by ejbeckner »

aswick wrote:Process steps using HandBrake, mplayer, BeSweet, and Quicktime Pro (along with another sample AC3):

http://www.garcias.com/TheGarcias/Dad%2 ... 6FE4E.html

http://www.megaupload.com/?d=7V2UYBR1

THX 5.1 demo works great, on Apple Tv. Audio passes through and i get the blue light on my receiver that it is 5.1 audio.

!!Now some one needs to automate this process!!

ragboy
Regular User
Posts: 82
Joined: Mon Apr 09, 2007 4:03 pm

Re: AC3 using multiple tools

Post by ragboy »

loyalty_anchored wrote: honestly you guys, why make the encode process such a pain? why not just hack the ATV to passthrough AC3?

mine works and i did not have to open the ATV, and i can use the original AC3 stream from my original DVD.

i dont understand why some are pursuing this, i believe it is easier to hack the atv to do passthrough then to encode 100+ movies with this process...

dont get me wrong, its cool that you guys have another solution, but i dont think processing and reprocessing the audio over and over is the right solution.
For me, and the garcias.com page is mine, I think the best solution is going to be one without altering the ATV. It is a pain to do at the moment, but the reason I posted the steps, is to prove this is a viable method, and hopefully others can help automating this into a simple step, like HB does with DPLII. AVI is a ancient technology, and even though you can hack the ATV to play them with ATVFiles, its not the direction I personally want to go, but just my opinion. And as gbooker mentioned, almost all dvds are mastered at 48khz, and so the solution I posted on my site gets around that, providing the best working solution. I have ripped many movies, and works very well.

loyalty_anchored
Bright Spark User
Posts: 183
Joined: Wed Mar 14, 2007 1:49 pm

Re: AC3 using multiple tools

Post by loyalty_anchored »

ragboy wrote:AVI is a ancient technology, and even though you can hack the ATV to play them with ATVFiles, its not the direction I personally want to go, but just my opinion. And as gbooker mentioned, almost all dvds are mastered at 48khz, and so the solution I posted on my site gets around that, providing the best working solution. I have ripped many movies, and works very well.
how about MKV? the support is semi-there already, and they are working to improve it. i have no plans on using AVI in any way, shape or form.

i guess i have to agree though, it is nice for some to have a solution that works with stock ATV. i would never butcher my audio stream that way! i would rather sell my ATV and just build a small media center PC of some sort. but that is just personal.

so all in all, i suppose the more options, the better in this case.

EDIT:

i was thinking about this further, how large do you find the DDWAV file to be for a normal DVD movie ? i have a feeling the space requirements to rip a movie with this method may be a pretty heavy limitation.

ragboy
Regular User
Posts: 82
Joined: Mon Apr 09, 2007 4:03 pm

Re: AC3 using multiple tools

Post by ragboy »

loyalty_anchored wrote: how about MKV? the support is semi-there already, and they are working to improve it. i have no plans on using AVI in any way, shape or form.

i guess i have to agree though, it is nice for some to have a solution that works with stock ATV. i would never butcher my audio stream that way! i would rather sell my ATV and just build a small media center PC of some sort. but that is just personal.

so all in all, i suppose the more options, the better in this case.

EDIT:

i was thinking about this further, how large do you find the DDWAV file to be for a normal DVD movie ? i have a feeling the space requirements to rip a movie with this method may be a pretty heavy limitation.
My goal is to only use the MP4 container, and since I don't think it will ever be possible to put a raw ac3 stream in an mp4 container like you do in AVI, the only other solutions are AAC, or ALAC.

For the record, I am a developer, and a MS partner, so have all MS operating systems laying around. And previous to my apple tv, I had a Media Center 2005, hacked to play dts and ac3 passthrough from AVIs. I have a 1.2 Terrabyte server in my basement, and ripped with HB to my library. But I hated the MS interface, and at the end of the day, its still just a computer, and the way I had it setup is just a hackers delight, and would never go mainstream.

I love the apple TV. I luv the interface, the streaming right from my itunes, plays my thousands of protected files, without me having to break drm.

On MS, you cannot scan through an AVI very well while watching, but on my ATV, I can scan one of my MP4/DD-Wav files with no problem. And if someone can get the DD issue solved, either automating my solution, or another, I think it could easily become something anyone can do.

As far as size, I just ripped a movie, man of the year, about 1:54 hours. I ripped using 2pass 1600kbps DPLII, and the resulting file is 1.39 Gigs. If I pull the vid, just the vid is 1.29Gigs. The raw AC3 file is almost 400 megs. So this would have made a AVI of about 1.7 Gigs. When I use besweet to make the dd-wav file, it ends up about 1.2 gigs. Then I use ALAC, and it comes down to 850 megs. Resulting mp4 just over 2 gigs. So it is bigger, but only about ~400 megs.

Anamonde
Regular User
Posts: 71
Joined: Fri Mar 16, 2007 11:11 pm

Re: AC3 using multiple tools

Post by Anamonde »

loyalty_anchored wrote:mine works and i did not have to open the ATV, and i can use the original AC3 stream from my original DVD.

i dont understand why some are pursuing this, i believe it is easier to hack the atv to do passthrough then to encode 100+ movies with this process...
I have my appletv hacked and ATVFiles up and working, but when i play handbraked AVI h.264 with AC3 passthrough it still downmixes to stereo. How are you getting this to work?

loyalty_anchored
Bright Spark User
Posts: 183
Joined: Wed Mar 14, 2007 1:49 pm

Re: AC3 using multiple tools

Post by loyalty_anchored »

Anamonde wrote:
loyalty_anchored wrote:mine works and i did not have to open the ATV, and i can use the original AC3 stream from my original DVD.

i dont understand why some are pursuing this, i believe it is easier to hack the atv to do passthrough then to encode 100+ movies with this process...
I have my appletv hacked and ATVFiles up and working, but when i play handbraked AVI h.264 with AC3 passthrough it still downmixes to stereo. How are you getting this to work?
i am using the latest ATVfiles test build from a few days ago... not sure when it will officially be available, but it should not be long.

@ragboy:
i am not whilling to give audio 800MB of space, but this is again my own personal preference, i feel it is not acceptable to go UP in size to LOOSE quality... but that is just me and my priorities, i do give you kudos for coming up with the solution you have though ! remember, not everyone has a 1TB+ server in their basement. although it is good for mainstream users since it allows 5.1 without ATVhacks... good stuff though, just not for me, plus isnt HB suppose to be a cross-platform open source project? how will this process be automated on an apple computer?

Anamonde
Regular User
Posts: 71
Joined: Fri Mar 16, 2007 11:11 pm

Post by Anamonde »

Sweetness! *waiting in anticcccccccccc........ipation*

Also, if A52Codec with perian supported FLAC, perhaps that could be a solution for handbrake instead of ALAC + DD-Wav ?


and... I seam to be retarded... ive installed mplayer, but cannot for the life of me figure out how to run it in terminal? Am I missing something?

ragboy
Regular User
Posts: 82
Joined: Mon Apr 09, 2007 4:03 pm

Post by ragboy »

Anamonde wrote:and... I seam to be retarded... ive installed mplayer, but cannot for the life of me figure out how to run it in terminal? Am I missing something?
Mplayer for os x, is a gui, but in the package contents, is a mplayer binary, that can be used in the terminal. But its old. FFMpegX will give you more, like FFMPEG and mplayer, and newer.

For the best results, get the latest SVN source, and compile, but its not for the faint of heart.

ragboy
Regular User
Posts: 82
Joined: Mon Apr 09, 2007 4:03 pm

Re: AC3 using multiple tools

Post by ragboy »

loyalty_anchored wrote:@ragboy:
i am not whilling to give audio 800MB of space, but this is again my own personal preference, i feel it is not acceptable to go UP in size to LOOSE quality... but that is just me and my priorities, i do give you kudos for coming up with the solution you have though ! remember, not everyone has a 1TB+ server in their basement. although it is good for mainstream users since it allows 5.1 without ATVhacks... good stuff though, just not for me, plus isnt HB suppose to be a cross-platform open source project? how will this process be automated on an apple computer?
I hear ya, but its only 400 megs. The AC3 stream, raw from the dvd is 400, so the diff is 400. I gotta think, that apple is working on AAC 5.1 to DD-Live, and a software update is going to activate it. That is what I hope for, more than my, or your solution. ;-)

In order to automate my process, someone would have to add the ability to transcode ac3 to dd-wav, prob in ffmpeg, since besweet code is based on ffmpeg code. And then, prob ffmpeg also, would have to encode apple lossless, since it already decodes, but doesn't encode.

aur0ra
Posts: 17
Joined: Sun Apr 15, 2007 12:53 pm

Re: AC3 using multiple tools

Post by aur0ra »

ejbeckner wrote:
aswick wrote:Process steps using HandBrake, mplayer, BeSweet, and Quicktime Pro (along with another sample AC3):

http://www.garcias.com/TheGarcias/Dad%2 ... 6FE4E.html

http://www.megaupload.com/?d=7V2UYBR1

THX 5.1 demo works great, on Apple Tv. Audio passes through and i get the blue light on my receiver that it is 5.1 audio.

!!Now some one needs to automate this process!!
Ok, so I tired the THX demo and it worked great after I installed the A52codec, Perian, as well as the ssh stuff. But then I added the ATVFiles and now when I play it all I hear is static... I obviously did something wrong but can't seem to backtrack enough to find where it was.

Anyone have any suggestions? Thanks!

aur0ra
Posts: 17
Joined: Sun Apr 15, 2007 12:53 pm

Re: AC3 using multiple tools

Post by aur0ra »

aur0ra wrote: Ok, so I tired the THX demo and it worked great after I installed the A52codec, Perian, as well as the ssh stuff. But then I added the ATVFiles and now when I play it all I hear is static... I obviously did something wrong but can't seem to backtrack enough to find where it was.

Anyone have any suggestions? Thanks!
I ended up doing a factory restore and started over... Thanks anyway...

ragboy
Regular User
Posts: 82
Joined: Mon Apr 09, 2007 4:03 pm

Re: AC3 using multiple tools

Post by ragboy »

aur0ra wrote:
aur0ra wrote: Ok, so I tired the THX demo and it worked great after I installed the A52codec, Perian, as well as the ssh stuff. But then I added the ATVFiles and now when I play it all I hear is static... I obviously did something wrong but can't seem to backtrack enough to find where it was.

Anyone have any suggestions? Thanks!
I ended up doing a factory restore and started over... Thanks anyway...
The THX demo I uploaded works on factory setup of Apple TV, you just need a receiver connected via optical, that will decode dolby digital CDs.

aur0ra
Posts: 17
Joined: Sun Apr 15, 2007 12:53 pm

Re: AC3 using multiple tools

Post by aur0ra »

ragboy wrote: The THX demo I uploaded works on factory setup of Apple TV, you just need a receiver connected via optical, that will decode dolby digital CDs.
Right on. I started experimenting to figure out what caused the problem. Turns out ATVFiles does *something* to hose the DDWAV output. I don't know how or why, but after installing ATVFiles the demo didn't work.

As a side note - I tried your method all night and wasn't able to get a DDWAV file to play. I thought I followed your instructions (again, it was late). Using AC3Machine and BeSweet v1.5b (since v1.4 didn't have the ac3enc.dll) cause the static sound on my computer (which is expected) but no sound at all from the receiver. I made sure to choose AC3-WAV from the options and turned everything else off.

Locked