Skip to content Skip to sidebar Skip to footer

Discord Bot: Fix ‘FFMPEG Not Found’

I want to make my Discord bot join voice chat but every time I make it I get a error into log(cmd) saying, FFMPEG not found, please help me. Picture of the error: This is the cod

Solution 1:

Introduction to Voice Voice in discord.js can be used for many things, such as music bots, recording or relaying audio.

In discord.js, you can use voice by connecting to a VoiceChannel to obtain a VoiceConnection, where you can start streaming and receiving audio.

To get started, make sure you have:

FFmpeg - npm install ffmpeg-binaries
an opus encoder, choose one from below:

  • npm install node-opus (better performance)
  • npm install opusscript (a good network connection)

The preferred opus engine is node-opus, as it performs significantly better than opusscript. When both are available, discord.js will automatically choose node-opus. Using opusscript is only recommended for development environments where node-opus is tough to get working. For production bots, using node-opus should be considered a necessity, especially if they're going to be running on multiple servers.


Solution 2:

FFmpeg is a convenient tool to work with audio/video/image/subtitle stuff, in this context this tool is required for extracting audio from an arbitrary container for bitstream (eg. mp4, mkv, flv, ogg) to a discord compatible VoIP codec OPUS.

Though it's intended be platform independent but for each platform requires different procedures, Note that: I only listed those platforms with which I have expertise with.

GNU/Linux

You mostly use the package manager to install it along with its dependencies, or you can just use the way of manually compiling the code with the steps described at here.

# Ubuntu / Debian / Linux Mint
sudo apt install ffmpeg

# ArchLinux / Manjaro / Anarchy
sudo pacman -S ffmpeg

# Gentoo / Funtoo
USE=opus sudo emerge ffmpeg

Windows

Windows is not easy as GNU/Linux, you either manually satisfy all dependencies then compile all the stuff all by yourself with MSVC or use Cygwin or Msys2 to compile. An alternative way is to download pre-compiled windows binaries from Zeranoe's website. Due to Zeranoe's website is closed, download from Gyan's website or anywhere else.

This will download you a Zip archive which you've to extract and copy all contents of the bin/ folder, those are the FFmpeg binaries. Optionally, store them at a file path which is listed in the PATH environment variable, to run it simply as ffmpeg in a shell.


Solution 3:

I had a problem with playing stream in Discord.js even thought I installed ffmpeg, so here's a possible fix, atleast in windows if ffmpeg command can't be run alone in CMD, then I went to node_modules\prism-media\src\core\FFmpeg.js on line 115 and there is an array of each possible directory of what to use e.g ffmpeg, so I changed from

}, 'ffmpeg', 'avconv', './ffmpeg', './avconv'];

to

}, 'ffmpeg', 'avconv', './ffmpeg', 'C:/ffmpeg/ffmpeg', './avconv'];

and it worked fine! :>


Post a Comment for "Discord Bot: Fix ‘FFMPEG Not Found’"