W
W
Wasya UK2019-02-27 17:32:03
fmpeg
Wasya UK, 2019-02-27 17:32:03

How to make a broadcast in fluent-ffmpeg?

If it's just on the command line, then everything is ok, but when I try to do it through the node, it doesn't work. Who came across, tell me pliz ...
Such is the line:

ffmpeg -f dshow -i video="screen-capture-recorder" -preset ultrafast -vcodec libx264 -tune zerolatency -b 900k -c:a aac -ar 44100 -f flv rtmp://localhost/live/STREAM_NAME

const command = ffmpeg('desktop')
  .videoCodec('libx264')
  .size('1920x1080')
  .flvmeta()
  .format('flv')
  .inputFPS(25)
  .videoBitrate('900k')
  .audioCodec('libmp3lame')
  .audioBitrate(128)
  .addInputOption('-f gdigrab')
  // .addInputOption('-f dshow')
  // .addInputOption('-i video="screen-capture-recorder"')
  .addInputOption('-preset ultrafast')
  .addInputOption('-tune zerolatency')
  .addInputOption('-c:a aac')
  .addInputOption('-ar 44100')
  .addOutputOption('rtmp://localhost/live/STREAM_NAME')
  .on('codecData', function(data) {
    console.log('Input is ' + data.audio + ' audio ' +
      'with ' + data.video + ' video');
  })
  .on('progress', function(progress) {
    console.log('Processing: ' + progress.percent + '% done');
  })
  .on('stderr', function(stderrLine) {
    console.log('Stderr output: ' + stderrLine);
  })
  .on('error', function(err, stdout, stderr) {
    console.log('Cannot process video: ' + err.message);
  })
  .on('end', function(stdout, stderr) {
    console.log('Succeeded !');
  });

const ffstream = command.pipe();
ffstream.on('data', function(chunk) {
  console.log('ffmpeg just wrote ' + chunk.length + ' bytes');
});

As a result I get:
Stderr output: [gdigrab @ 00000200acdebd40] Capturing whole desktop as 1920x1080x32 at (0,0)
Stderr output: Option sample_rate not found.
Stderr output:
Cannot process video: ffmpeg exited with code 1: Option sample_rate not found.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question