Skip to content

Instantly share code, notes, and snippets.

@AgentOak
Last active October 9, 2024 09:19
Show Gist options
  • Save AgentOak/34d47c65b1d28829bb17c24c04a0096f to your computer and use it in GitHub Desktop.
Save AgentOak/34d47c65b1d28829bb17c24c04a0096f to your computer and use it in GitHub Desktop.
Youtube Format IDs

Last updated: April 2021

Also known as itag or format codes and way back they could be specified with the fmt parameter (e.g. &fmt=22). Depending on the age and/or popularity of the video, not all formats will be available.

DASH video

Resolution AV1 HFR High AV1 HFR AV1 VP9.2 HDR HFR VP9 HFR VP9 H.264 HFR H.264
MP4 MP4 MP4 WebM WebM WebM MP4 MP4
4320p 402/571 272 138
2160p 701 401 337 315 (313) (305) (266)
1440p 700 400 336 308 (271) (304) (264)
1080p 699 399 335 303 (248) 299 (137)
720p 698 398 334 302 247 298 136
480p 697 397 333 244 135
360p 696 396 332 243 134
240p 695 395 331 242 133
144p 694 394 330 278 160
  • HFR stands for "High Framerate", which means up to 60 FPS, whereas non-HFR is limited to 30 FPS
  • Non-HFR 1080p+ H.264 and VP9 variants are not provided for HFR videos anymore
  • Same IDs are reused for 360° videos
  • 1440p+ H.264 variants are only provided for 360° videos anymore
  • At the moment, AV1 variants are only provided for popular videos
  • All AV1 variants can be HDR (no separate non-HDR AV1 variants are offered)
  • AV1 HFR High: High refers to the bitrate. These variants have ~3-4 times the bitrate of their normal counterparts. Additional side effect is providing AV1 HFR variants for low resolutions (<=480p). These variants are rare even among videos with AV1 variants. Found on this video.
  • AV1 HFR 4320p: Format 571 has roughly 50% higher bitrate than 402. Sometimes only one of them is offered, sometimes both. Can be seen on this video.

DASH audio

Code Container Audio Codec Audio Bitrate Channels Still offered?
139 MP4 AAC (HE v1) 48 Kbps Stereo (2) Rarely, YT Music
140 MP4 AAC (LC) 128 Kbps Stereo (2) Yes, YT Music
(141) MP4 AAC (LC) 256 Kbps Stereo (2) No, YT Music*
249 WebM Opus (VBR) ~50 Kbps Stereo (2) Yes
250 WebM Opus (VBR) ~70 Kbps Stereo (2) Yes
251 WebM Opus (VBR) <=160 Kbps Stereo (2) Yes
256 MP4 AAC (HE v1) 192 Kbps Surround (5.1) Rarely
258 MP4 AAC (LC) 384 Kbps Surround (5.1) Rarely
327 MP4 AAC (LC) 256 Kbps Surround (5.1) ?*
338 WebM Opus (VBR) ~480 Kbps (?) Quadraphonic (4) ?*
  • Surround audio can be found on some demo videos
  • YT Music: These formats are offered on Youtube Music. Format 141 is only available to Premium users with High Quality option
  • Format 327, 338: These have been found on this Stereo 3D video

Legacy (non-DASH)

Code Container Video Codec Video Res. Audio Codec Audio Bitrate Channels Still offered?
18 MP4 H.264 (Baseline, L3.0) 360p AAC (LC) 96 Kbps Stereo (2) Yes, GDrive
(59) MP4 H.264 (Main, L3.1) 480p AAC (LC) 128 Kbps Stereo (2) No, GDrive
22 MP4 H.264 (High, L3.1) 720p AAC (LC) 192 Kbps Stereo (2) Mostly*, GDrive
(37) MP4 H.264 (High, L4.0) 1080p AAC (LC) 128 Kbps Stereo (2) No, GDrive
  • Always limited to 30 FPS
  • GDrive: These formats are offered for Google Drive video previews. Note that the video player on GDrive displays incorrect codecs on rightclick -> stats
  • Format 22: Available for most videos, except music and music videos (not limited to official music channels!)

Livestreams (non-DASH)

