[FFmpeg-user] How can I convert mpeg2 5.1 audio to ac3?

bluesky at caramail.com bluesky at caramail.com
Tue Nov 4 17:56:08 CET 2014


"Carl Eugen Hoyos" <cehoyos at ag.or.at> wrote:

>> If I play the same file in XBMC only the front
>> speakers are used.

> How is your computer connected to your receiver?
> I can choose here between analog, hdmi and
> TOSLINK (optical). If I use hdmi or the optical
> input, my receiver allows me to switch the
> "listen mode": As suspected, the audio uses
> Dolby PLII to encode surround sound via stereo
> channels. If I select "PLII" on my receiver, I
> hear the surround sound (with failures because
> the algorithm cannot be perfect).
> If I use the analog input, I have to force the
> receiver to "two-channel" input to make it
> detect PLII: If I set it to 6-cable input
> (which is what I normally use), I cannot choose
> PLII.

Well that is interesting.  My computer is connected to my receiver via a S/PDIF (Toslink optical) cable but I know someone else who has encountered the same issue and he is using a HDMI connection, the difference being that I don't think he ever hears audio from his rear speakers when playing in XBMC (but he does in Myth, same as I do).

> As said, FFmpeg does not support PLII decoding
> (only encoding). Are you sure MythTV contains
> an internal implementation and not does not use
> your receiver's Dolby decoder?

I know nothing about how MythTV handles audio so the short answer to that is "no".

> Just to make things less confusing: Above has
> nothing to do with "mpeg2": You can use any
> audio codec that supports two channels and
> use it to store PLII-encoded surround sound.

That would explain everything, except why Myth can play this audio and XBMC can't (well actually it does, but it does a poor job of it - see below).

> There is also "MPEG-2 5.1" or "MPEG-2
> Multichannel". This is very rare and FFmpeg
> cannot detect it (nor decode it). I don't
> think your file can use both Dolby PLII and
> MPEG-2 Multichannel at the same time.

Do you know of any utility that can tell me if any of these lesser-known methods are being used?

> Wikipedia articles for Dolby PLII, toslink and
> MPEG-2 Multichannel exist.

Thank you.  I'm aware of Toslink but will look up the other two.

It turns out that the reason I thought XBMC was not playing anything from the rear speakers is because I did not have my ear right up next to them.  When I play the test video in XBMC, what actually happens is this:

Left, Right, Center, and the low frequency hum all play from the correct speakers and NOT from any other speakers.
Left Surround plays at significantly reduced volume from BOTH the left and right rear speakers, at normal volume from the left front speaker, and at normal volume but with breakups from the right front speaker!
Right Surround plays at significantly reduced volume from BOTH the right and left rear speakers, at normal volume from the right front speaker, and at normal volume but with breakups from the left front speaker!

This happens whether I play the original .TS file or the file that I attempted to convert using ffmpeg - it sounds exactly the same; I just never heard the rear speaker audio because the front is so much louder.

But as noted, if I play it in MythTV then all the audio comes from the correct spearlers - which is to say, Left, Right, Center, and the low frequency hum all play from the correct speakers and NOT from any other speakers.  The left and right surrounds both play from the speakers on their respective sides, but louder from the rear speakers than the front, and not on the opposite side's speakers as they do in XBMC.

>From what you are telling me, I'm guessing that ffmpeg cannot decode this signal and break it out to individual channels which can then be properly re-encoded as six channel ac3, but instead can only pass it through.  Is there a reason ffmpeg cannot do this or is it simply that no one has figured out a way to do it (yet)?  

In any case I thank you for the explanation - you are the first person that hasn't in effect tried to tell me I'm crazy for hearing 5.1 audio in this thing when I play it in MythTV.  I will read those Wikipedia pages you mentioned.


More information about the ffmpeg-user mailing list