【问题标题】:I am getting this "Error: FFmpeg/avconv not found!"我收到这个“错误:找不到 FFmpeg/avconv!”
【发布时间】:2020-07-10 12:18:55
【问题描述】:

我正在尝试创建一个不和谐的机器人,但是每次我尝试运行 youtube 链接时都会收到此错误。

Error: FFmpeg/avconv not found!
    at Function.getInfo (C:\Users\-\discord-bot\node_modules\prism-media\src\core\FFmpeg.js:130:11)
    at Function.create (C:\Users\-\discord-bot\node_modules\prism-media\src\core\FFmpeg.js:143:38)
    at new FFmpeg (C:\Users\-\discord-bot\node_modules\prism-media\src\core\FFmpeg.js:44:27)
    at AudioPlayer.playUnknown (C:\Users\-\discord-bot\node_modules\discord.js\src\client\voice\player\BasePlayer.js:47:20)
    at VoiceConnection.play (C:\Users\-\discord-bot\node_modules\discord.js\src\client\voice\util\PlayInterface.js:71:28)
    at Object.play (C:\Users\-\discord-bot\commands\play.js:78:8)
    at Object.execute (C:\Users\-\discord-bot\commands\play.js:48:16)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:14004) UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send an empty message
    at RequestHandler.execute (C:\Users\-\discord-bot\node_modules\discord.js\src\rest\RequestHandler.js:170:25)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:14004) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandl
ed promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:14004) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

我用npm install -g ffmpeg-binaries 安装了ffmpeg 来尝试全局安装它。我还在 PATH 中添加了 ffmpeg,但这似乎不起作用。

有办法解决吗?

【问题讨论】:

  • 是什么让您认为 ffmpeg 二进制文件是您所需要的?我建议安装 prism-media 包的自述文件的依赖项部分中列出的依赖项之一npmjs.com/package/prism-media#dependencies
  • 您是否也尝试运行ffmpeg -h 以确保系统找到它?
  • 嘿,我有同样的问题,我做了一些挖掘和一些实验,我的问题 100% 与通过 url 传递的文件的大小有关。所以我可以播放带有音频的纯静态图像的 youtube 视频,比如播放歌曲的专辑封面,但我不能播放任何带音频的音乐视频。我看到了几个类似的问题,但仍然没有实际的解决方法。当我找到一个时,我会更新。如果您在我之前也这样做,请在此处发布答案。

标签: node.js ffmpeg discord.js


【解决方案1】:

你在用这个方法吗? https://discord.js.org/#/docs/main/stable/class/VoiceConnection?scrollTo=play

由于您没有提供任何代码...

我有同样的问题,那天我做了两件事,但我不知道哪一个是修复的。

我不确定它是哪一个修复程序。但是现在它也可以在没有目录中的文件的情况下工作,所以我有点困惑

也尝试在 js 文件中要求 ffmpeg-binaries

【讨论】:

  • 添加 exe 文件解决了这个问题,但我如何用 github 将它推送到 heroku?
  • 像往常一样推送即可。不要在 gitignore 中包含 .exe 文件
【解决方案2】:

尝试运行这个npm i ffmpeg-static

【讨论】:

    【解决方案3】:

    我在 Discord.js 中播放流时遇到问题,即使我安装了 ffmpeg 二进制文件,所以这里有一个可能的修复方法,如果 ffmpeg 不能在 CMD 中单独运行,那么至少在 Windows 中,然后我转到第 115 行的 node_modules\prism-media\src\core\FFmpeg.js 并且每个可能的目录都有一个数组,例如 ffmpeg,所以我从

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

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

    对我来说效果很好:)

    【讨论】:

      【解决方案4】:

      安装 avconv 和 ffmpeg

      它像这样对我有用

      【讨论】:

        【解决方案5】:

        要添加 ffmpeg,请到这里:

        https://dashboard.heroku.com/apps/YOURAPPNAME/settings

        然后找到这个:

        通过“添加 Buildpack”按钮添加: https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest

        【讨论】:

          猜你喜欢
          • 2020-11-08
          • 2021-05-09
          • 2018-02-02
          • 2018-06-14
          • 1970-01-01
          • 1970-01-01
          • 2020-05-04
          • 2019-08-25
          • 2020-11-22
          相关资源
          最近更新 更多