Spotify-Saver Bitrate Options: How Audio Quality Settings Affect Your Downloads

TLDR: Spotify-Saver supports four discrete audio bitrates—96, 128, 192, and 256 kbps—defined in the Bitrate enum, where higher values preserve greater frequency detail and stereo imaging at the cost of increased file size.

When downloading tracks with gabrielbaute/spotify-saver, audio fidelity is controlled through a strict enumeration of bitrate values. The Bitrate enum in spotifysaver/enums/bitrates_enum.py restricts inputs to four standard qualities, ensuring that every download request translates into a predictable FFmpeg encoding configuration. These Spotify-Saver bitrate options propagate from the command-line interface through the YouTubeDownloader class and ultimately determine the compression applied to your extracted audio files.

Available Bitrate Options in Spotify-Saver

The application defines allowable bitrates as an Enum class to prevent invalid entries and provide type-safe validation throughout the download pipeline.

In spotifysaver/enums/bitrates_enum.py, the supported values are declared as follows:

class Bitrate(Enum):
    """Enum for supported audio bitrates."""
    B96  = 96
    B128 = 128
    B192 = 192
    B256 = 256

Each variant maps to a specific kilobits-per-second (kbps) value that directly configures the output encoder:

  • Bitrate.B96 (96 kbps): Low-fidelity compression producing the smallest files; high-frequency content is noticeably attenuated.
  • Bitrate.B128 (128 kbps): Baseline quality serving as the practical default; balances storage efficiency with acceptable clarity for casual listening.
  • Bitrate.B192 (192 kbps): High-fidelity setting that retains more instrumental nuance and stereo separation, ideal for acoustic genres.
  • Bitrate.B256 (256 kbps): Very high fidelity approaching transparency; preserves the most detail from the source stream but generates the largest output files.

How Bitrate Selection Propagates Through the Codebase

When you specify a bitrate, the value undergoes validation and conversion before reaching the encoding layer. This flow ensures that only supported integers from the Spotify-Saver bitrate options reach the FFmpeg post-processor.

CLI Input and Validation

The --bitrate argument is exposed through the download command interface. The user-provided integer is forwarded to the downloader instance after basic parsing through the command handlers in spotifysaver/cli/commands/download/download.py and its track/album/playlist variants.

Enum Conversion and Type Safety

The YouTubeDownloader class converts raw integers to typed Bitrate objects via the static method int_to_bitrate located in spotifysaver/downloader/youtube_downloader.py:

@staticmethod
def int_to_bitrate(bitrate_int: int) -> Bitrate:
    """Convert integer bitrate to Bitrate enum."""
    bitrate_map = {
        96:  Bitrate.B96,
        128: Bitrate.B128,
        192: Bitrate.B192,
        256: Bitrate.B256,
    }
    if bitrate_int not in bitrate_map:
        raise ValueError(
            f"Unsupported bitrate: {bitrate_int}. Supported bitrates: {list(bitrate_map.keys())}"
        )
    return bitrate_map[bitrate_int]

This mapping rejects any value outside the defined set, raising a ValueError with the complete list of supported bitrates.

FFmpeg Encoding Configuration

The validated bitrate reaches the yt-dlp configuration builder within _get_ydl_opts. The numeric value is cast to a string and injected into the FFmpegExtractAudio post-processor as preferredquality:

"postprocessors": [
    {
        "key": "FFmpegExtractAudio",
        "preferredcodec": format_value,
        "preferredquality": str(bitrate_value),
    }
],

According to the spotify-saver source code, this parameter dictates the encoding bitrate to FFmpeg, directly controlling the trade-off between audio fidelity and file size.

Configuring Bitrate via CLI and Python API

You can specify your desired quality level when invoking the tool or programmatically through the YouTubeDownloader class.

Choose 128 kbps for standard quality:

spotifysaver download "https://open.spotify.com/track/..." --format mp3 --bitrate 128

Select 192 kbps for high-fidelity acoustic tracks:

spotifysaver download "https://open.spotify.com/track/..." --format mp3 --bitrate 192

Use 256 kbps for maximum quality with M4A output:

spotifysaver download "https://open.spotify.com/track/..." --format m4a --bitrate 256

When using the Python API, convert integers to the enum explicitly before passing them to download_track:

from spotifysaver.downloader import YouTubeDownloader
from spotifysaver.enums import Bitrate
from pathlib import Path

downloader = YouTubeDownloader(base_dir=Path("/tmp/music"))
bitrate = YouTubeDownloader.int_to_bitrate(192)   # Returns Bitrate.B192

downloader.download_track(
    youtube_url="https://music.youtube.com/watch?v=...",
    output_format=AudioFormat.MP3,
    bitrate=bitrate,
)

Summary

  • Spotify-Saver bitrate options are restricted to four discrete values (96, 128, 192, 256 kbps) defined in the Bitrate enum in spotifysaver/enums/bitrates_enum.py.
  • The int_to_bitrate method in spotifysaver/downloader/youtube_downloader.py validates user input against these specific values and rejects unsupported integers.
  • Higher bitrates (192–256 kbps) preserve more high-frequency detail and stereo imaging, while 96 kbps prioritizes minimal file size with audible quality loss.
  • The chosen value is passed to FFmpeg via the preferredquality parameter in the yt-dlp post-processor configuration, directly determining the output file's encoding bitrate.

Frequently Asked Questions

What is the default bitrate if I don't specify one?

The source code analysis indicates that 128 kbps serves as the baseline quality default. When you omit the --bitrate flag or pass None programmatically, the downloader typically falls back to Bitrate.B128 unless explicitly configured otherwise during YouTubeDownloader initialization.

Can I use a custom bitrate like 320 kbps with Spotify-Saver?

No. The int_to_bitrate method explicitly validates inputs against a fixed mapping containing only 96, 128, 192, and 256. Attempting to pass 320 or any other value triggers a ValueError listing the supported bitrates, as enforced in spotifysaver/downloader/youtube_downloader.py.

How does changing the bitrate affect the final audio file size?

Audio file size scales linearly with bitrate. Selecting Bitrate.B256 produces files approximately 2.6 times larger than Bitrate.B96 for the same track duration, while Bitrate.B192 yields files roughly 50% larger than the 128 kbps default. This relationship holds because the kbps value directly determines the number of kilobits encoded per second of audio.

Which Spotify-Saver bitrate should I choose for archival storage?

For archival purposes where storage capacity allows, Bitrate.B256 provides the highest fidelity available in the application, preserving the most detail from the YouTube Music source stream. If balancing quality and space, Bitrate.B192 offers a strong compromise with significantly better clarity than the 128 kbps default while maintaining reasonable file sizes.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →