PDA

View Full Version : Current state of ac3+aac mp4 creation




ajv
Feb 22, 2008, 02:33 AM
So after searching and browsing several posts, am I correct that we're still waiting for/working on a solution for adding an ac3 track to an mp4 file? VisualHub does not currently do this, and although HandBrake does, it only works with VIDEO_TS directories, not other formats.

I have mp4box 0.4.4, and when I run:

mp4box -add foo.video.x264 -add foo.audio.aac.mp4 -add foo.audio.ac3 -fps 23.976 foo.mp4

I get:

AVC-H264 import - frame size 1280 x 544 at 23.976 FPS
Import results: 787 samples - Slices: 24 I 723 P 40 B - 1 SEI - 22 IDR
Stream uses B-slice references - max frame delay 2
IsoMedia import - track ID 1 - Audio (SR 48000 - 2 channels)
Unknown input file type
Unknown input file type
Saving to foo.mp4: 0.500 secs Interleaving

The resulting file does not include the ac3 track



smilinmonki666
Feb 22, 2008, 10:26 AM
To include, you need either Visual Hub 3.31 (I think?) or Hand Brake 0.9.2 to include the AC3 passthrough. With HB, you can add AC3 passthrough & AAC 2ch encoding in the same file.

Avatar74
Feb 22, 2008, 10:56 AM
So after searching and browsing several posts, am I correct that we're still waiting for/working on a solution for adding an ac3 track to an mp4 file? VisualHub does not currently do this, and although HandBrake does, it only works with VIDEO_TS directories, not other formats.


Unless I misread you, you seem to be asking why you can't encode AC-3 from formats other than DVD.

I'm not sure I understand your goal here. What source are you transcoding from, and what file is your AC-3 source coming from?

Jestered
Feb 22, 2008, 11:44 AM
I have the same question. It does not really matter where the file "came from", I just want to know if it is possible and how?

I have some .mkv files that have the 5.1 audio but it is aac format. HandBrake won't do anything with a .mkv file so that is out. VisualHub will encode the video perfectly, but it won't do the audio.

Any ideas?

Avatar74
Feb 22, 2008, 12:09 PM
I have the same question. It does not really matter where the file "came from", I just want to know if it is possible and how?

Well, yes it does matter. AC-3 Pass-through only works if the source file is itself AC-3. Handbrake 0.9.2 is the best tool for producing AppleTV compatible files with the AC-3 track encapsulated in the MPEG-4 container.

I have some .mkv files that have the 5.1 audio but it is aac format. HandBrake won't do anything with a .mkv file so that is out. VisualHub will encode the video perfectly, but it won't do the audio.

Any ideas?

Unless you have a Dolby Digital encoder, you're most likely out of luck. Most receivers don't know what to do with an AAC file, and most transcoding tools do not have a Dolby Digital encoder that will actually take multichannel audio and produce an AC-3 bitstream from it.

spice weasel
Feb 22, 2008, 12:26 PM
I suppose you could just paste an AC-3 track into an mp4 in QT and save as a .mov. You'd likely have sync problems though. But, as has been asked, where would you get the AC-3 track from? A DVD. In that case, why not just use Handbrake?

Avatar74
Feb 22, 2008, 12:34 PM
But, as has been asked, where would you get the AC-3 track from? A DVD. In that case, why not just use Handbrake?

Precisely.

sJv
Feb 22, 2008, 12:49 PM
If your source .mkv file does not have the AC3 bit stream in it, you will likely not find an easy way to transcode this into an AppleTV format with AC3. Most tools merely pass on the existing AC3 stream and do not do encoding. Many .mkv files do have the AC3 stream. In this case Visual Hub is your best bet.

Just be sure your illegally downloaded .mkv movies have the AC3 stream in them and you should be set! :)

-steve

secondcup
Feb 22, 2008, 12:50 PM
So after searching and browsing several posts, am I correct that we're still waiting for/working on a solution for adding an ac3 track to an mp4 file? VisualHub does not currently do this, and although HandBrake does, it only works with VIDEO_TS directories, not other formats.

I have mp4box 0.4.4, and when I run:

mp4box -add foo.video.x264 -add foo.audio.aac.mp4 -add foo.audio.ac3 -fps 23.976 foo.mp4