Code Container Video Codec Video Res. Audio Codec Audio Bitrate Still offered?
91 MPEG-TS (HLS) H.264 (Baseline, L1.1) 144p AAC (HE v1) 48 Kbps Yes
92 MPEG-TS (HLS) H.264 (Main, L2.1) 240p AAC (HE v1) 48 Kbps Yes
93 MPEG-TS (HLS) H.264 (Main, L3.0) 360p AAC (LC) 128 Kbps Yes
94 MPEG-TS (HLS) H.264 (Main, L3.1) 480p AAC (LC) 128 Kbps Yes
95 MPEG-TS (HLS) H.264 (Main, L3.1) 720p AAC (LC) 256 Kbps Yes
96 MPEG-TS (HLS) H.264 (High, L4.0) 1080p AAC (LC) 256 Kbps Yes
300 MPEG-TS (HLS) H.264 (Main, L3.2) HFR 720p AAC (LC) 128 Kbps Yes
301 MPEG-TS (HLS) H.264 (High, L4.2) HFR 1080p AAC (LC) 128 Kbps Yes
  • Non-HFR variants are limited to 30 FPS, HFR to 60 FPS
  • Non-HFR variants for 720p and 1080p may not be offered if HFR is available
  • Livestreams are also offered through DASH video (H.264, VP9) and DASH audio (AAC) streams

Template youtube-dl formats

For archiving videos: Only choose combinations that fit WebM (VP9+Opus) or MP4 (H.264+AAC)

bestvideo[ext=webm]+251/bestvideo[ext=mp4]+(258/256/140)/bestvideo[ext=webm]+(250/249)/best

For archiving audio: Choose any format that's best

AAC Surround 384 / Opus 160 / AAC 192 / AAC Surround 192 / AAC 128 / Opus 70 / AAC 96 / Opus 50 / AAC 48

258/251/22/256/140/250/18/249/139

For streaming videos: Allow any combination

bestvideo+bestaudio/best

youtube-dl usage example

Archive videos

youtube-dl --download-archive youtube-dl.list --ignore-errors --write-info-json --add-metadata --write-sub --sub-lang en,de,ja --write-thumbnail --embed-subs -f "<format>" "<URL>"

Archive audio

youtube-dl --download-archive youtube-dl.list --ignore-errors --write-info-json --add-metadata --write-sub --sub-lang en,de,ja --write-thumbnail --embed-thumbnail --extract-audio -f "<format>" "<URL>"
@guruprasaathm
Copy link

Do you guys know any way to search for videos with a specific audio format?

Just write a youtube-dl script in python that searches for a video by keyword, then filters the resulting data based on format, eliminates videos with any other formats and returns the filtered data(videos with just that format).

@gugacavalieri
Copy link

Just write a youtube-dl script in python that searches for a video by keyword, then filters the resulting data based on format, eliminates videos with any other formats and returns the filtered data(videos with just that format).

Thanks for your suggestion @guruprasaathm! I wrote a little npm package that filter videos by codecs in case anyone needs it :)

Pretty simple to use!

https://github.com/gugacavalieri/youtube-video-codec-search

@Aluminite
Copy link

I was watching a video and noticed it was using audio format 600. @LBSiUK said something about it but that's the only mention I can find online.
Screenshot_20210906-134341
Video link: https://youtu.be/AeZr8B87a4Y
yt-dlp doesn't seem to support downloading this format yet.

@MinePlayersPE
Copy link

MinePlayersPE commented Sep 6, 2021

@Aluminite yt-dlp actually can download itag 600, but only under MWEB (which might mean that format 600 is only whitelisted for certain Android phones)

