Get rid of 0.5s latency when playing audio over Bluetooth with A2DP
As described in the title I experience a half a second delay when playing audio over Bluetooth with A2DP.
This makes watching movies not possible as the sound is not synchronised with the video.
I'm not sure if the delay is caused by the Bluetooth standard, the A2PD protocol, the A2DP implementation on Ubuntu 12.04, or the Belkin Z73 Bluetooth Receiver.
Anyways, is this a normal lag? Is there a way to play audio over Bluetooth without any noticeable latency?
No, this is not normal but I've had a similar problem occasionally with my Altec Lansing iMT525 Bluetooth Speakers. Something similar in concept to Sri's answer almost always works for me, and I need to do it only once per connect.
Auto-switching Bluetooth profiles to re-initialize PulseAudio
If you're looking for a culprit, I'd look at Ubuntu's sound system, PulseAudio first, and then your bluetooth receiver. Try this:
-
First, delete and re-pair your Bluetooth device.
-
Then, copy and paste the below into a
.sh
file in your home directory, say/home/brillout/pabluezswitch.sh
:
#!/bin/bash
bluezcard=$(pactl list cards short | awk '/bluez/{print $2}')
pactl set-card-profile "$bluezcard" a2dp
pactl set-card-profile "$bluezcard" hsp
pactl set-card-profile "$bluezcard" a2dp
-
Make the file executable by opening a terminal and typing
chmod +x ~/pabluezswitch.sh
-
Go to Settings...Keyboard...Shortcuts, and create a custom shortcut; name it whatever you want, with the command as
/home/brillout/pabluezswitch.sh
(substitute appropriate username in path!). Click Apply, and then click on the right where it says Disabled to set up a keyboard shortcut to execute the script.
What this does is force the PulseAudio system to resynchronize the audio being sent to your headset/speakers by switching profiles from ad2p -> hsp -> a2dp
, thus hopefully getting rid of any latency.
Whenever you connect and notice the lag, you should press the keyboard shortcut chosen above to attempt to fix the latency -- hopefully it works for you!
- Install pavucontrol:
sudo apt install pavucontrol
- Run
pavucontrol
from the menu - Go to Output Devices
- Under the Bluetooth Device, open the Advanced menu
- There you can set the latency offset to the value in millisecond (plus or minus). To make sure of the value you need to put start with any value e.g., 250.00 ms.
- Play any "audio sync test" from YouTube and set the playback speed to 0.25 (make it slower) and from there you can start noticing if the value is correct or needs to be increased or decreased.