I get:

AVC-H264 import - frame size 1280 x 544 at 23.976 FPS
Import results: 787 samples - Slices: 24 I 723 P 40 B - 1 SEI - 22 IDR
Stream uses B-slice references - max frame delay 2
IsoMedia import - track ID 1 - Audio (SR 48000 - 2 channels)
Unknown input file type
Unknown input file type
Saving to foo.mp4: 0.500 secs Interleaving

The resulting file does not include the ac3 track

The latest version of Visual Hub now supports AC3. There's a new setting "optimize for AppleTV 5.1"

Check out the link:

http://www.techspansion.com/techspansion-vh131.pdf

Avatar74
Feb 22, 2008, 01:15 PM
If your source .mkv file does not have the AC3 bit stream in it, you will likely not find an easy way to transcode this into an AppleTV format with AC3. Most tools merely pass on the existing AC3 stream and do not do encoding. Many .mkv files do have the AC3 stream. In this case Visual Hub is your best bet.

Just be sure your illegally downloaded .mkv movies have the AC3 stream in them and you should be set! :)

-steve

However, since AC-3 streams are often short a few frames (even at the time of compiling the master DVD) there arises the question of whether stripping AC-3 from an MKV is even worthwhile.

For example, if the MKV encoder drops any AC-3 frames at the beginning or end to compensate for any format idiosyncrasies with MKV, the same AC-3 file might not actually sync up to an H.264 video stream encapsulated in an MPEG-4 container.

The best, simplest solution is to transcode from the original DVD using handbrake. However, as you so astutely point out, the only reason one would insist on going to more elaborate lengths than that is because they don't have the DVD source... i.e. illegal download. :D

ajv
Feb 22, 2008, 01:16 PM
I have a library of 720p .mkv files with ac3 audio. I want to convert them to an apple tv compatible format that will do ac3 passthrough for receivers that support it and stereo for those that don't. I plan on getting an appletv for each tv in the house, but only the living room setup will have surround sound. I would also like to be able to manage the resulting files with MetaX.

I've spent some time learning about x264 encoding and how to get the best quality in the least amount of encoding time. The latest build of the x264 command line tool can do a two pass encode with higher quality settings in about the same time it takes visualhub to do a "go nuts" ffmpeg single pass.

Here's the script I'm using. Unfortunately the ac3 track gets left out of the result. The script requires mplayer, x264, mkvtoolnix, qt_tools, and mp4box. You can generate qt_export.aac.160kbps.stereo.48kHz.best.st using the qt_export --dodialog and --savesettings options.


#!/bin/sh

rm -f stream.yuv stream.y4m
mkfifo stream.yuv
ln -s stream.yuv stream.y4m

mplayer -vo yuv4mpeg -ao null -nosound "$1" > /dev/null &
x264 --progress --bframes 3 --b-pyramid --no-cabac --bitrate 4500 \
--vbv-maxrate 11500 --threads auto --level 31 --ref 1 --subme 1 --pass 1 \
--stats "$1.video.264.log" -o /dev/null stream.y4m

mplayer -vo yuv4mpeg -ao null -nosound "$1" > /dev/null &
x264 --progress --bframes 3 --b-pyramid --no-cabac --bitrate 4500 \
--vbv-maxrate 11500 --threads auto --level 31 --ref 3 --subme 6 --pass 2 \
--stats "$1.video.264.log" -o "$1.video.264" stream.y4m

mkvextract tracks "$1" "2:$1.audio.ac3"

qt_export --loadsettings=qt_export.aac.160kbps.stereo.48kHz.best.st \
"$1.audio.ac3" "$1.audio.aac.mp4"

mp4box -add "$1.video.264" -add "$1.audio.aac.mp4" -add "$1.audio.ac3" \
-fps 23.976 "$1.mp4" && \
rm "$1.video.264" "$1.video.264.log" "$1.audio.ac3" "$1.audio.aac.mp4"

