【问题标题】:using node-fluent-ffmpeg to transcode with ffmpeg on windows not working使用 node-fluent-ffmpeg 在 Windows 上使用 ffmpeg 进行转码不起作用
【发布时间】:2013-04-28 20:15:11
【问题描述】:

我正在尝试使用模块 node-fluent-ffmpeg (https://github.com/schaermu/node-fluent-ffmpeg) 对视频文件进行转码和流式传输。由于我在Windows机器上,我首先从官方网站(http://ffmpeg.zeranoe.com/builds/)下载了FFMpeg。然后我提取文件夹 C:/FFmpeg 中的文件并将路径添加到系统路径(准确地说是 bin 文件夹)。我通过在命令提示符下键入来检查 FFmpeg 是否工作:ffmpeg -version。它给出了成功的响应。

之后,我继续从模块 (https://github.com/schaermu/node-fluent-ffmpeg/blob/master/examples/express-stream.js) 中复制/更改了以下代码:

app.get('/video/:filename', function(req, res) {
res.contentType('avi');
console.log('Setting up stream')

var stream = 'c:/temp/' + req.params.filename
var proc = new ffmpeg({ source: configfileResults.moviepath + req.params.filename, nolog: true, timeout: 120, })
    .usingPreset('divx')
    .withAspect('4:3')
    .withSize('640x480')
    .writeToStream(res, function(retcode, error){
        if (!error){
            console.log('file has been converted succesfully',retcode);
        }else{
            console.log('file conversion error',error);
        }
    });
});

我已经用 flowplayer 正确设置了客户端并尝试让它运行,但是 没发生什么事。我检查了控制台,它说:

file conversion error timeout

之后我增加了超时,但不知何故,它只在我重新加载页面时开始。但是由于页面重新加载,当然会立即停止。我是否需要为文件转码制作单独的节点服务器?还是我需要触发某种事件?

我可能遗漏了一些简单的东西,但我似乎无法让它工作。 希望有人能指出我错过了什么。

谢谢

【问题讨论】:

    标签: node.js ffmpeg transcoding


    【解决方案1】:

    我已经通过使用 videoJs 而不是 Flowplayer 来修复它。在我的情况下,flowplayer 的启动方式无法正常工作。所以我初始化流,然后初始化 videojs 以显示流。效果很好。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-04-26
      • 2016-08-17
      • 2017-11-10
      • 2021-02-19
      • 2015-05-06
      • 1970-01-01
      相关资源
      最近更新 更多