[MEncoder-users] losing 5.1 audio on -oac copy transcode

Scott Larson scowl at pacifier.com
Mon Sep 15 09:12:19 CEST 2008

On Sun, 2008-09-14 at 08:00 -0500, Dan Shoup wrote:
> I have an mpg file that uses AC3 5.1 surround sound.  I am trying to transcode, but having a difficult time getting 5.1 sound in the output file.  My transcoding settings are:
> Mencoder.exe -i "E:\GBPVR\Dir\filename.mpg” -of avi -oac copy -ovc xvid -xvidencopts fixed_quant=4 -vf scale=1024:576 -o “E:\GBPVR\Dir\filename.avi”
> This workes (file transcodes and is playable play), but the file plays with 2-channel audio in most players.  If I play it with mplayer, it also plays with 2-channel audio by default, but I can get 5.1 if  I force it with -afm hwac3 -channels 6.  The original file does not have any problems playing in 5.1 on any audio player (except mplayer, but will work if I specify -afm hwac3 -channels 6), so it seems something in the transcoding process is causing this problem.  I’m guessing it simply has the wrong header information (Mencoder identifies the original file as AC3 2 channel when it starts transcoding despite the fact that the 6 channels are actually there…so it is probably passing this misinformation to the transcoded file).  

I experienced this with at least an old version of mencoder. The problem
was that the audio at the beginning of the file was actually AC3 2.0 (a
commercial) before the station switched it to AC3 5.1. mencoder was
seeing the initial audio format (and printing it as such, like in your
case) and assuming the audio in the entire file was the same format.
This also caused A/V sync problems in my case since the AC 2.0 section
was a lower bit rate.

The solution was to use increasing large values to the -sb option until
mencoder would skip over the initial AC3 2.0 section. mencoder would
then print that the audio format of the file was AC 5.1 and everything
worked fine after that.

I don't know if the latest version of mencoder has fixed this problem of
copying AC3 audio with changing bit rates and formats.

More information about the MEncoder-users mailing list