>yt-dlp -F "https://youtu.be/AeZr8B87a4Y" --extractor-args "youtube:player_client=mweb"
[youtube] AeZr8B87a4Y: Downloading webpage
[youtube] AeZr8B87a4Y: Downloading mweb player API JSON
[info] Available formats for AeZr8B87a4Y:
ID EXT RESOLUTION FPS | FILESIZE TBR PROTO | VCODEC VBR ACODEC ABR ASR MORE INFO
--- ---- ---------- --- - ---------- ----- ----- - ----------- ----- --------- ---- ------- -------------------
599 m4a audio only | 3.38MiB 30k https | mp4a.40.5 30k 22050Hz ultralow, m4a_dash
600 webm audio only | 3.88MiB 35k https | opus 35k 48000Hz ultralow, webm_dash
249 webm audio only | 5.76MiB 52k https | opus 52k 48000Hz low, webm_dash
250 webm audio only | 7.56MiB 68k https | opus 68k 48000Hz low, webm_dash
140 m4a audio only | 14.21MiB 129k https | mp4a.40.2 129k 44100Hz medium, m4a_dash
251 webm audio only | 14.15MiB 128k https | opus 128k 48000Hz medium, webm_dash
17 3gp 176x144 8 | 8.46MiB 77k http | mp4v.20.3 77k mp4a.40.2 0k 22050Hz 144p
597 mp4 256x144 15 | 3.15MiB 28k https | avc1.4d400b 28k 144p, mp4_dash
598 webm 256x144 15 | 3.04MiB 27k https | vp9 27k 144p, webm_dash
160 mp4 256x144 30 | 6.57MiB 59k https | avc1.4d400c 59k 144p, mp4_dash
278 webm 256x144 30 | 8.25MiB 75k https | vp9 75k 144p, webm_dash
133 mp4 426x240 30 | 11.58MiB 105k https | avc1.4d4015 105k 240p, mp4_dash
242 webm 426x240 30 | 15.48MiB 141k https | vp9 141k 240p, webm_dash
134 mp4 640x360 30 | 23.33MiB 212k https | avc1.4d401e 212k 360p, mp4_dash
18 mp4 640x360 30 | 54.21MiB 493k http | avc1.42001E 493k mp4a.40.2 0k 44100Hz 360p
243 webm 640x360 30 | 27.79MiB 253k https | vp9 253k 360p, webm_dash
135 mp4 854x480 30 | 36.67MiB 334k https | avc1.4d401f 334k 480p, mp4_dash
244 webm 854x480 30 | 45.07MiB 410k https | vp9 410k 480p, webm_dash
136 mp4 1280x720 30 | 114.98MiB 1047k https | avc1.4d401f 1047k 720p, mp4_dash
22 mp4 1280x720 30 | 1176k http | avc1.64001F 1176k mp4a.40.2 0k 44100Hz 720p
247 webm 1280x720 30 | 96.25MiB 877k https | vp9 877k 720p, webm_dash
298 mp4 1280x720 60 | 70.61MiB 643k https | avc1.4d4020 643k 720p60, mp4_dash
302 webm 1280x720 60 | 117.62MiB 1071k https | vp9 1071k 720p60, webm_dash
299 mp4 1920x1080 60 | 196.67MiB 1792k https | avc1.64002a 1792k 1080p60, mp4_dash
303 webm 1920x1080 60 | 251.79MiB 2294k https | vp9 2294k 1080p60, webm_dash

>yt-dlp -f 600 "https://youtu.be/AeZr8B87a4Y" --extractor-args "youtube:player_client=mweb"
[youtube] AeZr8B87a4Y: Downloading webpage
[youtube] AeZr8B87a4Y: Downloading mweb player API JSON
[info] AeZr8B87a4Y: Downloading 1 format(s): 600
[download] Destination: Using Classic BTD5 PREMIUM Upgrades In Bloons TD 6! [AeZr8B87a4Y].webm
[download] 100% of 3.88MiB in 00:04

@Raprodent
Copy link

Any success with 1440p / 2160p with audio?

@MinePlayersPE
Copy link

I doubt they will ever have merged formats for 1080p+, but especially for 1440p+ since they aren't even encoded in h264

@Raprodent
Copy link

But for 1080p / 137 it's "video only" although I receive audio.
Shouldn't 266 give me both as well then? :/

@Krit789
Copy link

Krit789 commented Feb 12, 2022

@Raprodent If I'm understanding you correctly you are trying to download 1440p/2160p video with audio in the same file right? If so you can merge any VP9 WebM video with any opus audio track and output it as a WebM file.

This is the command I use
yt-dlp -o "%(title)s.%(ext)s" --add-metadata -f "bestvideo[ext=webm]+251" --merge-output-format webm [video link]

As YouTube only offered videos with embedded audio tracks on 360p (18) and 720p (22) quality.

@itsTyrion
Copy link

Looks like video quality DOES sometimes affect audio quality.
https://www.youtube.com/watch?v=BPVu5xaZk-4

opus (250) in 144p, opus (251) for the rest. (not that it makes a huge difference with lofi)

@pgorod
Copy link

