Jump to content

[GUIDE] Kodi on Orange Pi 5 with GPU Hardware Acceleration and HDMI Audio


adr3nal1n27

Recommended Posts

@dkg It seems like your cec-client is missing the linux cec framework api, but with what do you want to use it? If it's with kodi you'll need to configure this before you compile it.

 

If you want to use cec-client outside of kodi, you could try to compile a new one. First remove the installed version.

apt-get update
apt-get install cmake libudev-dev libxrandr-dev python-dev swig
git clone https://github.com/Pulse-Eight/libcec.git
mkdir libcec/build
cd libcec/build
cmake -DHAVE_LINUX_API=1 ..
make -j8
sudo make install
sudo ldconfig

 

Edited by royk
Link to comment
Share on other sites

Have you already tried the official Kodi repository? 

 

The Kodi version for Ubuntu unfortunately has internally linked libcec and does not use libcec via the system library. 

 

Unfortunately, I don't have a system to test right now. I can check next week.

Link to comment
Share on other sites

@dkg When I tried to build libcec from github repo I had some headers missing related to RPi implementation, so I disabled RPi API at all. Built cec-client can't find cec device in the board. Did you have similar issue? Did you have additional setup for libcec build?

Link to comment
Share on other sites

But it works with kodi, so, problem is resolved, thank you all.

 

@dkg I would use LD_PRELOAD instead of replacing system libs

 

In general, if someone is interested in headless kodi - It works nice even without installing DE.

Edited by Alex D
Link to comment
Share on other sites

@dkg I'll check on weekend

 

@Dbosco Just try to build as royk mentioned

On 4/3/2023 at 9:24 PM, royk said:
apt-get update
apt-get install cmake libudev-dev libxrandr-dev python-dev swig
git clone https://github.com/Pulse-Eight/libcec.git
mkdir libcec/build
cd libcec/build
cmake -DHAVE_LINUX_API=1 ..
make -j8
sudo make install
sudo ldconfig

 

Link to comment
Share on other sites

@Alex D thanks, i've tried that, and this is the error:

 

make -j8
Scanning dependencies of target cec_swig_compilation
[  4%] Building CXX object src/libcec/CMakeFiles/cec.dir/CECClient.cpp.o
[  4%] Swig compile libcec.i for python
[  9%] Building CXX object src/libcec/CMakeFiles/cec.dir/adapter/RPi/RPiCECAdapterCommunication.cpp.o
[  9%] Building CXX object src/libcec/CMakeFiles/cec.dir/LibCECC.cpp.o
[ 13%] Building CXX object src/libcec/CMakeFiles/cec.dir/LibCEC.cpp.o
[ 13%] Building CXX object src/libcec/CMakeFiles/cec.dir/CECProcessor.cpp.o
[ 15%] Building CXX object src/libcec/CMakeFiles/cec.dir/adapter/RPi/RPiCECAdapterMessageQueue.cpp.o
[ 18%] Building CXX object src/libcec/CMakeFiles/cec.dir/adapter/RPi/RPiCECAdapterDetection.cpp.o
/home/dani/libcec/src/libcec/adapter/RPi/RPiCECAdapterDetection.cpp:40:10: fatal error: interface/vmcs_host/vc_cecservice.h: No such file or directory
   40 | #include <interface/vmcs_host/vc_cecservice.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [src/libcec/CMakeFiles/cec.dir/build.make:132: src/libcec/CMakeFiles/cec.dir/adapter/RPi/RPiCECAdapterDetection.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from /home/dani/libcec/src/libcec/adapter/RPi/RPiCECAdapterCommunication.cpp:37:
/home/dani/libcec/src/libcec/adapter/RPi/RPiCECAdapterCommunication.h:45:10: fatal error: interface/vmcs_host/vc_cecservice.h: No such file or directory
   45 | #include <interface/vmcs_host/vc_cecservice.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [src/libcec/CMakeFiles/cec.dir/build.make:146: src/libcec/CMakeFiles/cec.dir/adapter/RPi/RPiCECAdapterCommunication.cpp.o] Error 1
