Skip to main content

YouTube-to-Audio CLI Tool

A lightweight Python package and command-line interface (CLI) tool that extracts audio from YouTube videos and playlists in multiple formats, such as MP3, WAV, OGG, AAC, and FLAC.

Features

  • Extract audio from YouTube videos or playlists in various formats: MP3, WAV, OGG, AAC, FLAC, M4A, and OPUS.
  • Customize the output audio file name.
  • By default, names the audio files and playlists after the YouTube video or playlist title.
  • Automatically cleans up temporary video files after extraction.

Installation

To install the package from PyPI, run the following command:

pip install youtube-to-audio

Usage

1. Download and Extract Audio from a Single Video in the Default Format (MP3)

youtube-to-audio --url "https://www.youtube.com/watch?v=WysanSNOjMc"

This command extracts the audio in MP3 format and saves it with the same name as the YouTube video title (e.g., The Video Title.mp3).

2. Extract Audio from a Playlist in MP3 Format

youtube-to-audio --url "https://www.youtube.com/playlist?list=PLRBp0Fe2GpgnymQGm0yIxcdzkQsPKwnBD"

This command extracts audio from all videos in a playlist and saves each file by default in a folder named after the playlist, using the YouTube video title as the filename (e.g., Video1.mp3, Video2.mp3, etc.).

3. Extract Audio in a Different Format (e.g., WAV)

youtube-to-audio --url "https://www.youtube.com/watch?v=WysanSNOjMc" --format wav

This command extracts the audio in WAV format and saves it with the YouTube video title (e.g., Your Video Title.wav).

4. Specify a Custom Audio File Name

youtube-to-audio --url "https://www.youtube.com/watch?v=WysanSNOjMc" --format wav --output_name "my_custom_name"

This command extracts the audio in WAV format and saves it as my_custom_name.wav.

5. Extract a Playlist into a Custom Folder

youtube-to-audio --url "https://www.youtube.com/playlist?list=PLRBp0Fe2GpgnymQGm0yIxcdzkQsPKwnBD" --playlist_name "MyPlaylist"

This saves all extracted audio files inside a folder named MyPlaylist instead of using the default playlist title.


Command-Line Options

Option Description Required Usage Scenario
--url YouTube video or playlist URL ✅ Yes Required for all cases
--format Audio format (mp3, wav, flac, aac, ogg, m4a, opus) ❌ No (default: mp3) Extracting in a specific format
--output_name Custom output file name (single videos only) ❌ No Naming a single file differently
--playlist_name Custom folder name for playlist downloads ❌ No Saving a playlist into a specific folder

Requirements

This tool requires FFmpeg to be installed on your system. If FFmpeg is not found, the tool will not be able to extract audio.


License

This project is licensed under the MIT License. See the LICENSE file for details.


Contributing

Contributions are welcome! If you have suggestions or bug fixes, feel free to open a pull request.


Author

Developed by Jack Tol
GitHub Repository

Metadata

Release files for youtube-to-audio 0.1.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for youtube-to-audio 0.1.8
File Size Uploaded
youtube_to_audio-0.1.8.tar.gz 4.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for youtube-to-audio 0.1.8
File Interpreter ABI Platform
youtube_to_audio-0.1.8-py3-none-any.whl Python 3 none any Details

Total release size: 9.8 kB

Release files / youtube_to_audio-0.1.8.tar.gz

Download URL youtube_to_audio-0.1.8.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
5c7a8ef1fef3a2cd51d1f1e08a26d143d4780e6b1f9cb5ddbd6131124fb9d9d6
BLAKE2b-256 checksum
How to use checksums
321eb2a944b923f1a6527c95c665f467025562d7cdad0d004ea0e0053f07fa4b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.5

Release files / youtube_to_audio-0.1.8-py3-none-any.whl

Download URL youtube_to_audio-0.1.8-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
380f3304f8016964cf872f6fec28b60b314cf6cdaf94be7ff4d9f14d2e2968ae
BLAKE2b-256 checksum
How to use checksums
4280cb2807a6f613723bd7f152ce35fd762fb99695b23c7964b99bb897f781df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.5

Release history Release notifications | RSS feed

This release

0.1.8 This release

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page