【发布时间】: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