[mythtv-users] Simultaneous analogue (analog) and S/PDIF output

Jean-Yves Avenard jyavenard at gmail.com
Fri Jan 14 13:27:50 UTC 2011


Hi

On 14 January 2011 22:42, Alex Butcher <mythlist at assursys.co.uk> wrote:
> Ideally, I'd like MythTV and ALSA combined to do what my PS2, XBox and cheap
> DVD player can do easily; output sensible analogue stereo at all times (I
> don't really care which combination of channels they use to generate the
> stereo pair when playing >2 channel soundtracks unless it can also be
> tweaked /as the content is playing/), and output PCM 2.0, Dolby Digital 2.0,
> 5.0, 5.1 or DTS over digital when any of those types of soundtracks are
> selected by the user.  Maybe some kind of advanced manual channel mapping
> for too, but that would just be making MythTV /better/ than appliances!

I know a cheap DVD player or STB receiver can do that.. But myth
can't. It can only handle one output at a time unfortunately. You can
play with the alsa configuration to simulate simultaneous output, but
ultimately myth can not output the digital DTS/AC3 stream while also
decoding it and outputting the decoded version.

The mythtv player has never been designed to do it, and its
architecture is fundamentally not design to handle it.

the issue isn't trivial either, because you inherently have
differences in delays and lags so handling AV-Sync with more than one
audio output is not possible with the current design.
By default myth does its AV sync by basing all timing on the audio
output. It can do AVSync based on the video timestamp instead, but
this has never worked anywhere as well as audio-based AV Sync.. AFAIK
video-based sync has been marked as experimental for years :P

Those cheap DVD player STB, don't have a problem. It's usually a
single chip solution doing all of that. Last I look, many if not most,
used a powerpc based chipset, it does it all: decode video, audio and
has multiple output.
In myth you have to deal with way more hardware configuration; it gets tricky

>
> From my testing, it would appear that currently, the choice is between
> solely analogue output, analogue output and only stereo AC3 over digital; or
> no analogue output and all types over digital.

stereo audio, AC3 or otherwise, is always decoded . So even if the
source is stereo AC3, it will be decoded and send via the main audio
device, not the digital one

The problem is people are now trying to use the passthrough audio
device for something that was never intended in the first place.

The only reason you had a separate digital audio device was to set the
IEC958 bit.
So in your main device you would put:
ALSA:iec958
and in the passthrough device you would put
ALSA:iec958:AES0=2 or 6 which set the iec958 digital mode...

that's it. Myth didn't know how to set the main audio device for
digital audio and relied on the user to do it.
In 0.23 , myth will now properly configure the audio device for
digital or analog ; making the passthrough device settings obsolete.

Now people started to use it to have distinguish between PCM/Analog
going to the main audio device, and passthrough going to another.
With connection like hdmi that supports more than 2 channels audio it
has made the problem very different.

If you want to easily achieve what you are looking for, you are better
off getting a hdmi amplifier ; now there you can completely remove
AC3/DTS digital audio and let myth decode everything and send LPCM
only. From there it's easy to configure alsa to mix the output to two
different devices.

> configuration, and found that setting AC3PassThru resulted in silence
> analogue output when playing UK DVB-T recordings (MPEG2, 2.0 audio). I'd
> rather have working analogue than >2.0 channel over digital.

If it's 2.0 audio, then the main audio device will always be used
unless upmixing is active.
The reason 2.0 digital audio is always decoded and never passthrough
is that it would break the upmixer. The upmixer only knows how to work
with a PCM stream. As the upmixer can be enabled at any time: 2.0
audio is always decoded and output as a stereo PCM.

So having AC3 or DTS checked when playing stereo audio has no effect
unless the upmixer is active.
If you have checked StereoPCM, or the main audio device only supports
2 channels and AC3 is uncked: then the upmixer is disabled (it would
be greyed in the settings if you didn't play with the database)

>
> I was hopeful that if I left AC3PassThru unset, unset StreoPCM, and set
> DTSPassThru, I could at least get DTS over digital from DVDs, but the sound
> from my receiver's speakers was distorted unless I also disabled
> MythControlsVolume (you alluded to this) but also silenced the analogue
> output when playing UK DVB-T recordings.

You are now back into the territory that you can not expect
multichannels audio to both digital output and main output. The only
way this can work is if your digital output is hdmi and supports
multichannels LPCM

For myth: one input -> one output. Period

> Yes, I read the note in the GUI that setting StereoPCM recodes >2.0 channel
> audio to 2.0 AC3.
it doesn't re-encode to 2.0 AC3, it re-encodes to multi-channels AC3
(usually 5.1)

It just happens that AC3 is carried over a stereo pcm stream.

> That must be a MythTV (0.24-fixes vs your tree or -trunk?) limitation then,
> as doing
>
> wget \
> "http://www.lynnepublishing.com/surround/www_lynnemusic_com_surround_test.ac3"
>
> mplayer -ao alsa:device=iec958 -ac hwac3
> www_lynnemusic_com_surround_test.ac3

but there you only output to the digital device.
not analog *and* digital at the same time, so how is this comparison relevant?

>
> works as one might expect, i.e. every channel gets the test sound that is
> intended for it, and only that sound.  Substituting 'alsa:device=digital-hw'
> for 'alsa:device=iec958' works the same way.  Substituting

according to your .asoundrc, digital-hw is the same as iec958, it's
just an alias. so why would it work differently?


you main problem is that you are starring at a wall saying very loudly
there's a door, when there's none.
turning around, jumping, repainting the wall, looking at it upside
down etc.. will never change the fact that there is no door; no matter
how long you try for.

i don't know in what language I should say it.. but you can not have
digital audio working at the same time as analog with mythtv.
You can output to both a PCM stream. But you can NOT output to one a
digital stream (AC3 or DTS) and a PCM one to another, myth can only
output ONE stream at a time.

I feel that we are now going in circle, and no matter how many times I
will say it you will keep trying to do otherwise playing with the
settings and wondering why it doesn't work.

So this is my last message on this topic. There is no bug in myth, it
is behaving exactly as designed.

Get a cheap STB or DVD player, it will do just what you want to do.


More information about the mythtv-users mailing list