Last active
December 9, 2017 15:13
-
-
Save tabvn/a5c27f3fffdeca0a2d9c60476b89b3d6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { exec } = require('child_process'); | |
const youtube_stream_key = ''; | |
const frame_rate = 30; | |
const streamCommand = `/usr/local/bin/ffmpeg -f avfoundation -i "0:0" -deinterlace -vcodec libx264 -pix_fmt yuv420p -preset medium -r 30 -g 60 -b:v 2500k -acodec libmp3lame -ar 44100 -threads 6 -qscale 3 -b:a 712000 -bufsize 512k -f flv rtmp://a.rtmp.youtube.com/live2/${youtube_stream_key}` | |
const ls = exec(streamCommand); | |
ls.stderr.on('data', (data) => { | |
console.log(`Streaming data: ${data}`); | |
}); | |
ls.on('close', (code) => { | |
console.log(`Streaming exist with code: ${code}`); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment