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
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!
Most helpful comment
needed a long audio stream in order to not end. It can't stay "alive" with just the PNG looping.