Possible to change/force Bluetooth codec (SBC to AAC)?

  • Recently got a pair of Bose QC 45's and wanted to use them within LE. Unfortunately out-of-the-box they connect using SBC with low quality settings which results in really bad audio quality, and I'm wondering if it's possible to get AAC up and running using the following setup:

    LE 9.2.8 (old I know ... compatibility issues)

    RPi3B

    Logilink Bluetooth dongle (RTL8761B chipset)

    This is the config set automatically on connection:

    Support for AAC is reported (but not used):

    Is AAC possible with this setup? If not, would it be with newer LE version? Or building from source? Any hints are appreciated.

  • Does your dongle work with AAC on a regular PC?

    It does yes, AAC works with this dongle on a PC running W11. Currently I'm testing with an image built from source (LE 11.0.3) with Pipewire support enabled, which supposedly supports AAC among others. I have no idea where to start to configure it though. Out-of-the-box SBC is being used once again and the only real documentation for configuring Pipewire seems to be using Wireplumber:

    Quote

    WirePlumber is a modular session / policy manager for PipeWire and a GObject-based high-level library that wraps PipeWire’s API, providing convenience for writing the daemon’s modules as well as external tools for managing PipeWire.

    Which isn't included with the Pipewire support in LE.

  • Sorry, I don't understand what that means. This is way out of my comfort zone and I don't understand what's what here. Is it not possible to use Pipewire instead of Pulseaudio?

    I tried adding KODI_PIPEWIRE_SUPPORT in addition to PIPEWIRE_SUPPORT in the build options but then I got the following error:

    Code
    Traceback (most recent call last):
    File "/mnt/f/wsl/LE2/LibreELEC.tv/scripts/genbuildplan.py", line 369, in <module>
    REQUIRED_PKGS = processPackages(args, ALL_PACKAGES)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/mnt/f/wsl/LE2/LibreELEC.tv/scripts/genbuildplan.py", line 298, in processPackages
    raise Exception(msg)
    Exception: Invalid package reference: dependency kodi:host in package kodi-platform::PKG_DEPENDS_TARGET is not valid
    Parallel build failure - see log for details. Time of failure: Sat Jul 29 01:18:41 CEST 2023
    make: *** [Makefile:10: image] Error 1

    I have no idea if it would make a difference though. I still can't figure out how to enable AAC using Pipewire.


    I may be in over my head here, I thought this would a common use case but doesn't seem like it after searching for a bit. Not being able to install any additional packages I guess there would need to be some "native" support for the non-free AAC codec in LE?

    I'm seeing in the build log that the Pipewire selection adds ldacBT and libfreeaptx, but nothing AAC related from what I can see.

    Edited once, last by osen: Merged a post created by osen into this post. (July 29, 2023 at 12:59 AM).

  • It seems that LE by default still uses Pulseaudio for BT though, no? The only output I have for BT in Kodi on LE 11.0.3 is PULSEAUDIO: Default, Bluetooth Audio. Both Pipewire selections are disabled in the build options by default I can't find any documentation or even discussions around using Pipewire in LE.

    Pipewire should support AAC from what I can gather, but it may require additional non-free packages to be installed.

  • Also edit those:

    ALSA_SUPPORT="no"

    KODI_ALSA_SUPPORT="no"

    PULSEAUDIO_SUPPORT="no"

    KODI_PULSEAUDIO_SUPPORT="no"

    That built successfully but does not get past the LE splash screen so I don't know how to debug further.

    For fun I tried OSMC and to my surprise AAC worked right out-of-the-box and was set by default with huge increase in audio quality:

    Code
    < AVDTP(p): Set config cmd: transaction 3 nsp 0x00
    ACP SEID 3 - INT SEID 1
    Media Transport
    Media Codec - MPEG-2,4 AAC
    MPEG-4 AAC LC
    48kHz
    2 Channels
    192000bps VBR
    Delay Reporting

    So it is definitely possible, question is if it's feasible to get it running under LE.

  • Yeah KODI_PIPEWIRE_SUPPORT and PIPEWIRE_SUPPORT set to yes and the ALSA and Pulseaudio ones set to no just hangs on splash screen. Tried to clean and build from scratch again but same issue. For some reason on the first boot with Pipewire support I get a message about resizing not being permitted because of the system already being initialized, while the standard ALSA + Pulseaudio resizes and reboots. Not sure why that is?

    From searching around a bit more it seems like maybe bluez needs to be built with AAC support using the --enable-aac option and fdk-aac package? By default only SBC is supported it seems.

    Edited 2 times, last by osen (July 30, 2023 at 5:44 AM).

  • Added a pr to add aac support into pipewire.

    https://github.com/LibreELEC/LibreELEC.tv/pull/8015

    This still needs to be run tested.

    osen - I’m unsure of the other “boot” error you are experiencing.

    Awesome, thank you. I'm very confused about that too. Normally resize2fs does its thing and the system reboots after a 15s countdown, but with Pipewire support enabled it's just a message that it can't due to the system already being initialized. I have not changed anything else in the build options other than:

    KODI_PIPEWIRE_SUPPORT="yes"

    PIPEWIRE_SUPPORT="yes"

    ALSA_SUPPORT="no"

    KODI_ALSA_SUPPORT="no"

    PULSEAUDIO_SUPPORT="no"

    KODI_PULSEAUDIO_SUPPORT="no"

    EDIT:

    Seems like this condition is triggered with Pipewire support enabled for some reason, but I don't know if that's what's causing the splash screen hang or not:

    LibreELEC.tv/packages/sysutils/busybox/scripts/fs-resize at aec466da8aaf5f79b8f18b8474d0a6e6fbaf5127 · LibreELEC/LibreELEC.tv
    Just enough OS for KODI. Contribute to LibreELEC/LibreELEC.tv development by creating an account on GitHub.
    github.com

    It works on Generic. However, with Pipewire I get all sorts of audio stuttering/crackling via HDMI and Bluetooth, so it is hardly usable.

    I see, still experimental I guess? I'm building for RPi 3 so maybe something fundamental is missing there still.

    Edited 3 times, last by osen (July 30, 2023 at 6:01 PM).