maxcutlyp / YoutubeBot

A self-hosted Discord bot for playing YouTube videos
51 stars 26 forks source link

Low Audio Quality #4

Closed Linkd-Aether closed 1 year ago

Linkd-Aether commented 1 year ago

I'm currently running this bot on Linux. It has been fully set up and the overall functionality works. However, I've noticed that the audio quality of the downloaded music is noticeably terrible. This is present in the downloaded file, it is not just Discord's own audio compression. Is this an issue of the YouTube API, the limitations of locally-run bots, or a potential issue in my setup?

Linkd-Aether commented 1 year ago

After a little digging, I found that the yt_dlp format setting is set to "worstaudio" (youtubebot.py, line 96). When set to "bestaudio" there does not appear to be any significant download delay, and the audio is up to YouTube standards. For anyone with this issue, consider changing this setting. I might make a pull request with this change, though it's really an extremely small fix.

maxcutlyp commented 1 year ago

Hey, sorry for the late reply. I chose "worstaudio" to save bandwidth, but obviously this should be changed depending on your priorities/requirements.

I'm hesitant to change it to bestaudio by default as the file might be unexpectedly large (esp. for longer videos), but happy to merge a PR adding it as an environment variable - something like YTDL_FORMAT? This would mean adding a variable to the .env.example file, loading it at the top of the script with all the other environment vars, then using it in place of the hardcoded string on line 96.

maxcutlyp commented 1 year ago

Closed - added it to .env in #13