Linux Why won't XBMC play 5.1 audio if the source is mpeg2 (but will if it's ac3)?
#1
I'm hoping there is an easy answer to this because even though I am running XBMC under Linux I am not a very technically knowledgable person. I managed to set up Ubuntu Linux 12.04 LTS on an Acer Aspire Revo a couple years ago, and installed XBMC on it and have simply let it upgrade whenever a new upgrade was offered. I am currently running XBMC version 13.2 "Gotham".

My audio settings look like this:

Image

The problem I am having is that when I play live or recorded TV programs in Live TV, some of them play using full 5.1 audio but some of them don't. The difference seems to be that the ones that will play full 5.1 audio show as "Dolby Digital" where the ones that will only play in stereo show as "MPEG 2 Audio".

I was having some issues related to PulseAudio so I typically start XBMC using

AE_SINK=ALSA xbmc --standalone &

from a shell script (someone suggested I try that some time back and it has worked pretty well for me). I've seen that suggestion in a few other places, at least the AE_SINK=ALSA part, so I don't think that is the problem but please feel free to correct me if I am wrong.

The recordings will play in full 5.1 if I take them to a system that is running the Myth TV program. It is only if I try to play them in XBMC that they revert to stereo, and I can't understand why. In particular, I have a "channel check" recording that says "left channel, right channel, center channel, left surround, right surround" and if played in Myth all the channels come from the correct speakers but if played in XBMC they come from the front speakers only.

I am using S/PDIF output on my system because I have an older receiver, but we tried this on someone else's system and he has a newer receiver that accepts HDMI and he gets exactly the same result - anything that shows as Dolby plays in full 5.1, but if it doesn't it won't under XBMC but will play in 5.1 using Myth TV.

Is there any way to make XBMC play these MPEG 2 audio tracks in full 5.1 or is that something that XBMC simply cannot do?
Reply
#2
Under that last setting in your screenshot is another one to do with transcoding. Have you enabled that ?
Learning Linux the hard way !!
Reply
#3
Yes. Sorry, I didn't notice the slider there, here is the lower part of that screen:

Image
Reply
#4
debug log (wiki)
AppleTV4/iPhone/iPod/iPad: HowTo find debug logs and everything else which the devs like so much: click here
HowTo setup NFS for Kodi: NFS (wiki)
HowTo configure avahi (zeroconf): Avahi_Zeroconf (wiki)
READ THE IOS FAQ!: iOS FAQ (wiki)
Reply
#5
(2014-11-04, 00:50)Memphiz Wrote: debug log (wiki)

Huh? I'm not reporting a bug, at least not yet. I'm asking if there is a way to configure XBMC so it handles these types of files correctly.

Surely I'm not the first person to ever experience this?

Basically I'm at the stage where I'd just like to know if my audio configuration is correct.
Reply
#6
It is quite uncommon that "Mpeg-2 Audio" is more than 2.0 at all. If you want that to play on all speakers, enable Stereo Upmix.

To see the mediainfo of exactly that file, please post a Debug Log - cause this log shows us details auf the audio track.
First decide what functions / features you expect from a system. Then decide for the hardware. Don't waste your money on crap.
Reply
#7
thats what i ment...
AppleTV4/iPhone/iPod/iPad: HowTo find debug logs and everything else which the devs like so much: click here
HowTo setup NFS for Kodi: NFS (wiki)
HowTo configure avahi (zeroconf): Avahi_Zeroconf (wiki)
READ THE IOS FAQ!: iOS FAQ (wiki)
Reply
#8
Okay, this gets more and more curious.

I have a 5.1 test video in .ts format that is representative of the problem. It basically has color bars on the video and on the audio track there is a voice that says each of the channel names (except for the low frequency, where it uses a low frequency hum).

If you try to use a media identification program such as mediainfo on it, it will tell you that it has two stereo tracks and that is all.

HOWEVER...

