Kodi 96kHz 8ch DTS outputs as 48kHz 8ch PCM
#1
Hello.
I understand that RPi 2 cannot pass-through DTS-HD and True-HD/Atmos audio stream and read about it a lot.
Meanwhile on this forum kodi team advises to disable pass-through, setup 7.1 ch output and enjoy 8ch HD audio output.
But... it doesn't work like that on my RPi 2B running Kodi 17 with OSMC.

What we have.
This demo file
https://www.demolandia.net/downloads.php?id=6357114
which is
Code:
15:15:47.839 T:1699476464    INFO: ffmpeg[654BF3F0]:     Stream #0:0(eng), 4, 1/1000: Video: h264 (High), yuv420p, 1920x1080, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
15:15:47.840 T:1699476464    INFO: ffmpeg[654BF3F0]:     Stream #0:1(eng), 16, 1/1000: Audio: dts (DTS-HD MA), 96000 Hz, 7.1, s32p (24 bit) (default)

This is how Kodi sees file
Code:
15:04:08.049 T:1263530992   DEBUG: COMXAudio::Initialize Input bps 32 samplerate 96000 channels 8 buffer size 4608000 bytes per second 3072000
15:04:08.049 T:1263530992   DEBUG: pcm->direction      : input
15:04:08.049 T:1263530992   DEBUG: pcm->nPortIndex     : 0
15:04:08.049 T:1263530992   DEBUG: pcm->eNumData       : 0
15:04:08.050 T:1263530992   DEBUG: pcm->eEndian        : 1
15:04:08.050 T:1263530992   DEBUG: pcm->bInterleaved   : 1
15:04:08.050 T:1263530992   DEBUG: pcm->nBitPerSample  : 32
15:04:08.051 T:1263530992   DEBUG: pcm->ePCMMode       : 0
15:04:08.051 T:1263530992   DEBUG: pcm->nChannels      : 8
15:04:08.051 T:1263530992   DEBUG: pcm->nSamplingRate  : 96000
15:04:08.051 T:1263530992   DEBUG: COMXAudio::Initialize device passthrough 0
15:04:08.051 T:1263530992    INFO: Audio codec  channels 8 samplerate 96000 bitspersample 32

This is how Kodi sends audio to my AVR

Code:
15:04:08.052 T:1263530992   DEBUG: COMXAudio::Decode ADec : setStartTime 0.000000
15:04:08.056 T:1958871040   DEBUG: COMXCoreComponent::Deinitialize : OMX.broadcom.image_decode handle 0x4f65538
15:04:08.059 T:1958871040   DEBUG: COMXCoreComponent::Deinitialize : OMX.broadcom.egl_render handle 0x4c6bdb8
15:04:08.059 T:1263530992   DEBUG: COMXCoreComponent::Initialize OMX.broadcom.audio_mixer input port 232 output port 231 m_handle 0x6e2391d8
15:04:08.060 T:1958871040   DEBUG: DecodeJpegToTexture: decoded special://skin/backgrounds/media-overlay.jpg 1280x720
15:04:08.062 T:1263530992   DEBUG: COMXCoreComponent::Initialize OMX.broadcom.audio_render input port 100 output port 100 m_handle 0x6e22ddc0
15:04:08.062 T:1263530992    INFO: COMXAudio::ApplyVolume - Volume=1.00 (* 1.00 * 1.00)
15:04:08.063 T:1958863856   DEBUG: CAnnouncementManager - Announcement: OnAdd from xbmc
15:04:08.063 T:1263530992   DEBUG: COMXAudio::PortSettingsChanged - Output bps 16 samplerate 48000 channels 8 buffer size 4608000 bytes per second 1536000
15:04:08.063 T:1263530992   DEBUG: pcm->direction      : output
15:04:08.063 T:1263530992   DEBUG: pcm->nPortIndex     : 231
15:04:08.063 T:1263530992   DEBUG: pcm->eNumData       : 0
15:04:08.063 T:1958863856   DEBUG: GOT ANNOUNCEMENT, type: 2, from xbmc, message OnAdd
15:04:08.064 T:1263530992   DEBUG: pcm->eEndian        : 1
15:04:08.064 T:1263530992   DEBUG: pcm->bInterleaved   : 1
15:04:08.064 T:1263530992   DEBUG: pcm->nBitPerSample  : 16
15:04:08.064 T:1263530992   DEBUG: pcm->ePCMMode       : 0
15:04:08.064 T:1263530992   DEBUG: pcm->nChannels      : 8
15:04:08.064 T:1263530992   DEBUG: pcm->nSamplingRate  : 48000
15:04:08.066 T:1263530992   DEBUG: COMXAudio::PortSettingsChanged - bits:32 mode:0 channels:8 srate:96000 nopassthrough

Why Kodi downsamples audio ?
What can I do to make same sample rate output ?

Full log is here
http://paste.ubuntu.com/25547476/
Reply
#2
First disable omxplayer in video/acceleration (that is only recommended for Pi0/Pi1 users).
Also what does "tvservice -a" report?

