MusicBot
MusicBot copied to clipboard
CPU load 100% when searching for a song on RPi2
Hi,
I am running this bot on a Raspberry PI 2. When searching for a new song (!play), it hangs with near 100% CPU usage, which makes the current song playing stutters/skips.
Wiki explicitly says that Raspberry Pi 2 is supported. It doesn't seem to be 100% compatible since it uses the whole CPU load when searching.
Do you know how to make MusicBot use less CPU load for RPi2 or at least reduce stuttering?
It doesn't do that for me. Are you sure that's all you have running?
I have transmission and Plex media server running but they only use about 1% each on idle.
You may have installed it wrong im not sure but it's running just fine for me
I have followed all the steps for Raspbian. Maybe I should try to reinstall with Debian Jessie Guide since I am on this OS.
It's worth a try. I don't really know what the problem is without fully knowing what went on during install
Don't install it on root lmao
I have exact same problem on RPI2. When i queue a song while some other song is playing, i get stutter. During the search there is a spike CPU usage and the sound is distorted.
Billy -- when some song is playing, and you search youtube, whats the CPU usage on your installation?
I have looked at debug information on discord and everything seems normal for the bot. Ping is between 20-40 ms and a reasonable amount of packet losses. My RPi2 has a 50 mbps download connection and I can stream 1080p videos on it. The discord server selected is the one closer to my home where my RPi2 is hosted (US East).
And about the CPU, bot can use up to 100% of a single CPU but my total CPU load never exceeds 50% with a 1 GHz quad core CPU (RPi2).
So I have eliminated all of the possible reasons that are not related to the application :
- Internet connection
- Discord's servers
- CPU usage
Using !play or !search with longer sentences on YouTube cause longer skips and artifacts. So there is a direct link between bot using ressources for song queries and the quality and consistency of the current song played.
Otherwise, if no commands are executed during a song, bot is flawless and song is played normally. The workaround is waiting for a song to finish to search for another one but it's not practical.
Please don't close this thread saying it's not an application issue.
I'm not sure on why you're getting high CPU load while running the bot on your Pi. When playing or searching for a video/song, the bot asynchronously executes a query using youtube-dl.
I'm gonna ping @imayhaveborkedit here and see if it's anything we can look into.
Its not likely its youtube-dl. The stutter seems to be caused by search, there is no skipping when playing a video directly through its URL. Also tried downloading some random videos with youtube-dl command directly while playing something on the musicbot, and there was no interference.
Can confirm this happens in RPi3 as well, observing the top command I can see that it is python3.5 that draws most CPU resources (50%+) while the transcoding by ffmpeg stays stable at around 5%
Tested another musicbot (https://github.com/jagrosh/MusicBot) and it didnt have the same problem, so it is not the pi that is bottlenecking.
considering py 3.5 is outdated now I'm going to close this issue.