# How to download YouTube Videos quickly

Original: https://swyx.io/youtube-download
Published: 2025-01-25

> I used to use yt5s all the time to rip and remix videos:

I used to use yt5s all the time to rip and remix videos:

![Image](https://github.com/user-attachments/assets/a4f2304e-c3cf-4ece-88d5-c6da077100af)

now you have to use https://ytdlp.online/

...but it often downloads the functionally useless `.webm` extension. Like with other bullshit google extensions, you can simply rename from `.webm` to `.mp4` and it may work - but twitter actually rejects it when you try to upload..

I also keep this flag around 

```bash
yt-dlp -f "bestvideo[ext=mp4][height<=720]+bestaudio[ext=m4a]/best[ext=mp4]/best" YOUR_URL_HERE
```


## vp9 codec errors

this is bad:  `youtube-dl -f bestvideo+bestaudio --merge-output-format mp4 https://www.youtube.com/watch\?v\=VcUl0vPJwxo` because it downloads the wrong video (https://chatgpt.com/c/68856117-61c8-8331-b493-9027ad956de5) which you then have to re encode `ffmpeg -i yourvideo.mp4 -c:v libx265 -c:a aac fixed.mp4`

if Youtube allows do this

```bash
yt-dlp -f "bv*[vcodec^=avc1][ext=mp4]+ba[acodec^=mp4a]/b[vcodec^=avc1][ext=mp4]" \
  --merge-output-format mp4 -o "%(title)s.%(ext)s" https://www.youtube.com/watch?v=VcUl0vPJwxo


# or re encode:

yt-dlp -f "bv*+ba/b" --recode-video mp4 \
  --postprocessor-args "ffmpeg:-c:v hevc_videotoolbox -b:v 8M -pix_fmt yuv420p -tag:v hvc1 -c:a aac -movflags +faststart" \
  -o "%(title)s.%(ext)s" https://www.youtube.com/watch?v=VcUl0vPJwxo

```


## for livestreams

```bash
yt-dlp --live-from-start -f "bestvideo[ext=mp4][height<=720]+bestaudio[ext=m4a]/best[ext=mp4]/best" YOUR_URL_HERE
```

with time limit cutoff

```bash
yt-dlp --hls-prefer-ffmpeg --live-from-start \
  --downloader ffmpeg \
  --downloader-args "ffmpeg:-t 02:00:00" \
  -o "%(title)s_%(upload_date)s_live.%(ext)s" \
  "https://www.youtube.com/watch?v=qcO6huB0O8Y"
```

## updates

If you ever get a .webm you might use

```bash
ffmpeg -i textgeneratorvision.webm -f lavfi -i anullsrc=channel_layout=stereo:sample_rate=44100 -shortest -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2,fps=30" -c:v libx264 -pix_fmt yuv420p -c:a aac textgeneratorvision.mp4
```

[per this guy](https://x.com/LeeLeepenkman/status/1890516696789914098)

and 

```bash
yt-dlp -f "bestvideo+bestaudio[ext=m4a]/bestvideo+bestaudio/best" -o "%(title)s.%(ext)s" --merge-output-format mp4
```
