Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/nginx/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Nginx RTMP模块未保存实时流媒体文件_Nginx_Amazon Ec2_Rtmp_Live Streaming - Fatal编程技术网

Nginx RTMP模块未保存实时流媒体文件

Nginx RTMP模块未保存实时流媒体文件,nginx,amazon-ec2,rtmp,live-streaming,Nginx,Amazon Ec2,Rtmp,Live Streaming,我在服务器的流媒体直播中没有遇到任何问题,但我正在尝试添加VOD功能,但有些困难。服务器没有创建或写入记录路径“/mnt/film/”,即使我在运行服务器之前创建了目录 我已尝试添加具有root权限的用户,但这似乎没有帮助。奇怪的是,虽然没有创建错误日志,但它写入“/mnt/hls”路径却没有任何问题 user nginx root; worker_processes auto; error_log logs/error.log debug; events { worker_conne

我在服务器的流媒体直播中没有遇到任何问题,但我正在尝试添加VOD功能,但有些困难。服务器没有创建或写入记录路径“/mnt/film/”,即使我在运行服务器之前创建了目录

我已尝试添加具有root权限的用户,但这似乎没有帮助。奇怪的是,虽然没有创建错误日志,但它写入“/mnt/hls”路径却没有任何问题

user nginx root;
worker_processes  auto;
error_log logs/error.log debug;
events {
    worker_connections  1024;
}

# RTMP configuration
rtmp {
    server {
        listen 1935;
        chunk_size 4096;

        application live {
            live on;
            # Turn on HLS
            hls on;
            hls_path /mnt/hls/;
            hls_fragment 3;
            hls_playlist_length 60;
            # record stream to folder /film/
            record all;
            record_path /mnt/film/;
            # disable consuming the stream from nginx as rtmp
            deny play all;
        }
    }
}

http {
    sendfile off;
    tcp_nopush on;
    default_type application/octet-stream;

    server {
        listen 8080;

        location /hls {
            # 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/vnd.apple.mpegurl m3u8;
                video/mp2t ts;
            }

            root /mnt/;
        }
    }

    server {
        listen 8384;

        # vod caches
        vod_metadata_cache metadata_cache 256m;
        vod_response_cache response_cache 128m;

        # vod settings
        vod_mode local;
        vod_segment_duration 2000; # 2s
        vod_align_segments_to_key_frames on;

        #file handle caching / aio
        open_file_cache max=1000 inactive=5m;
        open_file_cache_valid 2m;
        open_file_cache_min_uses 1;
        open_file_cache_errors on;
        aio on;

        location /vod/ {
            alias mnt/film/;
            vod hls;
            add_header 'Access-Control-Allow-Headers' '*';
            add_header 'Access-Control-Expose-Headers' 'Server,range,Content-Length,Content-Range';
            add_header 'Access-Control-Allow-Methods' 'GET, HEAD, OPTIONS';
            add_header 'Access-Control-Allow-Origin' '*';
            expires 100d;
        }
    }
}
我只是想让一些文件显示在上面nginx.conf中定义的“record_path”目录中


谢谢

您是否检查了
hls\U清理
指令?默认情况下,该功能处于启用状态。在此模式下,nginx缓存管理器进程从HLS目录中删除旧的HLS片段和播放列表


您是否检查了
hls\U清理
指令?默认情况下,该功能处于启用状态。在此模式下,nginx缓存管理器进程从HLS目录中删除旧的HLS片段和播放列表


谢谢您的回复。我通过在nginx必须访问的每个文件夹上使用
chmod 777
临时解决了这个问题。我知道这是一种不好的做法,但当我在创建一个用户并将其添加到组中时,我很难让它授予权限。我相信这是由于缺乏经验。但是,vod模块似乎不适用于我当前的nginx.conf设置,因此我必须对此进行研究。感谢您的回复。我通过在nginx必须访问的每个文件夹上使用
chmod 777
临时解决了这个问题。我知道这是一种不好的做法,但当我在创建一个用户并将其添加到组中时,我很难让它授予权限。我相信这是由于缺乏经验。但是,vod模块似乎不适用于我当前的nginx.conf设置,因此我必须对此进行研究。