logo

한국어

[ffmpeg]RTSC 프로토콜 캡쳐

관리자 2018.12.12 17:04 조회 수 : 8

#!/bin/bash
############################################################
#
# SANNCE I41CB 스트리밍 레코딩 스크립트
#
# crontab -e
# */10 * * * * /root/rtsp_capture.sh
#
############################################################
SAVE_DIR="/usbmem/cctv"
OLDDATA_EXPMIN=+1440
SEGMENT_SEC=300
RTSP_ADDR="rtsp://192.168.0.7:10554/tcp/av0_0"

mkdir -p ${SAVE_DIR} > /dev/null
find ${SAVE_DIR} -mmin ${OLDDATA_EXPMIN} -name "*.mp4" -type f -exec rm -f {} \;

if ! pgrep -x "ffmpeg" > /dev/null
then
  rm -f nohup.out
  nohup ffmpeg  -rtsp_transport tcp -i ${RTSP_ADDR} -f segment -segment_time ${SEGMENT_SEC} -segment_format mp4  -reset_timestamps 1 -strftime 1 -c copy -map 0 ${SAVE_DIR}/sannce_i41cb_%Y%m%d-%H%M%S.mp4 &
fi