youtube-dl is a command-line program to download videos from and other video platforms.

Option -F   or --list-formats   lists all available formats of requested videos

$ youtube-dl -F URL

An example of output:

format code  extension  resolution note
249          webm       audio only tiny   51k , opus @ 51k (48000Hz), 11.32MiB
250          webm       audio only tiny   68k , opus @ 68k (48000Hz), 15.04MiB
251          webm       audio only tiny  121k , opus @121k (48000Hz), 26.88MiB
140          m4a        audio only tiny  129k , mp4a.40.2@129k (44100Hz), 28.57MiB
160          mp4        256x144    144p   19k , avc1.4d400c@  19k, 30fps, video only, 4.30MiB
278          webm       256x144    144p   20k , vp9@  20k, 30fps, video only, 4.45MiB
242          webm       426x240    240p   29k , vp9@  29k, 30fps, video only, 6.61MiB
133          mp4        426x240    240p   36k , avc1.4d4015@  36k, 30fps, video only, 7.98MiB
243          webm       640x360    360p   46k , vp9@  46k, 30fps, video only, 10.17MiB
134          mp4        640x360    360p   58k , avc1.4d401e@  58k, 30fps, video only, 12.86MiB
244          webm       854x480    480p   66k , vp9@  66k, 30fps, video only, 14.68MiB
135          mp4        854x480    480p   89k , avc1.4d401f@  89k, 30fps, video only, 19.73MiB
247          webm       1280x720   720p  116k , vp9@ 116k, 30fps, video only, 25.79MiB
302          webm       1280x720   720p60  144k , vp9@ 144k, 60fps, video only, 31.78MiB
136          mp4        1280x720   720p  147k , avc1.64001f@ 147k, 30fps, video only, 32.58MiB
298          mp4        1280x720   720p60  162k , avc1.640020@ 162k, 60fps, video only, 35.84MiB
303          webm       1920x1080  1080p60  194k , vp9@ 194k, 60fps, video only, 43.03MiB
299          mp4        1920x1080  1080p60  248k , avc1.64002a@ 248k, 60fps, video only, 54.76MiB
18           mp4        640x360    360p  143k , avc1.42001E, 30fps, mp4a.40.2 (44100Hz), 31.72MiB
22           mp4        1280x720   720p  276k , avc1.64001F, 30fps, mp4a.40.2 (44100Hz) (best)

Option -f   or --format   helps to download the video only in needed format, for instance, webm 1280x720 video with webm opus@68k audio:

$ youtube-dl -f 247+250 --merge-output-format webm URL

youtube-dl ยท GitHub