Registry / messaging / node-ffmpeg-stream

node-ffmpeg-stream

JSON →
library1.1.0jsnpmunverified

Node-ffmpeg-stream is a Node.js library for converting RTSP streams to WebSocket streams, enabling multi-view surveillance camera display in web browsers. It wraps FFmpeg to transcode RTSP feeds into MPEG-TS chunks served via WebSocket, and includes built-in HTTP endpoints for stream management (list, add, remove). Version 1.1.0 is the current stable release; the project appears to have irregular updates and limited community adoption. It differentiates from alternatives like node-rtsp-stream by offering a more integrated API with Express.js support and screenshot capabilities.

npm install node-ffmpeg-stream
INSTALL
IMPORT
SIG · NODE-FFMPEG-STREAM
N
node-ffmpeg-stream
messagingjavascriptv1.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import RTSP2Web from 'node-ffmpeg-stream';
const rtsp2web = require('node-ffmpeg-stream');
This package is ESM-only. CommonJS require will fail.
Stream
import { Stream } from 'node-ffmpeg-stream';
const { Stream } = require('node-ffmpeg-stream');
Named exports similarly require ESM imports.
createServer
import { createServer } from 'node-ffmpeg-stream';
const { createServer } = require('node-ffmpeg-stream');
ESM-only; CommonJS won't work.

Shows how to set up an Express server that serves RTSP streams via WebSocket, adding a camera stream and starting the service.

import RTSP2Web from 'node-ffmpeg-stream'; import express from 'express'; const app = express(); const rtsp2web = new RTSP2Web(); app.get('/stream/:id', (req, res) => { const stream = rtsp2web.getStream(req.params.id); if (stream) { res.writeHead(200, { 'Content-Type': 'video/mp2t' }); stream.pipe(res); } else { res.status(404).send('Stream not found'); } }); rtsp2web.addStream('camera1', 'rtsp://admin:password@192.168.1.100:554/stream1'); rtsp2web.start(); app.listen(3000, () => console.log('Server running on port 3000'));
Debug
Known issues
gotchaFFmpeg must be installed and accessible in PATH or specified via options.
fix
Install FFmpeg via package manager or download from ffmpeg.org, and ensure ffmpeg command works in terminal.
affects: >=1.0.0
gotchaOnly MPEG-TS format is supported for WebSocket output; other formats may not work.
fix
Ensure client expects video/mp2t MIME type.
affects: >=1.0.0
gotchaRTSP authentication credentials are passed in plain text in the URL.
fix
Avoid hardcoding credentials; use environment variables. Consider RTSP over TLS if supported.
affects: >=1.0.0
breakingAPI changed between 0.x and 1.0: addStream signature changed.
fix
Update addStream(id, rtspUrl) call to the new signature (no options object as third argument).
affects: >=1.0.0
Errors
Common errors & fixes
Error: FFmpeg not found. Please install FFmpeg and ensure it's in your PATH.
FFmpeg binary is missing or not in system PATH.
fix
Install FFmpeg, e.g., on Ubuntu: sudo apt install ffmpeg. On Windows, download and add to PATH.
TypeError: rtsp2web.getStream is not a function
Using CommonJS require with an ESM-only module.
fix
Change require to import: import RTSP2Web from 'node-ffmpeg-stream';
Error: connect ECONNREFUSED 192.168.1.100:554
RTSP server is not reachable or camera is offline.
fix
Check network connectivity and camera status; verify IP and port.
Upgrade
Version history
1.1.0latest on npm
Audit
Dependencies
ffmpegrequiredFFmpeg binary required for transcoding; not an npm dependency but a system-level tool.
Agent activity
12 hits · last 30 days
node
8
OpenAI (training)
1
Resources
node-ffmpeg-stream — npm install node-ffmpeg-stream · libregistry