forum

Opus audio codec

posted
Total Posts
16
This is a feature request. Feature requests can be voted up by supporters.
Current Priority: +234
Topic Starter
Wafu
Hello everyone. This topic was already discussed 2 years ago on t/199444/ (I cannot revive it from denied) - but was considered invalid without apparent reasoning, I would like to come through the arguments given against it, give my reasoning and answer those arguments.

Basically what I want is to make osu! support Opus audio codec and maybe even remove the mp3 support in future for following reasons:

If you've never seen ziin's guide on how to determine audio quality, be sure to check it: t/320007 - That's just so I can show a little comparison. I converted a flac file to mp3 (192kbps) and to opus (96kbps), that means I can now put it into a Spek as explained in ziin's guide.
This maybe told you that opus caught some additional frequencies, but it's not that much of a difference, "I cannot hear those frequencies it anyway". The thing is, if you are a healthy person, you should clearly hear up to 20kHz. 128kbps - 192kbps mp3s usually cut somewhere between 15kHz to 18kHz, opus however attempts to cut only above 20kHz and also as you see mp3 skipped even some frequencies in some parts, like beginning, end and all the gaps. This is what makes the mp3 distinctive from flac - the lossless one. If there are less gaps and frequencies are cut higher, it is more near the lossless version and it will be harder to tell the difference.

Above was a visual reference, which is always nice to have, because you can use it as a logical argument. On the other hand, there is also possibility to tell the difference by sound. This is a little bit harder to compare, but is still clearly possible. You don't really need to be audiophile or anything, being audiophile is more like liking the "clarity" of sound than being able to hear better than other people. What matters more here are headphones you are using, I'm not saying you need any professional headphones, you don't need to throw away 400$ for "The headphones used to mix in every major studio." (just making fun of Beats, but you've got the point). Honestly, I just took old 13$ Panasonic headphones and could tell the difference, but it is obviously more distinguishable in better headphones, I could personally tell opus sounded more clean and there was better clarity than the mp3 and in overall is more similar to the original.. Obviously, it's not like you're going to put on headphones and be like: "Oh my god! That's the best quality I ever heard!" - You're most likely not doing this even with lossless audio. If you want to compare yourself, he's the little test on above files.
The best way to compare is opening Audacity, putting one sound to left ear, second to right ear, listen to only one at one time, but swap from time to time.

From two above comparisons, we can say that Opus has slightly better qualities than mp3, now consider that we were using 96kbps Opus versus 192kbps mp3. That turns it into a quite more interesting situation, because for about half the bitrate, we get even better result.

Another reason for Opus being better is its low response time. If you look at wikipedia, you can see that response time of MP3 is higher than 100ms, while Opus is 5-66.5ms.

Now, arguments that were given or could be given, and why I think they're incorrect:

mp3 is the most used and most famous
Don't be so conservative. If something is used often, it doesn't mean it is the best thing in the world. If something is old, it sometimes needs a better replacement. Do you think that 18 years not updated codec will be better than relatively new codec? Possible, but not true in this case. MP3 was never open source, Opus is open source, so it is easier to implement and improve, because community can improve.

TheVileOne wrote:

You seem a little too obsessed with this audio format. Why are you trying so hard to sell us this new format?
Nothing against TheVileOne, but straight up this was a rejection without even thinking about the idea. He gave some arguments for "why", but was rejected with "why are you trying to convince us?" That in my opinion isn't the best answer here and was really irrelevant.
It's first time I hear about this codec, we should stick to the standard!
Even Opus is standardized, is that what you want? Anyways, have you ever heard of Vorbis or FLAC? These were developed by Xiph. Vorbis was already a bit better than mp3, but we could say that would have no benefit on osu!, the difference wouldn't be noticable at all and it's delay is same as mp3. FLAC is probably the most famous codec for lossless audio. And guess what! Xiph is developer of Opus and is highly supported by Google at current time, therefore it's not just a codec for people who want something different, but it's actually very successful.

Lach wrote:

This is a rhythm game, where the primary objective is to have an audio track that is fine for clicking circles to.
That basically means Opus is more appropriate as it has lower delay, which is in my opinion more suitable for rhythm games.
It's just 96kbps difference, that's nothing. It's not gonna help server load either.
Let's admit it, mp3s are 1/2 of Songs folder size (actually a little bit below 1/2), at least from what I have on computer. We have videos, backgrounds, storyboards, all that takes space and quite a lot of it, but still, even 1/2 of file size is quite impressive. I made a little program in Python to check length of each mp3 in Songs folder, return it's real size and then potential, if it was Opus with 96kbps. You can see the code here and try it yourself if you don't believe in this result. The output of that was:
  1. Current size = 44926.39706993103 megabytes
  2. Potential size = 23457.618713378906 megabytes
That's obviously not all maps on osu! and that won't change much. These ~45GB will still stay like that, this is if all the beatmaps were converted, which is barely possible, because everyone would probably have to redownload and stuff. But look, it was rejected 2 years ago. How many maps do we make within 2 years? Many, and that could've already decreased this number by quite a solid number.

