Page 1 of 1

AC3 issues in H264 encoded .m4v

Posted: 01 Feb 2009 08:33
by ERICSPEEd
Hello,

I have recently been encoding my DVDrips with Handbrake 0.9.3 using the x264 encoder with AC3 audio into .m4v files.

I have my computers audio set to "desktop stereo speakers" (going to get a 5.1 speaker system when cash allows) within "Advanced Audio Properties" and VLC (0.9.8a) plays the video beautifully but there is something amiss with the audio when playing the above mentioned video files.

The right speaker seems to have the "front" channels audio and the left speaker seems to have the "rear" channels audio. VLC "notices" that I have set my audio properties to "stereo" and selects "stereo" from the get go. But as I stated the audio is messed up. Even when I select "5.1" or "2 front 2 rear" from the audio device drop down menu within audio it sounds basically the same. The "mono" setting balances it out of course but I don't want it mono.

It plays stereo encoded files I've created perfectly (mp3 audio). It seems to be directing the "center channel mix" to my right speaker.

It might be a handbrake issue but I haven't found any reported problems within the handbrake forum as of yet.

Anyone have any thoughts as to why?

I'm using my motherboard's audio (C-Media 6501) with a Microsoft "generic" USB driver (5.1.2535.0) since the drivers from C-Media crash after about 30min of playback. I've tried as many C-Media 6501 driver releases as I could find and they all crashed. Even with the C-Media driver installed I had the same weird AC3 issue - front channels sound in the right speaker and rear channels sound in the left speaker.


Help.

Thanks

Windows XP Professional SP3, AMD Athlon X2 64 4000+, ASUS M2N-SLI using on board audio (C-Media 6501 chip), MSI 8500GT running a LCD main and CRT TV, VLC 0.9.8a Grishenko.

Re: AC3 issues in H264 encoded .m4v

Posted: 01 Feb 2009 14:24
by Arite
Sounds like the AC3 channel mapping is incorrect - have you tried the file with another player?

Are you re-encoding the audio? If you want 5.1 AC3 audio in the output file then, assuming the DVD-Video has 5.1 AC3 audio, is copying the original not possible?

Arite.

Re: AC3 issues in H264 encoded .m4v

Posted: 02 Feb 2009 00:19
by ERICSPEEd
There must be a bug in Handbrake when using the x264 encoder and AC3 "pass through" because I did some test encodes using XviD encoded video with AC3 audio and x264 encoded video with AAC "6 channel discrete" audio. Both worked perfectly when played in stereo.
So there is a "mapping" issue.
I haven't any other player that can handle .m4v files with AC3 at this time. Quicktime doesn't handle AC3 without a plugin (I haven't downloaded yet, mainly because I don't use Quicktime). I don't have Classic Media Player but I will download it and see if it can playback the problem files without the audio mapping issues.
I'll have to see if anyone in the Handbrake forum answers my query.

Thanks.

FYI the AC3 file within both the working and non-working files is a bit for bit copy of the original DVD AC3 5.1 audio.

Re: AC3 issues in H264 encoded .m4v

Posted: 02 Feb 2009 01:56
by Arite
FYI the AC3 file within both the working and non-working files is a bit for bit copy of the original DVD AC3 5.1 audio.
Interesting. Might be a container issue then.

Arite.

Re: AC3 issues in H264 encoded .m4v

Posted: 02 Feb 2009 02:29
by ERICSPEEd
I'll try .mp4 as a container. I could just change the file extension of the preexisting .m4v files but I'll do a new encoding with x264 and AC3 using .mp4 and see if that rectifies the problem.

Thanks

Re: AC3 issues in H264 encoded .m4v

Posted: 02 Feb 2009 13:41
by Arite
Well *.m4v file are techincally just the video stream. Since VLC doesn't rely on file extentions to determine the format renaming it shouldn't make any difference, however if the output container format can be changed it should.

You could extract the AC3 audio separately and then mux it alongside the separate video into e.g. an MKV file (or an MP4 file using mp4UI).

Arite.

Re: AC3 issues in H264 encoded .m4v

Posted: 03 Feb 2009 03:51
by ERICSPEEd
I did a "test" encode in Handbrake with H264 video and 5.1 AC3 audio with an .avi extension and it worked perfectly in stereo. I changed the .m4v extension on one of the faulty files to .mp4 but the audio was just as before, outta whack.
So it must be a bug in Handbrake and no fault of VLC.

Thanks for your responses and information Arite.

Have a good one.

P.S. Originally I was using .m4v because it was the default extension for H264 encoded videos within Handbrake.

Re: AC3 issues in H264 encoded .m4v

Posted: 03 Feb 2009 12:56
by VLC_help
You should try to demux the audio track out from that file using mp4box and try to playback the demuxed audio track. That way you can figure out where the issue is.

Re: AC3 issues in H264 encoded .m4v

Posted: 27 Mar 2009 03:33
by woodsse
Hefty bump here.

Does anyone know if the cause of the OP's problem was found. I am having the exact same issue. Handbrake 0.9.3 and VLC 0.9.8a. Any mp4/m4v that contains an ac3 track when played back in stereo ends up with the front channels going to the right and the rear channels going to the left. I can encode the same dvd segment into a mkv and playback is fine in VLC. Further, I can demux the audio from the mp4 that does not play correctly in VLC into an ac3 file and it plays back in VLC perfectly.

When I look at the codec information for the mp4 VLC reports the audio codec as "ac-3" but when I play the original DVD, the mkv, or just the demuxed ac3 file it reports the audio codec as "a52".

Trying to run down if this is a Handbrake issue or a VLC issue. Which ever it appears to be solely related to ac3 being contained in an mp4/m4v.

Thanks

Re: AC3 issues in H264 encoded .m4v

Posted: 27 Mar 2009 15:45
by VLC_help
This should be fixed in VLC 1.0.0, you can try nightlies.
http://nightlies.videolan.org/build/win32/?C=M;O=D (trunks are 1.0.0)

Re: AC3 issues in H264 encoded .m4v

Posted: 27 Mar 2009 17:01
by woodsse
I tried nightly vlc-0.9.9-rc2-20090327-0107-win32 and still experienced the issue. Is the fix actually in the nightlies or is it just scheduled for 1.0 but hasn't been committed yet?

EDIT: I apparently got my tard on. You clearly said trunk and I grabbed a branch. The latest trunk fixed the issue. Thanks for the help.

Re: AC3 issues in H264 encoded .m4v

Posted: 28 Mar 2009 22:24
by Jean-Baptiste Kempf
EDIT: I apparently got my tard on. You clearly said trunk and I grabbed a branch. The latest trunk fixed the issue. Thanks for the help.
Thanks for the report.