Skip to content

yt-dlp and ffmpeg: why you need it, how to install it, and the commands that use it

By Tunelio teamPublished

Without ffmpeg, yt-dlp can only save what YouTube serves as a single file — usually 360p or 720p with baked-in audio. Everything above that comes as separate video and audio streams that ffmpeg must merge, and every MP3 or format conversion is an ffmpeg job. Install it once, put it on your PATH (or use --ffmpeg-location), and the “ffmpeg not found” warning, the missing 1080p and the failed -x extractions all go away.

What ffmpeg does for yt-dlp

  • Merging: YouTube delivers 1080p, 1440p and 4K as separate video-only and audio-only DASH streams. yt-dlp downloads both and asks ffmpeg to mux them into one MP4 or MKV.
  • Audio extraction: -x --audio-format mp3 (or m4a, opus, flac, wav) is a transcode or remux done by ffmpeg.
  • Post-processing: embedding thumbnails and metadata, splitting chapters, remuxing WebM to MP4, fixing container issues, and downloading HLS/m3u8 streams for some sites.

If yt-dlp prints “WARNING: ffmpeg not found” or “You have requested merging of multiple formats but ffmpeg is not installed”, it silently downgrades to the best single-file format — that is why so many people “only get 720p”.

Install ffmpeg

Linux

sudo apt install ffmpeg        # Debian / Ubuntu
sudo dnf install ffmpeg        # Fedora (enable RPM Fusion first)
sudo pacman -S ffmpeg          # Arch
ffmpeg -version

macOS

brew install ffmpeg

Windows

winget install Gyan.FFmpeg      # or: choco install ffmpeg  /  scoop install ffmpeg
# then open a NEW terminal so PATH is refreshed, and check:
ffmpeg -version

The yt-dlp project also publishes its own ffmpeg builds (yt-dlp/FFmpeg-Builds on GitHub) with patches for a few edge cases; for most users the distribution package is fine. yt-dlp needs the ffmpeg and ffprobe executables — both come in every package above.

Tell yt-dlp where ffmpeg is

# if ffmpeg is not on PATH (portable Windows builds, custom locations):
yt-dlp --ffmpeg-location "C:\ffmpeg\bin" "URL"
yt-dlp --ffmpeg-location /opt/ffmpeg/bin/ffmpeg "URL"

# make it permanent in yt-dlp's config file (~/.config/yt-dlp/config or %APPDATA%\yt-dlp\config.txt):
--ffmpeg-location /opt/ffmpeg/bin

--ffmpeg-location accepts either the directory containing ffmpeg/ffprobe or the path to the ffmpeg binary itself. Verify with yt-dlp -v: the debug header prints the ffmpeg version it found, or “ffmpeg: none” if it did not.

Commands that use ffmpeg

Best quality MP4 (video + audio merged)

# best video + best audio, merged into MP4
yt-dlp -f "bv*+ba/b" --merge-output-format mp4 "https://youtu.be/dQw4w9WgXcQ"

# prefer H.264 + AAC so the file plays everywhere without re-encoding
yt-dlp -S "res:1080,vcodec:h264,acodec:m4a" --merge-output-format mp4 "URL"

Merging is a remux, not a re-encode: it takes seconds and loses no quality. Re-encoding happens only if you ask for it with --recode-video or if the codecs cannot live in the container you chose (VP9 video in MP4 is fine; Opus in MP4 is not — yt-dlp falls back to MKV then).

Extract audio

yt-dlp -x --audio-format mp3 --audio-quality 0 "URL"   # MP3, best VBR
yt-dlp -x --audio-format best "URL"                   # keep the original Opus/AAC, no transcode

Embed thumbnail and metadata

yt-dlp -x --audio-format mp3 --embed-thumbnail --embed-metadata "URL"

Cut a clip

yt-dlp --download-sections "*00:01:00-00:02:30" -f "bv*+ba/b" "URL"

Common ffmpeg errors with yt-dlp

  • “ffmpeg not found” after installing → open a new terminal (Windows PATH is read at start) or pass --ffmpeg-location.
  • “Postprocessing: Conversion failed!” → usually a corrupt partial download; delete the .part file and retry, or update yt-dlp — older builds hand ffmpeg broken fragments.
  • “ffmpeg exited with code 1” on merge → check disk space and that the output directory is writable; run with -v to see ffmpeg’s own stderr.
  • 1080p still missing with ffmpeg installed → YouTube did not offer it to your client; try another player client or check for a PO-token warning (see the 403 guide).
  • Very old ffmpeg (before 4.x) → some options and codecs fail; upgrade — yt-dlp expects a reasonably current build.

Docker

FROM python:3.12-slim
RUN apt-get update && apt-get install -y --no-install-recommends ffmpeg curl unzip \
 && pip install --no-cache-dir "yt-dlp[default]" \
 && curl -fsSL https://deno.land/install.sh | DENO_INSTALL=/usr/local sh
ENTRYPOINT ["yt-dlp"]

A container needs three things for full YouTube support today: yt-dlp, ffmpeg and a JavaScript runtime (Deno). Rebuild the image regularly — see the update guide.

When you don’t want to run ffmpeg at all

Merging and transcoding is CPU you pay for on every download; on a server that serves users it adds up fast, and it is one more binary to keep patched. A hosted API returns an already-muxed MP4 or a ready MP3 as one signed URL, so your side is a single HTTP request. Tunelio is our own service, so weigh the pitch accordingly — for local use, ffmpeg plus yt-dlp is the right tool. New accounts get 100 free credits.

Sources

  • yt-dlp README — Dependencies (ffmpeg/ffprobe), Post-processing options, --ffmpeg-location.
  • yt-dlp/FFmpeg-Builds — the project’s patched ffmpeg builds.
  • ffmpeg.org — official download and documentation.

Frequently asked questions

Is ffmpeg required for yt-dlp?

Not to run, but effectively yes for YouTube: anything above 720p and every audio conversion needs it. Without ffmpeg you get the best single-file format only.

Does merging reduce quality?

No. Merging is a remux — streams are copied into a new container without re-encoding. Quality is lost only when you transcode, for example to MP3.

yt-dlp says ffmpeg not found but it is installed — why?

It is not on the PATH yt-dlp sees (common on Windows right after installing, or in cron/Docker). Open a new terminal or pass --ffmpeg-location with the folder that contains ffmpeg.exe.

Do I need ffprobe too?

Yes, yt-dlp uses ffprobe for some post-processors. Every standard ffmpeg package includes it.

Related guides