btrecord - Linux


Overview

btrecord is a command-line utility for recording the audio output from a Bluetooth device connected to your Linux system. It enables users to capture high-quality audio in various formats, making it ideal for recording podcasts, creating audio samples, or preserving live audio streams.

Syntax

btrecord [options] <filename>

Options/Flags

  • -d, –device : Specify the Bluetooth device’s address to record audio from. Use bt-device -l to list available devices.
  • -f, –format : Choose the output audio format. Supported formats include WAV, OGG, MP3 (with LAME), and FLAC.
  • -q, –quality : Set the audio quality level. Lower values indicate higher quality. Default: 0 (highest quality)
  • -c, –codec : Define the audio codec to use. Refer to the FFmpeg documentation for available codecs.
  • -m, –mono: Record audio in mono (single channel) instead of stereo.
  • -s, –sample-rate : Adjust the sample rate for the recording. Default: 48000 Hz
  • -b, –bitrate : Set the audio bitrate in kbps. Higher values generally result in larger file sizes. Default: 128 kbps
  • -h, –help: Display this help menu

Examples

Record audio from a specific device to a WAV file:

btrecord -d 00:11:22:33:44:55 -f WAV output.wav

Record in MP3 format with LAME encoder:

btrecord -f MP3 -c lame output.mp3

Capture audio in mono and output it as a FLAC file:

btrecord -m -f FLAC output.flac

Set the sample rate to 96000 Hz and bitrate to 320 kbps:

btrecord -s 96000 -b 320 output.ogg

Common Issues

  • No audio recorded: Ensure that the Bluetooth device is properly connected and is transmitting audio. Check the device’s settings to verify that audio output is enabled.
  • Intermittent audio dropouts: Try adjusting the audio quality or bitrate settings. Network interference or Bluetooth signal strength issues may also cause dropouts.
  • Static or distortion in the recording: Lower the audio quality setting or adjust the gain on the Bluetooth device to reduce noise and distortion.

Integration

Record from a specific Bluetooth profile (e.g., A2DP):

pactl load-module module-bt-record device=XX:XX:XX:XX:XX:XX profile=a2dp sink_name=bt-record
btrecord -d bt-record output.wav

Combine with Audacity for post-processing:

btrecord output.wav
audacity output.wav

Related Commands