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
Distorted sound in OPUS streams #1459
Comments
@ivellios1988 I'm not sure what's causing the problem here. This may be an upstream issue with Liquidsoap rather than anything with AzuraCast, though it's definitely possible that our settings are causing the problem, in which case we're happy to modify the settings as needed to resolve it. |
Maybe Liquidsoap needs update? Or is it already up-to-date in current version of AzuraCast? I just did some tests in order to determine of there's anything I can do to fix the issue. In liquidsoap.liq I changed complexity for my OPUS stream to 0. No success, the distortion still occurred. Then I did some tests using Web DJ. I've been experimenting with different sample rates, switching from MP3 to raw, changing bitrates, etc. No success, the distortion still occurred. I remember that I had a similar issue with virtual audio devices in Windows 7/8/10, similar distortion appeared when I tried to send some audio through them. It turned out that the cuplrit was wrong 'internal sampling rate' which was set to 96000 Hz, I had to either change sampling rates in my audio devices to 48000 Hz or change the 'internal sampling rate' to 88200 Hz (or something like that). |
I just did a one more test, this time I was experimenting with changing sample rate in liquidsoap.liq. I changed samplerate from 48000 to 24000, then I changed permissions in order to prevent the file from being overwritten when Liquidsoap is restarted, and I restarted Liquidsoap. Audio bandwidth was cut to 24000 Hz, of course, but the distortion was still there. |
For the purposes of testing various things, I created a station with two streams: OGG: https://s.paranormalium.pl/radio/8020/ogg OPUS: https://s.paranormalium.pl/radio/8020/opus Audio bandwidth of the file being played is 8000 Hz (I attached the original file to this post). In OGG stream the sound is clear, whereas in OPUS stream a heavy distortion is clearly audible. I also tried playing files with sample rate of 48000, however, no success, the distortion was still present. |
@ivellios1988 I'm very confident that this issue is "upstream" from the AzuraCast web interface, and that something in either Liquidsoap or its underlying lib implementation is causing this problem. I would heavily advise that you make an issue reporting these same details over at https://github.com/savonet/liquidsoap |
How to check which version of libopus, libsamplerate and liquidsoap does AzuraCast use? |
@ivellios1988 You can see which versions of the packages we install in the Dockerfile of the radio container. |
@ivellios1988 The docker image is now updated to use libopus 1.3.1. Can you update and check if the problem is fixed by that? |
I just updated my AzuraCast installation, then rebooted my server. Unfortunately, however, the distortion is still present. :( |
Just a quick test: opus_test.zip Artifacts in 'opus' file remind me of the issue some users of Teamspeak had. From what I read on their community forums, the problem was related to framesize being too low which resulted in opus adding some noises to the sound. |
@ivellios1988 I'm actually not sure what our original rationale was for setting the sampling rate for OPUS streams to be 48kHz instead of 44.1kHz, but I've switched it back to the same sample rate used by the other formats. That should fix the issue, but let me know if it doesn't. |
Unfortunately the distortion is still there. I updated my AzuraCast installation and even rebooted my VPS. No success, sound in OPUS is still distorted :( |
I did a couple of tests. I tested AzuraCast on three versions of Ubuntu (16.04 LTS, 18.04 LTS, 19.04). Distortion in OPUS streams was present all the time. I thought the problem may in some way be related to version of Ubuntu but it turned out that's not the case. It seems to me that the sound sent to OPUS encoder is already distorted. By the way, after the recent update, AzuraCast keeps setting sample rate for OPUS streams to 44100 which results in errors when starting Liquidsoap, and it's necessary to change the sample rate manually in liquidsoap.liq and change permissions to avoid the file being overwritten. |
@ivellios1988 Apparently that's why we set it to 48kHz. Reverting that commit then. Have you tried modifying the other things that we set on OPUS streams:
i.e. changing complexity, max_bandwidth, application, or signal? |
Already tried that, no success. I even added frame_size with all possible values - still no success, sound is distorted all the time. |
@ivellios1988 Well then I'm even more confident it isn't something we're doing wrong with AzuraCast itself. This is almost 100% likely to be an "upstream" issue from us, likely to do with either the OCaml encoder connector or the encoder itself. If you haven't already, I'd definitely recommend creating an issue over on Liquidsoap's GitHub page and seeing if they can track down the source of the problem. If you find anything out and there's something that requires our action (i.e. updating our codebase or library dependencies) just let us know. |
There's already an open issue on their GitHub page: savonet/liquidsoap#759 Since streams in other formats work perfectly fine, I'm also sure that there's nothing wrong with AzuraCast. |
I've also done some tests in my dev environment where I could replicate the issue from a bare liquidsoap script that just re-encodes an .mp3 to an opus file, which means it's not the config that AzuraCast generates, it could still be the system setup but it's more likely to be an issue with the upstream software. I added that to the issue over at liquidsoap together with my tests input / output files so that they have something to try to replicate that. |
@ivellios1988 Our Docker and Ansible scripts have both been updated to incorporate libsamplerate and its OCaml connector; please update and let us know if it helps with the issue. |
I can confirm that the distortion is gone, at last :) Thank you very much. You're real scientists! |
@ivellios1988 Happy we could help! :) |
I noticed strange problem with OPUS streams. There appears a distortion which makes them sound like they were badly resampled from 44100 Hz to 48000 Hz without proper filtering. I recorded a sample to illustrate the issue:
left channel: OPUS 192kbps, 48000 Hz
right channel: MP3 128kbps, 44100 Hz
In the left channel, the distortion is very clearly audible, especially with sibilants.
Untitled Session 2_mixdown.zip
The text was updated successfully, but these errors were encountered: