ffmpeg -i "rtsp://dev:rezaIpCctv1402@192.168.20.43:554/cam/realmonitor?channel=1&subtype=1" -fflags flush_packets -max_delay 5 -flags -global_header -hls_time 5 -hls_list_size 3 -vcodec copy -tag:v hvc1 -y .\videos\ipcam\01\index.m3u8
ffmpeg -i "rtsp://dev:rezaIpCctv1402@192.168.20.44:554/cam/realmonitor?channel=1&subtype=1" -fflags flush_packets -max_delay 5 -flags -global_header -hls_time 5 -hls_list_size 3 -vcodec copy -tag:v hvc1 -y .\videos\ipcam\02\index.m3u8

ffmpeg -i "rtsp://dev:rezaIpCctv1402@192.168.20.43:554/cam/realmonitor?channel=1&subtype=1" -c:v copy -c:a copy -hls_time 2 -hls_list_size 10 -hls_flags delete_segments -start_number 1 .\videos\ipcam\01\index.m3u8




chmod +x ~/convert_school_cameras_linux.sh
chmod +x ~/convert_school_cameras_windows.sh



#STATE0 : INSTALL FFMPEG
apt install ffmpeg

#STAGE1 : MAKE PERMISSION FOR CONVERT SCHOOL CAMERAS BASH FILES
chmod +x convert_school_cameras_linux.sh


#STAGE2 : CONVERT STREAM VIDEO TO HLS VIDEO STREAMING
convert_school_cameras_linux.sh


#STAGE3 : SERVE STREAM FILES TO PORT 4000
node .\hls-server.js


#STAGE4 : CLEAN CACHE FILES ** IMPORTANT
node .\cleaner.js


#STAGE5 : KILL PROCESS
pid=$(ps -ef | convert_school_cameras_linux | awk '{print $2}')
kill ${pid}




const WebSocket = require("ws").Server;
const HttpsServer = require('https').createServer;
const fs = require("fs");

server = HttpsServer({
    cert: fs.readFileSync(config.ssl_cert_path),
    key: fs.readFileSync(config.ssl_key_path)
})
socket = new WebSocket({
    server: server
});

socket.on(...);
server.listen(config.port);







ffmpeg -fflags nobuffer -loglevel debug -rtsp_transport tcp -i "rtsp://dev:rezaIpCctv1402@192.168.20.43:554/cam/realmonitor?channel=1&subtype=1" -vsync 0 -copyts -vcodec copy -movflags frag_keyframe+empty_moov -an -hls_flags delete_segments+append_list -f hls -hls_time 1 -hls_list_size 3 -hls_segment_type mpegts -hls_segment_filename './stream/%d.ts' ./stream/index.m3u8