So I've been trying to download youtube videos in 720p using pytube. This is my code:
from pytube import YouTube
yt = YouTube('https://www.youtube.com/watch?v=xxxxxxx')
stream = yt.streams.get_by_resolution('720p')
stream.download('static/videos/')
Despite using
.get_by_resolution('720p')
.get_highest_resolution()
.get_by_itag(22)
The video always downloads in low quality.
When I get more info from finder settings(using macOS), I get this:
Dimensions: 1280 × 720
Codecs: MPEG-4 AAC, H.264
Colour profile: HD (1-1-1)
Duration: 14:08
See, although it says that I'm getting the correct dimensions for the resolution, the video itself is a lot worse than viewing 720p on youtube. It looks like 360p. I will attach 2 images to show.
Youtube:

Pytube:

I don't really understand what's going on to be honest. I've looked quite a bit online and I don't see anyone facing the same issue. Asked ChatGPT as well and it doesn't have a clue either. I also tried using yt-dlp but it resulted in the same lower quality. Any help will be appreciated.
I need a high quality video since I'm going to be doing further encoding which drastically lowers the quality. Even if re-ecnoded in a very high bitrate, it doesn't help much if the original video is basically 360p.