Skip to main content

fm-dlp — Download from YouTube, YTMusic, and 1000+ sites

Python PyPI License Platform Ruff

fm-dlp is a CLI tool for searching YouTube/YTMusic and downloading audio/video from 1000+ sites


📋 Table of Contents


🚀 Quick Start

pip install fm-dlp                    # Python 3.11+ & FFmpeg required
fm-dlp config ~/Music                 # Set download directory
fm-dlp search "Ambient"               # Search tracks
fm-dlp download "URL"                 # Download audio

⚙️ Requirements

  • Python 3.11+ - TOML support required
  • FFmpeg - Required for audio/video processing and subtitle embedding. Install via:
    • macOS: brew install ffmpeg
    • Linux:
      • Debian: sudo apt install ffmpeg
      • Fedora: sudo dnf install ffmpeg
      • Arch Linux: sudo pacman -S ffmpeg
    • Windows: Download from ffmpeg.org and add to PATH

💡 If ffmpeg is not on your PATH, you can point fm-dlp directly to it with --ffmpeg-path (see download).


🌈 Color Output

By default, fm-dlp uses colored output for better readability. To disable colors globally, use the --no-color flag before the command:

fm-dlp --no-color search "artist"
fm-dlp --no-color download "URL"
fm-dlp --no-color config ~/Music

📋 Commands

Search for music tracks, albums, or videos on YouTube/YTMusic.

fm-dlp search <query> [--limit LIMIT] [--yt-video] [--album] [--raw] [--only-url]
Option Default Description
query Req Search query string
--limit N, -l 10 Maximum number of results to return (1-100)
--yt-video, -v False Search for YouTube videos instead of music tracks
--album, -a False Search for albums instead of individual tracks
--raw, -r False Output results in raw format (Python dict representation)
--only-url, -u False Output only the URLs without any formatting

download

Download audio or video content from supported platforms (YouTube, YTMusic, and 1000+ sites).

fm-dlp download <urls> [OPTIONS]
Option Default Description
urls Required Single URL, comma/space-separated list, or path to text file with URLs (one per line)
--codec, -c opus Audio: mp3, aac, flac, m4a, opus, vorbis, wav, alac
Video: mp4, mov, mkv, webm, avi, flv
--kbps, -K 256 Audio bitrate in kbps (64, 128, 192, 256, 320). Higher = better quality, larger file
--quality, -Q best Video quality preset: best, worst, 2160p, 1440p, 1080p, 720p, 480p, 360p, 240p, 144p, or custom height (e.g., 720)
--jobs, -j 5 Maximum number of concurrent downloads (1-24) for faster batch processing. The upper limit is automatically capped at your CPU core count (detected at runtime)
--quiet, -q False Suppress yt-dlp output messages (errors still shown)
--no-metadata False Disable embedding metadata (title, artist, album) and thumbnail into audio files
--keep, -k False Keep the original downloaded file after conversion/post-processing
--save, -s False Save settings (except URL) to config file
--use-config, -u False Use saved parameters from config file as defaults
--path, -p Configured path Custom download directory (overrides default config)
--ffmpeg-path, -fp None Path to ffmpeg binary or directory containing ffmpeg/ffprobe. Passed to yt-dlp as ffmpeg_location. If omitted, yt-dlp searches PATH
--config-file None Path to a custom TOML config file. Overrides the platform-specific default
--only-video, -v False Download video file without audio track
--cookies None Browser name: brave, chrome, chromium, edge, opera, vivaldi, whale, firefox, safari
Or path to cookies file (.txt, .sqlite, .db, .cookies)
--remote, -r None Download external JavaScript components for bypassing anti-bot protections.
Options: github (yt-dlp repo) or npm (NPM registry)
--subtitles False Download subtitles for the video. Use --subtitle-langs to specify languages
--subtitle-langs en Comma-separated subtitle language codes, e.g. 'en,ru,ja'
--embed-subs False Embed subtitles into the video container (requires FFmpeg)
--auto-subs False Include auto-generated subtitles (in addition to manually uploaded ones)
--ytdlp-args, -y None Extra yt-dlp options as a dict object. Merged last; postprocessors are extended, other keys override

ℹ️ CPU Detection: When parsing the download command, fm-dlp automatically detects the number of CPU cores on your system. The --jobs option is capped at this value to prevent overloading your system. If detection fails, a fallback value is used instead.

Audio Codec Details:

  • Lossy: mp3 (universal), aac (Apple), m4a (Apple), opus (modern web) - smaller files
  • Lossless: flac (high quality), wav (uncompressed), alac (Apple lossless) - larger files
  • Recommended: opus for best quality/size ratio, flac for archival

Video Container Details:

  • mp4 - Most compatible, uses m4a audio
  • mkv - Open format, uses opus audio
  • webm - Web optimized, uses opus audio
  • mov - Apple format, uses m4a audio
  • avi - Legacy Windows, uses mp3 audio
  • flv - Flash video, uses aac audio

