• AnyStream is having some DRM issues currently, Netflix is not available in HD for the time being.
    Situations like this will always happen with AnyStream: streaming providers are continuously improving their countermeasures while we try to catch up, it's an ongoing cat-and-mouse game. Please be patient and don't flood our support or forum with requests, we are working on it 24/7 to get it resolved. Thank you.

H264/AAC 5.1 profile (works sort of)...

AtTheAsylum

Well-Known Member
Thread Starter
Joined
Jan 17, 2008
Messages
56
Likes
0
Hi all,

I've done a bit of research into mencoder options specifically in an attempt to enable 5.1 surround sound when encoding H264/AAC (for my PS3).

Here's what I have so far - it's based on the standard PS3 16:9 profile:

Code:
[PS3 16:9 (AVC/H264/AAC 5.1)]
AllowNativeTVResolution=1
Manufacturer=Sony Playstation 3
ScreenRatio=16:9
Res1=320x240
Res2=640x480
ResAna1=320x180
ResAna2=640x360
ARate=48000
ABRate=384
Format=avi
moac=lavc
movc=x264
mopts=-channels 6 -lavcopts acodec=libfaac:abitrate=%abrate% -x264encopts bitrate=%vbrate%:level_idc=31:bframes=3:frameref=2:nopsnr:nossim%PASS%
FileType=mp4
Quality=15
useMencoder=1
SubTitle=1
MaxVBitrate=2500
AllowChapterFiles=0
MVolume=10
Remux=2642MP4
QualityFactor=130

Results: Mostly working. The resultant mp4 file plays on the PS3 with AAC 5.1 surround sound. Picture is great, sound is great.

The only problem is that the channels assignments are not correct. ie: centre audio comes out of right speaker etc. Aparently AC3 channels do not map directly onto AAC channels.

I've seen references on the web to the use of the -af switch to reasign the channels. The option looks like this:

-af channels=0:1:1:2:2:3:3:4:4:0:5:5

I've tried various ways of adding this into the profile without success. Basically I get a mencoder error if I add the -af switch into the mopts.

Any ideas or thoughts for a way forward?
 
Hi all,

I've done a bit of research into mencoder options specifically in an attempt to enable 5.1 surround sound when encoding H264/AAC (for my PS3).

Here's what I have so far - it's based on the standard PS3 16:9 profile:

Code:
[PS3 16:9 (AVC/H264/AAC 5.1)]
AllowNativeTVResolution=1
Manufacturer=Sony Playstation 3
ScreenRatio=16:9
Res1=320x240
Res2=640x480
ResAna1=320x180
ResAna2=640x360
ARate=48000
ABRate=384
Format=avi
moac=lavc
movc=x264
mopts=-channels 6 -lavcopts acodec=libfaac:abitrate=%abrate% -x264encopts bitrate=%vbrate%:level_idc=31:bframes=3:frameref=2:nopsnr:nossim%PASS%
FileType=mp4
Quality=15
useMencoder=1
SubTitle=1
MaxVBitrate=2500
AllowChapterFiles=0
MVolume=10
Remux=2642MP4
QualityFactor=130

Results: Mostly working. The resultant mp4 file plays on the PS3 with AAC 5.1 surround sound. Picture is great, sound is great.

The only problem is that the channels assignments are not correct. ie: centre audio comes out of right speaker etc. Aparently AC3 channels do not map directly onto AAC channels.

I've seen references on the web to the use of the -af switch to reasign the channels. The option looks like this:

-af channels=0:1:1:2:2:3:3:4:4:0:5:5

I've tried various ways of adding this into the profile without success. Basically I get a mencoder error if I add the -af switch into the mopts.

Any ideas or thoughts for a way forward?
I tried testing this (even paid for the CoreAAC decoder) and I get the same results with your profile (centre audio from right speaker).

If you check the sticky thread at the top of the forum (CloneDVD mobile Format Extention Thread) there is a profile for copying the DTS/DD stream (Direct Sound Copy (For DTS/DD+) for DivX files. You could try a variation for AVC. Unfortunately, using mpeg=raw option results in an MP4Box.exe error (documented elsewhere on this site) so passing the AC3 stream doesn't seem to work properly.

This would be a great addition to the sticky thread if anyone can get it to work - please post your results.
 
Last edited:
Yeah, I've seen that thread and have used it quite successfully to rip a couple of DVD's :) So far hi bit rate DivX and AC3 seems to be the best option for a PS3.

