| General > General Technical Chat |
| Why does OPUS audio taken from youtube differ in file size every time? |
| (1/1) |
| ELS122:
Whenever I rip some audio from a youtube video from the 251 stream, which is in the OPUS codec, it is a different file size every time, files taken from the same video can vary from like 2.9mb to 3.2mb, or around that. Why is this? the files all play fine so it's not some weird corruption I don't think. It is 'variable bitrate' but doesn't this just mean that the bitrate isn't constant troughout the whole track, as to conserve memory by not sending a ton of data in for example silent parts of the audio? Or does it mean that the actual streamed audio track changes bitrates depending on internet speed or something like that? If so, would it be possible to manipulate youtube into streaming the highest quality audio it can stream? |
| Jope:
I get the same size every time with yt-dlp. |
| magic:
Any example video where it happens? TBH I have never tried downloading the same stream multiple times and comparing, but I would surely expect no variation as long as you always use the same format ID. Why would they re-encode the file for each download or keep multiple encodes stored on the server and send them out randomly? (Answering myself: perhaps they re-encode files sometimes (rarely) when something changes and you have just witnessed such an event?) The problem of connection speed is normally solved by using different bitrates, which means different format IDs. 251 is normally the highest quality OPUS available, and 140 is the highest quality AAC. Both are approximately 128kb/s. |
| ELS122:
--- Quote from: magic on August 04, 2023, 09:42:12 pm ---Any example video where it happens? TBH I have never tried downloading the same stream multiple times and comparing, but I would surely expect no variation as long as you always use the same format ID. Why would they re-encode the file for each download or keep multiple encodes stored on the server and send them out randomly? (Answering myself: perhaps they re-encode files sometimes (rarely) when something changes and you have just witnessed such an event?) The problem of connection speed is normally solved by using different bitrates, which means different format IDs. 251 is normally the highest quality OPUS available, and 140 is the highest quality AAC. Both are approximately 128kb/s. --- End quote --- Well then it must be my crappy code that probably leaves some empty bytes in the file somewhere. Well youtube always re-encodes files before uploading, I don't re-encode them. The OPUS streams vary in the bitrate from like 90kb/s to 200kb/s when looking at MediaInfo. they vary between different videos. |
| coppice:
Doesn't YouTube vary the audio bit rate with the video resolution, to give better audio with high resolution video? |
| Navigation |
| Message Index |