Discord bot:修复“找不到 FFMPEG"

Discord bot: Fix ‘FFMPEG not found’(Discord bot:修复“找不到 FFMPEG)
本文介绍了Discord bot:修复“找不到 FFMPEG"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我想让我的 Discord 机器人加入语音聊天,但每次我做到这一点时,我都会在 log(cmd) 中收到错误提示,FFMPEG not found,请帮助我.

错误图片:

这是代码:

client.on('message', message => {//语音仅在公会中有效,如果消息不是来自公会,//我们忽略它如果(!message.guild)返回;if (message.content === '/join') {//仅当他们自己在一个时才尝试加入发送者的语音频道if (message.member.voiceChannel) {message.member.voiceChannel.join().then(connection => {//Connection 是 VoiceConnection 的一个实例message.reply('我已成功连接频道!');}).catch(console.log);} 别的 {message.reply('您需要先加入语音频道!');}}});

这是我的 package.json 文件:

<代码>{名称":xxxtentacion",版本":1.0.0",主":index.js",脚本":{开始":节点 index.js",开发":nodemon index.js"},依赖":{discord.js":^11.4.2","dotenv": "^6.2.0",ffmpeg":0.0.4",作品":0.0.6"},开发依赖":{nodemon":^1.18.9"}}

解决方案

这将为您下载一个 Zip 存档,您必须提取并复制 bin/ 文件夹的所有内容,即 FFmpeg 二进制文件.或者,将它们存储在 PATH 环境变量中列出的文件路径中,以便在 shell 中简单地作为 ffmpeg 运行.

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 code:

client.on('message', message => {
  // Voice only works in guilds, if the message does not come from a guild,
  // we ignore it
  if (!message.guild) return;

  if (message.content === '/join') {
    // Only try to join the sender's voice channel if they are in one themselves
    if (message.member.voiceChannel) {
      message.member.voiceChannel.join()
        .then(connection => { // Connection is an instance of VoiceConnection
          message.reply('I have successfully connected to the channel!');
        })
        .catch(console.log);
    } else {
      message.reply('You need to join a voice channel first!');
    }
  }
});

this is my package.json file:

{
  "name": "xxxtentacion",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "start": "node index.js",
    "dev": "nodemon index.js"
  },
  "dependencies": {
    "discord.js": "^11.4.2",
    "dotenv": "^6.2.0",
    "ffmpeg": "0.0.4",
    "opusscript": "0.0.6"
  },
  "devDependencies": {
    "nodemon": "^1.18.9"
  }
}

解决方案

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.

这篇关于Discord bot:修复“找不到 FFMPEG"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会
问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转
Rails/Javascript: How to inject rails variables into (very) simple javascript(Rails/Javascript:如何将 rails 变量注入(非常)简单的 javascript)
CoffeeScript always returns in anonymous function(CoffeeScript 总是以匿名函数返回)
Ordinals in words javascript(javascript中的序数)
getFullYear returns year before on first day of year(getFullYear 在一年的第一天返回前一年)