user16928153
user16928153

Reputation: 21

Discord PY: How can I take an Audio MP3 URL and play it in a voice channel?

https://onlyconnect.s3.eu-west-2.amazonaws.com/Audio/s16e2-11-Toyah-Brave+New+World.mp3

I'm trying to make a discord bot that plays certain mp3 files hosted online in a voice channel on request. I have the following audio file which is easily callable but none of the audio source classes in Discord PY which can be played using voice_client.play() seem to work:

For example:

voiceclient.play(discord.FFmpegPCMAudio("https://onlyconnect.s3.eu-west-2.amazonaws.com/Audio/s16e2-11-Toyah-Brave+New+World.mp3"))

leads to the exception:

Command raised an exception: ClientException: ffmpeg was not found.

I don't really understand what the different audio source building objects represent. According to the documentation, the PCMAUDIO object "reads byte data representing raw PCM." but I cannot find anywhere to convert an mp3 into raw byte data representing PCM so I am still stumped.

Upvotes: 0

Views: 1305

Answers (1)

Sourav Das
Sourav Das

Reputation: 1

you've to download ffmpeg.exe and add it to Your system path. and then you can use it. Example:-

ctx.voice_client.play(discord.FFmpegPCMAudio(url, executable='C:/programs/ffmpeg.exe'))

You must add the full path(root path) of ffmpeg.exe file
download link: https://ffmpeg.org/download.html

Upvotes: 0

Related Questions