Sudarsh19 Youtube uses either AV1, H.264, or VP9 codecs for their videos. H.264 is old school, and unless your machine is ancient, it supports it. Hardware decoding support for VP9 only exists on AMD APUs newer than Raven Ridge and GPUs newer than Navi GPUs, Intel CPUs newer than Ice Lake, and only became standard with Nvidia GPUs starting with the 10 series (Pascal). Hardware decoding support for AV1 only exists on AMD RX 6000 series GPUs, Intel CPUs starting with Tiger Lake, and Nvidia 30 series GPUs.
If your hardware doesn't support the codec the video is encoded with, it will fallback to software decoding which can absolutely beat up a weak CPU.