azlux / botamusique

Bot to play youtube / soundcloud / radio / local music on Mumble (using pymumble).
MIT License
311 stars 78 forks source link

Custom ffmpeg options #288

Closed 3291823 closed 3 years ago

3291823 commented 3 years ago

I've been using botamusique for a minute & I have noticed that the audio usually comes out sounding tinny or small, with no lower frequencies. I'm sure this is a result of converting to opus/mumble audio protocol. I'd like the ability to add a custom ffmpeg option, such as a low pass filter, or whatever else I desire. I'm not sure about other alternatives, mumble does not have any built in equalizer function yet. TIA.

TerryGeng commented 3 years ago

Did you set the volume by using !v command or the volume slider on the web interface?

3291823 commented 3 years ago

The volume is not the issue. I set it with !v. Listening to source material & what comes out thru botamusique is very different.

TerryGeng commented 3 years ago

Hi. Thanks for your reply.

I'm still confused by your original post saying you are experiencing tiny volume. Have you succeeded in making the bot sound louder?

As far as I've known, Opus has done a very decent job in compressing the audio material. I have been using botamusique for more than a year and haven't encountered any significant loss of fidelity.

A possibility is the server you are connecting to has enforced a rather low bitrate and that made the loss sounds pretty bad.

Could you try to connect to different servers and play different kinds of music files to see if this problem persists?

azlux commented 3 years ago

Hi, The ffmpeg command is hard coded here : https://github.com/azlux/botamusique/blob/6faadd6669aa27f1c65bf7327f2b2eccf6b15255/mumbleBot.py#L398 This command look like :

ffmpeg -v ffmpeg_debug -nostdin -i uri -ss f"{start_from:f} -ac str(channels) -f 's16le' -ar 48000 - 

If you really think that a ffmpeg issue you have, you can customize this command for testing purpose.

3291823 commented 3 years ago

Thanks.

3291823 commented 3 years ago

If anybody else is wondering, I was able to add a little bit of bass with the following.

   command = ("ffmpeg", '-v', ffmpeg_debug, '-nostdin', '-i',
                uri, '-ss', f"{start_from:f}", '-af', 'equalizer=f=40:width_type=h:width=50:g=7', '-ac', str(channels), '-f', 's16le', '-ar', '48000', '-')
paperbenni commented 2 years ago

Is this an issue with the codec/mumble or the bot? I have noticed this on my server as well, the music has noticeably less bass as if the codec settings were optimized for voice only at the cost of other sounds sounding bad. Discord which also uses the opus codec sounds a lot better when using a music bot. Maybe the music bot has adjusted settings to balance out the weird sound, but I'd definitely love to see this fixed

TerryGeng commented 2 years ago

@paperbenni Are you using Mumble 1.3.x?

paperbenni commented 2 years ago

yes

TerryGeng commented 2 years ago

I believe the problem is, not sure if you have noticed or not, that 1.3.x doesn't support stereo audio. Everything comes out in mono. You lost a huge amount of bass and other things during the converting process.

The RCs of 1.4.0 have been released on Mumble's site, which support stereo audio. I suggest you use that in order to get the best experience.

paperbenni commented 2 years ago

Do both the client and the server need mumble 1.4? Oh, and is there a Linux build for the server?

TerryGeng commented 2 years ago

Only clients. 1.4.0 build can be found at https://mumble.info for windows, linux and macos.

TerryGeng commented 2 years ago

image

I would not continue to answer Mumble release-related questions. Please refer to Mumble's website and #mumble-voip/mumble..

paperbenni commented 2 years ago

I tried the mumble client 1.4 and it sounds pretty much like the original sound file. I wildly underestimated how much of an impact stereo makes, my apologies for not checking before. The bass levels are fine, it just sounds a lot more tinny in mono. Thanks for your help :)