Interesting. I feel like the code could be simplified and be a lot more resistant to YouTube changes by just using yt-dlp, and selecting (or automatically extracting with ffmpeg) the audio-only AAC format YouTube serves. That would get rid of the YouTube request and MP4 parsing code.