If you play it in the MythTV frontend, each of the named channels come from the correct speakers. The Left, Right, Center, and low frequency are ONLY heard in their respective speakers. The Left Surround is heard from the left front and rear speakers, but at higher volume in the rear left speaker. The Right Surround is similar, it is heard from the right front and rear speakers, but at higher volume in the rear right speaker. This produces a very pronounced 5.1 effect, even though according to mediainfo there is no 5.1 in the file.

BUT if you play it in XBMC, XBMC identifies it as a 2.0 file but that's not how it is played! I didn't fully realize what XBMC is doing until I started listening very closely, and it's even more strange than I first suspected. As under MythTV, the Left, Right, Center, and low frequency are ONLY heard in their respective speakers. BUT when there is audio in EITHER of the surround channels, it is played like this: Left surround, played at lower volume on BOTH rear speakers, and at higher volume on the two front speakers, although the audio breaks up a bit on the right front speaker. Right surround, played at lower volume on BOTH rear speakers, and at higher volume on the two front speakers, although the audio breaks up a bit on the left front speaker. Since it is background audio the breakup on the opposite side speaker really isn't that noticeable unless you have a test recording such as this, and listen very carefully to what is coming out of each of the speakers in turn.

Again, this happens even though if you hit info (on a MCE Remote) the file is identified as an MPEG-2 2.0 file. Yet clearly there are more than two channels of audio there. The problem in XBMC is that the Left Surround and Right Surround channels don't seem to be mapped correctly (since they are appearing on both sides) and are coming out of the rear speakers at a much lower volume than they should be.