Blazer5913
Feb 22, 2008, 01:45 PM
I think this is a great queestion that everybody with 720p HD .mkv encodes has on their mind right now. When is VisualHub going to give us what we need? Handbrake did it exactly right, and the darn thing is free. Yet, I fork over 25 bucks for VisualHub, and granted they do give an update, but they change the format to .mov, something they know MetaX can't handle (at least stability wise now). VisualHub needs to get their act together, I have hudnreds of gb worth of .mkv just waiting to be thrown into VisualHub! I want my HD with 5.1 on AppleTV!

stuff4me
Feb 22, 2008, 02:21 PM
I am slowly re-encoding all my DVDs again because I want that AC-3 stream now. So I have to spend time again to re-rip and encode my DVDs. Am I upset no. I should have waited.

As for the few that are complaining in this post the HandBrake only supports a VIDEO_TS folder and VisualHub does not have support yet for the mp4 container and AC-3 stream need to chill out a bit. I can see your frustration, but come on, give the developers of these fine pieces software a break.

I think VisualHub is worth the $23.32 I paid for it and I think there is only one developer working on all aspects of it (could be wrong).

HandBrake, one day the developers might change from being free to charging for updates.

AppleTV 2 has only been out for 2 weeks now, so be patient as the developers catch up with the new technology of the AppleTV 2.

It seems like now-a-days, everyone needs "it" right away and if it is not done right, they draw quick blame to the developer/provider, when the developer/provider is trying their best to keep up with the new standards. I think both VisualHub and HandBrake teams are doing wonderful work and in most cases they are not doing this development as their primary job.

Just my $.02

ajv
Feb 22, 2008, 03:51 PM
VisualHub uses standard open source command line utilities under the hood, so until mp4box can do this, VisualHub will have to wait also. Both mp4box and ffmpeg (what VisualHub uses) use the GPAC library for mp4 encapsulation. I assumed that Handbrake did as well since it is open source. I guess I'll have to dig around the source and figure out how it's doing it.

What's all this talk of DVD ripping being somehow less illegal than downloading? The only legal ways to get movies on your appletv under US law are to shoot them yourself, or buy/rent them from itunes. In fact even *discussing* how to rip a CSS encrypted DVD that you own to appletv format is a criminal offense. People have actually been arrested for it. http://en.wikipedia.org/wiki/Dmitry_Sklyarov

Why do you think iTunes rips CDs but not DVDs? Why does HandBrake not include de-css? We're all outlaws here (those of us living in the US anyway), so don't get too smug.

edit: It looks like Handbrake is using something called mpeg4ip which had a patch submitted about a week ago to allow it to include ac3 tracks in mp4 files. I'll see if there's an easy way to use it. If not then the option is to write my own command line program to use it, or see about getting the functionality added into GPAC.

spice weasel
Feb 22, 2008, 04:36 PM
What's all this talk of DVD ripping being somehow less illegal than downloading? The only legal ways to get movies on your appletv under US law are to shoot them yourself, or buy/rent them from itunes. In fact even *discussing* how to rip a CSS encrypted DVD that you own to appletv format is a criminal offense. People have actually been arrested for it. http://en.wikipedia.org/wiki/Dmitry_Sklyarov

Why do you think iTunes rips CDs but not DVDs? Why does HandBrake not include de-css? We're all outlaws here (those of us living in the US anyway), so don't get too smug.

I don't want to thread-jack here, but there is a qualitative and moral difference between ripping/encoding from a source you own and downloading one that you do not. I understand that ripping your own DVDs is illegal under DCMA law, but as far as I'm concerned it is not nearly as illegal as downloading something you don't even own. In that case, you are not only an accomplice in breaking DCMA, but also guilty of trafficking in stolen goods.

I'm not trying to get sanctimonious here by any means. But the two are not (im)morally equivalent in my book.

ajv
Feb 22, 2008, 05:02 PM
Since it's my thread, is it okay for me to hijack it? :) I think it's a really interesting topic.

Okay, so what you're saying is that it's okay to ignore the law as long as what you're doing is moral. I happen to agree with that. In fact I would go one further and say it's our civic *duty* in a free society to disobey laws against perfectly moral acts (Rosa Parks). Now the question is only about what's moral regardless of the law. What if I only download movies that were released before 1994, the original 14 year copyright term? Copyright is a contract between content producers and the public. The public gives up their right to do what they like with their stuff in exchange for increasing the incentive for content producers to create more stuff to begin with. Unfortunately the content producers have been able to lobby the legislature to continually extend this copyright term... retroactively. Now explain that one to me. When the work was created the producer knew he would only have exclusive control of the work for a fixed time. How does retroactively extending the term for stuff he's already completed encourage him to create more? Wouldn't it actually do the opposite, encouraging him to rely on the income from the stuff he's already created? I think the public got the raw end of that deal, and that's not even considering all sorts of other things like the fact that the public is forced to pay for the enforcement of copyright.

