I have an aptX-capable headset and I want to use it to play music with the highest possible audio quality the headset can technically provide in Ubuntu. How can I do that?
While A2DP supports a lot of codecs optionally and is extensible to support other manufacturer-defined codecs. AptX does not only boast to provide better audio quality than the competition, but also advertises to reduce delay to have lip sync audio when watching videos.
Here are my questions:
- How can I make aptX-capable Bluetooth equipment use this codec in Ubuntu?
- What solutions are available?
- How can I check and verify an established connection for the codec it uses?
I'd like to point out, while this may look like a sponsored post, it is not. In my opinion FLAC and Opus should be the gold standard, but to my knowledge devices with support for these codecs aren't available right now.
Update for 2021: PulseAudio supports AptX, LDAC - https://9to5linux.com/pulseaudio-15-0-released-with-support-for-ldac-and-aptx-codecs-improved-hardware-support
Edit 2018-10-27: LDAC, APTX(-HD) and AAC support for PulseAudio are in the works. There is a repository on GitHub by EHfive with patches as well as a PPA for 18.04 onward, check the Wiki for more information. It looks like the patches will arrive upstream at some point in time. I checked the PPA on 18.04, it works, though it replaces PA 11.1 with 12, installs a newer version of ffmpeg and x265.
Edit 2017-12-18: I must have missed it a few weeks ago, but it looks like there is an encoder now in FFmpeg. To my knowledge no user friendly solution exists at the moment.
The short answer
You have to use special branded Bluetooth dongles. Have a look at the How can I use aptX then? section of this answer or browse the aptx.com site for transmitters.
The longer answer
Licensing issues
The aptX codec is proprietary standard, that CSR acquired from APT Licensing Ltd. with the goal to develop and market aptX powered high fidelity Bluetooth audio solutions via ingredient branding. You are correct, this is a strategy for CSR to sell exclusive chips.
I found the following clause when looking through the decoder license agreement:
While this does not answer questions about the encoder, I would say that the situation is at least as difficult as with other proprietary codecs and software components (1, 2, 3).
How can I use aptX then?
You can use it, just not as a free software solution.You can find special branded Bluetooth dongles, so called aptX Transmitters. These are not the typical nano or pico-sized Bluetooth dongles, but USB Audio Class devices. (Have a look at the device classes section on the USB article in Wikipedia for more information.) This means that these devices will be recognized as sound cards and will not provide Bluetooth connectivity to the host computer. There is also one major downside: they cost almost 10 times as much as regular Bluetooth dongles.
List of aptX Transmitters or Bluetooth dongles with aptX support in alphabetical order:
Check the configured codec of a connection
Install
bluez-hcidump
and runsudo hcidump avdtp
, then connect the device and look for the configuration negotiation. The following this is the result I got (see also), it looks like it tried aptX, AAC and finally settled for SBC.Troubleshooting
What about Ubuntu Phone?
I don't know if Ubuntu on Phones will support this codec. CSR documents say that solutions are available for Android device manufacturers, so I assume it's up to the phone manufacturers to decide if and how. Of course Ubuntu Touch generally supports Bluetooth headsets and I was able to pair my Nexus 4 running Ubuntu with the headsets I tested.
My experience and tests
Bluetooth modules and dongles tested:
Headsets tested:
≥ 2021: with pipewire
Pipewire supports APT-X through libfreeaptx0.
To install it use the instruction of the pipewire-debian ppa, in summary:
Pic of the additional codecs in KDE (for a device not supporting apt-X)
Perhaps you don't need aptX - as there is
sbc-xq
Recently the 'lifehack'
sbc-xq
has been added to linux. According to this blogPerhaps you want to give it a try. On my machine, I could choose between
sbc
andsbc-xq
with the help of theblueman-manager
.