2

I am trying to use fluent-ffmpeg to stream a video from disk, this video is a MKV file. I am trying to transcode this video to MP4 on my NodeJS server and stream it to the client. However, I keep getting the error code 1: Conversion failed! when I try to transcode the MKV file to MP4. Does anyone know why I am getting this error?

My code works when I try to transcode a MP4 file to MKV (matroska), but it does not work the other way around.

Here is the code I am using:

app.get('/video123', function (req, res) {
  var path = 'assets/sample2.mkv';
  ffmpeg(path)
    .format('mp4')
    .on('end', function () {
      console.log('file has been converted successfully');
    })
    .on('progress', function (progress) {
      console.log('Processing: ' + progress.frames + 'frames done');
    })
    .on('error', function (err) {
      console.log('an error happened: ' + err.message);
    })
    .pipe(res, { end: true });
});
Jackie
  • 75
  • 6

1 Answers1

0

For anyone who will search for is in future. Just use format('matroska') to format