config

Configure the default download directory path.

fm-dlp config <path>
Option Default Description
path Required Default directory path for downloads. Use absolute path for best results (e.g., /home/user/Music or C:\Music)

Config Location:

  • Windows: %LOCALAPPDATA%/fm-dlp/config.toml
  • macOS: ~/Library/Application Support/fm-dlp/config.toml
  • Linux: ~/.config/fm-dlp/config.toml

💡 To use a config file at a custom location, pass --config-file /path/to/config.toml to the download command.


💡 Examples

Basic Download

Download a track from YouTube Music:

fm-dlp download https://music.youtube.com/watch?v=0KNxOBerr_8

With custom settings:

# Download as high-quality MP3 with metadata
fm-dlp download "URL" --codec mp3 --kbps 320 --path ~/Music

# Download video in 1080p
fm-dlp download "URL" --quality 1080p --codec mp4

# Batch download from file
fm-dlp download urls.txt --jobs 3 --quiet

# Use saved config and cookies from browser
fm-dlp download "URL" --use-config --cookies chrome

# Download video-only and keep original file
fm-dlp download "URL" --only-video --keep
📦 Example Output
Starting: https://music.youtube.com/watch?v=0KNxOBerr_8
[youtube] Extracting URL: https://music.youtube.com/watch?v=0KNxOBerr_8
[youtube] 0KNxOBerr_8: Downloading webpage
[youtube] 0KNxOBerr_8: Downloading android vr player API JSON
[info] 0KNxOBerr_8: Downloading 1 format(s): 251
[info] Downloading video thumbnail 41 ...
[info] Writing video thumbnail 41 to: /home/user/Music/Lexapro Delirium.webp
[download] Destination: /home/user/Music/Lexapro Delirium.webm
[download] 100% of    6.53MiB in 00:00:01 at 5.74MiB/s
[ExtractAudio] Destination: /home/user/Music/Lexapro Delirium.opus
Deleting original file /home/user/Music/Lexapro Delirium.webm (pass -k to keep)
[Metadata] Adding metadata to "/home/user/Music/Lexapro Delirium.opus"
[ThumbnailsConvertor] Converting thumbnail "/home/user/Music/Lexapro Delirium.webp" to png
[EmbedThumbnail] mutagen: Adding thumbnail to "/home/user/Music/Lexapro Delirium.opus"

Success: https://music.youtube.com/watch?v=0KNxOBerr_8
Search Examples

Search for tracks, albums, and videos:

# Search for tracks on YouTube Music
fm-dlp search "Sewerslvt" --limit 5

# Search for albums
fm-dlp search "Skitzofrenia Simulation" --album --limit 1

# Search for videos on YouTube
fm-dlp search "Psychology" --yt-video --limit 1

# Get raw data for scripting
fm-dlp search "Willix" --raw

# Get only URLs for batch processing
fm-dlp search "ativansocial" --only-url > urls.txt

📝 Subtitles

Download subtitles alongside the video, save them as separate files, or embed them directly into the video container.

How it works

Flag yt-dlp option(s) Effect
--subtitles writesubtitles=True, subtitleslangs=[...] Downloads subtitle files for the given languages
--auto-subs writeautomaticsub=True Includes auto-generated subtitles
--embed-subs embedsubtitles=True, postprocessor FFmpegEmbedSubtitle Muxes subtitles into the video container

⚠️ Embedding caveats

  • Requires FFmpeg.
  • Only makes sense for video codecs (mp4, mkv, webm, mov) or when --only-video is set.
  • For audio-only codecs (mp3, flac, etc.) --embed-subs is silently skipped.

Language selection

--subtitle-langs is a comma-separated string, e.g. "en,ru,ja". Whitespace is stripped. If empty, defaults to ["en"].

Examples

Download video with English + Russian subtitles embedded into MKV

fm-dlp download "URL" \
  --codec mkv \
  --quality 1080p \
  --only-video \
  --subtitles \
  --subtitle-langs "en,ru" \
  --embed-subs

Download audio with subtitles saved as separate .srt files

fm-dlp download "URL" \
  --codec mp3 \
  --kbps 320 \
  --subtitles \
  --subtitle-langs "en" \
  --auto-subs

🧩 Raw yt-dlp Arguments

For anything not covered by the high-level CLI, you can pass arbitrary yt-dlp options via --ytdlp-args (short: -y).

Rules

  • Value must be a dict (Python literal).
  • Keys are snake_case yt-dlp option names (the same keys used by YoutubeDL(opts)).
  • Options are merged last into the built options dict → they override existing values.
  • Exception: postprocessors are extended (built-in postprocessors are preserved) rather than replaced.

Examples

Add retries and a custom subtitle format

fm-dlp download "URL" -y '{"retries": 10, "fragment_retries": 10, "subtitlesformat": "srt/best"}'

