Skip to content
yt-dlp

yt-dlp Command Generator for Bilibili

Build a yt-dlp command for Bilibili, starting with the browser impersonation that avoids most 403 errors.

Optional. Leave it empty and the command ends with URL for you to fill in.

Your command

yt-dlp -f 'bv*[height<=1080]+ba/b[height<=1080]' --merge-output-format mp4 --no-playlist --impersonate chrome --cookies-from-browser chrome https://www.bilibili.com/video/BV1xx411c7mD
Basics

Audio-only extracts the soundtrack and drops the video stream.

Video and quality

Caps the height. yt-dlp still picks the best stream at or below it.

The file type separate video and audio streams are merged into.

Advanced options (3)

Overrides the quality dropdown. For people who already know the format syntax.

Repackages the streams without re-encoding. Fast and lossless.

Re-encodes the video. Slow and lossy — only when remuxing will not do.

Audio

The file the audio is converted to.

VBR gives the best size-to-quality ratio; fixed bitrates are more predictable.

Subtitles

Embedding puts them inside the video; saving writes a separate .srt next to it.

Comma separated. Use all for every available language.

Playlists and channels

What to do when the URL belongs to both a video and a playlist.

Ranges and lists both work, for example 1-10,15 or -5::2 for every second item from the end.

Advanced options (1)

Records what has been downloaded so re-running skips it. The way to keep a channel in sync.

Sections and chapters
Advanced options (2)

A time range like *00:01:30-00:03:00, or a chapter name. The leading asterisk means it is a timestamp.

Metadata and artwork
Advanced options (3)
SponsorBlock

Cuts community-marked segments out of the file using SponsorBlock data.

Advanced options (1)

Keeps the segments but marks them, so you can skip them yourself.

Files and folders

Field names go in %(...)s. Slashes create folders.

Advanced options (4)

Where files are written. Combine with the template above for subfolders.

Maximum file name length in characters.

Filters
Advanced options (5)

YYYYMMDD, or a relative date like now-1month.

YYYYMMDD, or a relative date.

Skips anything smaller. Accepts 5M, 500K and similar.

Skips anything larger.

Number of files to download before stopping.

Network

For example 2M or 500K. Useful when you need the rest of your bandwidth.

Advanced options (5)

Speeds up fragmented streams. Four is a sensible starting point.

How many times to retry a failed piece. infinite is allowed.

HTTP, HTTPS or SOCKS proxy URL.

Makes requests look like a real browser. The usual fix for sudden 403 errors.

Login and cookies

Reads your logged-in session directly. Needed for private, age-restricted or members-only content.

Advanced options (1)

A Netscape-format cookies.txt exported from your browser.

Live streams
Advanced options (2)

Polls until a scheduled stream begins. MIN-MAX seconds between checks.

Workarounds
Advanced options (3)

Deprecated in favour of --add-headers. Kept because plenty of older guides still use it.

Deprecated in favour of --add-headers.

Site-specific switches, for example youtube:player_client=web.

Output and debugging
Advanced options (2)
Reset

403 errors and quality limits

Bilibili rejects requests that do not look like a browser, which is why a plain command often returns 403. Impersonation is switched on in this preset because it is the fix in most cases.

1080p and above are usually reserved for logged-in or premium accounts, so cookies matter here for quality and not just for access. Multi-part videos appear as playlist entries.

Bilibili is the platform where a stale yt-dlp breaks fastest — the site reworks its API more often than any Western platform, and extractor updates land in yt-dlp releases within days of each change. When a download that worked last month starts failing, update first: yt-dlp -U. Impersonation (on by default in this preset) covers the browser-looking-headers part of the 403 problem; the rest is usually a missing or expired session.

Multi-part uploads — the P1/P2/P3 structure common for series — arrive as playlist entries, so whole-playlist handling fetches every part, and the playlist index in the output template keeps the parts in order. Danmaku (the scrolling comments) are a subtitle track to yt-dlp: --write-subs saves them as an .ass file, which is the only format they exist in. If you do not want them, do nothing — they are not merged unless asked.

Interaction qualities — the "dolby" and premium ladders — exist only for accounts holding them, and no flag reaches them without cookies from such an account. Region-locked content is the other wall: some uploads are visible only from mainland China, and a proxy in-region is the only route when the block is enforced at the CDN rather than the page. Geo-bypass occasionally works for the page-level block and never for the CDN one.

Bilibili serves its higher qualities as DASH with separate audio, so ffmpeg merges just like YouTube — the merge step is in this preset already. Audio-only extraction with -x works and is the fastest way to take just the sound from a long multi-part upload. For live replays, the replay becomes an ordinary VOD after the stream ends, so download it like any video; the live-recording options on this site are for the stream while it is happening.

Frequently asked questions

Why does Bilibili return 403?
Bilibili rejects requests that do not look like a browser. --impersonate chrome fixes this most of the time; add cookies for member-only content.
How do I download 1080p or higher from Bilibili?
Higher resolutions are reserved for logged-in and sometimes premium accounts. Use --cookies-from-browser with such an account.
How do I get every part of a multi-part video?
Set playlist handling to the whole playlist — the parts are exposed as playlist entries.