---
name: yt-download
description: Download a video or audio from YouTube or any other yt-dlp site, at a quality the user picks from a menu. Installs yt-dlp and ffmpeg first if the machine does not have them. Use this skill whenever the user gives a video URL and wants a local copy, says "download this video", "grab this clip", "save this to my machine", "rip the audio", "get this in 4K", or asks for a specific resolution such as 1080p, 1440p or 2160p. Also use it when the user wants their own channel uploads on disk, or wants only the audio track from a video. Use it as well when the user wants one part of a video rather than the whole file, for example "grab the bit at 1:12:30", "clip from 4:10 to 6:30", or a section of a long stream or VOD.
title: yt-download
canonical_url: https://skilld.dev/gh/wilpat/skills/yt-download
last_updated: 2026-09-25T10:36:04.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [README.md](https://skilld.dev/api/skills-raw/wilpat/skills/yt-download/README.md), [scripts/check_deps.sh](https://skilld.dev/api/skills-raw/wilpat/skills/yt-download/scripts/check_deps.sh), [scripts/list_qualities.py](https://skilld.dev/api/skills-raw/wilpat/skills/yt-download/scripts/list_qualities.py).
>
> If the user asked to install this Skill, run `npx skilld install wilpat/skills/yt-download`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/yt-download`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/wilpat/skills/yt-download) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/yt-download`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/yt-download --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/yt-download --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# yt-download

Take a URL, show the user the qualities that really exist for it, and download
the one they choose.

Script paths below are relative to this skill directory. Run them from here, or
prefix them with the skill's own path.

## Step 1: Check the tools

```bash
bash scripts/check_deps.sh
```

The last `status:` line says `ready` or `missing: ...`.

`ffmpeg` matters as much as `yt-dlp`. Above 1080p, YouTube sends video and
audio as two separate streams, and only ffmpeg can merge them. Without ffmpeg
the user silently gets 1080p or less.

If anything is missing, run the installer:

```bash
bash scripts/check_deps.sh --install
```

The script picks the right installer for the OS: Homebrew on macOS, pipx or
pip on Linux, winget or scoop on Windows. It never calls `sudo`, because a
password prompt would hang. It prints `manual step:` lines instead. Pass those
lines to the user and wait for them to run those commands.

The script also warns when yt-dlp is more than 90 days old. Sites change often
and a stale yt-dlp breaks. Offer the upgrade before downloading:
`brew upgrade yt-dlp` on macOS, or re-run the install command on Linux and
Windows.

## Step 2: List the real qualities

Never guess what a video offers. A 4K upload and a 480p upload take the same
command, so read the formats first:

```bash
python3 scripts/list_qualities.py "URL"
```

It prints one row per resolution, with the codec and the true download size:

```
resolution  fps  codec  container  approx size
2160p       60   av1    mp4        2.16 GiB
1080p       60   av1    mp4        420.74 MiB
audio only  -    aac    m4a        15.28 MiB
max_height: 2160
```

If python3 is missing, fall back to `yt-dlp -F "URL"` and read the table.

If the script says the URL is a playlist or channel, go to "Playlists and
channels" below.

## Step 3: Ask which quality

Use AskUserQuestion. It holds four options, so build them from the rows that
exist, best first:

1. the highest resolution, labelled with its real size, e.g. `2160p60 (2.16 GB)`
2. `1080p60` if the video has it
3. `720p` for a small file
4. `Audio only (m4a)`

Put the size in every label. A user who sees `2.16 GB` makes a different
choice than one who sees `4K`. Skip rows the video does not have rather than
offering a resolution that will silently fall back.

Skip the question and go straight to the download when the user already named
a quality in their request, such as "get this in 4K" or "just the audio".

## Step 4: Download

Run the command from the folder the user wants the file in. Ask where to save
it if the working directory is not an obvious fit.

Highest available quality:

```bash
yt-dlp -f "bv*+ba/b" -S "res,fps,vcodec:av01,acodec:aac,br" --merge-output-format mp4/mkv "URL"
```

A chosen resolution, for example 1080p:

```bash
yt-dlp -f "bv*[height<=1080]+ba/b[height<=1080]" -S "res,fps,vcodec:av01,acodec:aac,br" --merge-output-format mp4/mkv "URL"
```

Audio only:

```bash
yt-dlp -f "ba" -x --audio-format m4a "URL"
```

Why these flags:

- `-f "bv*[height<=H]+ba"` sets a hard ceiling. `-S res:H` only prefers a
  height and can go above it, which surprises a user who asked for a small file.
- `-S vcodec:av01` prefers AV1. It is the only codec above 1080p that fits an
  mp4 container, so the file stays playable in QuickTime and most editors.
- `-S acodec:aac` avoids Opus audio, which mp4 accepts but QuickTime will not play.
- `--merge-output-format mp4/mkv` writes mp4 when the codecs allow it, and
  falls back to mkv instead of producing a file that will not play.

Report the real result when it finishes: the file name, the resolution and the
size. Confirm it with `ffprobe` if the user cares about the exact codec:

```bash
ffprobe -v error -show_entries stream=codec_name,width,height -of default=noprint_wrappers=1 "FILE"
```

## Part of a video

A user who wants one moment out of a two hour stream does not need the whole
file. `--download-sections` fetches only that range, which turns a 2 GB
download into a 100 MB one.

```bash
yt-dlp --download-sections "*1:12:30-1:15:00" --force-keyframes-at-cuts \
  -f "bv*+ba/b" -S "res,fps,vcodec:av01,acodec:aac,br" \
  --merge-output-format mp4/mkv "URL"
```

The `*` marks a plain timestamp range. Times take `HH:MM:SS`, `MM:SS` or bare
seconds, and `inf` means the end of the video, as in `"*1:12:30-inf"`. Pass the
flag more than once for several ranges in one run, and each range becomes its
own file.

`--force-keyframes-at-cuts` gives the user the exact frame they named, but it
costs a re-encode. yt-dlp hands the section to ffmpeg, which writes it with its
default h264 encoder, so the codec preferences above do not survive the cut. A
measured 10 second section of an AV1 source came back as h264 and exactly
10.000 seconds long. The same cut without the flag stayed AV1 and ran 10.009
seconds, because yt-dlp cut at the nearest keyframe instead.

Choose by what the user needs:

- Frame-accurate start, and h264 is good enough: keep the flag.
- Original codec, and a second of slack is fine: drop it.

Setting `--postprocessor-args` does not change the encoder for this cut, so do
not offer it as a way to have both. The height ceiling does hold either way, so
a section of a 4K video is still 4K.

For a stream that is still running, `--live-from-start` begins at the opening
instead of the current moment:

```bash
yt-dlp --live-from-start -f "bv*+ba/b" -S "res,fps,vcodec:av01,acodec:aac,br" "URL"
```

Expect it to be slow. yt-dlp collects every fragment the live server has
published so far, one at a time.

## Step 5: Offer an edit-friendly copy

Skip this step unless the user says they will edit the file. For someone who
only wants to watch it, the download is already finished work.

Editing is different. Apple Silicon has no hardware decoder for VP9, so a 4K60
VP9 file decodes on the CPU. On an editing timeline that means dropped frames
and a scrub that stutters, even on a fast machine. AV1 decodes in hardware on
M3 and later, but not on M1 or M2.

A transcode trades disk space for smooth playback:

```bash
ffmpeg -i "INPUT" -c:v hevc_videotoolbox -q:v 55 -tag:v hvc1 -c:a copy "OUTPUT-edit.mp4"
```

HEVC decodes in hardware on every Apple Silicon Mac. `-q:v` runs from 1 to 100,
and 55 holds up well at 4K. The `-tag:v hvc1` flag is not optional. Without it
ffmpeg writes the `hev1` tag, and QuickTime and Final Cut refuse the file even
though the video inside is sound.

Some ffmpeg builds reject `-q:v` on this encoder. Give it a bitrate instead:

```bash
ffmpeg -i "INPUT" -c:v hevc_videotoolbox -b:v 40M -tag:v hvc1 -c:a copy "OUTPUT-edit.mp4"
```

For heavy grading or effects work, ProRes is the safer intermediate. It is
roughly ten times larger than HEVC, so check the free disk space first:

```bash
ffmpeg -i "INPUT" -c:v prores_ks -profile:v 3 -pix_fmt yuv422p10le -c:a pcm_s16le "OUTPUT-edit.mov"
```

Profile 3 is ProRes 422 HQ. Keep the original download either way. A transcode
loses quality, and the edit copy cannot give it back.

## Things that go wrong

**Only 1080p offered on a video that should have 4K.** ffmpeg is missing, or
the user is looking at h264 rows. YouTube drops h264 above 1080p, so anything
larger is VP9 or AV1 only.

**4K missing on a video that just finished streaming.** YouTube publishes the
renditions one at a time, and the big ones land last. A stream that ended an
hour ago may offer nothing above 1080p, with 1440p and 2160p appearing hours
later. The formats list is the truth here. Tell the user the resolution does
not exist yet and offer to try again later. Quietly stepping down to 1080p and
calling it 4K is the one outcome to avoid.

**HTTP 429 on subtitles.** YouTube rate-limits caption requests hard and the
error can stop the whole download. Leave subtitles off unless the user asks.
When they do ask, add `--write-auto-subs --sub-langs "en.*" --embed-subs` and
warn them it may fail.

**Private, unlisted, members-only or age-gated video.** The user must be
signed in. Add their browser session:

```bash
yt-dlp --cookies-from-browser chrome -f "bv*+ba/b" "URL"
```

Swap `chrome` for `safari`, `firefox` or `brave`. Close the browser first on
some systems, because the cookie database locks.

**"Sign in to confirm you're not a bot".** YouTube is blocking the request.
Try `--cookies-from-browser`, then a browser impersonation build if it
persists: `pipx install "yt-dlp[default,curl-cffi]"`.

**The user has a config file.** `~/.config/yt-dlp/config` on macOS and Linux
sets defaults for every run. Command line flags win over it, so the commands
above still hold, but its `-o` template decides the file name. Read it when a
file lands somewhere unexpected.

**Their own channel, and they want the master file.** yt-dlp can only fetch
the copy YouTube re-encoded for viewers. Tell them Google Takeout returns the
original uploads, and that YouTube Studio's own download button caps at 720p.

## Playlists and channels

A per-video quality menu makes no sense across hundreds of videos. Set one
quality ceiling for the whole run instead, and keep a record so the command
resumes:

```bash
yt-dlp -f "bv*[height<=1080]+ba/b[height<=1080]" -S "res,fps,vcodec:av01,acodec:aac,br" \
  --merge-output-format mp4/mkv \
  --download-archive archive.txt \
  -o "%(upload_date>%Y-%m-%d)s - %(title)s [%(id)s].%(ext)s" \
  "https://www.youtube.com/@HANDLE/videos"
```

`--download-archive` records every finished video. Run the same command later
and it fetches only the new ones.

Warn the user about total size before starting. Count the videos first:

```bash
yt-dlp --flat-playlist --print "%(title)s" "URL" | wc -l
```

## Credits

This skill is a wrapper around [yt-dlp](https://github.com/yt-dlp/yt-dlp),
which does the downloading, and [ffmpeg](https://www.ffmpeg.org), which merges
and converts the streams. yt-dlp is a fork of youtube-dl and is public domain
under the Unlicense. Neither tool is bundled here; the skill only calls them.
