gabrielvidalandClaude Opus 5.5 1b26880406 feat: fall back to a system or static ffmpeg where the bundled one can't start
The crate's ffmpeg build links glibc 2.38, so it fails on Ubuntu 22.04 and
Debian 12. ensure() now checks `ffmpeg -version`; if it fails it links a
working system ffmpeg/ffprobe, else (Linux) unpacks yt-dlp's static build
(yt-dlp/FFmpeg-Builds, glibc >= 2.28) with tar + lzma-rs. Verified on a
clean ubuntu:22.04.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 22:03:19 +01:00

video-dl

Download a video, or just its audio, from a URL: YouTube, TikTok, X, Instagram, Reddit, TED, Dailymotion and the ~1800 other sites yt-dlp knows. One static binary. yt-dlp, ffmpeg and deno (YouTube's JS runtime) are fetched into its data dir on first run, so there's nothing else to install.

curl -fsSL https://git.gabvdl.xyz/gabrielvidal/video-dl/raw/branch/main/install.sh | sh

Linux and macOS, x64 and arm64. The installer drops video-dl into ~/.local/bin, adds the Claude Code skill when ~/.claude exists, and runs video-dl setup. Options: --version vX.Y.Z, --bin-dir DIR, --no-skill, --no-setup (sh -s -- <options> after a pipe). With no prebuilt binary for the machine, it builds one with cargo if Rust is there.

Use

video-dl https://www.youtube.com/watch?v=jNQXAC9IVRw     # ≤1080p mp4 → ~/Downloads/ytpdl/
video-dl <url> --audio                                    # mp3
video-dl <url> --subs --to ./clips                        # + .vtt subtitles, elsewhere
video-dl <url> --arg=--download-sections --arg='*1:00-1:30'
video-dl -p https://www.youtube.com/@channel --items 1:5
video-dl info <url>
video-dl setup | update [--all]

video-dl --help and video-dl get --help list every flag. The skill's SKILL.md is the full reference: output format, exit codes, what to do when a site fails.

variable effect
VIDEO_DL_DIR default output dir (else ~/Downloads/ytpdl)
VIDEO_DL_HOME where the tools live (else ~/.local/share/video-dl, macOS ~/Library/Application Support/video-dl)
VIDEO_DL_AUTO_UPDATE=0 don't update a yt-dlp that's over 45 days old before downloading

How it works

  • Tools. The yt-dlp crate (LibraryInstaller) installs the standalone yt-dlp from its GitHub releases and a static ffmpeg build. It also updates yt-dlp (update_downloader). deno comes from deno's GitHub releases. That ffmpeg build links glibc 2.38, so where it won't start (Ubuntu 22.04, Debian 12) video-dl uses a working system ffmpeg, or on Linux yt-dlp's own static build (yt-dlp/FFmpeg-Builds, glibc ≥ 2.28, a ~150 MB download once). Every child process gets TMPDIR=<data dir>/tmp, because the standalone yt-dlp unpacks itself on each start and a small /tmp breaks it.
  • Downloads are yt-dlp's. The crate can download streams itself, but only plain HTTPS formats: HLS/DASH formats (most of X, Reddit, Twitch, TED, and YouTube's m3u8 ones) are neither "video" nor "audio" to it. So get runs yt-dlp with a --progress-template and an --print after_move: JSON line, and parses both. That keeps sections, SponsorBlock, playlists, subtitles and every extractor working.
  • Subtitles are a second, --skip-download pass. Inside the main run, a subtitle error (YouTube 429s happen) makes yt-dlp drop the video.
  • info is one yt-dlp -J --flat-playlist call (capped at 100 entries for playlists). The crate's fetch_video_infos extracts every entry of a playlist, and its Video model only fits YouTube's JSON.
  • Freshness. get checks the yt-dlp version at most every 6 h and updates it once it's over 45 days old, because sites break stale extractors within weeks.

Building and releasing

cargo test
scripts/release.sh          # tag v<Cargo.toml version>, build what this machine can, upload to the Gitea release

On Linux it builds video-dl-linux-x64 and -arm64: static musl, cross-built with cargo-zigbuild + zig. On a Mac it builds video-dl-macos-arm64 and -x64 natively. macOS can't be cross-built from Linux, because reqwest's rustls verifier links Apple's Security framework. Each run adds its binaries to the same release and rewrites checksums.txt. It needs a Gitea token in $GITEA_TOKEN or ~/.config/homelab-gitea-token.

The homelab ships this skill to the ai-agent's guests from a copy in ~/homelab/.claude/skills/video-dl/ (SKILL.md + scripts/install.sh). Copy both there when they change.

License

GPL-3.0-only, as the yt-dlp crate it links is. yt-dlp (Unlicense), ffmpeg (GPL build) and deno (MIT) are downloaded by your machine at runtime, not shipped here.

S
Description
No description provided
Readme GPL-3.0
128 KiB
0 Stars 1 Watchers 0 Forks
2026-11-03 22:04:17 +01:00
Languages
Rust 84.8%
Shell 15.2%