BTW, mpeg4ip includes a command line utility called mp4creator. I'll see if it's been patched to deal with ac3.

roland.g
Feb 22, 2008, 05:22 PM
Yes it is very interesting that music is legal to rip. Put it your CD and compress it to your computer. You should be able to do the same thing with a DVD. People will argue that music is cheaper. Really $10-20 for a CD. DVDs are that cheap. But you can rent - blockbuster/netflix - DVDs and not really music. So I guess the argument goes that with DVDs people would rent them and add them to their personal library. And that just screws those of us who own the content and want to back it up (i.e. prevent kids from destroying discs) as well as use an Apple TV to have a dedicated media server and put all those discs in a box somewhere. Is the ability to rip a movie slowing down my movie purchase rate. NO. Personally I would like to see the HD movies come to iTunes for purchase. Between renting $2.99-$4.99 I would prefer to buy at $10-20 for download. Saves me ripping. But I would also prefer to buy HD content or at least higher definition than the 'almost DVD' quality of current iTunes purchase movies at 640x.

ajv
Feb 22, 2008, 06:59 PM
I found this thread over on the handbrake dev forum:

http://forum.handbrake.fr/viewtopic.php?f=4&t=4726&st=0&sk=t&sd=a

It looks like edgyg is the only guy outside of apple to figure out how to get mp4 ac3+aac working so far. I'll shoot him an email and see if he has any interest in getting his patch working with the mp4creator command line tool that's part of the mpeg4ip library he's using.

theBB
Feb 22, 2008, 07:32 PM
What if I only download movies that were released before 1994, the original 14 year copyright term.

I think you are mixing up patents with copyrights. AFAIK, copyrights covered decades after the death of the original author for a long time. They just keep on increasing the number of decades after that death. The patents were extended beyond the original limit to be compatible with European systems, but the two does not have much to do with each other.

A lot of companies get affected by patents in a negative way, so they lobby to balance the rights of the public versus the incentive to innovate. In copyrights, very few members of the public actually lobbies for the public and there are no rich companies that make money through works whose original copyright have expired, so copyright holding media companies usually get what they want from Congress.

ajv
Feb 22, 2008, 08:11 PM
From the US Copyright office website:
May 31, 1790 - First copyright law enacted under the new U.S. Constitution. Term of 14 years. Books, maps, and charts protected. Copyright registration made in the U.S. District Court where the author or proprietor resided.

Rufus Pollock of Cambridge wrote and excellent paper recently where he attempts to calculate the optimal copyright term for producing the greatest social benefit. He comes to the conclusion that 14 years is the optimal length:

http://www.rufuspollock.org/economics/papers/optimal_copyright.pdf

Patents are 7 years, with the exception of drug patents which are for 14.

spice weasel
Feb 23, 2008, 12:39 AM
From the US Copyright office website:
May 31, 1790 - First copyright law enacted under the new U.S. Constitution. Term of 14 years. Books, maps, and charts protected. Copyright registration made in the U.S. District Court where the author or proprietor resided.

I think it's silly to cite 1790 copyright law and try to apply it to today. Laws change all the time as legislatures attempt to keep up with advances in technology, societal change, etc. I'm hardly an expert, but my understanding is that motion picture copyright originally lasted 28 years, but has now been extended for up to 95 years. I do agree that this is entirely too long. But that doesn't give me the right to infringe on someone's copyright.

I never said that breaking DCMA was morally right, only that there is a fundamental difference between breaking DCMA to copy something you already own for your own use and freely downloading a copyrighted motion picture of which you don't own a copy.

I must also HIGHLY disagree with your attempt to equate the civil disobedience of people such as Rosa Parks with stealing copyrighted material. Civil rights movement leaders did not get hosed, beaten, and attacked by police dogs so that you could feel better about downloading illegally copied motion pictures. Your indignity over DCMA and copyright does not even begin to approach the travesty that was Jim Crow.

