Files
rtsp-video-analysis-system/bin/start-rtsp-server.sh

24 lines
712 B
Bash
Raw Normal View History

#!/bin/bash
echo "启动RTSP测试服务器..."
echo
# 检查FFmpeg是否安装
if ! command -v ffmpeg &> /dev/null; then
echo "错误: FFmpeg未安装请先安装FFmpeg"
echo "Ubuntu/Debian: sudo apt install ffmpeg"
echo "CentOS/RHEL: sudo yum install ffmpeg"
exit 1
fi
# 视频文件路径
VIDEO_FILE="test.mp4"
# 如果没有测试视频,创建一个测试模式
if [ ! -f "$VIDEO_FILE" ]; then
echo "创建测试视频流..."
ffmpeg -f lavfi -i testsrc=duration=3600:size=640x480:rate=25 -c:v libx264 -preset ultrafast -f rtsp rtsp://localhost:8554/11
else
echo "使用视频文件: $VIDEO_FILE"
ffmpeg -re -i "$VIDEO_FILE" -c copy -f rtsp rtsp://localhost:8554/11
fi