As for H264 and AC3 - I think the reason that MP4Box gives an error is that the mp4 container does not support AC3 whereas the avi container does - hence the DivX profile with direct sound copy (not saying that MP4Box is used to create an avi).

However the avi container does not properly support H264 (according to Wikipedia - http://en.wikipedia.org/wiki/Comparison_of_container_formats) so that option seemed to be out as well.

BUT, I though I would test this theory :) Using the following profile:
Code:
[PS3 16:9 (H264/AC3 5.1)]
AllowNativeTVResolution=1
Manufacturer=Sony Playstation 3
ScreenRatio=16:9
Res1=320x240
Res2=640x480
ResAna1=320x180
ResAna2=640x360
ARate=48000
Format=avi
moac=copy
movc=x264
mopts=-x264encopts bitrate=%vbrate%:level_idc=31:bframes=3:frameref=2:nopsnr:nossim%PASS%
Format=avi -noodml
FileType=avi
Quality=15
useMencoder=1
SubTitle=1
MaxVBitrate=2500
AllowChapterFiles=0
MVolume=10
QualityFactor=130

I get an avi file that GSpot identifies as containing H264 video and AC3 audio :) The next step is to test on my PS3 - will update soon.

A third option is the open Matroska container (not in CloneDVD Mobile). It does support both H264 and AC3 :) if only the PS3 would support this container.
 
