I am facing a problem "discord.errors.ClientException: ffmpeg was not found." after running the code
import discord, nacl, ffmpeg
from discord import FFmpegPCMAudio
from discord.utils import get
from youtube_dl import YoutubeDL
client = discord.Client()
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith('&' + 'join'):
connection = message.author.guild.voice_client
if (connection):
await message.channel.send('**Перемещение в** ' + str(message.author.voice.channel))
await connection.move_to(message.author.voice.channel)
else:
await message.channel.send('**Подключение к** ' + str(message.author.voice.channel))
await message.author.voice.channel.connect()
ydl_opts = {'format': 'bestaudio', 'noplaylist':'True'}
FFMPEG_OPTIONS = {'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options': '-vn'}
voice = get(client.voice_clients, guild = message.channel.guild)
video_link = 'https://www.youtube.com/watch?v=uCc7hnuFDmg&ab_channel=Kontor.TV'
if not voice.is_playing():
with YoutubeDL(ydl_opts) as ydl:
info = ydl.extract_info(video_link, download = False)
URL = info['formats'][0]['url']
voice.play(FFmpegPCMAudio(URL, **FFMPEG_OPTIONS))
voice.is_playing()
else:
await message.channel.send('Музыка уже воспроизводится')
return
I have tried installing the module pip install ffmpeg
. I also downloaded the ffmpeg using this guide: https://www.youtube.com/watch?v=a_KqycyErd8&ab_channel=TroubleChute.
I will be grateful if you can also tell me why the video is being downloaded during the work:
[youtube] uCc7hnuFDmg: Downloading webpage
[youtube] Downloading just video uCc7hnuFDmg because of --no-playlist
Just the main task is to launch music without downloading.