首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >未生成Nignx rtmp模块m3u8文件

未生成Nignx rtmp模块m3u8文件
EN

Stack Overflow用户
提问于 2020-08-14 21:45:43
回答 1查看 465关注 0票数 0

我正在尝试创建一个带有nginx rtmp模块的本地流媒体服务器。服务器本身似乎工作得很好,因为我可以与OBS服务器流。服务器将.ts视频文件存储在"/usr/local/nginx/sbin/hls“目录下,但没有创建与之关联的m3u8文件。

配置文件如下;

代码语言:javascript
复制
#user  nobody;
worker_processes  auto;

#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;  #listen port

        chunk_size 4096;


        application live {  #rtmp push stream request path 
            live on;
            hls on;
            hls_path /usr/local/nginx/sbin/hls/;
            hls_fragment 3s;
            hls_playlist_length 18s;
        deny play all;
        }
    }
}


http {
    sendfile off;
    tcp_nopush on;
    # aio on;
    directio 512;
    default_type application/octet-stream;

    server {
        listen 8080;

        location / {
            # Disable cache
            add_header 'Cache-Control' 'no-cache';

            # CORS setup
            add_header 'Access-Control-Allow-Origin' '*' always;
            add_header 'Access-Control-Expose-Headers' 'Content-Length';

            # allow CORS preflight requests
            if ($request_method = 'OPTIONS') {
                add_header 'Access-Control-Allow-Origin' '*';
                add_header 'Access-Control-Max-Age' 1728000;
                add_header 'Content-Type' 'text/plain charset=UTF-8';
                add_header 'Content-Length' 0;
                return 204;
            }

            types {
                application/dash+xml mpd;
                application/vnd.apple.mpegurl m3u8;
                video/mp2t ts;
            }

            root /usr/local/nginx/sbin/;
        }
    }
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-08-14 22:25:34

解决方案是通过设置流密钥来解决。生成的视频文件被命名为-n.ts (n是视频编号)。设置流密钥后,文件名变为"streamkey-n.ts“

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63414011

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档