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.

up vote 26 down vote accepted

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:

  • implement the Software as firmware in secure code embedded in the Licensee Product

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 soundcards and will not provide Bluetooth connectivity to the host computer. There is also one major downside: these cost almost 10 times as much as regular Bluetooth dongles.

List of aptX Transmitters or Bluetooth dongles with aptX support in alphabetical order:

  • Creative BT-D1 USB Bluetooth Transmitter, Bluetooth 2.1 + EDR
  • Creative BT-W1/BT-W2 USB, Bluetooth 2.1 + EDR
  • Sennheiser BTD 500 USB, Bluetooth 3.0
  • Avantree BTDG-50-WGR, Bluetooth 4.1 with aptX LL

(Supplements are welcome! I'd love to see—preferably cheaper—alternatives.)

Check the configured codec of a connection

Install bluez-hcidump and run sudo 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.

$ sudo hcidump avdtp
HCI sniffer - Bluetooth packet analyzer ver 5.35
device: hci0 snap_len: 1500 filter: 0x400
< AVDTP(s): Discover cmd: transaction 11 nsp 0x00
> AVDTP(s): Discover rsp: transaction 11 nsp 0x00
    ACP SEID 5 - Audio Sink
    ACP SEID 3 - Audio Sink
    ACP SEID 1 - Audio Sink
< AVDTP(s): Capabilities cmd: transaction 12 nsp 0x00
    ACP SEID 5
> AVDTP(s): Capabilities rsp: transaction 12 nsp 0x00
    Media Transport
    Media Codec - non-A2DP (aptX)
      16kHz 32kHz 44.1kHz 48kHz 
      Stereo 
< AVDTP(s): Capabilities cmd: transaction 13 nsp 0x00
    ACP SEID 3
> AVDTP(s): Capabilities rsp: transaction 13 nsp 0x00
    Media Transport
    Media Codec - MPEG-2,4 AAC
      MPEG-2 AAC LC MPEG-4 AAC LC 
      8kHz 11.025kHz 12kHz 16kHz 22.05kHz 24kHz 32kHz 44.1kHz 48kHz 
      1 2 Channels
      320000bps VBR
    Content Protection
      02 00 
< AVDTP(s): Capabilities cmd: transaction 14 nsp 0x00
    ACP SEID 1
> AVDTP(s): Capabilities rsp: transaction 14 nsp 0x00
    Media Transport
    Media Codec - SBC
      16kHz 32kHz 44.1kHz 48kHz 
      Mono DualChannel Stereo JointStereo 
      4 8 12 16 Blocks
      4 8 Subbands
      SNR Loudness 
      Bitpool Range 2-53
    Content Protection
      02 00 
< AVDTP(s): Set config cmd: transaction 15 nsp 0x00
    ACP SEID 1 - INT SEID 1
    Media Transport
    Media Codec - SBC
      44.1kHz 
      JointStereo 
      16 Blocks
      8 Subbands
      Loudness 
      Bitpool Range 2-53
> AVDTP(s): Set config rsp: transaction 15 nsp 0x00
< AVDTP(s): Open cmd: transaction 0 nsp 0x00
    ACP SEID 1
> AVDTP(s): Open rsp: transaction 0 nsp 0x00
< AVDTP(s): Start cmd: transaction 1 nsp 0x00
    ACP SEID 1
> AVDTP(s): Start rsp: transaction 1 nsp 0x00
< AVDTP(m): ver 2 cc 0 pt 1 seqn 0 time 0 ssrc 1
< AVDTP(m): ver 2 cc 0 pt 1 seqn 1 time 896 ssrc 1

Troubleshooting

  • A2DP is unidirectional, you can only listen to music with A2DP. For voice calling use the HSP/HFP profiles.
  • If headphones or devices are not recognized or listed as output device for example in VLC, try switching to another soundcard and back via sound settings. The devices should be recognized then.

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 manufacurers 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:

  • Desktop with nano Bluetooth 2.1 and 4.0 dongles, Lenovo T530 with built in module. - A2DP achieved almost the same quality level as the BTD 500 when playing music from FLAC files. Audio from movies was in sync with 14.04.
  • Sennheiser BTD 500 USB. - Pairing takes as long as with regular non-NFC capable dongles.

Headsets tested:

  • Philips Fidelio M1BTBL, Bluetooth 4.0. - Works fine with all dongles and modules.
  • Sony MDR-10RBT, Bluetooth 3.0, NFC. - Works fine with all dongles and modules.
  • Creative Sound Blaster EVO ZxR, Bluetooth 2.1, NFC. - This one had the best reception range of all the three, but couldn't connect to the BTD 500.
  • 1
    How did you check if a device is actually connecting using aptX instead of SBC? – pseudosavant Jun 30 '16 at 22:28
  • Avantree also make one, model BTDG-50-WGR. No I dont work for them, it is just good information to know. – Mtl Dev Feb 25 '17 at 16:52
  • Out of curiosity and definitely not because I would never pay $40 for a freakin' dongle, nobody ever reconstructed the binary / created alternative that would connect like aptx that would be available in some shady places? – Jezor Jul 23 '17 at 18:46
  • 1
    @Jezor I did not look in shady places because I didn't have this much interest or technical skill nor have I I been able to find anything about this back then. Maybe some people did, I don't know and I rather prefer an open source solution, as I have written. LDAC appears to make aptX obsolete and is more open as far as I know. – LiveWireBT Jul 24 '17 at 2:23
  • Azio BTD-v401 also advertises aptX capability but I cannot comment on it's compatibility with Ubuntu or any linux for that matter. – kapad Dec 1 '17 at 18:22

protected by Community Jan 16 at 15:42

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.