Skip to content

Binary-Vanguard-12138/rtsp-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

rtsp-demo

Sample RTSP demo project with server and client

Reference Link

Running Demo

Server

Prerequisites

Install FFMPEG

You can refer to the following link to install FFMPEG libaray on CentOS7.

Install FFMpeg on CentOS7

Install npm packages

Change into server directory and run npm install ws to install npm dependency packages.

cd server
npm install ws

Run server

First you will need to run HTTP-Websocket relay server.

node websocket-relay.js supersecretpassword 8081 27017

Here you should provide the password for authentication, HTTP listening port and Websocket listening port.

Next you will need to run ffmpeg program to receive RTSP stream from the server and push it to the relay server as HTTP traffic.

ffmpeg -i rtsp:https://<any rtsp stream URL> -f mpegts -codec:v mpeg1video -s 320x240 -b 800k -r 30 https://localhost:8081/supersecretpassword

Here the output format MUST be mpegts, since jsmpeg library which is used on the client side only supports this format. Video size parameter can be given by -s 320x240.

Client

In the client directory, we have 1 html and 1 js file. In the view-stream.html file, you can find the websocket URL and you should replace it with the address of your own relay server.

var canvas = document.getElementById('video-canvas');
// var url = 'ws:https://'+document.location.hostname+':8082/';
var url = 'ws:https://89.40.7.94:27017/';
var player = new JSMpeg.Player(url, {canvas: canvas});

If you open the html file, you can see the shining video streams. 😎

About

Sample RTSP demo project with server and client

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published