The Real-Time Streaming Protocol (RTSP) is a tried-and-true video technology. Its used to control audio/video transmission between two endpoints and facilitate the transportation of low-latency streaming content across the internet. Most of DVRs has this rtsp option and it is very possible to record videos from camera directly in linux computer easily by using the following script.
The
#!/bin/bash
#testing channel
declare -a arr=("1" "3" "5")
#for folderIndex in {1..4}
for folderIndex in "${arr[@]}"
do
docker run --rm -u $(id -u):$(id -g) --name dvr01_chnl$folderIndex -v /disk/dvr01/ch$folderIndex:/data vimagick/ffmpeg -i "rtsp://:554/user=admin&password=&channel=$folderIndex&stream=0.sdp" -vcodec libx264 -crf 20 -acodec copy -map 0 -f segment -strftime 1 -segment_time 300 -segment_format mp4 "/data/%Y-%m-%d_%H-%M-%S.mp4" 2>&1 >/dev/null &
done