I hope this won't be considered a duplicate, because the old one was already in completed ones, so I cannot bump it. This time, I hope people will try to defend either Opus or mp3 with arguments that make sense and are relevant to the topic and that this won't be rejected for reason as previous. "It's new, we don't want to change the ol' good mp3."

Similar could apply for x265 and VP9 support for videos. It's not that hard to update it and there's essentially no reason to not do that, that's different topic however.

Let out your opinions and discuss!
If I quoted you, it's nothing against you, it's just something against your argument. Nothing is meant offensively.
IppE
Vorbis and AAC have been suggested before, I can see peppy turning this down for the same silly reasons.
[Kanzaki Ranko]
Opus has different frequency cuts because it's optimized for voice, not music. That's why music bots deliver bad quality audio on Discord even from lossless sources, although my channel is set up with 96kbps Opus. That's why it isn't the norm for music yet (AAC is bad at low bitrates, Vorbis has barely the same quality as mp3 CBR on the same bitrates, but it supports lossy encoding with a considerably smaller loss (q9/q10)).

Besides, Opus would slightly increase the CPU/RAM usage by the game, as it's a compressed format. This is never desired.

There's no reason for moving away from what we have right now. Besides, changing the EULA to adjust for a different audio codec's license would be a pain.

Besides, FLAC support has been turned down by peppy because this is a rhythm game, not a music library; if you want a (supposedly, in Opus's case) higher audio quality, go support the artist.

@Ippe:
... Vorbis is supported by the client, by the way. At least it used to.

And h265 is a bad idea as well, at least right now. Very few GPUs support h265 decoding, and doing it on a CPU is really expensive (my i5-4460 can't decode h265 at 4k@30fps)
Topic Starter
Wafu

hozuki wrote:

Opus has different frequency cuts because it's optimized for voice, not music. That's why music bots deliver bad quality audio on Discord even from lossless sources, although my channel is set up with 96kbps Opus. That's why it isn't the norm for music yet (AAC is bad at low bitrates, Vorbis has barely the same quality as mp3 CBR on the same bitrates, but it supports lossy encoding with a considerably smaller loss (q9/q10)).

Besides, Opus would slightly increase the CPU/RAM usage by the game, as it's a compressed format. This is never desired.

There's no reason for moving away from what we have right now. Besides, changing the EULA to adjust for a different audio codec's license would be a pain.

Besides, FLAC support has been turned down by peppy because this is a rhythm game, not a music library; if you want a (supposedly, in Opus's case) higher audio quality, go support the artist.

@Ippe:
... Vorbis is supported by the client, by the way. At least it used to.

And h265 is a bad idea as well, at least right now. Very few GPUs support h265 decoding, and doing it on a CPU is really expensive (my i5-4460 can't decode h265 at 4k@30fps)
I didn't say to include flac support, that doesn't make much sense. Vorbis afaik is no longer supported. About increasing CPU/RAM usage, mp3 takes much more CPU as it's compressed format too. Lower delay of Opus is basically because it has lower requirements.

About the Discord thing, I've been making a bot recently, which is a little bit out of theme, but I also thought that Discord was using Opus to play audio. It was supposed to play sound, so I was about to make it quicker and make it play directly the opus file without converting it insensibly. But after hours of looking into the documentation, I was told by the wrapper developer, that it's impossible, because it needs to be converted into DCA format (Discord Audio), which sounds worse for music. Opus is highly optimized for both music and speech since version 1.1, before that, it didn't have mode for music - Discord is essentially using the speech mode, but their codec is little bit more changed than just that. But that's already 3 years ago. They even have that on their website by the way.

Also quite a good website indeoendent on Opus that tells quite useful info about it, especially the bitrates table is useful, both for music and speech http://wiki.hydrogenaud.io/index.php?ti ... ng_quality

Discord audio will always have worse music, it's not optimized for it, nobody expected Discord to be a radio, therefore it's using optimization for voice, Opus is different, because it can deal with both. So the Discord may be a little bit misleading here.

Also if Opus was not optimized for music, why does it sound much more near the original than the mp3? There were also people on Reddit, who noticed their favourite music channels on youtube improved sound quality and that was right after YT started encoding to Opus.

Addition to video codecs: You're right about x265, it gets updates like each week and the GPU support is low. VP9 is however good alternative and that shouldn't lag to anyone unless even youtube lags for them, because that's the codec they use currently.

tl;dr Discord is using Opus with some changes, but is only using voice mode, which will work terribly for music. Opus can deal greatly with music (greatly = better than mp3) for 3 years already and has both music and voice modes. Discord is misleading reference.

If interested for testing your own files, you may encode with opusenc (requires wav) included in opus-tools on their website, or ffmpeg (any format):
opusenc --bitrate 96 --hard-cbr "inputfile.wav" "outputfile.opus"

ffmpeg -i "input.flac" -c:a opus -b 96K -vbr off "outputfile.opus"
riffy
I don't see any reason not to give this format a try. If we try to make the format rankable, the bitrate would have to be something between 64 and 96, which would reduce the amount of space and/or let SBers get even more creative with more sprites to use.
Flanster
Plus it wouldn't be much of a pain to ingerate since BASS has an Opus plugin.
IppE

hozuki wrote:

Vorbis is supported by the client, by the way. At least it used to.
MP3 is the only rankable format for music in beatmaps.
Topic Starter
Wafu

Flanster wrote:

Plus it wouldn't be much of a pain to ingerate since BASS has an Opus plugin.
I suppose osu! is using avcodec-51.dll and avformat-52.dll for playback, which are shared libraries of ffmpeg and it shouldn't be difficult to update them for Opus support, there are even builds for it, eventually building it is not that difficult as we need only few codecs. I suppose BASS is used for the effects like spectrums in menu and so on, but I don't want to lie, that's what I just suppose.
Ayesha Altugle
Also noticed that converting my mp3 into opus definitely helped more. Since we are checking the quality of the audio, why not?
Full Tablet
If someone already has a MP3 file that meets the ranking criteria (128kbps - 192kbps), they shouldn't convert it to Opus for ranking (the file should be as close as the source as possible, transcoding would reduce the audio quality further). Ideally, only lossless files should be converted.

If one uses Youtube as a source, they should extract the original audio of the video (instead of using a video downloader that converts to MP3), since many high audio quality videos use Opus already (128kbps AAC-LC is also common, depending on the video).
Topic Starter
Wafu

Full Tablet wrote:

If someone already has a MP3 file that meets the ranking criteria (128kbps - 192kbps), they shouldn't convert it to Opus for ranking (the file should be as close as the source as possible, transcoding would reduce the audio quality further). Ideally, only lossless files should be converted.

If one uses Youtube as a source, they should extract the original audio of the video (instead of using a video downloader that converts to MP3), since many high audio quality videos use Opus already (128kbps AAC-LC is also common, depending on the video).
Exactly, if that eventually changed, people should take lossless, or at least very high quality audio to convert it to opus. If they already have 128-192, it will degrade quality as if you converted mp3 from 128 to 128kbps. Lossless -> Lossy is fine, Lossy -> Lossy is fine only if the original is like, let's say 320kbps mp3. In case of Opus, it attempts to act like lossless if bitrate is not so high, but because of differences in algorithm, there are still possible losses from mp3 to Opus, in most cases, you shouldn't be able to notice if all current maps were converted, but for the best results, Lossless/High quality lossy -> Opus is always the better option.

To the second point, I was surprised how many of Youtube videos have quite great quality when it comes to audio, just downloading with those "Youtube2mp3" websites results in terrible quality. I can highly recommend JDownloader, which is able to extract the original files that are streamed from Youtube. Also can work well with many other websites.
Flanster

Wafu wrote:

Flanster wrote:

Plus it wouldn't be much of a pain to ingerate since BASS has an Opus plugin.
I suppose osu! is using avcodec-51.dll and avformat-52.dll for playback, which are shared libraries of ffmpeg and it shouldn't be difficult to update them for Opus support, there are even builds for it, eventually building it is not that difficult as we need only few codecs. I suppose BASS is used for the effects like spectrums in menu and so on, but I don't want to lie, that's what I just suppose.
Those dlls are for video formats, bass.dll is the audio engine.
http://www.un4seen.com/
Topic Starter
Wafu

Flanster wrote:

Those dlls are for video formats, bass.dll is the audio engine.
http://www.un4seen.com/
AV in avcodec and avformat stands for Audio and Video. avformat is used to mux and demux data from any container and avcodec is for decoding and encoding audio or video. I know what can bass.dll do, but it doesn't mean it is used for decoding music and playing it in osu!, it has many usages. But yeah, there's not much sense in talking about that - no matter what, both bass and avcodec+avformat should be able to play/decode audio, so it doesn't really matter what is used, both shouldn't be a problem to update.
OperaMini0
 
Full Tablet

OperaMini0 wrote:

Wafu wrote:

Also, most osu beatmaps in 2016 still use CBR instead of VBR (V2 VBR is better than 192kbps CBR with the same bitrate/size, same with V5 and 128kbps CBR), I don't think that many people will use a new codec.
VBR is the default setting in most mp3 encoding software I know. I think the reason CBR is the most common is because the mappers want to fulfill the ranking criteria (192kbps at most), and CBR is quicker for that (using VBR would require tinkering with settings until it is just 192kbps average for best quality).

Opus support would mainly help people who can work in that format, making things easier for them.
As said before, YouTube rips give you audio in Opus format nowadays (AAC for some videos), so people could use them without having to transcode (reducing audio quality, and possibly increasing file size).
Topic Starter
Wafu
According to the bumping rules, I am apparently allowed to bump it to get it back to the discussion.
Please sign in to reply.

New reply