【问题标题】:Using nodejs fluent-ffmpeg to stream to icecast server使用 nodejs fluent-ffmpeg 流式传输到 icecast 服务器
【发布时间】:2019-06-02 02:54:37
【问题描述】:

我正在尝试进行 api 调用来表达哪个调用 ffmpeg 将流输出到 icecast。

我可以使用 child_process 来做到这一点,但我已经为 nodejs 找到了 fluent-ffmpeg

如果我添加

.save('icecast://source:hackme@localhost:8000/test')

我得到一个无效的参数错误,如果我使用

.output('icecast://source:hackme@localhost:8000/test')

我没有收到错误,对调用网页的响应正确,但没有 ffmpeg 进程。

有人知道fluent-ffmpeg 是否输出到icecast

var ffmpeg = require('fluent-ffmpeg');
  app.get('/ffmpeg', function(req, res) {
    var ffmpegPath = '/usr/bin/ffmpeg';
    proc = new ffmpeg('/home/russ/radio_audio/fore/BaBeL74.wav')
      .output('icecast://source:hackme@localhost:8000/test');
    proc.setFfmpegPath(ffmpegPath);
    res.send('ok');
  });

【问题讨论】:

    标签: javascript node.js ffmpeg fluent-ffmpeg


    【解决方案1】:

    尝试在 nodejs 中使用 icecast 的 icy 模块


    icy module nodejs

    【讨论】:

    • 感谢您的回复,据我所知,这个模块接受一个流并将流到标准输出/注入元数据。我需要对结果进行编码并将结果流式传输到 icecast,所以不确定它是否有帮助。
    【解决方案2】:

    自从我使用“fluent-ffmpeg”以来,您是否尝试过使用“writeToStream”功能?比如:

    var ffmpeg = require('fluent-ffmpeg');
    app.get('/ffmpeg', function(req, res) {
      var ffmpegPath = '/usr/bin/ffmpeg';
      new ffmpeg('/home/russ/radio_audio/fore/BaBeL74.wav')
       .writeToStream(res, function(retcode, error){
        console.log('file has been converted succesfully');
      });
    });
    

    也许这个链接可以https://github.com/fluent-ffmpeg/node-fluent-ffmpeg/issues/124

    【讨论】:

    • 感谢您的回复,对于延迟回复感到抱歉。最后我决定使用 child_process bash 脚本,因为我有一个复杂的 ffmpeg 脚本,我必须为 fluent-ffmpeg 添加选项。
    猜你喜欢
    • 2012-08-12
    • 2011-05-20
    • 2014-11-30
    • 1970-01-01
    • 2013-07-23
    • 1970-01-01
    • 2013-12-26
    • 1970-01-01
    • 2019-08-25
    相关资源
    最近更新 更多