ytdlp.org

Practical yt-dlp docs: install, commands, fixes, cookies, and workflows.

Current section

How-to

Download part of a video with yt-dlp

If you only need a minute out of an hour, you don't have to download the hour and trim it. --download-sections tells yt-dlp which time range you want, and it fetches just that part.

Quick answer

yt-dlp --download-sections "*1:00-1:20" "<URL>"

The * at the start matters: it marks the value as a time range. Without it, yt-dlp treats the text as a chapter name. Times can be seconds (60), MM:SS or HH:MM:SS, with decimals if you need them (1:00.5). You need ffmpeg installed for this.

What it actually downloads

We tested on the Internet Archive's copy of Big Buck Bunny (a 9:56, 59 MiB MP4) with yt-dlp 2026.10.26 in November 2026:

yt-dlp -f "b[ext=mp4]" --download-sections "*00:01:00-00:01:20" \
  -o "clip.%(ext)s" "https://archive.org/details/BigBuckBunny_124"

[info] BigBuckBunny_124: Downloading 1 time ranges: 60.0-80.0
[download] 100% of    2.18MiB in 00:00:01 at 1.26MiB/s

2.18 MiB instead of 59, and ffprobereports the clip as 20.0 seconds long. yt-dlp passes the range to ffmpeg, which reads only the part of the file it needs. ffmpeg prints its own progress lines while it works; that's normal.

Ranges you'll actually use

# from 10:15 to the end
yt-dlp --download-sections "*10:15-inf" "<URL>"

# the last 30 seconds
yt-dlp --download-sections "*-30-inf" "<URL>"

# two clips from the same video, one file each
yt-dlp --download-sections "*0:30-0:40" --download-sections "*5:00-5:10" \
  -o "%(title)s %(section_start)s-%(section_end)s.%(ext)s" "<URL>"

inf means the end of the video, and a negative number counts back from the end. On our test video, *-30-inf gave a 30.0-second file. The two-clip command produced Big Buck Bunny 30-40.mp4 and Big Buck Bunny 300-310.mp4: section_start and section_end are in seconds. Without them in the template, the second clip would overwrite the first. More fields are in the output template guide.

Exact cuts: --force-keyframes-at-cuts

By default yt-dlp copies the video stream as-is, so a cut can only land on a keyframe. Depending on how the video was encoded, that can be a fraction of a second or a few seconds away from the time you asked for. If the clip has to start on an exact frame, re-encode at the cut points:

yt-dlp --download-sections "*1:00.5-1:20" --force-keyframes-at-cuts "<URL>"

On our test file this gave exactly 19.5 seconds. It costs CPU time and a little quality around the cuts, so only use it when the precise start matters, like a clip you'll publish or feed into a model with timestamps.

Download a chapter by name

Without the *, the value is a regular expression matched against chapter titles:

# every chapter whose title contains "intro" or "demo"
yt-dlp --download-sections "intro|demo" "<URL>"

This only works when the site gives yt-dlp chapter data (YouTube videos with timestamps in the description usually do). When it doesn't, yt-dlp says so and downloads nothing:

[info] BigBuckBunny_124: Cannot match chapters since chapter information is unavailable

Check what chapters a video has with yt-dlp --print chapters "<URL>" first. If it prints NA, use a time range instead.

When it doesn't work

  • "Cannot match chapters" and no file: you left out the *. We ran --download-sections "1:00-1:20" and yt-dlp read it as a chapter name and downloaded nothing. Write "*1:00-1:20", in double quotes.
  • ffmpeg errors: update ffmpeg. Old builds mishandle seeking in some streams. The ffmpeg guide covers installing a current one.
  • Live streams:we tested ranges on finished videos. For a stream that's still live, see downloading YouTube live streams.
  • 403 or bot-check errors:those aren't about the range. Start with the yt-dlp errors guide.

For builders

Using yt-dlp inside an app or script?

Paste a link to see what a managed media-import API returns — no install, no signup.

Building this into an app? See the API your backend calls instead

Frequently asked questions

How do I download only part of a video with yt-dlp?

Use --download-sections with a time range that starts with an asterisk: yt-dlp --download-sections "*1:00-1:20" "URL". The asterisk tells yt-dlp the value is a time range rather than a chapter name. yt-dlp then fetches just that range, not the whole file.

Why does my yt-dlp clip start a little early or late?

By default yt-dlp copies the streams without re-encoding, so the cut lands on a keyframe near the time you asked for. Add --force-keyframes-at-cuts to cut at the exact time. It re-encodes around the cut, so it's slower.

Can I download several parts of a video at once?

Yes. Repeat the option: --download-sections "*0:30-0:40" --download-sections "*5:00-5:10". Each range becomes its own file, so put %(section_start)s in the output template to keep the names apart.

How do I download the last 30 seconds of a video?

Use a negative start and inf as the end: --download-sections "*-30-inf". inf means the end of the video, and a negative number counts back from the end.

Does --download-sections need ffmpeg?

Yes. yt-dlp hands the range to ffmpeg, which reads only the part it needs, so install ffmpeg before using it.

Straightforward yt-dlp help for installs, commands, fixes, cookies, and repeatable workflows.

ytdlp.org is an independent, community-maintained documentation site. It is not affiliated with the yt-dlp project — the official source code lives at github.com/yt-dlp/yt-dlp.