(also note you are underclocking the Pi - arm_freq=850 when the default is 900).
Reply
#3
Thanx @popcornmix
Disabling of omxplayer solved my problem. Whereas i'm running RPi 2B
What is proc/cons of disabling it ?
What kind of files i will not be able to play ?

p.s.
Here is my tvservice -a
Code:
root@kodi:/home/osmc# /opt/vc/bin/tvservice -a
     PCM supported: Max channels: 8, Max samplerate: 192kHz, Max samplesize 24 bits.
     AC3 supported: Max channels: 6, Max samplerate:  48kHz, Max rate  640 kb/s.
     DTS supported: Max channels: 6, Max samplerate:  96kHz, Max rate 1536 kb/s.
  DTS_HD supported: Max channels: 8, Max samplerate: 192kHz, Max rate    8 kb/s.

p.p.s.
Thanx for pointing me at CPU clock.
Have no clue how i could downclock myself Rolleyes
Reply
#4
omxplayer is a much more basic GPU side video player that is recommended on pi0/pi1 where arm side cpu is very limited
but it doesn't benefit from new features and improvements added kodi's default VideoPlayer.

omxplayer is disabled by default on Pi2/Pi3 and should be left that way.
Reply
#5
Well.... i found that some of my music video clips started to freeze during playback with MMAL which i never experienced before...
Cat it be fixed ?

Especially this one, it playbacks almost like there is no HW acceleration at all
Code:
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : Main@L5
Format settings                          : CABAC / 3 Ref Frames
Format settings, CABAC                   : Yes
Format settings, RefFrames               : 3 frames
Format settings, GOP                     : M=4, N=25
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 3 m. 24 s.
Bit rate mode                            : Variable
Bit rate                                 : 74,6 Mbit/sec
Maximum bit rate                         : 90,0 Mbit/sec
Width                                    : 1920 pixels
Height                                   : 1080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 25,000 frames/sec
Standard                                 : PAL
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bit
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 1.439
Stream size                              : 1,78 Gbytes (100%)
Language                                 : English
Encoded date                             : UTC 2014-12-01 17:00:45
Tagged date                              : UTC 2014-12-01 17:00:45
Color range                              : Limited
Reply
#6
Where are you playing file from? Network or attached drive? Wireless or wifi?
Reply
#7
USB HDD.
Attached.
Foreseeing your possible question i would like to share read speed from hdd:
Code:
# time cp Seekae\ -\ Stars\ Below.mp4 /dev/null

real    1m4.789s
user    0m0.100s
sys     0m9.510s

File size is 1 869 604 kbytes
Copying took 64 seconds
Means hdd read speed is 29212 kbytes / sec = 28.5 mbytes / sec = 228 mbit/sec
Whereas maximum video stream bitrate is 90 - 100 mbit.

I guess bottle neck is not read speed.
Reply
#8
Can you provide a sample (e.g. 1 minute) of a file which has the issue? I can then test it.
Reply
#9
Thank you for support.
Check PM.
Reply
#10
Okay, I've tested your file. The problem is:
Code:
Bit rate                                 : 74.6 Mb/s
Maximum bit rate                         : 90.0 Mb/s

This is very high for 1080p25 video. Note raw BluRay has a limit of 40Mb/s for video, so this is close to double BluRay "quality".
Really it's just unwise settings being selected when encoding.

However the file did play without issue for me from an nfs share on a Pi3.
I got 3 skips at start of playback (that happens with all files) but no more skips or drops at end of file.
It didn't buffer apart from at very start.

One difference between pi2 and pi3 is a slightly higher gpu clock frequency on pi3.
Can you try adding "gpu_freq=400" to config.txt? Any different?
Reply
#11
@popcornmix thank you so much.
You are the greatest!

After i set gpu_freq=500 playback become smoother but still i had some flicks and frame drops.
Then added this to  advancedsettings.xml

Code:
   <advancedsettings>
      <cache>
        <buffermode>1</buffermode>
        <memorysize>104857600</memorysize>
        <readfactor>20</readfactor>
      </cache>
    </advancedsettings>


And now it seems everything works like a charm.


Here is my config.txt for whom it may help:

Code:
gpu_mem_1024=256
gpu_mem_512=144
gpu_mem_256=112
hdmi_ignore_cec_init=1
disable_overscan=1
start_x=1
disable_splash=1
dtoverlay=lirc-rpi
dtparam=gpio_in_pin=18
dtparam=gpio_out_pin=17
initial_turbo=0
arm_freq=950
over_voltage_sdram=1
gpu_freq=500
over_voltage=2
temp_limit=80
force_turbo=0
sdram_freq=500
max_usb_current=1

Thank you once again.
</thread>
Reply

Logout Mark Read Team Forum Stats Members Help
Kodi 96kHz 8ch DTS outputs as 48kHz 8ch PCM0