Stealing movies does not make you Patrick Henry, Rosa Parks, or even Henry David Thoreau, regardless of how unfair you think current copyright law may be.

ajv
Feb 23, 2008, 11:49 PM
I never said overly long copyright terms were comparable to jim crow laws. The only thing they have in common is that I happen to think both are unjust. Clearly the level of unjustness isn't comparable either. I do compare myself to figures like Thoreau, but I wouldn't cite violating copyright as a reason why. The DMCA is a much more oppressive law that directly contradicts the first amendment, but again this still doesn't rise to the level of jim crow laws, or taxation in Thoreau's case.

I do think that it's our civic duty to defy unjust laws, large or small. I will encourage others to be aware of and think about the justness of restrictions placed on them and decide for themselves what's just and what isn't.

In the case of copyright I maintain that exclusive control of a work for a period of several years is reasonable as a standard contract between a content producer and the public, but when this contract is extended continually retroactively through corruption of the legislature, we as citizens should fight back.

Making a copy or derivative work of something that someone else created is absolutely not theft. It's not always right, but comparing it to theft is a pretty twisted corruption of that term. If I steal your bicycle, you are deprived of a bicycle. A more apt analogy would be if I made a copy of your bicycle.

Copyright can be a great benefit to everyone. Just as traffic laws place minor restrictions on me, but give me the freedom to travel around, so copyright can also place a restriction on me while creating an incentive for producers to make a lot of things for me to enjoy. The term of copyright should be chosen to provide the greatest overall freedom to everyone involved. So far the best estimation of what that term should be that I've come across is about 14 years, which also just happens to be what the founding fathers decided on. Their ideas and judgements have served us well in the past. I think we'd all be a lot better off if we didn't discard their judgement so readily in all sorts of areas. This is a pretty small one by comparison to some others.

secondcup
Feb 23, 2008, 11:56 PM
I found this thread over on the handbrake dev forum:

http://forum.handbrake.fr/viewtopic.php?f=4&t=4726&st=0&sk=t&sd=a

It looks like edgyg is the only guy outside of apple to figure out how to get mp4 ac3+aac working so far. I'll shoot him an email and see if he has any interest in getting his patch working with the mp4creator command line tool that's part of the mpeg4ip library he's using.

Wow...talk about thread jacking!
:)

Alphy
Feb 25, 2008, 10:49 PM
I've been trying to find a solution for this problem all damn night.

I guess the gist of it, as mentioned above, is the follow;

How to take my .mkv's and put them into a format that is compatible with Apple TV (maintaining 5.1 sound), in as little as time and effort as possible?

Basically from what I understand now, we're at the cusp of a solution. I've been going over Doom9 threads:

http://forum.doom9.org/showthread.php?t=127611&highlight=audio+ac3+aac

and I'm still not quite there yet. Anyways, I forgot why I originally posted all of this but I'm going to try and post on Doom9 and see if I can get an answer that doesn't involve me having to go commandline. /faint

Alphy
Feb 25, 2008, 11:34 PM
Bingo.

Managed to get AutoMKV (google it) to give me a nice .aac track that I can throw into yamb and then remux with my h.264 to give me an .mp4. REMEMBER, you need to manually set the fps in yamb to 23.967.

But, I'm still not quite there yet. I need to the "Level" to 3.1 to have Apple TV play it back. It's getting late though...More tomorrow.

Thread at Doom9 asking about this:

http://forum.doom9.org/showthread.php?p=1105296#post1105296

Alphy
Feb 26, 2008, 01:13 AM
Stayed up a little later. The quick fix I had for changing "levels" that were originally 5.1 or 4.1 in the .MKV's in h264info didn't quite work out; green frame all the way through..

So uh, unless the h.264 stream is in someway Apple TV compatible, I'm **** out of luck here.

Alphy
Feb 26, 2008, 09:46 AM
I've given up. I spent another four hours this morning and I've come to the conclusion that you just need to reencode, which is a shame.

dynaflash
Feb 26, 2008, 09:55 AM
HandBrake, one day the developers might change from being free to charging for updates.
Never.

