HOWTO find which codec is used between iOS device and bluetooth headphones
Feb 12, 2017 at 12:20 PM Thread Starter Post #1 of 26

rshev

New Head-Fier
Joined
Jan 27, 2017
Posts
9
Likes
19
Was just curious this weekend (I'm an iOS engineer by day) how to find out which codec your iOS device uses to communicate to bluetooth headphones.
There are numerous tutorials on this matter for macOS (OSX) on the Internet, Alt+Click, Bluetooth Explorer and friends, but nothing on iOS.
That's why I decided to compose this tutorial for you, requires looking into console log and some keyboard munching.
(wanted to insert screenshots here but have no rights as I'm very fresh to head-fi. Version with screenshots here: https://stackoverflow.com/questions/22639691/how-to-determine-which-codecs-a-bluetooth-device-supports-over-a2dp/42190656)
 
Here we go:
 
1. Connect your iOS device to your Mac, answer Trust on the iOS device if you haven't done this before.
 
2. Open Console.app.

3. Select your iOS device on the left sidebar.

4. Type `bluetooth` in the top-right search bar, press Enter and select `Subsystem` instead of `All`.

5. Now, start playing to your bluetooth headphones on the iOS device (codec activates only when you output sound).

6. Press `Cmd+F` and search for `Starting a2dp send thread` in your console messages.

7. You'll see used codec in `codec: ` field. Values are the same as specified in Bluetooth specs. Basically `0 = SBC`, `2 = AAC`.
 
Was very surprised, though, that a pair of headphones I just bought from very adored and award-winning manufacturer (not Sennheiser) does not have AAC codec in them, despite having that in specifications (will not name them here, contacting their tech support for clarification).
 
Feel free to publish your experience and discoveries here.
 
Mar 21, 2018 at 2:36 PM Post #4 of 26
Was just curious this weekend (I'm an iOS engineer by day) how to find out which codec your iOS device uses to communicate to bluetooth headphones.
There are numerous tutorials on this matter for macOS (OSX) on the Internet, Alt+Click, Bluetooth Explorer and friends, but nothing on iOS.
That's why I decided to compose this tutorial for you, requires looking into console log and some keyboard munching.
(wanted to insert screenshots here but have no rights as I'm very fresh to head-fi. Version with screenshots here: https://stackoverflow.com/questions...-bluetooth-device-supports-over-a2dp/42190656)

Here we go:

1. Connect your iOS device to your Mac, answer Trust on the iOS device if you haven't done this before.

2. Open Console.app.

3. Select your iOS device on the left sidebar.

4. Type `bluetooth` in the top-right search bar, press Enter and select `Subsystem` instead of `All`.

5. Now, start playing to your bluetooth headphones on the iOS device (codec activates only when you output sound).

6. Press `Cmd+F` and search for `Starting a2dp send thread` in your console messages.

7. You'll see used codec in `codec: ` field. Values are the same as specified in Bluetooth specs. Basically `0 = SBC`, `2 = AAC`.

Was very surprised, though, that a pair of headphones I just bought from very adored and award-winning manufacturer (not Sennheiser) does not have AAC codec in them, despite having that in specifications (will not name them here, contacting their tech support for clarification).

Feel free to publish your experience and discoveries here.

This works great. I tried this with my MDR-1000X and in priority connection I can see codec-0 and in priority sound quality I can see codec-2.
 
Last edited:
Dec 28, 2018 at 3:10 PM Post #6 of 26
Thanks for this awesome post rshev!

I'm having trouble finding the codec value.

When I search for "Starting a2dp send thread" I get no results, so I searched for "Starting a2dp" and I see this as paired playback stars:

"Starting A2DP audio streaming to device <private>"

I googled around and it seems that there's no way to view apple's <private> values...

I'm on iOS 12.1.2 pairing with my Jaybird X3's which advertise that they support AAC, but sometimes I'm skeptical.

Any other suggestions you might have?
 
Jan 23, 2019 at 6:52 PM Post #9 of 26
Fiddling with bluetooth codecs today to figure out why some songs on some devices sound worse. I used all the relevant tricks on Mac to figure out my brand new WH-1000xm3’s were connecting via SBC - sounds way better forcing AptX

Next up is a new pair of earbuds that sound halfway decent on my iPhone, but way worse on my Mac with my SBC-killer test tracks (some poppy energetic St Lucia, and RAC’s Let Go - they sound artifact-y and aliased in the sharp synth highs).

Anyway, I got testing in Console. The trick seems to be to have console open not just during track start, but during initial connection of the target device. After the headphones were powered off for a minute, I searched “(subsystem: bluetooth) codec” and got:

default 15:48:00.538802 -0800 bluetoothd Bad48KHzCodecs: Disabling 48 KHz - Device is NOT in 48 KHz AAC whitelist
default 15:48:00.718042 -0800 mediaserverd Codecs available. NBS (CVSD): 1, WBS (mSBC): 1, UWBS (AAC-ELD): 0
debug 15:48:00.718391 -0800 mediaserverd Sending codec metric - codecType: 1, mediaType: 1, [sampleRate: 16000]
debug 15:48:02.784335 -0800 bluetoothd Parsing Audio Codec ID and information for seid 1
default 15:48:02.784492 -0800 bluetoothd Audio Codec ID <private> for remote SEID 1
debug 15:48:02.801615 -0800 bluetoothd Parsing Audio Codec ID and information for seid 2
default 15:48:02.801789 -0800 bluetoothd Audio Codec ID <private> for remote SEID 2
default 15:48:02.802527 -0800 bluetoothd Selected preferred codec AVDTP_CODEC_MPEG_AAC (0x2) out of 2 available endpoints
default 15:48:02.802677 -0800 bluetoothd Selected preferred codec AVDTP_CODEC_MPEG_AAC (0x2) out of 2 available endpoints
debug 15:48:02.872643 -0800 bluetoothd Found AVDTP_CODEC_MPEG_AAC codec type 0x2
default 15:48:02.873476 -0800 bluetoothd A2DP configured at 44.1 KHz. Codec: AAC-LC, VBR max: 221 kbps. 1 frames * (12+644) bytes = 656 per RTP (max=656) every 23.22 ms
debug 15:48:02.906085 -0800 mediaserverd Sending codec metric - codecType: 2, mediaType: 2, [sampleRate: 44100]

AAC-ELD is a 64kbps voice codec, so I think that’s actually a red herring. Down a bit lower, “Selected preferred codec AVDTP_CODEC_MPEG_AAC” seem to be the ticket. Then “A2DP configured at 44.1 KHz. Codec: AAC-LC, VBR max: 221 kbps…”

So it looks like these headphones are, in fact, using AAC on my iPhone, which would explain why they sound much better in my torture test there. Now I just need to go figure out why they AREN'T using AAC on my mac.
 
Jan 24, 2019 at 1:44 PM Post #10 of 26
Now I just need to go figure out why they AREN'T using AAC on my mac.

Thanks for figuring out the Console thing! To enable AAC (and aptX) on your Mac, you need to download one of the developer tools and then check a box. Instructions are here. I did this yesterday, and can now happily report that I'm getting AAC on both iPhone and Mac. Though it seems like the Mac uses a higher bitrate than the phone (XS Max).
 
Jan 24, 2019 at 5:07 PM Post #11 of 26
Thanks for figuring out the Console thing! To enable AAC (and aptX) on your Mac, you need to download one of the developer tools and then check a box. Instructions are here. I did this yesterday, and can now happily report that I'm getting AAC on both iPhone and Mac. Though it seems like the Mac uses a higher bitrate than the phone (XS Max).

I'd already done that for the Sony's (force aptX), but hadn't changed the AAC settings, hence had to go back in and do just what you say (thanks!).

Those settings confuse me terribly though, and what I was really getting at is "why are these not defaults?"

For instance, we've got a checkbox each for "Force aptX," "Disable aptX," "Disable AAC," and "Enable AAC"
What the eff does it even mean to leave both disable aac and enable aac unchecked (the default)?! At least "Force aptX" and "Disable aptX" leave room in the middle for the default to be "use aptX if appropriate"
But then, in practice, that isn't even what happens.

Defaults (everything unchecked): Headphones connect with SBC, regardless of better codec support. Sounds mostly fine for the cans with the good antenna/RSSI since they use a high bitpool, sounds crap for the earbuds.
Check "Enable AAC": sonys connect with AAC, sound good. Earbuds connect with SBC, sound like crap.
Check "Enable AAC" and also "Force aptX": sonys connect with AAC - sound good, but aptX would be better (equal quality, lower latency). Earbuds connect with AAC, sound great.
----At this point, why on earth would "Force aptX" be necessary for the AAC-only earbuds to use AAC? Makes no sense. And if "Force aptX", why do the Sonys then default to AAC?!
UNCHECK "Enable AAC" and KEEP "Force aptX": Sonys connect with aptX (optimal). Buds fall back to SBC and suck again.
Interestingly, when I check all 3 of "Force aptX," "Enable AAC," AND "Disable AAC" (yeah...), the buds connect via SBC (of course?), but despite the same bitpool, the connection is WAY more stable. And the Sonys in this case connect with aptX.

So basically, I've learned that
1) the defaults don't do the most logical thing (aptX falls back to AAC falls back to SBC)
2) there's no combination of settings that enables this "optimal" behavior
3) The closest you can get is either a) "Force aptX+Enable AAC+Disable AAC" (aptX device connects that way, AAC-only connects with SBC, but stably), or b) "Force aptX+Enable AAC" (aptX device falls back to AAC, but AAC-only devices also connect with AAC)

