Node-fluent-ffmpeg: Stream to RTMP server (facebook live) is ending almost immediately

Created on 26 Nov 2016  路  3Comments  路  Source: fluent-ffmpeg/node-fluent-ffmpeg


OSX 10.12.1 Sierra, running node v6.6.0

Hi,

I'm trying to stream a loop of a PNG image as a video to facebook live, using the following code:

ffmpeg('image.png') .loop() .flvmeta() .format('flv') .size('1280x720') .videoBitrate('512k') .videoCodec('libx264') .fps(24) .videoFilters({ filter: 'drawtext', options: { fontfile:'./opensansbold.ttf', text: 'Testing streaming', fontsize: 50, fontcolor: 'white', x: '(main_w/2-text_w/2)', y: 50, shadowcolor: 'black', shadowx: 2, shadowy: 2 } }) .on('error', function(err) { console.log('An error occurred: ' + err.message); }) .on('end', function() { console.log('Processing finished !'); }) .save("rtmp://rtmp-api.facebook.com:80/rtmp/<fbstreamstuff>")

The stream starts, but once I check it on my facebook page, it's already "ended". If I continue running for a while, I can confirm that data is still being sent. When I stop the ffmpeg process, facebook will process the recording video and play the entire time I was broadcasting. Looks like my png file is not being sent in a way facebook will recognize as a live stream, and it ends it after a few seconds.

Changing the output to a local file, it works fine and the file is playable.

Also, If I broadcast a mp4 file instead of a png in loop, it works fine on Facebook. So, I suspect the problem is related to how I'm doing the image to video conversion.

I tried with and without flvmeta (which is installed and seems to be working properly)

Any help will be appreciated!

Geraldo

Most helpful comment

needed a long audio stream in order to not end. It can't stay "alive" with just the PNG looping.

All 3 comments

needed a long audio stream in order to not end. It can't stay "alive" with just the PNG looping.

this helped thanks

needed a long audio stream in order to not end. It can't stay "alive" with just the PNG looping.

Hi! Could you provide an example about long audio stream? Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Laurian picture Laurian  路  4Comments

baoxiangyang picture baoxiangyang  路  3Comments

odigity picture odigity  路  4Comments

judemorrissey picture judemorrissey  路  5Comments

echo66 picture echo66  路  3Comments