Avatar74
Feb 26, 2008, 11:02 AM
I've given up. I spent another four hours this morning and I've come to the conclusion that you just need to reencode, which is a shame.

It's a shame that you believe that you're entitled to copyrighted material free of charge.

Alphy
Feb 26, 2008, 11:06 AM
It's a shame that you believe that you're entitled to copyrighted material free of charge.

Enlighten all of us as to where EXACTLY in this thread you see mention of copyrighted files.

So please, ****** off.

Alphy
Feb 26, 2008, 11:08 AM
Anyways, back to the topic at hand. You can stream _most_ .mkv's to a PS3 with this utility:

http://forum.doom9.org/showthread.php?t=131782


I suppose I might get a PS3 later today once I have more information.

alFR
Feb 26, 2008, 11:22 AM
Enlighten all of us as to where EXACTLY in this thread you see mention of copyrighted files.

Isn't .mkv a bit of an odd format for your home movies? :rolleyes:

Alphy
Feb 26, 2008, 11:42 AM
You must not be aware that a .mkv can contain subtitles and DTS audio, where as a .mp4 cannot. I've captured a number of off-the-air HD broadcasts and encoded them to .mkv, however I've deleted the original source.

Think before you start making assumptions.

ajv
Feb 26, 2008, 03:11 PM
Actually you need to put an ac3 into the mp4, not 5.1aac. Appletv won't generate ac3 on the fly (what 5.1 receivers expect) but it will pass through an ac3 track muxed into an mp4 while decoding a stereo aac track at the same time for non 5.1 output.

alFR
Feb 27, 2008, 02:12 AM
You must not be aware that a .mkv can contain subtitles and DTS audio, where as a .mp4 cannot. I've captured a number of off-the-air HD broadcasts and encoded them to .mkv, however I've deleted the original source.

Think before you start making assumptions.

Actually I didn't know that, because in the UK we don't have over-the-air HD unless you pay (through the nose) for it. It should be coming within the next few months, though. Out of interest, what are you using to capture and encode?

plugh
Apr 2, 2008, 08:41 PM
My primary source of encode/transcode material is Transport Stream captures - ie mpeg2 video and AC-3 audio. So my source for AC-3 audio comes from neither DVD ripping nor downloaded files, but rather as a seperate file produced from demuxing the ts file.

I would much prefer to keep the original audio rather than re-encode it to aac. A google search led me to this discussion...

So, in a nutshell, is there a tool that will allow me to mux my ac3 file as-is into the mp4 container (for playback on my AppleTV)?

eddyg
Apr 2, 2008, 10:25 PM
I found this thread over on the handbrake dev forum:

http://forum.handbrake.fr/viewtopic.php?f=4&t=4726&st=0&sk=t&sd=a

It looks like eddyg is the only guy outside of apple to figure out how to get mp4 ac3+aac working so far. I'll shoot him an email and see if he has any interest in getting his patch working with the mp4creator command line tool that's part of the mpeg4ip library he's using.

Ah nope, I did it for one reason only, so that I could have AC3 on my front room ATV, and AAC on my bedroom one from the same file encoded using HandBrake.

Any other developer is free to incorporate those changes into mp4creator or any other program as they see fit.

Either that or change HandBrake to accept mkv as a source ;)

Cheers, Ed.

eddyg
Apr 2, 2008, 10:30 PM
So, in a nutshell, is there a tool that will allow me to mux my ac3 file as-is into the mp4 container (for playback on my AppleTV)?

In a nutshell - yes - HandBrake will take an MPEG2 transport stream, with AC3 audio from an over the air broadcast and mux that into an mp4 container for use on your ATV.

If the source with the AC3 is anything other than an MPEG2 transport stream, then in a nutshell, no, there is nothing available at this time. The closest is VisualHub and it's .mov container "trick".

Cheers, Ed.

plugh
Apr 2, 2008, 11:02 PM
In a nutshell - yes - HandBrake will take an MPEG2 transport stream, with AC3 audio from an over the air broadcast and mux that into an mp4 container for use on your ATV.

If the source with the AC3 is anything other than an MPEG2 transport stream, then in a nutshell, no, there is nothing available at this time. The closest is VisualHub and it's .mov container "trick".

