Skip to content

The Moving Parts

One yt-dlp command sets five pieces in motion. Knowing which piece does what is most of troubleshooting, because every error message names one of them.

The extractor

Each supported site has an extractor: a small plugin that knows how that site's pages are built. It reads the page, finds the media, and reports back a tidy bundle of facts — the title, the uploader, the duration, the subtitle languages, and the list of formats the site will serve.

yt-dlp --list-extractors | wc -l

Check: the lab's build prints 1755. Most entries are sites you will never visit; what matters is that your site has one, or that the generic extractor can cope (chapter 10).

Formats

A format is one concrete serving of the media: this resolution, this codec, this file size. A single video usually arrives as several formats — the same film at 240p, 480p and 720p, say — and some sites serve picture and sound as separate formats that must be combined. Chapter 5 is about reading the list (yt-dlp -F) and choosing; the choice is yours, not the site's.

The downloader

The downloader fetches the chosen formats. Plain files come over ordinary HTTP. Much of the web's video, though, is served as HLS or DASH: a playlist of many small segment files (fragments) that are downloaded one by one and joined. yt-dlp has a built-in fragment downloader, and can also hand the job to ffmpeg — the difference mattered in the lab, where one route failed and the other worked (transcripts t10 and t11).

While a download runs you may see files ending in .part (a half-fetched file) and .ytdl (resume state for fragments). They are how an interrupted download picks up where it left off; they disappear when the job finishes.

ffmpeg and the postprocessors

After the download, postprocessors do the finishing work:

  • Merger — combines a separate video format and audio format into one file.
  • Audio extractor — writes just the sound out as an MP3 or another audio format (chapter 7).
  • Subtitle tools — embed or convert subtitle files.

Nearly all of this is done by ffmpeg, the standard free tool for handling audio and video, which yt-dlp calls for you. If ffmpeg is missing, downloads still work, but merging and audio extraction fail — chapter 3 installs it alongside, and chapter 14 reads the error.

ffmpeg -version | head -1

Check: the lab's prints ffmpeg version 8.1.2 ....

The template and the archive

Two pieces of bookkeeping sit around the download itself. The output template decides each file's name from the facts the extractor reported (chapter 6). The download archive is a small text file listing everything already fetched, so repeating a command skips what you have (chapter 8).

One more part, mentioned here because chapter 14 needs it: some sites now ask the downloader to run a little JavaScript before they will talk. yt-dlp then needs a JavaScript runtime (it looks for deno first). The lab had none installed, and its absence is noted in transcript t01 — one more reason that particular site said no.