1、下载所需包:

RTSP转RTMP插图

2、配置nginx-win-rtmp.conf

RTSP转RTMP插图1

ngnix-win-rtmp.conf配置详情

#user nobody;
# multiple workers works !
worker_processes 5;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;

events {
worker_connections 8192;
# max value 32768, nginx recycling connections+registry optimization = 
# this.value * 20 = max concurrent connections currently tested with one worker
# C1000K should be possible depending there is enough ram/cpu power
# multi_accept on;
}

rtmp {
server {
listen 1935;
chunk_size 1024;
application live {
live on;
}
application hls{
live on;
hls on;
hls_path temp/hls;
hls_fragment 8s;
}
}
}

http {
#include /nginx/conf/naxsi_core.rules;
include mime.types;

server {
listen 8080;
server_name localhost;

location / {
root html;
index index.html;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html{
root html;
}
}
}
3.启动linux
.\nginx.exe -c .\conf\nginx-win-rtmp.conf
将ffmpeg添加到系统环境变量中

RTSP转RTMP插图2

4.启动ffmpeg rstp转rtmp
ffmpeg -re -rtsp_transport tcp -i "rtsp://admin:12345@192.168.0.111:554/h264/ch1/main/av_stream" -f flv -vcodec libx264 -vprofile baseline -acodec aac -ar 44100 -strict -2 -ac 1 -f flv -s 1280x720 -q 10 "rtmp://192.168.0.125:1935/live/"
RTSP转RTMP插图3
5.下载VLC,播放串流地址rtmp://192.168.0.125:1935/live/

RTSP转RTMP插图4

ffmpeg -re -rtsp_transport tcp -i "rtsp://admin:12345@192.168.0.111:554/h264/ch1/main/av_stream" -f flv -vcodec libx264 -vprofile baseline -acodec aac -ar 44100 -strict -2 -ac 1 -f flv -s 1280x720 -q 10 "rtmp://venton.cn/push?auth_key=1607496736-0-0-5eb96eee7be306ca60b25006c791a819"