Author Topic: Why does OPUS audio taken from youtube differ in file size every time?  (Read 2944 times)

0 Members and 1 Guest are viewing this topic.

Offline ELS122Topic starter

  • Frequent Contributor
  • **
  • Posts: 937
  • Country: 00
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?
 

Offline Jope

  • Regular Contributor
  • *
  • Posts: 111
  • Country: de
Re: Why does OPUS audio taken from youtube differ in file size every time?
« Reply #1 on: August 04, 2023, 06:14:11 pm »
I get the same size every time with yt-dlp.
 

Offline magic

  • Super Contributor
  • ***
  • Posts: 7454
  • Country: pl
Re: Why does OPUS audio taken from youtube differ in file size every time?
« Reply #2 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.
« Last Edit: August 04, 2023, 09:44:45 pm by magic »
 

Offline ELS122Topic starter

  • Frequent Contributor
  • **
  • Posts: 937
  • Country: 00
Re: Why does OPUS audio taken from youtube differ in file size every time?
« Reply #3 on: August 04, 2023, 11:42:32 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.

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.
 

Offline coppice

  • Super Contributor
  • ***
  • Posts: 10035
  • Country: gb
Re: Why does OPUS audio taken from youtube differ in file size every time?
« Reply #4 on: August 04, 2023, 11:48:39 pm »
Doesn't YouTube vary the audio bit rate with the video resolution, to give better audio with high resolution video?
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf