基于Nginx+nginx-rtmp-module+ffmpeg搭建rtmp、hls流媒体服务器(二)

前言

Nginx-rtmp-module插件针对RTMP协议中一些命令,实现了事件通知和exec外部脚本处理。这里我通过一个简单的SpringBoot项目和Python代码,快速搭建一个HTTP服务来接收RTMP的回调和FFmpeg的动态推流

配置Nginx.conf

nginx.conf

#user  nobody;
worker_processes  1;
 
#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
 
#pid        logs/nginx.pid;
 
 
events {
    worker_connections  1024;
}
 
 
rtmp {
    server {
        listen 1935;
        chunk_size 4096;
        on_connect http://192.168.3.56:7070/v1/rtmp/on_connect;
        application vod {
            play /usr/local/nginx/html/hls;
        }
        application live {
            live on;
            exec_play /home/hylink/anaconda3/bin/python "/usr/local/nginx/controller.py" -device_id $name -operate_type play 2>>/usr/local/nginx/logs/$name.txt;
            exec_play_done /home/hylink/anaconda3/bin/python "/usr/local/nginx/controller.py" -device_id $

posted on 2019-04-25 11:08  疯狂的小萝卜头  阅读(338)  评论(0编辑  收藏  举报