Skip to content
yt-dlp

Live Stream Downloader — yt-dlp Command Generator

Build a yt-dlp command to record a live stream, from the start where the platform allows it.

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

Your command

yt-dlp --merge-output-format mkv --no-playlist -N 4 --live-from-start --wait-for-video 60-300 'https://www.youtube.com/watch?v=live_stream_id'
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

Recording live safely

Record-from-the-start captures from the beginning rather than the moment you ran the command, where the platform still has the earlier part. Wait-for-video polls a scheduled stream and starts the instant it goes live.

Choose MKV. A recording that stops unexpectedly — and live recordings do — usually leaves a playable MKV, where an MP4 cut off mid-write often cannot be opened at all. There is no resuming a live stream, so the container choice is the whole safety net.

Waiting for a scheduled stream is a different mode from recording one in progress: wait-for-video polls the URL until the stream opens, then starts recording — leave the terminal running and it captures from the first minute. The poll interval is minutes, not seconds, so start the command early; arriving late to the poll costs minutes of stream, and no option recovers minutes that were never recorded.

Record-from-the-start has a platform boundary: YouTube keeps the beginning of a stream and serves it on demand, so the option genuinely reaches it; Twitch likewise within its retention window. Other platforms keep nothing before the moment you joined. That is why the option is not a magic switch — it fetches what the platform stored, and platforms differ in what they store. If the platform offers a replay afterwards, the replay is the better source than any live capture.

Live streams are HLS by definition: hundreds of short segments arriving in real time, joined by ffmpeg into the container as they land. This is why live recording is the case where MKV matters most — an MP4 needs its index written at the end, and a recording killed at minute three of a two-hour stream has no index at all. Disk space is the other real limit: a live recording grows at stream bitrate for as long as it runs, and a size limit protects the disk on a stream that runs twelve hours because the broadcaster forgot to stop.

After the fact, two things deserve naming. A recording with dead air is normal — silence between segments of the event is in the source — and cutting it afterwards is an edit, not a failed download. And streams that ended hours ago are ordinary VODs by the time you find them: use the platform's normal video options, which are the ones this form shows by default, and the live-specific ones only while the stream is actually live.

Frequently asked questions

Can I record a live stream from the beginning?
Turn on record-from-the-start. It only works where the platform keeps the earlier part of the stream available.
How do I record a stream that has not started?
Use wait-for-video with a MIN-MAX interval. yt-dlp polls and begins as soon as the stream goes live.
Which container is best for live?
MKV. It tolerates an interrupted write, where an MP4 cut off mid-recording can be unplayable.
What happens if my recording is interrupted?
With MKV you usually keep everything written so far. Resuming a live recording is not possible — the missing part is gone.