At this point nothing about this makes any sense. I have provided fritsch with a copy of the test file (Memphiz, I would have offered it to you also but you don't accept PM's, and I don't want to post it publicly, for reasons I need not go into here). I don't know if he's hearing the same thing I am but at least with that maybe he can make some sense of this.
Reply
#9
I have received that sample via PM. It looks quite interesting. The second audio track announces:

Code:
Audio #1
ID                                       : 64 (0x40)
Menu ID                                  : 137 (0x89)
Format                                   : MPEG Audio
Format version                           : Version 1
Format profile                           : Layer 2
Codec ID                                 : 3
Duration                                 : 1mn 6s
Bit rate mode                            : Constant
Bit rate                                 : 256 Kbps
Channel(s)                               : 2 channels
Sampling rate                            : 48.0 KHz
Compression mode                         : Lossy
Delay relative to video                  : -15ms
Stream size                              : 2.03 MiB (1%)
Language                                 : English

Audio #2
ID                                       : 65 (0x41)
Menu ID                                  : 137 (0x89)
Format                                   : MPEG Audio
Format version                           : Version 1
Format profile                           : Layer 2
Mode extension                           : Intensity Stereo + MS Stereo
Codec ID                                 : 3
Duration                                 : 1mn 6s
Bit rate mode                            : Constant
Bit rate                                 : 256 Kbps
Channel(s)                               : 2 channels
Sampling rate                            : 48.0 KHz
Compression mode                         : Lossy
Delay relative to video                  : -28ms
Stream size                              : 2.03 MiB (1%)
Language                                 : English

which I have never seen before. I forwarded the sample to you Memphiz and FernetMenta.
First decide what functions / features you expect from a system. Then decide for the hardware. Don't waste your money on crap.
Reply
#10
Ha conclusion - Kodi doesn't support this sort of audio format. Can you switch between stream 1 and 2 in XBMC?
AppleTV4/iPhone/iPod/iPad: HowTo find debug logs and everything else which the devs like so much: click here
HowTo setup NFS for Kodi: NFS (wiki)
HowTo configure avahi (zeroconf): Avahi_Zeroconf (wiki)
READ THE IOS FAQ!: iOS FAQ (wiki)
Reply
#11
Switching is possible. Kodi detects it as Stereo.
First decide what functions / features you expect from a system. Then decide for the hardware. Don't waste your money on crap.
Reply
#12
sounds complicated to me:

http://de.wikipedia.org/wiki/Kanalkopplung
AppleTV4/iPhone/iPod/iPad: HowTo find debug logs and everything else which the devs like so much: click here
HowTo setup NFS for Kodi: NFS (wiki)
HowTo configure avahi (zeroconf): Avahi_Zeroconf (wiki)
READ THE IOS FAQ!: iOS FAQ (wiki)
Reply
#13
Just another question to the OP:
Mythtv play _this_ recording? This very same file with all 6 channels? Or does it play the "original TV stream"?

Please post a debug log of mythtv playing the very same sample file you linked.
First decide what functions / features you expect from a system. Then decide for the hardware. Don't waste your money on crap.
Reply
#14
(2014-11-04, 22:02)fritsch Wrote: Just another question to the OP:
Mythtv play _this_ recording? This very same file with all 6 channels? Or does it play the "original TV stream"?

Yes, MythTV plays that same recording - I copied it back and played it to make sure.

One interesting difference I have noticed - when playing the file in MythTV the receiver front panel briefly displays either "THX Cinema 3/2.1" or "Dolby D 3/2.1" depending on which mode I have selected (strangely it makes absolutely no difference which is selected with regard to the playback). When playing the file in XBMC in either mode it displays only "PCM 48kHz".

(2014-11-04, 22:02)fritsch Wrote: Please post a debug log of mythtv playing the very same sample file you linked.

I have no idea if MythTV has a "debug log" or how you would access it - I know very little about the internals of Linux. I did look in /var/log and found that there is a /var/log/mythtv/ directory which contains several log files, none of which contain the word "debug", but only two of them have been recently written to, one called "mythbackend.log" (which is strange because there is no backend on this computer, it is a frontend only) and one called "mythfrontend.log", which seems like it would be most likely to hold the information you want. So here is what is contained in mythfrontend.log for the time period during which I played the file:

Code:
Nov  4 19:07:08 htpc mythfrontend[3519]: I CoreContext tv_play.cpp:987 (TV) TV: Creating TV object
Nov  4 19:07:08 htpc mythfrontend[3519]: N CoreContext mythmainwindow.cpp:2591 (PauseIdleTimer) Resuming idle timer
Nov  4 19:07:08 htpc mythfrontend[3519]: N CoreContext mythmainwindow.cpp:2586 (PauseIdleTimer) Suspending idle timer
Nov  4 19:07:08 htpc mythfrontend[3519]: I CoreContext tv_play.cpp:1206 (Init) TV: Created TvPlayWindow.
Nov  4 19:07:08 htpc mythfrontend[3519]: I CoreContext tv_play.cpp:2121 (HandleStateChange) TV: Attempting to change from None to WatchingVideo
Nov  4 19:07:09 htpc mythfrontend[3519]: I CoreContext audio/audiopulsehandler.cpp:320 (SuspendInternal) Pulse: PulseAudio suspend OK
Nov  4 19:07:09 htpc mythfrontend[3519]: N CoreContext audioplayer.cpp:167 (ReinitAudio) AudioPlayer: Enabling Audio
Nov  4 19:07:10 htpc mythfrontend[3519]: I CoreContext avformatdecoder.cpp:2102 (ScanStreams) AFD: Opened codec 0xa1a5a30, id(MPEG2VIDEO) type(Video)
Nov  4 19:07:10 htpc mythfrontend[3519]: I CoreContext avformatdecoder.cpp:1960 (ScanStreams) AFD: codec MP2 has 2 channels
Nov  4 19:07:10 htpc mythfrontend[3519]: I CoreContext avformatdecoder.cpp:2102 (ScanStreams) AFD: Opened codec 0x9970810, id(MP2) type(Audio)
Nov  4 19:07:10 htpc mythfrontend[3519]: I CoreContext avformatdecoder.cpp:1960 (ScanStreams) AFD: codec MP2 has 2 channels
Nov  4 19:07:10 htpc mythfrontend[3519]: I CoreContext avformatdecoder.cpp:2102 (ScanStreams) AFD: Opened codec 0x9970fa0, id(MP2) type(Audio)
Nov  4 19:07:10 htpc mythfrontend[3519]: I CoreContext audio/audiooutputbase.cpp:791 (Reconfigure) AO: Opening audio device 'iec958:CARD=NVidia,DEV=0' ch 2(2) sr 48000 sf signed 16 bit reenc 0
Nov  4 19:07:10 htpc mythfrontend[3519]: E CoreContext audio/audiooutputalsa.cpp:195 (SetPreallocBufferSize) ALSA: Setting hardware audio buffer size to 128
Nov  4 19:07:10 htpc mythfrontend[3519]: E CoreContext audio/audiooutputalsa.cpp:211 (SetPreallocBufferSize) ALSA: Error opening /proc/asound/card0/pcm1p/sub0/prealloc: Permission denied.
Nov  4 19:07:10 htpc mythfrontend[3519]: E CoreContext audio/audiooutputalsa.cpp:213 (SetPreallocBufferSize) ALSA: Try to manually increase audio buffer with: echo 128 | sudo tee /proc/asound/card0/pcm1p/sub0/prealloc
Nov  4 19:07:10 htpc mythfrontend[3519]: E CoreContext audio/audiooutputalsa.cpp:545 (OpenDevice) ALSA: Unable to sufficiently increase ALSA hardware buffer size - underruns are likely
Nov  4 19:07:10 htpc mythfrontend[3519]: E CoreContext audio/audiooutputalsa.cpp:975 (OpenMixer) ALSA: no playback control PCM found on mixer device default
Nov  4 19:07:10 htpc mythfrontend[3519]: E CoreContext audio/audiooutputalsa.cpp:550 (OpenDevice) ALSA: Unable to open audio mixer. Volume control disabled
Nov  4 19:07:11 htpc mythfrontend[3519]: I CoreContext mythrender_vdpau.cpp:1675 (CreatePresentationSurfaces) VDPAU: Created 2 output surfaces.
Nov  4 19:07:11 htpc mythfrontend[3519]: I CoreContext mythrender_vdpau.cpp:1709 (CheckHardwareSupport) VDPAU: Version 1
Nov  4 19:07:11 htpc mythfrontend[3519]: I CoreContext mythrender_vdpau.cpp:1716 (CheckHardwareSupport) VDPAU: Information NVIDIA VDPAU Driver Shared Library  331.20  Wed Oct 30 17:56:34 PDT 2013
Nov  4 19:07:11 htpc mythfrontend[3519]: I CoreContext mythrender_vdpau.cpp:401 (Create) VDPAU: Created VDPAU render device 1920x1080
Nov  4 19:07:11 htpc mythfrontend[3519]: N CoreContext mythplayer.cpp:506 (CheckExtraAudioDecode) Player(0): Forcing decode extra audio option on (Video method requires it).
Nov  4 19:07:12 htpc mythfrontend[3519]: I CoreContext mythplayer.cpp:1737 (InitAVSync) Player(0): Video timing method: USleep with busy wait
Nov  4 19:07:12 htpc mythfrontend[3519]: I CoreContext tv_play.cpp:5169 (StartPlayer) TV: Created player.
Nov  4 19:07:12 htpc mythfrontend[3519]: I CoreContext tv_play.cpp:2360 (HandleStateChange) TV: Changing from None to WatchingVideo
Nov  4 19:07:12 htpc mythfrontend[3519]: I CoreContext tv_play.cpp:2451 (HandleStateChange) TV: Main UI disabled.
Nov  4 19:07:12 htpc mythfrontend[3519]: I CoreContext tv_play.cpp:378 (StartTV) TV: Entering main playback loop.
Nov  4 19:07:12 htpc mythfrontend[3519]: I CoreContext screensaver-x11.cpp:149 (DisableDPMS) ScreenSaverX11Private: DPMS Deactivated 1
Nov  4 19:07:12 htpc mythfrontend[3519]: N CoreContext mythplayer.cpp:2078 (PrebufferEnoughFrames) Player(0): Waited 101ms for video buffers AAAAAAAAAAAAAL
Nov  4 19:07:12 htpc mythfrontend[3519]: I CoreContext mythrender_vdpau.cpp:587 (CheckOutputSurfaces) VDPAU: Added 2 output surfaces (total 4, max 4)
Nov  4 19:08:18 htpc mythfrontend[3519]: E Decoder avformatdecoder.cpp:4216 (ProcessAudioPacket) AFD: Unknown audio decoding error
Nov  4 19:08:18 htpc mythfrontend[3519]: E Decoder avformatdecoder.cpp:4379 (GetFrame) decoding error#012#011#011#011eno: Input/output error (5)
Nov  4 19:08:18 htpc mythfrontend[3519]: I CoreContext tv_play.cpp:2121 (HandleStateChange) TV: Attempting to change from WatchingVideo to None
Nov  4 19:08:18 htpc mythfrontend[3519]: I CoreContext mythpainter_vdpau.cpp:111 (ClearCache) VDPAU Painter: Clearing VDPAU painter cache.
Nov  4 19:08:18 htpc mythfrontend[3519]: W CoreContext mythpainter.cpp:32 (~MythPainter) MythPainter: 16 images not yet de-allocated.
Nov  4 19:08:19 htpc mythfrontend[3519]: I CoreContext audio/audiopulsehandler.cpp:320 (SuspendInternal) Pulse: PulseAudio resume OK
Nov  4 19:08:19 htpc mythfrontend[3519]: I CoreContext tv_play.cpp:2360 (HandleStateChange) TV: Changing from WatchingVideo to None
Nov  4 19:08:19 htpc mythfrontend[3519]: I CoreContext screensaver-x11.cpp:161 (RestoreDPMS) ScreenSaverX11Private: DPMS Reactivated 1
Nov  4 19:08:19 htpc mythfrontend[3519]: I CoreContext tv_play.cpp:2121 (HandleStateChange) TV: Attempting to change from None to None
Nov  4 19:08:19 htpc mythfrontend[3519]: I CoreContext tv_play.cpp:380 (StartTV) TV: Exiting main playback loop.
Nov  4 19:08:19 htpc mythfrontend[3519]: N CoreContext mythmainwindow.cpp:2591 (PauseIdleTimer) Resuming idle timer

I have no idea what I am looking at here so I don't know if it is helpful or not. I normally don't ever look at log files so I'm not even certain this is what you want to see, but if it isn't, I have no idea where it might be. I hope this is at least somewhat useful to you. By the way, the other file (mythbackend.log) contains nothing for that time period.
Reply
#15
Quote:Nov 4 19:07:10 htpc mythfrontend[3519]: I CoreContext avformatdecoder.cpp:1960 (ScanStreams) AFD: codec MP2 has 2 channels
Nov 4 19:07:10 htpc mythfrontend[3519]: I CoreContext avformatdecoder.cpp:2102 (ScanStreams) AFD: Opened codec 0x9970810, id(MP2) type(Audio)
Nov 4 19:07:10 htpc mythfrontend[3519]: I CoreContext avformatdecoder.cpp:1960 (ScanStreams) AFD: codec MP2 has 2 channels
Nov 4 19:07:10 htpc mythfrontend[3519]: I CoreContext avformatdecoder.cpp:2102 (ScanStreams) AFD: Opened codec 0x9970fa0, id(MP2) type(Audio)
Nov 4 19:07:10 htpc mythfrontend[3519]: I CoreContext audio/audiooutputbase.cpp:791 (Reconfigure) AO: Opening audio device 'iec958:CARD=NVidia,DEV=0' ch 2(2) sr 48000 sf signed 16 bit reenc 0

It also detects 2 channels. Makes me rather clueless. It seems it tunnels through pulseaudio. Can you get me: pactl list sinks please?
First decide what functions / features you expect from a system. Then decide for the hardware. Don't waste your money on crap.
Reply

Logout Mark Read Team Forum Stats Members Help
Why won't XBMC play 5.1 audio if the source is mpeg2 (but will if it's ac3)?0