0

here is my code:

   async def direct(self, interaction: discord.Interaction, link: str):
        voice_client = get(self.bot.voice_clients, guild=interaction.guild)
        if voice_client is None:
            return await interaction.response.send_message("❌ Connect to a channel first.")

        await interaction.response.send_message("Using direct link.")
        voice_client.play(discord.FFmpegPCMAudio(link))
        return

here is my error:

[tls @ 0x557c73a19d00] Error in the pull function.
https://cdn.discordapp.com/attachments/1109998398150545410/1112473248505004142/portradio-_1_.ogg: Input/output error
2023-05-28 13:29:11 INFO     discord.player ffmpeg process 1458408 successfully terminated with return code of 0.

this happens usually around half-way through whatever im playing consistently

i've tried setting arguments like:

ffmpeg_options = {'options': '-vn -dn -sn -ignore_unknown -fflags +discardcorrupt'}

from this other post 'corrupt input packet in stream 1' error in FFMPEG which fixed the error corrupt input packet but im still having trouble any ideas?

goal is to get the audio playing to discord without having to store the file locally then playing it from there then discarding it after.

1 Answers1

0

FFMpeg doesn't handle HTTP read errors. So as your network load insreases, so does the probability of an error.

Your best bet is either to download everything first, or stream it to FFMpeg via another program that does do retries and stuff -- like cURL.

For one input file, you can just pipe it via stdin/stdout. For multiple input files, you can use FIFO files.

ivan_pozdeev
  • 33,874
  • 19
  • 107
  • 152