After refactoring and working on all possible solutions I could find on google I always get the following error:
Invalid data found when processing input
My code snippet:
FFMPEG_OPTIONS = {
"before_options": "-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5",
"options": "-vn -sn -dn"
}
@commands.command()
async def radio(self,ctx,url):
await self.joinLogic(ctx)
await self.playStreamOpus(ctx,url)
async def joinLogic(self, ctx):
if ctx.author.voice is None:
await ctx.send("Please join a voice channel!")
else:
voice_channel = ctx.author.voice.channel
if ctx.voice_client is None:
await voice_channel.connect()
async def playStreamOpus(self, ctx, url):
source = await discord.FFmpegOpusAudio.from_probe(url, **self.FFMPEG_OPTIONS)
ctx.voice_client.play(source)
What have I already tried:
- Re-install all dependencies on pip.
- A variety of streaming links that were working in the past for the same code.
- Tried the PCM instead of Opus.
- Different streaming URLs.
- More options in FFMPEG_Options to explicit that I need only audio.
- Made sure that my bot is joined in my channel and can reach other places in my code.
Streaming (sample) links I tried (worked before):
- https://streema.com/radios/StereoAnime
- http://www.e-radio.gr/Radio-Polis-994-Larisa-i54/live
- http://live24.gr/radio/generic.jsp?sid=169
Full FFmpeg options from Debugger console: ['ffmpeg', '-reconnect', '1', '-reconnect_streamed', '1', '-reconnect_delay_max', '5', '-i', 'http://www.e-radio.gr/Radio-Polis-994-Larisa-i54/live', '-map_metadata', '-1', '-f', 'opus', '-c:a', 'libopus', '-ar', '48000', '-ac', '2', '-b:a', 'Nonek', '-loglevel', 'warning', '-vn', 'pipe:1']
Youtube links work just fine in a similar method in the class.
async def playYouTube(self,ctx,url):
await self.joinLogic(ctx)
YDL_OPTIONS = { "format": "bestaudio" }
voiceClient = ctx.voice_client
with youtube_dl.YoutubeDL(YDL_OPTIONS) as youTube:
info = youTube.extract_info(url, download=False)
formattedUrl = info['formats'][0]['url']
source = await discord.FFmpegOpusAudio.from_probe(formattedUrl, **self.FFMPEG_OPTIONS)
voiceClient.play(source)
So most likely the problem lies with the URLs, which still boggles me cause they were working before?
Any insights will be highly appreciated!