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

时间:2017-06-12 23:30:12

标签: nginx rtmp hls

如果你能为我揭开光明,我将不胜感激。

所以,基本上我从我的编码器中拉出一个流并且它工作,我得到m3u8输出并且它是可访问的但是HLS视频是跳跃的并且我丢失帧。戏剧不是连续的。

2017/06/12 16:04:09 [error] 1281#0: *58 hls: force fragment split: 10.002 sec

(从RTSP拉出后编辑......) 2017/06/13 10:48:55 [错误] 1281#0:* 763 hls:强制片段拆分:10.416秒,客户端:XX,服务器:0.0.0.0:1935

这是我的配置文件:

#user  nobody;
worker_processes  1;
events {
    worker_connections  1024;
}

# RTMP configuration

rtmp {
    server {
        listen 1935; # Listen on standard RTMP port
        chunk_size 4000;

        application live {
        live on;

        exec_pull ffmpeg -re -i rtsp://xxx/xxx -c copy -f flv rtmp://xxx:1935/live/xxx;

        exec_pull ffmpeg -re -i rtsp://xxx:8080/xxx -c copy -f flv rtmp://xxx:1935/live/xxx;

        # Turn on HLS
        hls on;
        hls_path /tmp/hls/;
        hls_fragment 3;
        hls_playlist_length 60;

        }
    }
}

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

    server {
        listen 80;
        server_name  localhost;

         # rtmp statistics
        location /stat {
        rtmp_stat all;
        rtmp_stat_stylesheet stat.xsl;
        }

    location /stat.xsl {
        # you can move stat.xsl to a different location
        # under linux you could use /var/user/www for example
        root html;          
    }

    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,Content-Range';
        add_header 'Access-Control-Allow-Headers' 'Range';

        # allow CORS preflight requests
        if ($request_method = 'OPTIONS') {
            add_header 'Access-Control-Allow-Origin' '*';
            add_header 'Access-Control-Allow-Headers' 'Range';
            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 /tmp/;
        }
    }
}

1 个答案:

答案 0 :(得分:0)

**好吧..我有新闻。基本上这种配置是完美的。我丢失所有这些包的原因是因为编码器和专用服务器之间的距离。

建议将服务器置于本地编码器所在的位置......所以,这对我来说很有用。

干杯**