11 lines
487 B
Bash
Executable File
11 lines
487 B
Bash
Executable File
#!/bin/bash
|
|
|
|
RTSP_URL="rtsp://admin:123456@192.168.0.123:554/mpeg4" # RTSP流的URL
|
|
OUTPUT_DIR="/home/pi/mp4" # 录像文件保存的目录
|
|
RECORD_DURATION=900 # 录像时长(秒)
|
|
# 获取当前时间
|
|
CURRENT_TIME=$(date +"%Y-%m-%d_%H-%M-%S")
|
|
# 构建录像文件名
|
|
OUTPUT_FILE="${OUTPUT_DIR}/${CURRENT_TIME}.mp4"
|
|
# 开始录制RTSP流
|
|
/usr/bin/ffmpeg -rtsp_transport tcp -i "${RTSP_URL}" -c copy -c:a aac -s 1280x720 -r 15 -crf 35 -t "${RECORD_DURATION}" -f mp4 "${OUTPUT_FILE}" |