Re-stream RTSP from IP cam with Node Media Server to http/ws and display it with html



My goal is to display my IP cam’s RTSP-output stream on a standard HTML-page (html5 + css3 + vanilla javascript, no magic = no plugins). The HTML-page should be hosted in a NGINX web server on my Raspberry Pi.

My equipment

The setup I am using is a Raspberry Pi 3 B+ with Rasbian OS, Node.js and Node-Media-Server package, NGINX (but I do not believe that NGINX is important for my problem? I have not made any config for the Node-Media-Server in it anyway.) An IP-camera, and a browser.
enter image description here

What I have tried

The readme in the Node-Media-Server-project is detailed and there is a tutorial describing almost exactly what I want to do. Specifically, there is a markup example on how the live stream could be accessed:



    <script src=""></script>
    <video id="videoElement"></video>
        if (flvjs.isSupported()) {
            var videoElement = document.getElementById('videoElement');
            var flvPlayer = flvjs.createPlayer({
                type: 'flv',
                url: 'http://localhost:8000/live/uterum.flv'


This is how I start the media server on my Raspberry PI, kommandoran-mediaserver.js:

const { NodeMediaServer } = require('node-media-server');

const config = {
    logType: 3, // 3 - Log everything (debug)
    rtmp: {
        port: 1935,
        chunk_size: 60000,
        gop_cache: true,
        ping: 60,
        ping_timeout: 30
    http: {
        port: 8000,
        allow_origin: '*'
    relay: {
        ffmpeg: '/usr/local/bin/ffmpeg',
        tasks: [
                app: 'cctv',
                mode: 'static',
                edge: 'rtsp://<USER>:<PASSWORD>@',
                name: 'uterum',
                rtsp_transport : 'tcp' //['udp', 'tcp', 'udp_multicast', 'http']

var nms = new NodeMediaServer(config);

My problem and question

When I try to view camera.html (see markup above) via the Chromium browser on Raspberry Pi (i.e. local host), nothing is displayed. In the Chromium debug inspector there are no javascript errors, but I get this:
GET http://localhost:8000/live/uterum.flv net::ERR_EMPTY_RESPONSE

Here is a screenshot from the node terminal:
enter image description here
The red area illustrates the output when I try to make a request to http://localhost:8000/live/uterum.flv.

I suppose I try to reach the wrong endpoint but which is correct? The documentation states http://localhost:8000/live/STREAM_NAME.flv. What is “STREAM_NAME” in my case?


As you can see from the configuration, your RTSP stream is pushed to the ‘cctv’ application.

So your playback address should be:




Answered By – ALiang

Answer Checked By – Gilberto Lyons (AngularFixing Admin)

Leave a Reply

Your email address will not be published.