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

bluesky at caramail.com bluesky at caramail.com
Wed Nov 5 18:08:54 CET 2014


"Moritz Barsnick" <barsnick at gmx.net> wrote:

> This is the technicality which needs to be understood. If the source is
> what Carl Eugen has identified, there is no digital indication that
> this is "Dolby Surround". You will identify two channels which can be
> played on stereo output, and will sound like a down-mix of surround
> material on stereo. Yet in these two channels, there is a mixture of
> four or six audio channels. If you know how to "decode" them, you can
> separate them. Actually, you should be able to detect this surround
> encoding if you analyze the audio waveforms, but this may mean actually
> decoding them and checking whether the "extra" channels contain sound.
> (My hardware decoder creates pseudo-surround effects from plain stereo
> material by the way, due to the way it "tries" to decode 6 from 2
> channels and the audio's phases.)

I might actually believe I was hearing pseudo-surround in MythTV if I did not have the one test recording that clearly and unambiguously states the name of each channel as it plays.  Apparently, by luck or by design, the MythTV people have stumbled onto a way to play these types of recordings correctly.  If they have figured it out, I would think it's not an impossible thing for someone who understands what they are doing.  But that said...

> Actually, a lot of digital TV channels broadcast their movies with
> surround sound like this, i.e. using two channels, but still containing
> surround. Mostly this is the case when they don't have 6 channels
> available. This is very common in broadcast, from my experience.

In the test file I have, on the video there is a line that says "Dolby E", which I never paid much attention to because none of the audio streams identify as ac3 format and because you could write what I know about Dolby on the head of a pin.  There is a page about Dolby E at http://wiki.multimedia.cx/index.php?title=Dolby_E but I do not know if it is applicable in this situation.

I also found mentions of Dolby E here https://forum.videolan.org/viewtopic.php?f=18&t=81323 and here http://www.videoredo.net/msgBoard/showthread.php?28982-Dealing-with-Dolby-E&s=9c4d4a18d25bf5b63595673bdaec178b

There is a program that supposedly can convert E-AC3 audio tracks at http://www.addictivetips.com/windows-tips/how-to-convert-dolby-truehd-and-e-ac3-audio-tracks-into-other-audio-formats-with-eac3to/ but it appears to be a Windows only program (there is a line in the article that claims that it works in Linux but when you go to this thread http://forum.doom9.org/showthread.php?t=125966 it appears to be a very Windows-centric program). A Windows program does me no good, especially if it in turn depends on the installation of other types of Windows software, because I have no computers running Windows (my desktop is OS X and the system I want to convert these files on is Linux).

I had originally thought that because the original file's audio is MPEG2 that perhaps something like mctooLAME (http://sourceforge.net/projects/mctoolame/?source=typ_redirect) would be helpful but the more comments I hear about it the more I suspect we are dealing with E-AC3 (Dolby E) here, though I don't understand how that can be possible if the audio tracks identify as MPEG2.

> Basically, ffmpeg currently can neither detect nor decode this
> encoding. I think decoding it would require something like an audio
> filter.

I understand that but it still begs the question of how MythTV pulls it off.  In case I didn't mention it, I am not a technically-inclined person and definitely not a programmer, so most of the material in the above links is way over my head.  I don't even know for sure that this is E-AC3 and I have not even found a utility that will positively identify E-AC3.  And yet it appears that somehow the MythTV people alone have it all figured out, at least as far as being able to play it correctly without the need for Windows or a bunch of additional software.

> Since it's easy to find algorithms (i.e. matrices) for encoding but not
> for decoding, I am guessing that the latter may be a much tougher task.
> It's not as easy as inverting the matrix. I'm no smarter than Carl
> Eugen concerning this. Here's the only description I have found of the
> process, and it looks very DSPish (if not analog):

> http://www.eetimes.com/document.asp?doc_id=1225389

> See figure 5 for a summarizing diagram. No C source code provided
> though. ;-)

All of that was way beyond my understanding.  I don't know if any of the links I have provided above will prove to be any more helpful, but perhaps there will be something in one of those that makes sense to you guys.  I'm already in way over my head here - I had no idea that this might be something complicated, because I just assumed that if MythTV can decode these signals then it must not be too difficult.  But then I honestly have no idea what is actually involved, nor the slightest clue how MythTV does it.


More information about the ffmpeg-user mailing list