[главная] | [каталоги]

создан: 2021-08-20 11:43:46
пользователь: asunvk раздел: linux
[просмотров|54]
Linux Debian shell/bash record camers ffmpeg
1. file cam.sh

#!/bin/bash
##############################################

screen -wipe

sleep 1

screen -X -S cam_record quit

sleep 1
screen -X -S cam_record stuff "^C"

cd /home/server_sh
screen -A -m -d -S cam_record ./cam_record.sh
echo "создан screen cam_record, start"
echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"


2. file cam_record.sh

[i]#!/bin/bash
##############################################

echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
echo "REMOVE RECORD CAM"
find /home/camera/cam1/cam1_* -mtime +30 -exec rm {} \;
find /home/camera/cam2/cam2_* -mtime +30 -exec rm {} \;

CTIME=`date +%Y%m%d-%H_%M_%S`

TYPE="mkv"
TIME="3540"
TIME2="3000"
#ultrafast superfast veryfast faster fast medium slow veryslow
PRESET="veryslow"
#direcroty your shell scripts
DIR_SH="/home/server_sh"
#ip check
IP='192.168.88.1'

# 1 CAMERA
NAME_S1="cam1"
DIR1="/home/camera/cam1"
NAME_F1="$DIR1/cam1_$CTIME.$TYPE"
NAME_F1_IMG="$DIR1/_image/cam1_$CTIME.jpg"
CAM_IP1="rtsp://192.168.88.82:554/12"

# 2 CAMERA
NAME_S2="cam2"
DIR2="/home/camera/cam2"
NAME_F2="$DIR2/cam2_$CTIME.$TYPE"
NAME_F2_IMG="$DIR2/_image/cam2_$CTIME.jpg"
CAM_IP2="rtsp://192.168.88.83:554/12"

var0=0
var1=0
var2=0
var3=0

echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
echo "SCREEN CAM QUIT"

screen -X -S $NAME_S1 quit
screen -X -S $NAME_S1 stuff "^C"

screen -X -S $NAME_S2 quit
screen -X -S $NAME_S2 stuff "^C"

sleep 1

while true; do

# проверяет ип адрес, если доступен, то идёт запись
while true; do

ping -c1 $IP > /dev/null 2>&1 && break;

var0=$((var0 + 1))
echo "Host not found $var0"

if [ "$var0" -ge 1800 ]
then

echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
echo ...
загрузить
ещё

fizord.ru © 2021
site by cl0oud