fluent-ffmpeg / node-fluent-ffmpeg

A fluent API to FFMPEG (http://www.ffmpeg.org)
MIT License
7.82k stars 874 forks source link

How to send multiple input streams to youtube live #984

Open kokaprathyush opened 4 years ago

kokaprathyush commented 4 years ago

Version information

Code to reproduce

I am sending multiple input streams to to youtube live stream but only the last input (input2.mp4) is getting streamed in youtube.

var ffmpeg = require('fluent-ffmpeg'); var command = ffmpeg(); var streamkey = 'xxxxxxxx'

var proc3 = new ffmpeg("input1.mp4") .input("input2.mp4") .addOption('-vcodec', 'libx264') .addOption('-acodec', 'libmp3lame') .addOption('-crf', 26) .addOption('-aspect', '1280:720') .addOption('-f', 'flv') .withSize('1280x720') .on('start', function(commandLine) { console.log('Query : ' + commandLine); }) .on('error', function(err) { console.log('Error: ' + err.message); }) .output('rtmp://a.rtmp.youtube.com/live2/'+ streamkey, function(stdout, stderr) { console.log('Convert complete' +stdout) }) .run()

Expected results

input1.mp4 should be streamed first followed by input2.mp4

Observed results

only input2.mp4 is streamed and the program stops.

Any help is greatly appreciated. Thanks

caffeinum commented 4 years ago

Hi! I am not sure how to fix that exact error, but you need to concatenate videos, not just feed multiple inputs. Here's on ffmpeg concatenation: https://trac.ffmpeg.org/wiki/Concatenate