Last edited:
Bad news - the PS3 will not play the avi containing H264 and AC3 :( Windows Media Player has no problems - both sound and video play successfully.

So anyway this profile may be useful to somebody.
 
Bad news - the PS3 will not play the avi containing H264 and AC3 :( Windows Media Player has no problems - both sound and video play successfully.

So anyway this profile may be useful to somebody.
Nice find anyway - I'll try that profile you posted in the sticky thread. If my kids succeed in their pressure tactics to get a PS3 (birthdays coming up) I will even be able to do some more testing on that 8)
 
Hi all,

After much stuffing around with mencoder, mp4box and neroaacenc I think I have a working solution for the H264/AAC 5.1 problem I talked about above. Unfortunately not all of it can be done in CloneDVD Mobile (CD-M) - we'll have to drop down to the command line. Don't be put off though - it's a very easy process. Read on :)

Tools you'll need:
CD-M (of course).
mplayer.exe (www.mplayerhq.hu) - this is the companion tool for mencoder which is included in CD-M. We'll use this to fix the channels assignments when converting from AC3 to AAC.
neroaacenc.exe (www.nero.com/eng/nero-aac-codec.html) - we'll use this to convert the AC3 audio into AAC 5.1.
mp4box.exe (included in CD-M - have a look in C:\Program Files\SlySoft\CloneDVDmobile\apps) - we'll use this to package up the MP4 at the end of the process.

Step 1: Encode the DVD as you usually would in CD-M. We use CD-M here because it has a very nice interface and allows you to hardcode subtitles etc. IMPORTANT: Use a profile that encodes H264 video and AC3 audio (ie: copies the audio straight off the DVD) into an AVI container. For example:

Code:
[* Generic (H264/AC3) AVI]
Res1=320x240
Res2=480x360
Res3=640x480
Res4=720x540
ResAna1=320x180
ResAna2=480x270
ResAna3=640x360
ResAna4=720x404
ResAna5=852x480
AllowNativeTVResolution=1
Format=avi
moac=copy
movc=x264
mopts=-x264encopts bitrate=%vbrate%:level_idc=31:bframes=3:frameref=2:nopsnr:nossim%PASS%
Format=avi -noodml
FileType=avi
Quality=15
useMencoder=1
SubTitle=1
MaxVBitrate=3000
AllowChapterFiles=0
QualityFactor=130

Time to execute this step: varies depending on movie length and quality settings. Can be over 8 hours.

WARNING: all the next steps are done at the command line. I've found the easiest way is to dump the AVI file from step 1 into a directory that contains mplayer.exe, neroaacenc.exe and mp4box.exe.

Step 2: Extract the AC3 audio from the AVI created in step 1, reassign the channels, and dump the result into a WAV file. We do this because AC3 channels do not map directly to AAC channels. The command to use is:
Code:
mplayer.exe [AVI FILENAME FROM STEP 1] -af channels=6:6:0:0:1:1:2:4:3:5:4:2:5:3 -ao pcm:waveheader:file=[A FILENAME].wav -channels 6 -novideo
eg: mplayer.exe test.avi -af channels=6:6:0:0:1:1:2:4:3:5:4:2:5:3 -ao pcm:waveheader:file=test.wav -channels 6 -novideo

Time to execute this step: approximately 5 minutes.

Step 3: Convert the WAV file into AAC 5.1 format. We use the -lc parameter to tell neroaacenc.exe to encode the audio using LC (low complexity) AAC profile (supported by the PS3). The -q parameter sets the quality level. Since the AC3 source is encoded at 448 kbits/s there is no point setting the AAC quality higher than .5 (results in AAC with a bit rate of 571 kbits/s).
Code:
neroaacenc.exe -q .5 -lc -if [A FILENAME].wav -of [A FILENAME].aac
eg: neroaacenc.exe -q .5 -lc -if test.wav -of test.aac

Time to execute this step: approximately 15 minutes.

BTW - if you have a CPU that supprts SSE you can use neroaacenc_SSE.exe instead of neroaacenc.exe to speed up the conversion process.

Step 4: Extract the H264 video from the AVI created in step 1. This will create a file called '[AVI FILENAME FROM STEP 1]_video.h264'.
Code:
MP4Box -aviraw video [AVI FILENAME FROM STEP 1]
eg: MP4Box -aviraw video test.avi

Time to execute this step: a couple of minutes.

Step 5: Combine the H264 video and AAC audio into an MP4 container.
Code:
MP4Box -add [AVI FILENAME FROM STEP 1]_video.h264#video -add [A FILENAME].aac#audio [A FILENAME].mp4
eg:
MP4Box -add test_video.h264#video -add test.aac#audio test.mp4

Time to execute this step: a couple of minutes.

Step 6: That's it :) The MP4 file is now ready to play :)

Total time (excluding step 1): approximately 30 minutes.

So far I've tested this on a small section of a DVD and played it back in Windows. The audio seems to be synced nicely and the picture and sound quaility is good.

Edit: see post below - I've tested this on a whole movie DVD and it plays back perfectly on my PS3 :)
 
Last edited:
Great find - must have taken a lot of work. But (why is there always a but?) - the bottom line is does it play on the PS3?
 
Short answer - yes it does :)

Long answer - still yes but with a few more details ;)

I ran a test on the DVD version of the movie Solaris (with George Clooney). I chose the profile I talked about above (H264/AC3 AVI), 852x480 resolution, quality max, no deinterlace, no letterbox zoom and the AC3 soundtrack. It took over 8 hours for CD-M to rip the DVD into an AVI container on my 3GHz P4 Hyperthreading system.

I then followed the process detailed above and tried the MP4 on my PS3 (copied to an iPod). It played perfectly :) Great video and audio quality and all the audio channels were in their correct position.

Would I use this method all the time? Probably not. I've been running comparison conversions using this method and the DivX DTS/DD+ profile detailed in the sticky profiles thread, both with max video quality (DivX quality set so that the size of the AVI does not exceed 2G), and I can not see any difference between the two on my 50 inch plasma. They both produce a filesize between 1.5 and 2G depending on movie length. The BIG advantage that DivX has is that it is much faster to encode. 1.5 hours versus 8+ hours.

BTW - I've edited the 'howto' I provided above to include approximate times for each step.
 
Last edited:
Hey all,

nice work. Can this approach be used to add several AC3 audio versions to it.
I would like to have more than one audio language in my file.

cloud77
 
Hey all,

nice work. Can this approach be used to add several AC3 audio versions to it.
I would like to have more than one audio language in my file.

cloud77
AFAIK you can only choose one audio stream in CloneDvdMobile.

To update my earlier comments in this thread, channel mapping now seems to work ok with the profile in the first post.
 
Back
Top