Cheers, Ed.
To make sure I'm parsing the above correctly...

Handbrake will accept the transport stream containing ac3, but not the ac3 sitting in a seperate file that I demuxed from it?

IE, I demux it, process the video, then want to mux the processed video with the demuxed audio...

dynaflash
Apr 3, 2008, 05:44 AM
yep ... in a nutshell

refulgentis
Apr 5, 2008, 02:33 AM
Correct me if I'm wrong, but from my limited understanding of encoding it seems that right now I can encode my mkvs into MP4s with 2-channel AAC audio and H.264, and then later on when the technology becomes available, remux my mp4s to include AC3, without any reencoding of the initial two-channel stream and H.264 video?

I want to make sure my HD conversions are "forward-compatible" before continuing converting the hundreds of gigabytes I have of them.

eddyg
Apr 5, 2008, 04:36 PM
Correct me if I'm wrong, but from my limited understanding of encoding it seems that right now I can encode my mkvs into MP4s with 2-channel AAC audio and H.264, and then later on when the technology becomes available, remux my mp4s to include AC3, without any reencoding of the initial two-channel stream and H.264 video?

I want to make sure my HD conversions are "forward-compatible" before continuing converting the hundreds of gigabytes I have of them.

Theoretically yes - assuming someone provides a tool to remux the AC3 stream from a mkv into an existing mp4 whilst retaining the AAC in that mp4.

Cheers, Ed.

RealCoolHandle
Apr 12, 2008, 11:50 AM
Slightly OT (but not as much as that IP debate up there), how do you guys play back Handbrake-encoded h.264/ac3 mp4 files? I don't have an AppleTV, I'm using an XP-based HTPC in my living room. Mplayer and VLC don't seem to be able to play back the audio. I've tried the VLC nightlies and that doesn't seem to work, either. Quicktime doesn't work. Any other suggestions?

entropy1980
Apr 12, 2008, 02:57 PM
Another slightly on/off topic.... If I have say an mkv file and I want to convert it for playback on my AppleTV, but lets say I have a couple requirements:


Must keep AC3 audio.
Must keep resolution so if it were say 1280 x 536 it needs to stay that way
End up in a .m4v container


Anyone have a suggestion for mkv -----> .m4v while keep the above? I have been using VisualHub but that just gives me a .mov (although it keeps the AC3) so it gets me part of the way.

refulgentis
Apr 14, 2008, 09:35 AM
Another slightly on/off topic.... If I have say an mkv file and I want to convert it for playback on my AppleTV, but lets say I have a couple requirements:


Must keep AC3 audio.
Must keep resolution so if it were say 1280 x 536 it needs to stay that way
End up in a .m4v container


Anyone have a suggestion for mkv -----> .m4v while keep the above? I have been using VisualHub but that just gives me a .mov (although it keeps the AC3) so it gets me part of the way.You can't, which is the point of this thread, so you're very on topic. :D

MP4 = M4V, from my knowledge M4V is an Apple way of designating MP4s that "should" be opened in iTunes. Right now, AC3 can't be muxed into MP4s.

entropy1980
Apr 14, 2008, 09:39 AM
You can't, which is the point of this thread, so you're very on topic. :D

MP4 = M4V, from my knowledge M4V is an Apple way of designating MP4s that "should" be opened in iTunes. Right now, AC3 can't be muxed into MP4s.
Glad I am on topic :)

Well I guess I am wondering how is Handbrake doing it? I mean I put a DVD in and end up with both a stereo AAC and the pass through AC-3 in an .m4v?

NightStorm
Apr 14, 2008, 09:45 AM
You can't, which is the point of this thread, so you're very on topic. :D

MP4 = M4V, from my knowledge M4V is an Apple way of designating MP4s that "should" be opened in iTunes. Right now, AC3 can't be muxed into MP4s.
That's not true. Handbrake is doing this right now. The .mov container is a limitation in the way VisualHub has chosen to create files with an AC3 soundtrack.

refulgentis
Apr 14, 2008, 09:48 AM
Glad I am on topic :)

Well I guess I am wondering how is Handbrake doing it? I mean I put a DVD in and end up with both a stereo AAC and the pass through AC-3 in an .m4v?

