Metadata-Version: 2.4
Name: yt-audio-cli
Version: 1.0.1
Classifier: Environment :: Console
Classifier: Programming Language :: Rust
Classifier: Topic :: Multimedia :: Sound/Audio
License-File: LICENSE
Summary: Save audio from YouTube as Opus, AAC, MP3 or WAV, with no yt-dlp or FFmpeg
License-Expression: MIT
Requires-Python: >=3.8
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Repository, https://github.com/pyyupsk/yt-audio-cli

# yt-audio-cli

[![PyPI version](https://img.shields.io/pypi/v/yt-audio-cli?label=pypi&logo=pypi&logoColor=white)](https://pypi.org/project/yt-audio-cli/)
[![NPM version](https://img.shields.io/npm/v/@pyyupsk/yt-audio-cli?label=npm&logo=npm&logoColor=white)](https://www.npmjs.com/package/@pyyupsk/yt-audio-cli)
[![Crates.io version](https://img.shields.io/crates/v/yt-audio-cli?label=crates.io&logo=rust&logoColor=white)](https://crates.io/crates/yt-audio-cli)
[![CI](https://github.com/pyyupsk/yt-audio-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/pyyupsk/yt-audio-cli/actions/workflows/ci.yml)
[![License](https://img.shields.io/github/license/pyyupsk/yt-audio-cli)](https://github.com/pyyupsk/yt-audio-cli/blob/main/LICENSE)

Save audio from YouTube as Opus, AAC, MP3 or WAV, with no yt-dlp or FFmpeg.

[📝 Changelog](https://github.com/pyyupsk/yt-audio-cli/releases) · [🐛 Issues](https://github.com/pyyupsk/yt-audio-cli/issues)

![yt-audio-cli saves a 6-video playlist as MP3](https://raw.githubusercontent.com/pyyupsk/yt-audio-cli/main/docs/demo.gif)

## Features

- 📦 One binary. It needs no Python, yt-dlp or FFmpeg
- ⚡ Starts in about 1 ms and uses about 10 MB of memory
- 🎧 Opus and AAC come straight from YouTube, with no second encode
- 📃 Videos, playlists and a batch file of URLs, with parallel downloads
- 🔁 A dropped connection resumes from the last byte
- 🏷️ Writes the title and channel as tags in Opus and MP3 files
- 🧹 Ctrl-C deletes the files that did not finish
- 🎨 Shows a progress bar for each download and a summary line at the end
- 🌍 Linux, macOS and Windows, on x86_64 and arm64

## Install

On macOS or Linux, open Terminal and paste:

```sh
curl -fsSL https://fasu.dev/yt-audio-cli.sh | sh
```

On Windows, open PowerShell and paste:

```powershell
irm https://fasu.dev/yt-audio-cli.ps1 | iex
```

The script checks the download against the release `SHA256SUMS` and installs the program for your user only, with no admin rights. It puts the program in `~/.local/bin` (on Windows, `%LOCALAPPDATA%\Programs\yt-audio-cli`) and adds that folder to your PATH. When it finishes, open a new terminal.

If you already use one of these tools, you can install with it instead:

```sh
uv tool install yt-audio-cli          # or: pipx install yt-audio-cli
npm install -g @pyyupsk/yt-audio-cli  # or: pnpm add -g, bun add -g
cargo binstall yt-audio-cli           # or: cargo install yt-audio-cli (needs a C compiler)
```

All of them install the same binary. To run it once, use `uvx yt-audio-cli`, `npx @pyyupsk/yt-audio-cli` or `bunx @pyyupsk/yt-audio-cli`.

Each [release](https://github.com/pyyupsk/yt-audio-cli/releases) also has an archive for every system, with a `SHA256SUMS` file.

## Usage

```sh
yt-audio-cli https://youtu.be/E-TVrIwwmpc
```

The file goes into the current folder, named after the video title.

If you run `yt-audio-cli` with nothing after it, or double-click it on Windows, it asks you to paste a URL. It then saves the file to your Downloads folder.

Progress, notes and errors go to stderr. If stdout is not a terminal, it gets only the path of each saved file, one per line, so a script can read them. To turn off colors, set `NO_COLOR=1`.

```sh
# Several videos, or a whole playlist
yt-audio-cli URL1 URL2
yt-audio-cli "https://www.youtube.com/playlist?list=PLAYLIST_ID"

# URLs from a file, one per line. Lines that start with # are skipped
yt-audio-cli --batch urls.txt

# Another format and folder
yt-audio-cli -f mp3 -o ~/Music URL
```

## CLI

| Option                   | Does                                                              |
| ------------------------ | ----------------------------------------------------------------- |
| `-f, --format <FORMAT>`  | `opus` (default), `aac`, `mp3` or `wav`                           |
| `-o, --output <DIR>`     | Folder for saved files. Default: the current folder               |
| `-b, --batch <FILE>`     | Reads URLs from a text file, one per line                         |
| `-F, --force`            | If the file exists, replaces it                                   |
| `-q, --quality <PRESET>` | MP3 only: `best` (320 kbps, default), `good` (192), `small` (128) |
| `--bitrate <KBPS>`       | MP3 only: 32 to 320 kbps. Overrides `--quality`                   |
| `--no-metadata`          | Writes no title and artist tags                                   |
| `-w, --workers <N>`      | Parallel downloads, 1 to 16. Default: 4                           |
| `-r, --retries <N>`      | Retries per failed download, 0 to 10. Default: 3                  |
| `-V, --version`          | Prints the version                                                |

Some older videos have no Opus stream. For these, yt-audio-cli uses the AAC stream. If you asked for `opus`, it encodes the AAC to Opus at 128 kbps and prints a note. AAC and WAV files have no place for tags.

| Exit code | Means                                                          |
| --------- | -------------------------------------------------------------- |
| `0`       | All files were saved or were already there                     |
| `1`       | At least one URL failed                                        |
| `2`       | No URLs were given, or yt-audio-cli cannot read the batch file |
| `130`     | Stopped with Ctrl-C. Press it twice to quit at once            |

## Moving from 0.2.x

Version 1.0 is a rewrite in Rust that supports YouTube only.

- The default format is now `opus`, not `mp3`. Use `-f mp3` to keep the old result
- `-q` and `--bitrate` now apply to MP3 only. Opus and AAC keep the quality of the YouTube stream
- Print the version with `-V`. The old `-v` is gone
- File names, `--batch`, `-o`, `-F`, `-w`, `-r` and `--no-metadata` work as before

The last Python version is [`v0.2.4`](https://github.com/pyyupsk/yt-audio-cli/tree/v0.2.4).

## Why?

yt-dlp supports more than 1,000 sites and needs Python and FFmpeg for audio. yt-audio-cli does one job: it saves YouTube audio. It asks YouTube for the streams the way the YouTube app for Apple Vision Pro does, so it does not need a JavaScript runtime. Opus and AAC files are copied as they are, not encoded again.

YouTube changes its systems often. If downloads stop working, update to the latest version. If that does not help, [open an issue](https://github.com/pyyupsk/yt-audio-cli/issues).

## License

[MIT](https://github.com/pyyupsk/yt-audio-cli/blob/main/LICENSE) License © 2026 [Pongsakorn Thipayanate](https://github.com/pyyupsk)

The binary includes [LAME](https://lame.sourceforge.io/) for MP3, under the LGPL. The full source is in this repository, so you can build the binary with your own copy of LAME.

