Node.JS Low Latency Rapsberry PI Camera Streaming via HTTP and VLC

Here is a short code snippet for relatively low latency video streaming using a Raspberry PI camera via the HTTP protocol, and viewing it in VLC. This post is inspired by a ‘netcat‘ approach found here.

Code for creating an HTTP Video Server:

var spawn = require('child_process').spawn,
child = spawn('/opt/vc/bin/raspivid', ['-t', '0', '-w', '300', '-h', '300', '-hf', '-fps', '20', '-o', '-' ]);

var http = require("http");
var server = http.createServer(function(request, response) {

console.log("Server is listening");

To view the stream in VLC, ensure the h264es demuxer is enabled and open a network video with the URL of your Raspberry PI http server.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.