0
 @commands.command()
    async def play(self, ctx, url):
        ctx.voice_client.stop()
        FFMPEG_OPTIONS = {'before_options': 'reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options': '-vn'}
        YDL_OPTIONS = {'format': 'bestaudio'}
        vc = ctx.voice_client

        with youtube_dl.YoutubeDL(YDL_OPTIONS) as ydl:
            info = ydl.extract_info(url, download=False)
            url2 = info['formats'][0]['url']
            source = await discord.FFmpegOpusAudio.from_probe(url2, **FFMPEG_OPTIONS)
            vc.play(source)

This is the code I am using to stream youtube into a discord voice channel. I use VSCode on Mac. I downloaded FFmpeg using homebrew. I keep running into the issue "FFmpeg was not found" even if the FFmpeg folder is in the same directory as my discord.py script. Is there something more I have to do? Also, I don't seem to have an FFmpeg executable. Only .pyc and .py files.

  • Something is funny, you should have the **ffmpeg.exe**. Can you try my manual instructions using a Mac Terminal: https://stackoverflow.com/questions/9913032/how-can-i-extract-audio-from-video-with-ffmpeg/36324719#36324719 - the download includes the exe and once you get it and confirm its working put the exe in the same folder as the py files. – Jeremy Thompson Aug 11 '21 at 04:14
  • make sure the path to the ffmpeg.exe is at the environment variables at windows – yotam rec Aug 11 '21 at 09:32
  • @JeremyThompson I am using a Mac and mac does not have .exe files. Is there an equivalent that I can use? – Fayeze Salih Aug 12 '21 at 01:14
  • Ok, I don't use Macs but yes and here's how you install FFMPEG on Mac: https://superuser.com/questions/1313069/which-ffmpeg-package-i-should-download-for-macos – Jeremy Thompson Aug 12 '21 at 03:29

0 Answers0