In file included from /home/dani/libcec/src/libcec/adapter/RPi/RPiCECAdapterMessageQueue.cpp:37:
/home/dani/libcec/src/libcec/adapter/RPi/RPiCECAdapterMessageQueue.h:41:10: fatal error: interface/vmcs_host/vc_cecservice.h: No such file or directory
   41 | #include <interface/vmcs_host/vc_cecservice.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [src/libcec/CMakeFiles/cec.dir/build.make:160: src/libcec/CMakeFiles/cec.dir/adapter/RPi/RPiCECAdapterMessageQueue.cpp.o] Error 1
[ 18%] Built target cec_swig_compilation
make[1]: *** [CMakeFiles/Makefile2:261: src/libcec/CMakeFiles/cec.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

Thanks!

Link to comment
Share on other sites

@Dbosco Perhaps you didn't uninstall the version with support for RPI. Try to install libcec again with:

cmake -DCMAKE_INSTALL_LIBDIR:PATH='lib/aarch64-linux-gnu' -DCMAKE_INSTALL_PREFIX:PATH='/usr' -DHAVE_LINUX_API=1 ..

make -j8 && sudo make install

 

For Kodi run "make clean" and your cmake command first before you run make again, otherwise it will make the config it made before 

Edited by royk
Link to comment
Share on other sites

@royk you're right i didn't uninstall correctly the previous version, only purge without --auto-remove. Now working! Thank you!

 

I've another issue in Kodi regard passtrough, unfortunately for me is not working properly. I've tried the config of this guide, Martivo with ansible, Joshua Riek, the following one (adding DP port as well)


 


And unfortunately the audio output is always distorted, with noises, like when you send an incompatible digital format to TV or AV

The official Orange android version works as expected, also my previous setup with Odroid C4. So it seems that there is some config that is incompatible with my TV (TCL 2022)

 

OPI5 -> TV -> Sony sound bar (ARC)

 

I've tried unplugging  Sony sound bar, but no luck

In internet I've found several guides and tips, modifying alsa daemon, changing sample and other stuff.

Also tried to use only Alsa disabling Pulse, same behavior

 

Tested with Kodi, VLC, various media files, all distros available for OPI5

Various HDMI cables

HDMI audio extractor

Do you have any suggestion?

 

Thanks
 

Edited by Dbosco
Link to comment
Share on other sites

@Dbosco This is probably because of the audio device naming rule, I think this is a copied broken fix.

Try:

sudo rm /etc/udev/rules.d/90-naming-audios.rules

 

What Martivo has should work then.

 

At least for eac3 ac3 and dts. With Alsa some other formats might work. dts-hd could only work with alsa, but it doesn't. I've no idea why yet. Some things I found: Intel had the issue that the channel mapping order was not right, rpi soundchip only accepts one format "IEC958_SUBFRAME_LE".

 

I think for the moment pulseaudio works best because then kodi decodes the non supported passthrough audio and plays it as multichannel, this way you should be able to play all movies with multichannel audio.

Edited by royk
Link to comment
Share on other sites

@royk

sudo rm /etc/udev/rules.d/90-naming-audios.rules
rm: cannot remove '/etc/udev/rules.d/90-naming-audios.rules': No such file or directory

 

rules.d:% ls
10-wifi-disable-powermanagement.rules  11-rockchip-multimedia.rules  50-usb-realtek-net.rules  99-rk-device-permissions.rules

 

I've looked here: /usr/lib/udev/rules.d and found:

 

90-alsa-restore.rules

90-console-setup.rules

90-libinput-fuzz-override.rules

90-nm-thunderbolt.rules

90-pipewire-alsa.rules

90-pulseaudio.rules

 

and tried to remove only this one 90-pulseaudio.rules, but no luck

 

I'm only trying to get AC3 and AAC

 

is there others folders with rules.d ?

 

will check this one IEC958_SUBFRAME_LE and let you know

 

 

Thanks again for your time and support

 

 

 

Link to comment
Share on other sites

@Dbosco 

Quote

will check this one IEC958_SUBFRAME_LE and let you know

That will not work

 

You shouldn't had to rm 90-pulseaudio.rules, I hope you only moved it instead of removing.

What is in /etc/udev/rules.d/11-rockchip-multimedia.rules

 

Be sure you've got in the file: /usr/share/alsa/cards/HDMI-OUT.conf

# configuration for HDMI connection which just expose the
# audio out device

<confdir:pcm/hdmi.conf>

HDMI-OUT.pcm.hdmi.0 {
        @args [ CARD DEVICE CTLINDEX AES0 AES1 AES2 AES3 ]
        @args.CARD { type string }
        @args.DEVICE { type integer }
        @args.CTLINDEX { type integer }
        @args.AES0 { type integer }
        @args.AES1 { type integer }
        @args.AES2 { type integer }
        @args.AES3 { type integer }
        type hw
	card $CARD 
}

 

And in /usr/share/alsa/cards/aliases.conf the line: 

rockchip-hdmi0 cards.HDMI-OUT

 

 

Then:

sudo alsa force-reload && pulseaudio -k && pulseadaudio -D

 

Then open pulseaudio volumecontrol: in "Configuration" only enable hdmi" set this on STEREO, then go to "Output devices" -> advanced and enable the passthrough functions 

 

 

Now you're able to passthrough dts and ac3, but not aac, dts-hd. This is why you could better set pulseaudio at 5.1/7.1 and let kodi the decoding do.

 

Otherwise you could try ALSA, assuming you're running it on GBM:

sudo nano /usr/share/wayland-sessions/kodi.desktop

And change:

Exec=kodi-standalone
to:

Exec=pasuspender -- env KODI_AE_SINK=ALSA kodi-standalone

 

Edited by royk
Link to comment
Share on other sites

@royk i didn't remove 90-pulseaudio.rules, but now is back in place

 

What is in /etc/udev/rules.d/11-rockchip-multimedia.rules

 

KERNEL=="mpp_service", MODE="0660", GROUP="video"
KERNEL=="rga", MODE="0660", GROUP="video"
KERNEL=="system-dma32", MODE="0666", GROUP="video"
KERNEL=="system-uncached-dma32", MODE="0666", GROUP="video" RUN+="/usr/bin/chmod a+rw /dev/dma_heap"

 

HDMI-OUT and card alias were correctly added

 

As suggested I've disabled other devices, and kept only HDMI

 

did this " sudo alsa force-reload && pulseaudio -k && pulseadaudio -D " and also a reboot

 

Unfortunately the issue persists

 

as example I've attached a recording of the audio output that i've when i'm trying to play ac3

 

 

 

Screenshotfrom2023-04-0717-02-38.thumb.png.404d7c4034be67d5fb9bff2051cf95cc.png

 

7 abr. 17.08​.aac

Link to comment
Share on other sites

@Dbosco Because you've installed the ansible of Martivo, you could try to edit the asound.conf to:

/etc/asound.conf

<confdir:pcm/dca.conf> 
defaults.pcm.dca.iec61937 1

Or:

<confdir:pcm/dca.conf>
defaults.pcm.dca.aes0 0x04

 

Then:

sudo alsa-force-reload && pulseaudio -k

pulseaudio -D

 

in pulseaudio you should see a hdmi/dts device. Choose that device.

 

I guess you already have this installed, but you could run: sudo apt install libswresample3

 

If this doesn't work, you could try to set pulseaudio back to hdmi stereo, then in kodi set the audio output to 2.0 and at passthrough options disable all formats except ac3 and enable ac3 transcoding

 

You could also try these with alsa, so 6 options to try.

I don't have other ideas at the moment, but will search further for hbr passthrough.

Edited by royk
Link to comment
Share on other sites

@royk

Tried everything and for some reason now is working with the hdmi audio extractor. OPI to TV no way to do it

There is probably some incompatibility issue between the OS and my TV, but at least now is ok. More cables and stuff but with Dolby and happy

Thanks again for your time


Enviado desde mi MI 8 SE mediante Tapatalk

Link to comment
Share on other sites

11 hours ago, amielke said:

I installed the Debian package from libcec and CEC works on Ubuntu with that as well


Strange that Ubuntu package is broken ...

 

but we have a nice mechanism to workaround such issues. Synchronising applications with Armbian repositories:
https://github.com/armbian/os/pull/34 Once this gets merged it will automatically sync libcec from Debian to (our) Ubuntu Jammy repository and manual hacking won't be needed anymore. This covers Ubuntu Jammy, for Lunar (if needed) a similar new config file has to be created.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines