Reputation: 51
------------------------------Format Numbers----------------------------------------------------------------------
- 249 webm audio only DASH audio 52k , opus @ 50k, 629.08KiB
- 250 webm audio only DASH audio 69k , opus @ 70k, 811.98KiB
- 171 webm audio only DASH audio 110k , vorbis@128k, 1.27MiB
- 140 m4a audio only DASH audio 128k , m4a_dash container, mp4a.40.2@128k, 1.56MiB
- 251 webm audio only DASH audio 138k , opus @160k, 1.53MiB
- 278 webm 254x144 144p 82k , webm container, vp9, 13fps, video only, 772.69KiB
- 242 webm 400x226 240p 101k , vp9, 25fps, video only, 884.56KiB
- 160 mp4 254x144 144p 112k , avc1.4d400c, 13fps, video only, 1.31MiB
- 133 mp4 400x226 240p 265k , avc1.4d400d, 25fps, video only, 2.92MiB
- 17 3gp 176x144 small , mp4v.20.3, mp4a.40.2@ 24k
- 36 3gp 320x180 small , mp4v.20.3, mp4a.40.2
- 18 mp4 400x226 medium , avc1.42001E, mp4a.40.2@ 96k
- 43 webm 640x360 medium , vp8.0, vorbis@128k (best)
I want use format numbers in a program like this
import youtube_dl
url = "https://www.youtube.com/watch?v=BaW_jenozKc"
ydl_opts = {
'verbose': True,
'format': 'bestaudio/best', #maybe like this 'formatid'= 22
'outtmpl': '%(title)s-%(id)s.%(ext)s',
'noplaylist': True,
}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download([url])
how can i do this
Upvotes: 0
Views: 2355
Reputation:
If you really want format 22, then indeed, pass in a format
key of 22
. You can use /best
to fall back to the best video format if 22 is not available:
ydl_opts = {
'format': '22/best',
...
Upvotes: 1