For now I'm sticking with "Force aptX+Enable AAC," but it's annoying that the Sonys won't use that aptX.

Bonus: if I go for broke and check all 4 boxes, which makes NO sense at ALL, the sonys use aptX and the headphones fall back to stable-but-crappy low bitpool SBC. Ok, the bitpool comes back up to "pretty good" after a module reset.

Unrelated (maybe?), the volume on my Sonys seems completely independent from the volume on the Mac. So that's super annoying.
 
Aug 12, 2019 at 5:21 PM Post #12 of 26
If anyone is interested I just found out that the bitrate of the PXC-550's connected to an iOS device is 317.9kbps (SBC) and 384kbps (aptX) connected to a Macbook Pro.

  • For iOS, I connected it to my computer, tapped "Trust" and then I opened console, started playing some music through my headphones and searched for "a2dp" and at first I was looking for the bit pool but apparently they log the actual bitrate.
  • For macOS, I connected my headphones, opened up the dev tool "Bluetooth Explorer" and then Tools>Audio Graphs and that's where they 'log' the bitrate.
 
Aug 13, 2019 at 10:00 AM Post #13 of 26
LDAC?
 
Aug 14, 2019 at 5:24 AM Post #15 of 26
Not on an iOS or OSX device - iPhones are AAC or SBC, Macs support AptX. To my knowledge neither do LDAC.
Hmm, you think apple will bring ldac support for their future ios firmware updates? Would be a shame not to include it. Its not like they're short on money for licensing fees lol.
 

Users who are viewing this thread

Back
Top