pgorod commented Mar 20, 2022

This Youtube Video boasts that it contains NonPoint In the Air Tonight HQ 432hz HD 1080p (I guess they meant those Hz to be KHz). However, I can't find a way to get that high-resolution audio with youtube-dl.

C:\Tools>youtube-dl.exe -F https://www.youtube.com/watch?v=0MM8n2Ipa5c
[youtube] 0MM8n2Ipa5c: Downloading webpage
[youtube] 0MM8n2Ipa5c: Downloading MPD manifest
[info] Available formats for 0MM8n2Ipa5c:
format code  extension  resolution note
139          m4a        audio only DASH audio   50k , m4a_dash container, mp4a.40.5 (22050Hz), 1.55MiB
251          webm       audio only tiny  127k , webm_dash container, opus @127k (48000Hz), 4.13MiB
140          m4a        audio only tiny  127k , m4a_dash container, mp4a.40.2@127k (44100Hz), 4.13MiB
278          webm       192x144    DASH video   95k , webm_dash container, vp9, 30fps, video only
160          mp4        192x144    DASH video  108k , mp4_dash container, avc1.4d400b, 30fps, video only
242          webm       320x240    DASH video  220k , webm_dash container, vp9, 30fps, video only
133          mp4        320x240    DASH video  242k , mp4_dash container, avc1.4d400c, 30fps, video only
134          mp4        480x360    360p   43k , mp4_dash container, avc1.4d401e@  43k, 30fps, video only, 1.42MiB
243          webm       480x360    DASH video  405k , webm_dash container, vp9, 30fps, video only
135          mp4        640x480    480p   77k , mp4_dash container, avc1.4d401e@  77k, 30fps, video only, 2.53MiB
244          webm       640x480    DASH video  752k , webm_dash container, vp9, 30fps, video only
18           mp4        480x360    360p  170k , avc1.42001E, 30fps, mp4a.40.2 (44100Hz) (best)

The best audio available is 4.1MB, at 48KHz which surely is not the audiophile quality that was promised. What's going on here? Maybe youtube just drops very heavy audio streams at the moment the video is uploaded? Can anybody point me to a Youtube video with a very high-quality audio track in it? Thanks.

@notdaniel
Copy link

notdaniel commented Mar 20, 2022

This Youtube Video boasts that it contains NonPoint In the Air Tonight HQ 432hz HD 1080p (I guess they meant those Hz to be KHz).

Actually @pgorod, they did mean 432Hz. This isn't referring to a sample rate, but rather a tuning standard. Instruments are usually tuned using the note A4 as reference. Most of the time, A4 is considered to be 440Hz, but there are some who believe that everything sounds better when tuning A4 as 432Hz instead. You can read more about it here, if interested.

So this has nothing to do with audio quality or specs, and as such you don't find anything useful about it with youtube-dl. It's not a claim for a superior experience in a technical sense, but rather a musical sense.

@pgorod
Copy link

pgorod commented Mar 21, 2022

Ah. That completely surprises me, but ok, makes sense. Thanks for explaining.

@lostb053
Copy link

Well, just a thanks for this effort

@almirus
Copy link

almirus commented May 26, 2022

please add new audio format (Dolby Digital\Plus 5.1)
youtube-dl -F https://youtu.be/XcD10pgTRZs


380 m4a audio only tiny 384k , m4a_dash container, ac-3 @384k (48000Hz), 2.25MiB
328 m4a audio only tiny 384k , m4a_dash container, ec-3 @384k (48000Hz), 2.25MiB

@gtk2k
Copy link

gtk2k commented Dec 29, 2022

I did a little research on Youtube 360 videos.
https://gist.github.com/gtk2k/2aa7aa1a1c6beeb9f9829c7be335a08f

@LetsRide-IL
Copy link

Anyone know about 148 or 149? These are MP4 audio tags shown on the stereo movies.

@luxlia
Copy link

luxlia commented May 21, 2023

old af, many new formats missing (incl 616)

@mechalincoln
Copy link

Does anyone have a 2023 version of this document?

@jaimet
Copy link

jaimet commented Nov 9, 2023

Does anyone have a 2023 version of this document?

https://gist.github.com/MartinEesmaa/2f4b261cb90a47e9c41ba115a011a4aa
HTH.

@mechalincoln
Copy link

It does.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment