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, come molti, fornisce solo un flusso RTSP. No modern web browsers support RTSP.
La ricerca e i requisiti
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, idealmente open source
- I wanted something that wouldn’t transcode the video or audio as this would waste processing resources
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 file js
Ho quindi usato il codice della guida (with modified paths to local files) per incorporare il video che ha funzionato immediatamente. ffmpeg is using around 0.2% cpu usage and a few mb of memory on the server that hosts the website.
Un'ultima nota, incase it matters — I used the win64 static build of ffmpeg 4.2.2
Cosa ne pensi? Mandaci un commento qui sotto! Se si desidera iscriversi si prega di utilizzare il link iscriviti sul menu in alto a destra. È inoltre possibile condividere con i tuoi amici usando i link sottostanti sociali. Saluti.