Skip to content

Instantly share code, notes, and snippets.

@toshvelaga
toshvelaga / ffmpeg.js
Last active June 19, 2025 09:49
stream to twitch and youtube RTMP destinations using FFmpeg
const ffmpeg = child_process.spawn('ffmpeg', [
// the input
'-i',
'-',
// video codec config: low latency, adaptive bitrate,
// list of presets: https://trac.ffmpeg.org/wiki/Encode/H.264
// tune zerolatency is good for fast encoding and low-latency streaming
// g:v 60 ==> https://www.reddit.com/r/ffmpeg/comments/redaa2/while_livestreaming_to_youtube_using_ffmpeg_i_get/
'-c:v',
@muralikg
muralikg / background.js
Last active July 29, 2024 14:29
puppeteer screen capture demo. Currently records 10 second video. Change the timeout in background.js with your own logic to stop the recording when necessary. Try with `node export.js`
/* global chrome, MediaRecorder, FileReader */
chrome.runtime.onConnect.addListener(port => {
let recorder = null
port.onMessage.addListener(msg => {
console.log(msg);
switch (msg.type) {
case 'REC_STOP':
console.log('Stopping recording')
if (!port.recorderPlaying || !recorder) {