基於Nginx+nginx-rtmp-module+ffmpeg搭建rtmp、hls流媒體服務器(二)

前言

Nginx-rtmp-module插件針對RTMP協議中一些命令,實現了事件通知和exec外部腳本處理。這裏我經過一個簡單的SpringBoot項目和Python代碼,快速搭建一個HTTP服務來接收RTMP的回調和FFmpeg的動態推流html

配置Nginx.conf

nginx.confpython

#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 $
相關文章
相關標籤/搜索