rtmp配制

Posted 海-哥

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了rtmp配制相关的知识,希望对你有一定的参考价值。

user  robot robot;
worker_processes  1;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    access_log  off;

    index  index.php index.html index.htm;
    server {
        listen       80;
        server_name  local.hflxhn.com;
        root   /var/www/hflxhn/api_hflxhn/public;

        location / {
            if (!-e $request_filename) {
                rewrite ^(.*)$ /index.php/index/$1 last;
            }
        }

        location /backmanage {
            if (!-e $request_filename) {
                rewrite ^(.*)$ /index.php/$1 last;
            }
        }

        location ~ \\.php(.*)$ {
            fastcgi_index  index.php;
            #fastcgi_pass   127.0.0.1:9000;
            fastcgi_pass   unix:/opt/lnmp/php7.4/var/run/www.sock;
            fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_param  PATH_INFO $1;
            include        fastcgi_params;
        }

        location /uploads {
            alias   /var/www/hflxhn/api_hflxhn/runtime/storage/;
        }
    }

    server {
        listen       8088;
        server_name  video.com;
        add_header Cache-Control no-cache;
        add_header Access-Control-Allow-Origin *;
        add_header Access-Control-Allow-Headers X-Requested-With;
        add_header Access-Control-Allow-Methods GET,POST,OPTIONS;

        location / {
            root   /var/www/video;
            index  index.html;
        }

        location /flv {
            alias   /var/www/flv/demo;
        }

        location /live {
            flv_live on;
        }
    }
}

rtmp_auto_push on;
rtmp_auto_push_reconnect 1s;
rtmp_socket_dir /tmp;
rtmp {
    out_queue 4096;
    out_cork 8;
    max_streams 128;
    drop_idle_publisher 30s;

    server {
        listen 1935;

        application hls {
            live on;
            hls on;
            gop_cache off;
            gop_max_frame_count 256;
            gop_max_video_count 128;
            gop_max_audio_count 128;
            # wait_key on;
            hls_path /var/www/video/hls;
            hls_fragment 2s;
            hls_playlist_length 10s;
        }
    }
}

以上是关于rtmp配制的主要内容,如果未能解决你的问题,请参考以下文章

redis存储session配制方法

HLS NGINX-RTMP [错误] 1281#0:* 58 hls:强制片段拆分:10.002 秒

Android基于RTMP视频流的人脸识别(下篇)

mysql.cnf 配制文件详解

webstorm中sftp远程调试配制

检查 RTMP 和非 RTMP url 的代码?