Extend postprocessors without losing built-ins

fm-dlp download "URL" -y '{"postprocessors": [{"key": "FFmpegMetadata"}, {"key": "SponsorBlock", "categories": ["sponsor"]}]}'

Rate-limit requests

fm-dlp download "URL" -y '{"sleep_interval_requests": 1, "sleep_interval": 2, "max_sleep_interval": 5}'

📁 Custom Paths

--ffmpeg-path, -fp

Point fm-dlp to a specific ffmpeg binary or to a directory containing ffmpeg/ffprobe. Passed to yt-dlp as ffmpeg_location. Useful when ffmpeg is not on your PATH.

# Directory containing ffmpeg/ffprobe
fm-dlp download "URL" --ffmpeg-path /usr/local/bin

# Specific ffmpeg binary
fm-dlp download "URL" --ffmpeg-path /opt/ffmpeg/bin/ffmpeg

--config-file

Use a TOML config file at a custom location. Overrides the platform-specific default path (see config).

fm-dlp download "URL" --config-file ~/my-fm-dlp.toml

--path, -p

Override the configured download directory for a single run.

fm-dlp download "URL" --path ~/Music/Downloads

💾 Saving Settings

Persist your download preferences (everything except the URL) into the config file, then reuse them later with --use-config.

# Save current settings
fm-dlp download "URL" --codec flac --kbps 320 --save

# Reuse them for the next download
fm-dlp download "URL" --use-config

📊 Search Output Examples

Examples of formatting search results from different sources. Click each example to expand.

🎵 YTMusic (Track)
    1. A Dream
        ├─ Flatsound
        ├─ Somewhere in the Distance, Somewhere Toward the Mountains
        ├─ 4M │ 2:51
        └─ https://music.youtube.com/watch?v=DVDiOMoW0wU
          ──────────────────────────────────────────────────

    N. Title
        ├─ Artist
        ├─ Album
        ├─ Views │ Duration
        └─ URL
           ──────────────────────────────────────────────────
💿 YTMusic (Album)
    1. Skitzofrenia Simulation
        ├─ Sewerslvt
        ├─ 2021
        └─ https://music.youtube.com/playlist?list=OLAK5uy_kXLBb5YlVizbrgXAHwTgarL5HYC3usuYA
          ──────────────────────────────────────────────────

    N. Title
        ├─ Artist
        ├─ Year
        └─ URL
           ──────────────────────────────────────────────────
▶️ YouTube (Video)
    1. Silence , I'm Dying.
        ├─ Willix
        ├─ 587,740 │ 2:05
        └─ https://youtu.be/oSOaz5yaBM8
          ──────────────────────────────────────────────────

    N. Title
        ├─ Artist
        ├─ Views │ Duration
        └─ URL
           ──────────────────────────────────────────────────

Format Elements

Element Description
N. Sequential number of search result
Title Track, album, or video title
Artist Artist or channel name
├─└─│ Tree branch characters
Views │ Duration View count and length (MM:SS or HH:MM:SS)
URL Direct link to content
─── Visual separator line

📄 License & Acknowledgments

AGPLv3 License — Built with:

Library Purpose
fm-dlp-core Main core

Author: Fkernel653

Project: GitHub • PyPI

Release files for fm-dlp 4.6.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 fm-dlp 4.6.8
File Size Uploaded
fm_dlp-4.6.8.tar.gz 12.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fm-dlp 4.6.8
File Interpreter ABI Platform
fm_dlp-4.6.8-py3-none-any.whl Python 3 none any Details

Total release size: 26.8 kB

Release files / fm_dlp-4.6.8.tar.gz

Download URL fm_dlp-4.6.8.tar.gz
Size 12.2 kB
Tags Source
SHA-256 checksum
How to use checksums
317b6cb06ef33c71abac06d206299b24bc785da7ca4822747523366fe9052259
BLAKE2b-256 checksum
How to use checksums
6922250d9f481c340a8407c4c8b7f1389a7de750f82a74e32ba91024ca51bde0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / fm_dlp-4.6.8-py3-none-any.whl

Download URL fm_dlp-4.6.8-py3-none-any.whl
Size 14.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dcdbb0355b94352868a6dea8a8cc0453a501c2d48164e99bba212dc4ba856f80
BLAKE2b-256 checksum
How to use checksums
61aa9984507d04e8c8a9f9dc806fdd66c20d4150e33c6791a7a2e03b206909cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

4.6.8 This release

2 release files

4.6.7

2 release files

4.6.6

2 release files

4.6.5

2 release files

4.6.4

2 release files

4.6.3

2 release files

4.6.2

2 release files

4.6.1

2 release files

4.6.0

2 release files

4.5.9

2 release files

4.5.8

2 release files

4.5.7

2 release files

4.5.6

2 release files

4.5.5

2 release files

4.5.4

2 release files

4.5.3

2 release files

4.5.2

2 release files

4.5.1

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