Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to select bitrate based on quality #92

Open
abbrev opened this issue Aug 26, 2024 · 2 comments
Open

Option to select bitrate based on quality #92

abbrev opened this issue Aug 26, 2024 · 2 comments

Comments

@abbrev
Copy link

abbrev commented Aug 26, 2024

I added a --quality N option to opusenc.c which automatically selects the bitrate depending on the number of channels in the input file. The quality scale is the same as Vorbis; that is, -2 to 10, with 3 being nearly transparent. With a bit of testing of levels -1 through 2 (I tested with a stock oggenc which doesn't support below -1), I get roughly the same audio quality output as oggenc (of course, Opus requires somewhat lower bitrate than Vorbis for the same quality). At quality level 3 and above I have a hard time distinguishing them from lossless, so there may be room for tuning the bitrates for quality 3 and above.

With this option you can do, for example:

opusenc --quality 3 mono.flac
opusenc --quality 3 stereo.flac
opusenc --quality 3 5.1.flac
opusenc --quality 3 7.1.flac

and get approximately the same audio quality from mono, stereo, and 5.1 or 7.1 surround.

Before I put in more effort to test and polish up my changes, how much real interest is there in this option? I saw some interest at https://hydrogenaud.io/index.php/topic,116997.0.html (and some discussion of bitrate vs quality at https://hydrogenaud.io/index.php/topic,120007.75.html). And I personally like the concept of having one knob to control the quality rather than having to set the bitrate depending on how many channels the input file has (having used Ogg Vorbis a lot in the past, it feels almost natural to me). And how likely is this feature to be merged?

I added this option based on the v0.2 tag, but I noticed that the master branch has changes related to handling channel configurations that affect mine. So I'd have to rebase to master if that's where it needs to go, assuming this gets enough interest.

Edit to add: there's more discussion about bitrate vs quality at https://hydrogenaud.io/index.php/topic,120007.75.html.

@RadegasTCZ
Copy link

RadegasTCZ commented Nov 6, 2024

I don't think Opus is made for mid-high bitrates (192kbps and above). In that case, just use AAC since Opus streams/files aren't natively supported in iOS 18 (VLC) anyway for whatever reason.

*edit: and back to quality settings, well it might be quite subjective so not so sure about that

@abbrev
Copy link
Author

abbrev commented Nov 8, 2024

I don't think Opus is made for mid-high bitrates (192kbps and above).

Opus works great at 192kbps and above. Listening tests have found it to be transparent in all samples tested at 192kbps (and AAC wasn't transparent in all of the samples at that bitrate). So I would agree if you said that it's overkill to use more than 192kbps with Opus. (This assumes the typical encoding parameters and stereo—other channel configurations like 5.1 and 7.1 have higher thresholds for transparency, and it's not as simple as just multiplying the bitrate by the number of channels.)

Opus streams/files aren't natively supported in iOS 18 (VLC) anyway for whatever reason.

That's unfortunate for Apple users. Opus has been around for 12 years and a WebRTC standard for 8 years now, so there's no good technical reason (only business reasons) for Apple not to natively support it.

But all of that really is neither here nor there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants