Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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>"
@Maxou44

This comment has been minimized.

Copy link

@Maxou44 Maxou44 commented Aug 16, 2020

Google drive video preview uses itags: 18, 22, 37, 59 with following resolutions:

18 => 360p
22 => 720
59 => 480p
37 => 1080p

@AgentOak

This comment has been minimized.

Copy link
Owner Author

@AgentOak AgentOak commented Aug 16, 2020

@Maxou44 Thanks. I tested with some videos and added these formats to the table.

@Maxou44

This comment has been minimized.

Copy link

@Maxou44 Maxou44 commented Aug 17, 2020

@Maxou44 Thanks. I tested with some videos and added these formats to the table.

Thanks for this quick update ;)

@ariasultan

This comment has been minimized.

Copy link

@ariasultan ariasultan commented Aug 27, 2020

4320p AV1 HFR uses itag 571 and also Youtube Music on High Quality still uses itag 141

@AgentOak

This comment has been minimized.

Copy link
Owner Author

@AgentOak AgentOak commented Aug 27, 2020

@ariasultan Thank you. Added YT Music formats and also found videos with itag 571. Weirdly though, 402 is still used and sometimes both formats are available for the same videos. It's the first time I've seen different bitrate variants for the same resolution on youtube.

@ariasultan

This comment has been minimized.

Copy link

@ariasultan ariasultan commented Aug 27, 2020

@AgentOak Thank You too for providing this content. Youtube is probably still experimenting with the AV1 format

@Newton-second

This comment has been minimized.

Copy link

@Newton-second Newton-second commented Sep 17, 2020

I'm pretty sure audio format codec 139 is AAC (HE). When my data is throttled my phone will stream 139 and I can hear the spectral band replication artifacts characteristic of the format.

@Ridtt

This comment has been minimized.

Copy link

@Ridtt Ridtt commented Dec 6, 2020

250 audio is A_AAC-2, not opus. My TV doesn't work with opus so I was surprised when audio played.

@AgentOak

This comment has been minimized.

Copy link
Owner Author

@AgentOak AgentOak commented Dec 6, 2020

@Ridtt How do you know your TV is getting 250 and not 140?

$ youtube-dl -f 250 qdoJroKUwu0
[youtube] qdoJroKUwu0: Downloading webpage
[download] Destination: How India Cooks Lunch for 50,000 People for FREE! The MIRACLE in Punjab, India.-qdoJroKUwu0.webm
[download] 100% of 6.03MiB in 00:00
$ ffprobe How\ India\ Cooks\ Lunch\ for\ 50\,000\ People\ for\ FREE\!\ The\ MIRACLE\ in\ Punjab\,\ India.-qdoJroKUwu0.webm -hide_banner
Input #0, matroska,webm, from 'How India Cooks Lunch for 50,000 People for FREE! The MIRACLE in Punjab, India.-qdoJroKUwu0.webm':
  Metadata:
    encoder         : google/video-file
  Duration: 00:13:05.54, start: -0.007000, bitrate: 64 kb/s
    Stream #0:0(eng): Audio: opus, 48000 Hz, stereo, fltp (default)
@Ridtt

This comment has been minimized.

Copy link

@Ridtt Ridtt commented Dec 6, 2020

@Ridtt How do you know your TV is getting 250 and not 140?

$ youtube-dl -f 250 qdoJroKUwu0
[youtube] qdoJroKUwu0: Downloading webpage
[download] Destination: How India Cooks Lunch for 50,000 People for FREE! The MIRACLE in Punjab, India.-qdoJroKUwu0.webm
[download] 100% of 6.03MiB in 00:00
$ ffprobe How\ India\ Cooks\ Lunch\ for\ 50\,000\ People\ for\ FREE\!\ The\ MIRACLE\ in\ Punjab\,\ India.-qdoJroKUwu0.webm -hide_banner
Input #0, matroska,webm, from 'How India Cooks Lunch for 50,000 People for FREE! The MIRACLE in Punjab, India.-qdoJroKUwu0.webm':
  Metadata:
    encoder         : google/video-file
  Duration: 00:13:05.54, start: -0.007000, bitrate: 64 kb/s
    Stream #0:0(eng): Audio: opus, 48000 Hz, stereo, fltp (default)

@AgentOak
Thanks for fast reply. This is my bad, I downloaded bunch of videos to test and was wrong with filename in this case.

youtube-dl -f 248+140 "https://www.youtube.com/watch?v=-p0PA9Zt8zk" -o "test_video_codec\248_250""

So it actually was 140 and that's why its played.

@Ridtt

This comment has been minimized.

Copy link

@Ridtt Ridtt commented Dec 6, 2020

Can I ask question, please? Is there a way with youtube-dl to add codecs to "blacklist"? I think I'm going way to deep in parsing formats myself but all I need skip opus and av1.

@AgentOak

This comment has been minimized.

