Giter Site home page Giter Site logo

fawadahmedraza / ip-camera-browser-client Goto Github PK

View Code? Open in Web Editor NEW

This project forked from foyzulkarim/ip-camera-browser-client

0.0 0.0 0.0 229 KB

Normally, IP Camera streams video as RTSP protocol. But browser is unable to render this format, so we need to convert it as HLS format so that modern browser's video tags can display it.

Home Page: https://dev.to/foyzulkarim/how-to-stream-your-ip-camera-into-browser-using-ffmpeg-node-and-react-162k

JavaScript 54.75% CSS 15.87% HTML 29.37%

ip-camera-browser-client's Introduction

How to stream your IP Camera into browser

YouTube explanation and demo

YouTube explanation

Steps

Stream IP Camera to VLC player

  • For the case of TP-Link C200 model the URL I used = rtsp://{username}:{password}@{ip}:554/stream1
  • Input the URL in Network Stream

image

Convert stream to HLS

Execute FFMPEG command

.\server\libs\ffmpeg.exe -i rtsp://{username}:{password}@{ip}:554/stream1 -fflags flush_packets -max_delay 5 -flags -global_header -hls_time 5 -hls_list_size 3 -vcodec copy -y .\videos\ipcam\index.m3u8

After successful execution, we should see the converted video files (index.m3u8 *.ts)

image

Install the packages

  • Open new terminal tab
  • Go inside server folder
  • Run npm install

Cleanup streamed .ts files

  • Open new terminal tab
  • Go inside server folder
  • Run .\node_modules\.bin\nodemon .\cleaner.js
  • This will delete the streamed/served .ts files from local directory to save the space

Serve the auto generated hls (m3u8) file

  • Open new terminal tab
  • Go inside server folder
  • Run .\node_modules\.bin\nodemon .\hls-server.js

Test hls file in browser

Run react client

  • Open new terminal tab
  • Go inside client\hls-client folder
  • Run npm install
  • Run npm start

image

Notes

It is possible to automate all of the commands under simplified npm start command in server project. However, for better understanding of how things work and better clarity, I break down the steps and showed how easy it is to actually stream your IP Camera to your browser.

If you have real IP from your ISP, you can point your Domain to your IP and see the camera feed from anywhere in the world through the browser.

Next

  • Webcam streaming from browser camera to remote user

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.