【问题标题】:spawn ENOENT error when trying to convert to mp3尝试转换为 mp3 时产生 ENOENT 错误
【发布时间】:2021-09-20 17:28:39
【问题描述】:

我试图使用名为youtube-mp3-downloader 的 npm 包制作 youtube 视频到 mp3 转换器,npm 文档说我必须下载 FFmpeg 才能运行程序,所以我下载了 FFmpeg Windows 版本。然后我将 FFmpeg 二进制路径添加到代码中,以便运行程序并获得预期的输出,即保存到指定位置的 mp3 文件和输出数据,但每次运行程序时,我都会收到错误 spawn ../client/ffmpeg-4.4-full_build/bin ENOENT .当我研究错误时,我发现我必须将ffmpegfluent-ffmpeg 依赖项安装到我的节点模块中,所以我这样做了,但错误仍然存​​在。我做错了什么?

var YoutubeMp3Downloader = require("youtube-mp3-downloader");

//Configure YoutubeMp3Downloader with your settings
var YD = new YoutubeMp3Downloader({
  // FFmpeg binary location *Where the error is arising
  "ffmpegPath": "../client/ffmpeg-4.4-full_build/bin",
  // Output file location (default: the home directory)
  "outputPath": "../client/audio",
  // Desired video quality (default: highestaudio)
  "youtubeVideoQuality": "highestaudio",
  "queueParallelism": 2, // Download parallelism (default: 1)
  // Interval in ms for the progress reports (default: 1000)
  "progressTimeout": 2000,
  "allowWebm": false // Enable download from WebM sources (default: false)
});

//Download video and save as MP3 file
YD.download("Vhd6Kc4TZls");

YD.on("finished", function(err, data) {
  console.log(JSON.stringify(data));
});

YD.on("error", function(error) {
  console.log(error);
});

YD.on("progress", function(progress) {
  console.log(JSON.stringify(progress));
});

【问题讨论】:

    标签: javascript node.js ffmpeg


    【解决方案1】:

    我遇到了同样的问题,我通过指定 ffmpeg.exe 文件的确切路径来修复它。

    如果您在对象中将ffmpegPath 设置为../client/ffmpeg-4.4-full_build/bin/ffmpeg.exe,它应该可以工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-07-30
      • 2014-09-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-23
      • 2021-02-05
      • 1970-01-01
      相关资源
      最近更新 更多