I wish there was a way to know what audio codec was used for a Youtube video when uploaded.

@matrix
No, not what gets delivered to you after Youtube transcodes stuff, but what the person uploaded in originally. Basically what they outputed in their video editor.

@matrix
I'm particularly interested in 1 Youtube channel that has a few music albums uploaded.
I know that opus, even at YouTube's bitrate, is great quality. Basically transparent, so I would want to rip one of those albums. But if the original encode was a bad mp3, then I wouldn't bother.

In this particular case, I was able to test a different song, compare it against a flac I have and transcodes from that flac to mp3, aac and opus. From looking at the spectograms (best use I ever get out of Audacity) it looks like the Youtube version was transcoded directly from lossless. Don't see either aac or mp3 artifacts.

@alyx @matrix probably better to try and find a torrent of it. If it doesn't exist and you want higher quality, you'll just have to buy it. But honestly if you can't tell just listening on YouTube does it even matter? The resulting mp3 you'll get will be 128kbps anyway, I think 192 max. Not really worth the trouble if you can find it higher quality somewhere else.

@beardalaxy @matrix
>the resulting mp3
Not sure what you mean by that. I can rip opus directly from Youtube, and I keep it like that. Plays just fine on everything I need it on. :peepoShrug:

@alyx @matrix YouTube's audio after it gets compressed down is relatively low quality ("good enough"), so any way you try to pull for it won't be HQ. YouTube targets 160kbps vbr. If that's good enough for you then cool though :) there are a lot of unreleased/lost tracks I can only find on YouTube, so unfortunately that has to be the case sometimes.

@beardalaxy @matrix
Except YouTube does opus these days. Which not only kicks mp3's ass, but also aac's ass in quality. A 160kbps opus is transparent and indistinguishable from a lossless source even to audiophile nerds with the equipment and autism to care about their audio cables.

Youtube's targeted bitrate for opus doesn't reach 160kbps though (which is a weird bitrate you pulled out of nowhere, cause it never targeted that. It did used to target 192kbps aac, a very long time ago, but never 160). From what I've seen it just slightly overshoots 128kbps, which for opus is still fine and surpasses mp3.

Whatever knowledge you think you have about Youtube's codecs is either way out of date, or was always completely wrong. Today, Youtube doesn't have low quality, or good enough audio. It has GOOD audio. Not great, but good.

The only limitation to Youtube's audio is not their transcoding, but what you upload to it. If you decide to upload 96kbps mp3, then sure, your Youtube video will sound like shit. But if you decide to upload with lossless audio, usually FLAC, then your video will have good audio.

And there are ways to check an audio file for encoding artifacts, especially mp3 ones. So it's not that difficult to have an educated guess on whether an opus ripped from Youtube is an mp3 retranscoded to opus, or if it was transcoded direct from a lossless format.

@alyx @matrix well this is from 2020. Looks like you can use this ytdl command to see it for any given video. The highest audio quality for this 1080p video is 160kbps and you can see here the highest it actually gets is 145kbps.

Opus is still good and YouTube's compression is still pretty good, but there isn't a way you would ever be able to tell what the original audio was like without asking the uploaded because it's already been compressed, the original audio doesn't exist on YouTube's end.

But that's what I was saying, if it still sounds good then it shouldn't matter too much what the original source was, you know?

YouTube has recommendations for audio bitrates too. It definitely helps to upload with a higher bitrate on your video and audio so the compression has more info to work with. It'll always end up as a sub-160 opus though at best. So if the audio quality REALLY matters, downloading off YouTube isn't the best idea, it's better to torrent FLACs or something. But if it doesn't matter as much, or you can't hear a difference, I'm just wondering why you want to know the original quality of the audio in the first place.

@beardalaxy @matrix
This is why I do actual testing, and don't rely on random info that a third party pulled from it's ass.
The 160kbps is youtube-dl's estimate probably, but it's extremely faulty. With my testing of opus encodes, they should have estimated it at 128kbps. I've NEVER seen an YouTube opus audio being anywhere outside the 11X-13Xbps range. This particular example is 137kbps. I'd be happy to test whatever video you want for this. Not sure what the 145 number is supposed to be, but it's still not the bitrate. Youtube-dl is out of date. I recommend you use yt-dlp. It seems it actually gives good estimates for bitrate.

>there isn't a way you would ever be able to tell what the original audio was like

You can hunt for compression artifacts in audacity with the spectrogram view. mp3 is the easiest to identify. It will have a frequency cutoff at 16khz for low bitrates, 18khz for decent encodes, and almost 20khz for best possible. Something else you'll find is big rectangular artifacts.
aac has a frequency cutoff at about 17khz at 128kbps, but no noticeable cutoff at over 256kbps, but it still has the square looking artifacts (though they will be harder to spot at higher bitrates).
opus has a frequency cutoff at 20khz, even for any bitrate, but you won't see the same types of blocky artifacts, even at 96kbps. If not for the cutoff, there's nothing clear cut that makes it clear it's a transcode and not lossless.

Attached you can see a 128kbps aac, a 320kbps mp3, and a 96kbps opus. (in that order if the upload preview is correct).

Sign in to participate in the conversation
Game Liberty Mastodon

Mainly gaming/nerd instance for people who value free speech. Everyone is welcome.