5

I have created Object Live Video as Facebook's document.

"stream_url": "rtmp://rtmp-api.facebook.com:80/rtmp/641310872699778?ds=1&a=AaYx3JYoFLTXAvBK"

I using https://github.com/fluent-ffmpeg/node-fluent-ffmpeg for stream but I failed.

Does anyone have solutions to stream video file (eg: mp4) to Object Video Facebook API?

var ffmpeg = require('fluent-ffmpeg'),
  fs = require('fs');

  // open input stream
var infs = fs.createReadStream(__dirname + '/2.mp4');

infs.on('error', function(err) {
  console.log(err);
});
var publish = "rtmp://rtmp-api.facebook.com:80/rtmp/641310872699778?ds=1&a=AaYx3JYoFLTXAvBK";
// make sure you set the correct path to your video file
var proc = ffmpeg(infs)

  .format('mp4')
  .size('320x?')
  .videoBitrate('512k')
  .videoCodec('libx264')
  .fps(24)
  .audioBitrate('96k')
  .audioCodec('aac')
  .audioFrequency(22050)
  .audioChannels(2)
  // setup event handlers
  .on('end', function() {
    console.log('file has been converted succesfully');
  })
  .on('error', function(err) {
    console.log('an error happened: ' + err.message);
  })
  // save to stream
  .save(publish); //end = true, close output stream after writing

an error happened: ffmpeg exited with code 1: rtmp://rtmp-api.facebook.com:80/rtmp/641310872699778?ds=1&a=AaYx3JYoFLTXAvBK: Operation not permitted

2
  • 1
    Same problem, but using just raw ffmpeg, did you find a solution in the meanwhile. Using Facebook OpenGraph API I was able to see that it's a problem with the authentication
    – Mitro
    Jul 5, 2016 at 10:07
  • try using single quotes ' in var publish with inside all the rtmp url, stream-recorder.com/forum/…;
    – Mitro
    Jul 5, 2016 at 10:36

2 Answers 2

1

I got this error too when I tried to send an mp4 to a rtmp server. Convert the file to flv first because that is the file type that rtmp servers read and decode.

ffmpeg(infs).videoCodec('libx264').audioCodec('aac').toFormat('flv').save(publish)
-1

Have you tried passing a quoted input? Something like this:

publish = "\"rtmp://... live=1 app=...\"";

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.