Skip to content

Instantly share code, notes, and snippets.

View blakev's full-sized avatar
🎯
Focusing

Blake VandeMerwe blakev

🎯
Focusing
View GitHub Profile
@blakev
blakev / livestream
Last active August 29, 2015 14:06 — forked from deandob/livestream
// Live video stream management for HTML5 video. Uses FFMPEG to connect to H.264 camera stream,
// Camera stream is remuxed to a MP4 stream for HTML5 video compatibility and segments are recorded for later playback
var liveStream = function (req, resp) { // handle each client request by instantiating a new FFMPEG instance
// For live streaming, create a fragmented MP4 file with empty moov (no seeking possible).
var reqUrl = url.parse(req.url, true)
var cameraName = typeof reqUrl.pathname === "string" ? reqUrl.pathname.substring(1) : undefined;
if (cameraName) {
try {
cameraName = decodeURIComponent(cameraName);