So im trying to make a simple discord music bot, which is halted right now due to this problem. The issue is that everytime i try to play a music through youtube_dl library, it pops up with the prompt: "ffmpeg was not found".

This is the main.py

import discordimport osimport asyncioimport youtube_dlimport ffmpegtoken = 'NzY5NTUzNDcwNjAwMTE4Mjgz.G3Dzce.XYKNAyLfBPg0ug5XPKssV-9EvsFjBlCMeM43ag'client = discord.Client()block_words = ['dick', 'nigga', 'ujku shijakut', 'arli', 'http://', 'https://']voice_clients = {}yt_dl_opts = {'format': 'bestaudio/best'}ytdl = youtube_dl.YoutubeDL(yt_dl_opts)ffmpeg_options = {'options': '-vn'}@client.eventasync def on_ready():print(f'Bot has logged in as {client.user}')@client.eventasync def on_message(msg):if msg.author != client.user:if msg.content.lower().startswith('?hi'):await msg.channel.send(f'Hi, {msg.author.display_name}')@client.eventasync def on_message(msg):if msg.author != client.user:for text in block_words:if "OTR" not in str(msg.author.roles) and text in str(msg.content.lower()):await msg.delete()returnprint("Not Deleting...")@client.eventasync def on_message(msg):if msg.content.startswith('?play'):try:url = msg.content.split()[1]voice_client = await msg.author.voice.channel.connect()voice_clients[voice_client.guild.id] = voice_clientloop = asyncio.get_event_loop()data = await loop.run_in_executor(None, lambda: ytdl.extract_info(url, download=False))song = data['url']player = discord.FFmpegPCMAudio(song, **ffmpeg_options)except Exception as err:print(err)client.run(token)
1

Best Answer


FFMPEG is an audio and video manipulation tool, the error ffmpeg was not found means that you don't have FFMPEG installed.

If your OS is linux, then sudo apt install ffmpeg should do the trick.

If your OS is windows, you can download FFMPEG from the official download page: https://ffmpeg.org/download.html#build-windows.

If your OS is MacOS, you can also download it from the official download page: https://ffmpeg.org/download.html#build-mac.

Note that if you downloaded the executable from the website, you'll have to manually move it to your script's directory (or add it to PATH).

This error does NOT have anything to do with Youtube. Youtube cannot stop you from downloading videos, and it cannot stop you from using a video manipulation tool.