DIY मीडिया होम लोगो

अपनी खुद की होम थिएटर और हाय-Fi सेटअप डिजाइन और बनाने के लिए परम साइट.

2एक वेबपेज में एक लाइव RTSP स्ट्रीम एम्बेड करें

I have recently been work­ing on my smarthome setup and one of the things I’ve been mean­ing to get set up is a tab­let with a touch-screen web inter­face to man­age my smart home. One of the first prob­lems I had to crack was how to stream my cctv feed to a web browser…


My CCTV cam­era, अन्य के जैसे, केवल RTSP स्ट्रीम प्रदान करता है. No mod­ern web browsers sup­port RTSP.

खोज और आवश्यकताओं

Google just isn’t what it used to be and it took sev­er­al days of search­ing to find an accept­able solu­tion that met all of my requirements…

  • I wanted some­thing that would work entirely off­line without any third party serv­ers involved.
  • I wanted some­thing that was com­pletely leg­ally free, आदर्श रूप से खुला स्रोत
  • I wanted some­thing that would­n’t transcode the video or audio as this would waste pro­cessing resources


मुझे एक मिला really use­ful guide which explained a way to do this with a bit of JavaS­cript and ffm­peg, both of which were read­ily avail­able for free.

To run ffm­peg I used the fol­low­ing com­mand, which I ran on win­dows as a ser­vice, cre­ated with nssm…
ffmpeg -i rtsp://your_rtsp_ip:port/path/to/ -c:v copy -c:a copy -bufsize 1835k -pix_fmt yuv420p -flags -global_header -hls_time 10 -hls_list_size 6 -hls_wrap 10 -start_number 1 /var/www/html/video.m3u8

To embed the video I down­loaded the fol­low­ing css file and 2 जेएस फाइलें

  • hTTPS://
  • hTTPS://
  • hTTPS://

मैंने तब गाइड से कोड का उपयोग किया था (with mod­i­fied paths to loc­al files) वीडियो को एम्बेड करने के लिए जो सीधे काम करता है. ffm­peg is using around 0.2% cpu usage and a few mb of memory on the serv­er that hosts the website.

एक अंतिम नोट, incase it mat­ters — I used the win64 stat­ic build of ffm­peg 4.2.2

अपना खुद का कुछ विचारों को समझे? खुद टिप्पणी से नीचे लिप्त! आप सदस्यता के लिए चाहते हैं, तो ऊपर दाईं ओर मेनू पर लिंक का उपयोग करें सदस्यता लें. आप नीचे दिए गए सामाजिक लिंक का उपयोग करके अपने दोस्तों के साथ इस साझा कर सकते हैं. चियर्स.

Leave a Reply

2 टिप्पणियाँ


हाय वहाँ,
im try­ing to do the same, but I cant seem to get it to work properly
I fol­lowed your instruc­tions, and the linked one, but i still seem to get 20–30 seconds of delay between the live feed and the pub­lished feed
any ideas what could be caus­ing it?

जवाब दें