Copy link
Owner Author

@AgentOak AgentOak commented Dec 6, 2020

You might want to check youtube-dl documentation, chapter Format Selection. You can exclude codecs using the format selection option -f:

$ youtube-dl -f 'bestvideo[vcodec!^=av01]+bestaudio[acodec!=opus]/best' "qdoJroKUwu0"

Currently this selects 137 (H.264 1080p) and 140 (AAC 128). Make sure to use single quotes for -f to avoid expansion of the ! symbol by your shell.

@LBSiUK

This comment has been minimized.

Copy link

@LBSiUK LBSiUK commented Feb 21, 2021

Recently I got these when I was quite limited of bandwidth. Samsung Galaxy S10 Plus on 4G.

Screenshot_20210221-164250_YouTube

@DerSkedda

This comment has been minimized.

Copy link

@DerSkedda DerSkedda commented Feb 25, 2021

AV1 does not seem to be reserved for very popular videos. I found this German video (id: fDQPhhLw1Os) which is formatted in AV1 HFR (399). It "only" has 500k views.

I found other videos from the same YouTuber that also have AV1 HFR videos but it seems arbitrary.

Edit: I found more videos from other channels that have AV1 formatting. I guess YouTube has finally experimented enough and it's starting to become more standard.

@ManuelWinkler

This comment has been minimized.

Copy link

@ManuelWinkler ManuelWinkler commented Feb 26, 2021

I guess YouTube has finally experimented enough and it's starting to become more standard.

I can confirm. I think it has to do with how well the video is performing and how many estimated views it will likely get in a specific time range. So, yes, support for AV1 is definitely rolling out wider.

@ArnisL

This comment has been minimized.

Copy link

@ArnisL ArnisL commented Mar 20, 2021

Think this have changed. Getting redirected to URL w/o fmt param whenever I try to add one.

Is there still a way to get original audio quality?

@AgentOak

This comment has been minimized.

Copy link
Owner Author

@AgentOak AgentOak commented Mar 20, 2021

@ArnisL fmt URL parameter has been dropped years ago. I'm not aware of a way to obtain original video/audio files from YT. You can use a tool like youtube-dl to download any of the formats listed above.

@DerSkedda

This comment has been minimized.

Copy link

@DerSkedda DerSkedda commented Mar 31, 2021

I stumbled across a new audio format (338) encoded in opus. Its on an 6k 360° Video

Video link: https://www.youtube.com/watch?v=QrhcfjPFaEk

@AgentOak

This comment has been minimized.

Copy link
Owner Author

@AgentOak AgentOak commented Mar 31, 2021

@DerSkedda Thanks, very interesting. I have added that format (along with new AAC format 327) to the table but I have no explanation what purpose they serve, especially given their weird channel configuration and I couldn't find them on other 3D/360° videos.

@omansak

This comment has been minimized.

Copy link

@omansak omansak commented Apr 21, 2021

@DerSkedda

This comment has been minimized.

Copy link

@DerSkedda DerSkedda commented Apr 21, 2021

Do you have HDR Playback? That could be HDR..

@AgentOak

This comment has been minimized.

Copy link
Owner Author

@AgentOak AgentOak commented Apr 23, 2021

@omansak Interesting find, I have updated the table. I have looked through a couple videos from the same channel but I wasn't able to find any other with these formats.

@LBSiUK

This comment has been minimized.

Copy link

@LBSiUK LBSiUK commented Apr 30, 2021

Any way to force on High bitrate AV1? If I click on @omansak's link I get regular AV1.

@DerSkedda

This comment has been minimized.

Copy link

@DerSkedda DerSkedda commented Apr 30, 2021

Afaik no. You can only force AV1 in the YouTube settings which doesn't really work either. I have it switched on and in Chrome on Win 10 clicking on the same link results in AV1 but on my Work PC with the same configuration it results in VP9.. I'd love to have a "advanced" setting where I can manually decide which available codec I want to use. But Google would never implement that.

@DerSkedda

This comment has been minimized.

Copy link

@DerSkedda DerSkedda commented Apr 30, 2021

@DerSkedda Thanks, very interesting. I have added that format (along with new AAC format 327) to the table but I have no explanation what purpose they serve, especially given their weird channel configuration and I couldn't find them on other 3D/360° videos.

I also found out what the format 338 is used for. It's purpose is for Google Cardboard/VR videos with 3 dimensional audio. That's where the quadraphonic comes from, I guess 4 channels for each virtual "corner" or something like that. No idea for 327 though.

@LBSiUK

This comment has been minimized.

Copy link

@LBSiUK LBSiUK commented May 7, 2021

Anybody work out what all the random characters in the video format section are for? This only appears to happen on a couple of music videos with a lot of views. I believe it may look slightly better than standard VP9, meaning it could have a higher bitrate. FYI: I'm on 4G.
Screenshot_20210507-075101_YouTube

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