- 安装SYS
Step 1:get SRS
git clone https://github.com/ossrs/srs
cd srs/trunk
Step 2:build SRS, Requires Centos6.x/Ubuntu12 32/64bits, others see Build(CN,EN).
./configure && make
Step 3: start SRS
./objs/srs -c conf/srs.conf
- 推流
ffmpeg -f v4l2 -framerate 25 -video_size 1280x720 -i /dev/video1 -f flv -y rtmp://192.168.7.138:1935/live/123
或者
- 安装nginx,启动nginx,速度更快
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
- 推流
ffmpeg -re -framerate 25 -video_size 1280x720 -i /dev/video1 -c copy -f flv rtmp://192.168.7.138:1937/live/123
用opencv收流
# 1937是服务器的端口号,我的srs是1935,nginx是1937,后面的目录根据推流时的目录来,任意
cap = cv2.VideoCapture("rtmp://192.168.7.138:1937/live/123")