Details are at the Handbrake board links in this thread, but basically it appears to me as I'm reading now that someone needs to take the time to "incorporate those changes into mp4creator or any other program as they see fit. Either that or change HandBrake to accept mkv as a source" as eddyg says above.

It would be incredible if this happened soon, since soft subtitles for Quicktime were recently settled over at Handbrake and are trivial, I haven't done any actual research into chapters but I'm pretty sure they're trivial, so the only barrier left is getting 5.1 AC3 and 2.0 AAC into the same file before Apple devices can support every feature I can think of for video.

refulgentis
Apr 14, 2008, 09:50 AM
That's not true. Handbrake is doing this right now. The .mov container is a limitation in the way VisualHub has chosen to create files with an AC3 soundtrack.I know it *can* be done, but there is no mp4 muxer right now that will do it properly, so in practice it can't be.

entropy1980
Apr 14, 2008, 09:54 AM
I know it *can* be, but there is no mp4 muxer right now that will do it properly, so in practice it can't be.

I wish VisualHub would make .m4v and I wish Handbrake would accept more input types. If I knew how to program I would be working hard on it.... maybe I need to learn!

refulgentis
Apr 14, 2008, 10:06 AM
I wish VisualHub would make .m4v and I wish Handbrake would accept more input types. If I knew how to program I would be working hard on it.... maybe I need to learn!
Haha that's exactly what I'm thinking, I downloaded the handbrake source last night, I wanted to poke around it today, but quite simply learning C , the different types of open source video decoders, the muxers, and then the intricacies of the program itself mean by the time I'm done, they'll have it done much quicker.

NightStorm
Apr 14, 2008, 12:32 PM
I know it *can* be done, but there is no mp4 muxer right now that will do it properly, so in practice it can't be.
Of course there is, it is used by Handbrake...

NightStorm
Apr 14, 2008, 12:33 PM
Haha that's exactly what I'm thinking, I downloaded the handbrake source last night, I wanted to poke around it today, but quite simply learning C , the different types of open source video decoders, the muxers, and then the intricacies of the program itself mean by the time I'm done, they'll have it done much quicker.
And it would take a major rewrite of how Handbrake is structured. Quite simply, it was made with MPEG2 sources in mind.

dynaflash
Apr 14, 2008, 12:38 PM
Believe me, if it were trivial it would have been done long ago.

refulgentis
Apr 14, 2008, 12:39 PM
Of course there is, it is used by Handbrake...
See the above post.

refulgentis
Apr 14, 2008, 01:20 PM
Bingo.

Managed to get AutoMKV (google it) to give me a nice .aac track that I can throw into yamb and then remux with my h.264 to give me an .mp4. REMEMBER, you need to manually set the fps in yamb to 23.967.

But, I'm still not quite there yet. I need to the "Level" to 3.1 to have Apple TV play it back. It's getting late though...More tomorrow.

Thread at Doom9 asking about this:

http://forum.doom9.org/showthread.php?p=1105296#post1105296Getting AAC into an MP4 container isn't a problem though, is it? Everyone wants AC3 because no cheap receivers can decode 5.1 AAC, also my understanding was converting AC3 to 5.1 AAC messed up the channel order.

The two problems with MKVs I know right now are that you can't mux 5.1 AC3 right now and 99% of the time the video track is using some h.264 encoding feature that is unsupported by Apple's H.264 implementation/Apple TV horsepower.

NightStorm
Apr 14, 2008, 01:30 PM
See the above post.
I could be mistaken, but I believe he (dynaflash) is referring to this post:
I wish VisualHub would make .m4v and I wish Handbrake would accept more input types. If I knew how to program I would be working hard on it.... maybe I need to learn!


Getting AAC into an MP4 container isn't a problem though, is it? Everyone wants AC3 because no cheap receivers can decode 5.1 AAC, also my understanding was converting AC3 to 5.1 AAC messed up the channel order.
No, MP4 and AAC go together very nicely. As far as I know, there are no home receivers on the market that can currently decode 5.1 AAC (I recall hearing about one a couple months ago, but don't know if/when it will make it to market and it definitely wasn't cheap). I don't know about the channel order issue as I never encoded to 5.1 AAC.