Skip to content

Instantly share code, notes, and snippets.

@BriellaBugs
Last active March 6, 2026 17:58
Show Gist options
  • Select an option

  • Save BriellaBugs/d9b3177ab308a1a242604b830cf0a53d to your computer and use it in GitHub Desktop.

Select an option

Save BriellaBugs/d9b3177ab308a1a242604b830cf0a53d to your computer and use it in GitHub Desktop.
Lua iTAG Script
local ansi = {
reset = "\27[0;0m" ,
black = "\27[0;30m",
red = "\27[0;31m",
green = "\27[0;32m",
yellow = "\27[0;33m",
blue = "\27[0;34m",
purple = "\27[0;35m",
cyan = "\27[0;36m",
white = "\27[0;37m",
bold = "\27[1m",
}
if not arg[1] then print(ansi.red.."No itag passed"..ansi.reset); return 0 end
local newArg = {}
local seen = {}
-- Argument deduplicator-inator 3000
for _, value in ipairs(arg) do
if not seen[value] then
newArg[#newArg + 1] = value -- Add to output table if not seen before
seen[value] = true -- Mark as seen
end
end
-- Remove non-number arguments
for i=#newArg, 1, -1 do
if tonumber(newArg[i]) == nil then
table.remove(newArg,i)
end
end
-- Sort the table for showing tags in ascending order
table.sort(newArg, function(a, b)
return tonumber(a) < tonumber(b)
end)
seen = nil -- De-reference table
local vidFormats = {
-- [id ] = {resolution,codec,container,HFR,High (bitrate),HDR}
[702] = {4320,"AV1","MP4",true,true,true},
[701] = {2160,"AV1","MP4",true,true,true},
[700] = {1440,"AV1","MP4",true,true,true},
[699] = {1080,"AV1","MP4",true,true,true},
[698] = {720 ,"AV1","MP4",true,true,true},
[697] = {480 ,"AV1","MP4",true,true,true},
[696] = {360 ,"AV1","MP4",true,true,true},
[695] = {240 ,"AV1","MP4",true,true,true},
[694] = {144 ,"AV1","MP4",true,true,true},
[402] = {4320,"AV1","MP4",true,false,"High Dynamic Range possible"},
[571] = {4320,"AV1","MP4",true,false,"High Dynamic Range possible"},
[401] = {2160,"AV1","MP4",true,false,"High Dynamic Range possible"},
[400] = {1440,"AV1","MP4",true,false,"High Dynamic Range possible"},
[721] = {1080,"AV1","MP4",true,false,"High Dynamic Range possible"},
[399] = {1080,"AV1","MP4",true,false,"High Dynamic Range possible"},
[398] = {720 ,"AV1","MP4",true,false,"High Dynamic Range possible"},
[397] = {480 ,"AV1","MP4",false,false,"High Dynamic Range possible"},
[396] = {360 ,"AV1","MP4",false,false,"High Dynamic Range possible"},
[395] = {240 ,"AV1","MP4",false,false,"High Dynamic Range possible"},
[394] = {144 ,"AV1","MP4",false,false,"High Dynamic Range possible"},
[337] = {2160,"VP9.2","WebM",true,false,true},
[336] = {1440,"VP9.2","WebM",true,false,true},
[335] = {1080,"VP9.2","WebM",true,false,true},
[334] = {720 ,"VP9.2","WebM",true,false,true},
[333] = {480 ,"VP9.2","WebM",true,false,true},
[332] = {360 ,"VP9.2","WebM",true,false,true},
[331] = {240 ,"VP9.2","WebM",true,false,true},
[330] = {144 ,"VP9.2","WebM",true,false,true},
[272] = {4320,"VP9","WebM",true,false,false},
[315] = {2160,"VP9","WebM",true,false,false},
[308] = {1440,"VP9","WebM",true,false,false},
[303] = {1080,"VP9","WebM",true,false,false},
[302] = {720 ,"VP9","WebM",true,false,false},
[612] = {720 ,"VP9","WebM",true,false,false},
[313] = {2160,"VP9","WebM",false,false,false},
[271] = {1440,"VP9","WebM",false,false,false},
[248] = {1080,"VP9","WebM",false,false,false},
[356] = {1080,"VP9","WebM",false,false,false},
[247] = {720 ,"VP9","WebM",false,false,false},
[244] = {480 ,"VP9","WebM",false,false,false},
[243] = {360 ,"VP9","WebM",false,false,false},
[242] = {240 ,"VP9","WebM",false,false,false},
[278] = {144 ,"VP9","WebM",false,false,false},
[598] = {144 ,"VP9","WebM",false,false,false},
[305] = {2160,"H.264","MP4",true,false,false},
[304] = {1440,"H.264","MP4",true,false,false},
[299] = {1080,"H.264","MP4",true,false,false},
[298] = {720 ,"H.264","MP4",true,false,false},
[138] = {4320,"H.264","MP4",false,false,false},
[266] = {2160,"H.264","MP4",false,false,false},
[264] = {1440,"H.264","MP4",false,false,false},
[137] = {1080,"H.264","MP4",false,false,false},
[136] = {720 ,"H.264","MP4",false,false,false},
[214] = {720 ,"H.264","MP4",false,false,false},
[135] = {480 ,"H.264","MP4",false,false,false},
[134] = {360 ,"H.264","MP4",false,false,false},
[133] = {240 ,"H.264","MP4",false,false,false},
[160] = {144 ,"H.264","MP4",false,false,false},
[597] = {144 ,"H.264","MP4",false,false,false},
[170] = {1080,"VP8","WebM",false,false,false},
[169] = {720 ,"VP8","WebM",false,false,false},
[168] = {480 ,"VP8","WebM",false,false,false},
[167] = {360 ,"VP8","WebM",false,false,false},
[787] = {608 ,"AV1","WebM",false,false,false},
[788] = {608 ,"AV1","MP4",false,false,false},
[780] = {608 ,"VP9","WebM",false,false,false},
[779] = {608 ,"VP9","WebM",false,false,false},
[228] = {72,"AVC","MP4",ansi.red.."VERY Low Framerate (6fps)"..ansi.reset,false,false},
}
local audioFormats = {
-- [id ] = {container,codec,bitrate Kbps,VBR,channels}
[139] = {"MP4","AAC (HE v1)",48,false,"Stereo (2)"},
[140] = {"MP4","AAC (LC)",128,false,"Stereo (2)"},
[141] = {"MP4","AAC (LC)",256,false,"Stereo (2)"},
[249] = {"WebM","Opus",50,true,"Stereo (2)"},
[250] = {"WebM","Opus",70,true,"Stereo (2)"},
[251] = {"WebM","Opus",128,true,"Stereo (2)"},
[256] = {"MP4","AAC (HE v1)",192,false,"Surround (5.1)"},
[258] = {"MP4","AAC (LC)",384,false,"Surround (5.1)"},
[325] = {"MP4","DTSE (DTS Express)",384,false,"Surround (5.1)"},
[327] = {"MP4","AAC (LC)",256,false,"Surround (5.1)"},
[328] = {"MP4","EAC3",384,false,"Surround (5.1)"},
[338] = {"WebM","Opus",480,true,"Ambisonic (4)"},
[380] = {"MP4","AC3",384,false,"Surround (5.1)"},
[599] = {"MP4","AAC (HE v1)",30,false,"Stereo (2)"},
[600] = {"WebM","Opus",35,true,"Stereo (2)"},
[773] = {"MP4","IAMF (Opus)",900,true,"Binaural (7.1.4)"},
[774] = {"WebM","Opus",256,true,"Stereo (2)"},
}
local legacyFormats = {
-- [id] = {container,video codec,video res,audio codec,audio bitrate Kbps,channels}
[5 ] = {"FLV","H.263 (Sorenson Spark)","240p (4:3)","MP3","64 Kbps","Mono (1)"},
[6 ] = {"FLV","H.263 (Sorenson Spark)","270p (4:3)","MP3","64 Kbps","Mono (1)"},
[13] = {"3GP","MPEG-4 (Simple, L0)","144p","AAC (LC)","Unknown","Mono (1)"},
[17] = {"3GP","MPEG-4 (Simple, L0)","144p","AAC (LC)","24 Kbps","Mono (1)"},
[18] = {"MP4","H.264 (Main, L3.0)","360p","AAC (LC)","96 Kbps (most) / 128 Kbps (some)","Stereo (2)"},
[22] = {"MP4","H.264 (High, L3.1)","720p","AAC (LC)","128 Kbps","Stereo (2)"},
[34] = {"FLV","H.264 (Main, L3.0)","360p","AAC","128 Kbps","Stereo (2)"},
[35] = {"FLV","H.264 (Main, L3.0)","480p","AAC","128 Kbps","Stereo (2)"},
[36] = {"3GP","MPEG-4 (Simple, L0)","144p","AAC (LC)","24 Kbps","Mono (1)"},
[37] = {"MP4","H.264 (High, L4.0)","1080p","AAC (LC)","128 Kbps","Stereo (2)"},
[38] = {"MP4","H.264","3072p","AAC","192 Kbps","Stereo (2)"},
[43] = {"WebM","VP8","360p","Vorbis","128 Kbps","Stereo (2)"},
[44] = {"WebM","VP8","480p","Vorbis","128 Kbps","Stereo (2)"},
[45] = {"WebM","VP8","720p","Vorbis","192 Kbps","Stereo (2)"},
[46] = {"WebM","VP8","1080p","Vorbis","192 Kbps","Stereo (2)"},
[59] = {"MP4","H.264 (Main, L3.1)","480p","AAC (LC)","128 Kbps","Stereo (2)"},
[78] = {"MP4","H.264","480p","AAC","128 Kbps","Stereo (2)"},
}
local liveFormats = {
-- [id ] = {container,video codec,video res,audio codec,audio bitrate Kbps,HFR}
[91 ] = {"MPEG-TS (HLS)","H.264 (Baseline, L1.1)",144,"AAC (HE v1)",48,false},
[92 ] = {"MPEG-TS (HLS)","H.264 (Main, L2.1)",240,"AAC (LC)",48,false},
[93 ] = {"MPEG-TS (HLS)","H.264 (Main, L3.0)",360,"AAC (LC)",128,false},
[94 ] = {"MPEG-TS (HLS)","H.264 (Main, L3.1)",480,"AAC (LC)",128,false},
[95 ] = {"MPEG-TS (HLS)","H.264 (Main, L3.1)",720,"AAC (LC)",128,false},
[96 ] = {"MPEG-TS (HLS)","H.264 (High, L4.0)",1080,"AAC (LC)",128,false},
[300] = {"MPEG-TS (HLS)","H.264 (Main, L3.2)",720,"AAC (LC)",128,true},
[301] = {"MPEG-TS (HLS)","H.264 (High, L4.2)",1080,"AAC (LC)",128,true},
}
function checkItag(itag)
local argID = tonumber(itag)
print(ansi.bold.." --+ "..tostring(itag).." +--"..ansi.reset)
if not argID then print(ansi.red.."Input is not a valid number"..ansi.reset); return 0 end
if vidFormats[argID] then
print("Type: DASH Video")
local curr = vidFormats[argID]
print("Resolution: "..curr[1].."p")
print("Codec: "..curr[2])
print("Container: "..curr[3])
if type(curr[4]) == "boolean" then
if curr[4] then
print(ansi.green.."High Frame Rate (≤60fps)"..ansi.reset)
else
print(ansi.yellow.."Standard Frame Rate (≤30fps)"..ansi.reset)
end
else
print(curr[4])
end
if curr[5] then
print(ansi.green.."High Bitrate (~4x)"..ansi.reset)
else
print(ansi.yellow.."Standard Bitrate"..ansi.reset)
end
if type(curr[6]) == "boolean" then
if curr[6] then
print(ansi.green.."High Dynamic Range"..ansi.reset)
else
print(ansi.yellow.."Standard Dynamic Range"..ansi.reset)
end
else
print(ansi.yellow..curr[6]..ansi.reset)
end
elseif audioFormats[argID] then
print("Type: DASH Audio")
local curr = audioFormats[argID]
local btrstr = curr[3].." Kbps"
if curr[4] then btrstr = "(VBR) ~" .. btrstr end
print("Bitrate: "..btrstr)
print("Codec: "..curr[2])
print("Container: "..curr[1])
print("Channels: "..curr[5])
elseif legacyFormats[argID] then
print("Type: Legacy (non-DASH)")
local curr = legacyFormats[argID]
print("Container: "..curr[1])
print("Video Codec: "..curr[2])
print("Video Res.: "..curr[3])
print("Audio Codec: "..curr[4])
print("Audio Bitrate: "..curr[5])
print("Channels: "..curr[6])
elseif liveFormats[argID] then
print("Type: Livestream (non-DASH)")
local curr = liveFormats[argID]
print("Container: "..curr[1])
print("Video Codec: "..curr[2])
print("Video Res.: "..curr[3].."p")
print("Audio Codec: "..curr[4])
print("Audio Bitrate: "..curr[5].." Kbps")
if curr[6] then
print(ansi.green.."High Frame Rate (≤60fps)"..ansi.reset)
else
print(ansi.yellow.."Standard Frame Rate (≤30fps)"..ansi.reset)
end
else
print(ansi.red.."Invalid or Unsupported itag"..ansi.reset)
print("You can check "..ansi.blue.."https://gist.github.com/MartinEesmaa/2f4b261cb90a47e9c41ba115a011a4aa"..ansi.reset.." for existing itags")
return 0
end
end
for i,tag in ipairs(newArg) do
checkItag(tag)
if i < #newArg then print() end
end
return 0
@BriellaBugs
Copy link
Author

Example output:

$ luajit itagID.lua 169 300 301 399 400 96
   --+ 96 +--
Type:          Livestream (non-DASH)
Container:     MPEG-TS (HLS)
Video Codec:   H.264 (High, L4.0)
Video Res.:    1080p
Audio Codec:   AAC (LC)
Audio Bitrate: 128 Kbps
Standard Frame Rate (≤30fps)

   --+ 169 +--
Type:          DASH Video
Resolution:    720p
Codec:         VP8
Container:     WebM
Standard Frame Rate (≤30fps)
Standard Bitrate
Standard Dynamic Range

   --+ 300 +--
Type:          Livestream (non-DASH)
Container:     MPEG-TS (HLS)
Video Codec:   H.264 (Main, L3.2)
Video Res.:    720p
Audio Codec:   AAC (LC)
Audio Bitrate: 128 Kbps
High Frame Rate (≤60fps)

   --+ 301 +--
Type:          Livestream (non-DASH)
Container:     MPEG-TS (HLS)
Video Codec:   H.264 (High, L4.2)
Video Res.:    1080p
Audio Codec:   AAC (LC)
Audio Bitrate: 128 Kbps
High Frame Rate (≤60fps)

   --+ 399 +--
Type:          DASH Video
Resolution:    1080p
Codec:         AV1
Container:     MP4
High Frame Rate (≤60fps)
Standard Bitrate
High Dynamic Range possible

   --+ 400 +--
Type:          DASH Video
Resolution:    1440p
Codec:         AV1
Container:     MP4
High Frame Rate (≤60fps)
Standard Bitrate
High Dynamic Range possible

@BriellaBugs
Copy link
Author

On the terminal it's colored it just doesn't show in GitHub markdown

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