Skip to content

Instantly share code, notes, and snippets.

@toshvelaga
Last active June 19, 2025 09:50
Show Gist options
  • Save toshvelaga/91157816f235c98030f945d2ae1ff7f3 to your computer and use it in GitHub Desktop.
Save toshvelaga/91157816f235c98030f945d2ae1ff7f3 to your computer and use it in GitHub Desktop.
ffmpeg to stream live video using tee muxer
const ffmpegTee = (youtube, twitch, facebook) => {
return [
'-i',
'-',
// select first stream intended for output
'-map',
'0',
// video codec config: low latency, adaptive bitrate
'-c:v',
'libx264',
'-preset',
'veryfast',
'-tune',
'zerolatency',
'-g:v',
'60',
// audio codec config: sampling frequency (11025, 22050, 44100), bitrate 64 kbits
'-c:a',
'aac',
'-strict',
'-2',
'-ar',
'44100',
'-b:a',
'64k',
//force to overwrite
'-y',
// used for audio sync
'-use_wallclock_as_timestamps',
'1',
'-async',
'1',
'-flags',
'+global_header',
'-f',
'tee',
`[f=flv:onfail=ignore]${youtube}|[f=flv:onfail=ignore]${twitch}|[f=flv:onfail=ignore]${facebook}`,
]
}
@MostafaRabia
Copy link

HI!

How can I input the video from camera to the ffmpeg?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment