Skip to main content

A simple command-line tool for downloading audio from YouTube and other sites

Project description

yt-audio-cli

CI codecov PyPI Python License

A simple command-line tool for downloading audio from YouTube and other sites.

What This Is

yt-audio-cli is an opinionated wrapper around yt-dlp and FFmpeg, designed specifically for audio downloads. It provides sensible defaults and a streamlined interface for common audio extraction tasks.

  • yt-dlp handles all video/audio downloading and site support (1000+ sites)
  • FFmpeg handles audio conversion and processing
  • yt-audio-cli ties them together with audio-focused defaults and a simplified CLI

If you need advanced features like video downloads, custom format selection, or fine-grained control, use yt-dlp directly.

Quick Start

# Install
pip install yt-audio-cli

# Download audio
yt-audio-cli https://youtube.com/watch?v=VIDEO_ID

Requirements

FFmpeg must be installed on your system for audio conversion:

  • Windows: winget install FFmpeg or download from ffmpeg.org
  • macOS: brew install ffmpeg
  • Linux: sudo apt install ffmpeg (Debian/Ubuntu) or sudo dnf install ffmpeg (Fedora)

yt-dlp is installed automatically as a Python dependency.

Installation

pip install yt-audio-cli

Or with uv:

uv tool install yt-audio-cli

Usage

Download Audio

# Single video (saves as MP3 by default)
yt-audio-cli https://youtube.com/watch?v=VIDEO_ID

# Multiple videos (downloaded in parallel)
yt-audio-cli URL1 URL2 URL3

# Entire playlist
yt-audio-cli https://youtube.com/playlist?list=PLAYLIST_ID

# From a batch file (one URL per line)
yt-audio-cli --batch urls.txt

Choose Format

yt-audio-cli -f opus URL   # Opus (smallest size)
yt-audio-cli -f aac URL    # AAC
yt-audio-cli -f mp3 URL    # MP3 (default)
yt-audio-cli -f wav URL    # WAV (lossless)

Choose Quality

yt-audio-cli -q best URL    # Highest quality (default)
yt-audio-cli -q good URL    # Balanced
yt-audio-cli -q small URL   # Smallest file size

# Or set exact bitrate (32-320 kbps)
yt-audio-cli -b 256 URL

Save Location

# Save to specific folder
yt-audio-cli -o ~/Music URL

# Default: current directory

Skip Metadata

# Don't embed title/artist in the file
yt-audio-cli --no-metadata URL

Parallel Downloads

# Use 8 concurrent workers (default: 4)
yt-audio-cli -w 8 URL1 URL2 URL3

# Single-threaded download
yt-audio-cli -w 1 URL

Batch File

# Download from a file containing URLs (one per line)
yt-audio-cli --batch urls.txt

# Combine batch file with additional URLs
yt-audio-cli --batch urls.txt https://youtube.com/watch?v=EXTRA

Batch file format:

# Comments start with #
https://youtube.com/watch?v=VIDEO1
https://youtube.com/watch?v=VIDEO2

# Blank lines are ignored
https://youtube.com/watch?v=VIDEO3

Retry Failed Downloads

# Retry failed downloads up to 5 times (default: 3)
yt-audio-cli -r 5 URL

# Disable retries
yt-audio-cli -r 0 URL

Options

Option Short Description Default
--format -f Audio format (mp3, aac, opus, wav) mp3
--output -o Output directory Current dir
--quality -q Quality preset (best, good, small) best
--bitrate Exact bitrate in kbps (32-320) -
--workers -w Concurrent download workers (1-16) 4
--retries -r Retry attempts for failures (0-10) 3
--batch -b Path to file containing URLs -
--no-metadata Skip embedding metadata -
--force -F Re-download even if file exists -
--version -v Show version -
--help Show help -

Note: By default, files that already exist in the output directory are skipped. Use --force to re-download them.

Troubleshooting

"FFmpeg not found" Install FFmpeg using the instructions in Requirements.

"Video unavailable" The video may be private, age-restricted, or region-locked. This is a limitation of the source site, not yt-dlp or this tool.

"Signature solving failed" / JS challenge warnings YouTube uses JavaScript challenges to protect some video formats. You may see warnings like:

yt-dlp: [youtube] Signature solving failed: Some formats may be missing.

Downloads usually still work (yt-dlp falls back to alternative formats), but to resolve these warnings:

  • Install Deno (recommended): curl -fsSL https://deno.land/install.sh | sh
  • Or download the solver: yt-dlp --remote-components ejs:github

See yt-dlp EJS wiki for more details.

Download fails Check your internet connection and verify the URL is correct. If the issue persists, ensure yt-dlp is up to date: pip install -U yt-dlp

Metadata

__metadata__ = {
    "name": "yt-audio-cli",
    "version": "0.2.2",
    "author": "pyyupsk",
    "license": "MIT",
    "python": ">=3.12",
    "repository": "github.com/pyyupsk/yt-audio-cli",
}

Disclaimer

[!IMPORTANT] This tool is intended for downloading content you have the right to access. Respect copyright laws and the terms of service of the platforms you use.

[!CAUTION] The authors are not responsible for any misuse of this software.

License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yt_audio_cli-0.2.2.tar.gz (27.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yt_audio_cli-0.2.2-py3-none-any.whl (33.3 kB view details)

Uploaded Python 3

File details

Details for the file yt_audio_cli-0.2.2.tar.gz.

File metadata

  • Download URL: yt_audio_cli-0.2.2.tar.gz
  • Upload date:
  • Size: 27.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for yt_audio_cli-0.2.2.tar.gz
Algorithm Hash digest
SHA256 c9f58dc1fbf646f65d34c2fe5c2740665ba90f4da7e6ba2503ecbbab718ccc20
MD5 3547dadbde2209b5fa81603550ed0983
BLAKE2b-256 6b940a3283430e3fb42d9e7ebd2cfbb73ce910740aefeb0d8e9b6b8001405c21

See more details on using hashes here.

Provenance

The following attestation bundles were made for yt_audio_cli-0.2.2.tar.gz:

Publisher: publish.yml on pyyupsk/yt-audio-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file yt_audio_cli-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: yt_audio_cli-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 33.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for yt_audio_cli-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 92119caea2b2d294c1f4abc6d13fbbfb6d6b1ac750d57c5a60779a66e1c346f4
MD5 1d6fd4b4d65e301fdaae5d256fe54806
BLAKE2b-256 6ac64afdabe10d48323698e2e8d2d2309bd141ab6dd04a30ddace48c2b932975

See more details on using hashes here.

Provenance

The following attestation bundles were made for yt_audio_cli-0.2.2-py3-none-any.whl:

Publisher: publish.yml on pyyupsk/yt-audio-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page