I have recently been working on my smarthome setup and one of the things I’ve been meaning to get set up is a tablet with a touch-screen web interface to manage my smart home. One of the first problems I had to crack was how to stream my cctv feed to a web browser…
সমস্যাটি
My CCTV camera, অনেকের মত, কেবল একটি আরটিএসপি স্ট্রিম সরবরাহ করে. No modern web browsers support RTSP.
অনুসন্ধান এবং প্রয়োজনীয়তা
Google just isn’t what it used to be and it took several days of searching to find an acceptable solution that met all of my requirements…
- I wanted something that would work entirely offline without any third party servers involved.
- I wanted something that was completely legally free, আদর্শ ওপেন সোর্স
- I wanted something that wouldn’t transcode the video or audio as this would waste processing resources
সমাধান
আমি খুঁজে পাওয়া যায় একটি really useful guide which explained a way to do this with a bit of JavaScript and ffmpeg, both of which were readily available for free.
To run ffmpeg I used the following command, which I ran on windows as a service, created with nssm…ffmpeg -i rtsp://your_rtsp_ip:port/path/to/file.stream -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 downloaded the following css file and 2 জেএস ফাইল
- HTTPS://vjs.zencdn.net/7.2.3/video-js.css
- HTTPS://cdnjs.cloudflare.com/ajax/libs/videojs-contrib-hls/5.14.1/videojs-contrib-hls.js
- HTTPS://vjs.zencdn.net/7.2.3/video.js
আমি তখন গাইড থেকে কোডটি ব্যবহার করেছি (with modified paths to local files) সরাসরি কাজ করে এমন ভিডিও এম্বেড করতে. ffmpeg is using around 0.2% cpu usage and a few mb of memory on the server that hosts the website.
একটি চূড়ান্ত নোট, incase it matters — I used the win64 static build of ffmpeg 4.2.2
FYI, ক্রৌমিয়াম (শুধুমাত্র ক্রোম আজ পর্যন্ত) can directly read .m3u8 files and play the video just like it would an mp4 etc.
পরিষ্কার উচ্চ নেই,
im trying to do the same, but I cant seem to get it to work properly
I followed your instructions, and the linked one, but i still seem to get 20–30 seconds of delay between the live feed and the published feed
any ideas what could be causing it?