This commit is contained in:
nm1 2026-11-04 00:33:23 +05:30
commit 74ae93a96e

View file

@ -0,0 +1,50 @@
yt-dlp
https://github.com/yt-dlp/yt-dlp
https://ostechnix.com/yt-dlp-tutorial/
- downloading video in specfic format
for highest being 480p use
`yt-dlp -f "best[height<=480]" <URL>`
Make sure to remove the video from that folder too bcz it wont replace it
or
`yt-dlp -f "best[height<=480][ext=mp4]" <URL>`
most of time there r video only for higher reolution so need to be combine audio and video which yt-dlp will do using ffmpeg
`yt-dlp -f "bv*[height<=480][ext=mp4]+ba" https://www.youtube.com/watch?v=RZmHlKpDpUU -o output.mp4`
or
`yt-dlp -f "bestvideo[height<=720][ext=mp4]+bestaudio[ext=m4a]/best[height<=720][ext=mp4]" "https://www.example.com/video"`
`bv+ba` means best video+best audio
It will download video only stream of sometimes webm format but with ffmpeg it will convert it to mp4 anyway
![34a0e6c7e86293c28495ad00eae7d378.png](../../../_resources/34a0e6c7e86293c28495ad00eae7d378.png)
![6556aecaa3e434aa5769bd62dcdcb74a.png](../../../_resources/6556aecaa3e434aa5769bd62dcdcb74a.png)
- getting video name from playlist
`yt-dlp --get-filename -o "%(title)s" <youtube playlist url>`
- download all songs from list of url with embeded thumnail too
`yt-dlp -x --audio-format mp3 --embed-thumbnail --add-metadata -o "%(title)s.%(ext)s" -a urls.txt`
- downloading yt video with cookies from browser
use this flag
`--cookies-from-browser firefox:xhn2zoyv.default`
- personal cookies one command
```bash
yt-dlp -f "bestvideo[height<=720][ext=mp4][vcodec^=avc1]+bestaudio[ext=m4a]/best[height<=720][ext=mp4]" \
--write-subs --write-auto-subs --embed-subs --embed-thumbnail --add-metadata \
-o "%(title)s.%(ext)s" "https://www.youtube.com/watch?v=QQQUuCydpo0"
--cookies-from-browser firefox:iy5sikrq.default-release-1
```
&nbspl
for downloading audio
`yt-dlp -x --audio-format mp3 playlistURL`
eg
`yt-dlp -x --audio-format mp3 --write-subs --write-auto-subs --embed-subs --embed-thumbnail --add-metadata -o "%(title)s.%(ext)s" "https://m.youtube.com/playlist?list=OLAK5uy_lEekRFbRdvpkPx6orDy3HEVBzTHbC75qg" -t sleep
`
for subtitles download
`yt-dlp --write-subs --skip-download --sub-lang en -o "%(title)s.%(ext)s" "https://youtube.com/watch?v=123" -t sleep`
**vpn**
1. when using vpn add `-4` to use ipv4 and will help with faster download.
2. also your ip will be flagged so better use `-t sleep`
when downloading hige playlist or channels make sure to use
`yt-dlp --download-archive archive.txt "URL"` to avoid downloading same videos again