Git Product home page Git Product logo

winshining / nginx-http-flv-module Goto Github PK

View Code? Open in Web Editor NEW
2.7K 108.0 567.0 3.79 MB

A media streaming server based on nginx-rtmp-module. In addtion to the features nginx-rtmp-module provides, HTTP-FLV, GOP cache, VHosts (one IP for multi domain names) and JSON style statistics are supported now.

License: BSD 2-Clause "Simplified" License

C 98.15% XSLT 1.57% Shell 0.02% HTML 0.26%
rtmp http-flv gop-cache media-server nginx-rtmp virtual-hosts nginx-http-flv chunked-transmission live-streaming h264

nginx-http-flv-module's Introduction

nginx-http-flv-module

nginx-http-flv-module workflow

A media streaming server based on nginx-rtmp-module.

中文说明.

Donate if you like this module. Many thanks to you!

PayPal

Credits

Features

Features nginx-http-flv-module nginx-rtmp-module Remarks
HTTP-FLV (for play) x HTTPS-FLV and chunked response supported
GOP cache x
Virtual Host x
Omit listen directive See remarks There MUST be at least one listen directive
Audio-only support for RTMP/HTTP-FLV See remarks Won't work if wait_video or wait_key is on
Single-track support for HLS x
reuseport support x
Timer for access log x
JSON style statistics x
Statistics for recordings x
Independent of endianness See remarks Partially supported in branch big-endian

Compatibility

The NGINX version SHOULD be equal to or greater than 1.2.6, the compatibility with other versions is unknown.

Systems supported

  • Linux (recommended) / FreeBSD / MacOS / Windows (limited).

Players supported

Note

Prerequisites

  • GNU make for activating compiler on Unix-like systems to compile software.

  • GCC for compilation on Unix-like systems or MSVC for compilation on Windows.

  • GDB for debug on Unix-like systems.

  • FFmpeg or OBS for publishing media streams.

  • VLC (recommended) or flv.js (recommended) for playing media streams.

  • PCRE for NGINX if regular expressions needed.

  • OpenSSL for NGINX if encrypted access needed.

  • zlib for NGINX if compression needed.

Build

Note

nginx-http-flv-module has all features that nginx-rtmp-module provides, so DON'T compile nginx-http-flv-module along with nginx-rtmp-module.

On Windows

For details about build steps, please refer to Building nginx on the Win32 platform with Visual C, and don't forget to add --add-module=/path/to/nginx-http-flv-module in Run configure script step.

Note

If some compilers which do not support x64 perfectly, VS2010 for example, are used to compile the module, please make sure that the default settings are used (target machine type x86).

On Unix-like systems

Download NGINX and nginx-http-flv-module.

Uncompress them.

cd to NGINX source directory & run this:

Compile the module into NGINX

./configure --add-module=/path/to/nginx-http-flv-module
make
make install

or

Compile the module as a dynamic module

./configure --add-dynamic-module=/path/to/nginx-http-flv-module
make
make install

Note

If the module is compiled as a dynamic module, the NGINX version MUST be equal to or greater than 1.9.11.

Usage

For details of usages of nginx-rtmp-module, please refer to README.md.

Publish

For simplicity, transcoding is not used (so -c copy is used):

ffmpeg -re -i MEDIA_FILE_NAME -c copy -f flv rtmp://example.com[:port]/appname/streamname

Note

Some legacy versions of FFmpeg don't support the option -c copy, the options -vcodec copy -acodec copy can be used instead.

The appname is used to match an application block in rtmp block (see below for details).

The streamname can be specified at will but can NOT be omitted.

The default port for RTMP is 1935, if some other ports were used, :port must be specified.

Play

via HTTP-FLV

http://example.com[:port]/dir?[port=xxx&]app=appname&stream=streamname

Note

  • If ffplay is used in command line to play the stream, the url above MUST be enclosed by quotation marks, or arguments in url will be discarded (some shells not so smart will interpret "&" as "run in background").

  • If flv.js is used to play the stream, make sure that the published stream is encoded properly, for flv.js supports ONLY H.264 encoded video and AAC/MP3 encoded audio.

The dir is used to match location blocks in http block (see below for details).

The default port for HTTP is 80, if some other ports were used, :port must be specified.

The default port for RTMP is 1935, if some other ports were used, port=xxx must be specified.

The value of app (appname) is used to match an application block, but if the requested app appears in several server blocks and those blocks have the same address and port configuration, host name matches server_name directive will be additionally used to identify the requested application block, otherwise the first one is matched.

The value of stream (streamname) is used to match the name of published stream.

Example

Assume that listen directive specified in http block is:

http {
    ...
    server {
        listen 8080; #not default port 80
        ...

        location /live {
            flv_live on;
        }
    }
}

And listen directive specified in rtmp block is:

rtmp {
    ...
    server {
        listen 1985; #not default port 1935
        ...

        application myapp {
            live on;
        }
    }
}

And the name of published stream is mystream, then the url of playback based on HTTP is:

http://example.com:8080/live?port=1985&app=myapp&stream=mystream

Note

Since some players don't support HTTP chunked transmission, it's better to specify chunked_transfer_encoding off; in location where flv_live on; is specified in this case, or play will fail.

via RTMP

rtmp://example.com[:port]/appname/streamname

via HLS

http://example.com[:port]/dir/streamname.m3u8

via DASH

http://example.com[:port]/dir/streamname.mpd

Sample Pictures

RTMP (JW Player) & HTTP-FLV (VLC)

RTMP & HTTP-FLV

HTTP-FLV (flv.js)

HTTP-FLV

Example nginx.conf

Note

The directives rtmp_auto_push, rtmp_auto_push_reconnect and rtmp_socket_dir will not function on Windows except on Windows 10 17063 and later versions, because relay in multiple processes mode needs help of Unix domain socket, please refer to Unix domain socket on Windows 10 for details.

It's better to specify the directive worker_processes as 1, because ngx_rtmp_stat_module may not get statistics from a specified worker process in multi-processes mode, for HTTP requests are randomly distributed to worker processes. ngx_rtmp_control_module has the same problem. The problem can be optimized by this patch per-worker-listener.

In addtion, vhost feature is OK in single process mode but not perfect in multi-processes mode yet, waiting to be fixed. For example, the following configuration is OK in multi-processes mode:

rtmp {
    ...
    server {
        listen 1935;
        server_name domain_name;

        application myapp {
            ...
        }
    }
}

While the following configuration doesn't work properly for play requests distinated to the second server (whether port is 1935 or not) of non-publisher worker processes:

rtmp {
    ...
    server {
        listen 1935;
        server_name 1st_domain_name;

        application myapp {
            ...
        }
    }

    server {
        listen 1945;
        server_name 2nd_domain_name;

        application myapp {
            ...
        }
    }
}

If NGINX is running in muti-processes mode and socket option SO_REUSEPORT is supported by platform, adding option reuseport for the directive listen will resolve the thundering herd problem.

rtmp {
    ...

    server {
        listen 1935 reuseport;
        ...
    }
}

Example configuration

worker_processes  1; #should be 1 for Windows, for it doesn't support Unix domain socket
#worker_processes  auto; #from versions 1.3.8 and 1.2.5

#worker_cpu_affinity  0001 0010 0100 1000; #only available on FreeBSD and Linux
#worker_cpu_affinity  auto; #from version 1.9.10

error_log logs/error.log error;

#if the module is compiled as a dynamic module and features relevant
#to RTMP are needed, the command below MUST be specified and MUST be
#located before events directive, otherwise the module won't be loaded
#or will be loaded unsuccessfully when NGINX is started

#load_module modules/ngx_http_flv_live_module.so;

events {
    worker_connections  4096;
}

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

    keepalive_timeout  65;

    server {
        listen       80;

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

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        location /live {
            flv_live on; #open flv live streaming (subscribe)
            chunked_transfer_encoding  on; #open 'Transfer-Encoding: chunked' response

            add_header 'Access-Control-Allow-Origin' '*'; #add additional HTTP header
            add_header 'Access-Control-Allow-Credentials' 'true'; #add additional HTTP header
        }

        location /hls {
            types {
                application/vnd.apple.mpegurl m3u8;
                video/mp2t ts;
            }

            root /tmp;
            add_header 'Cache-Control' 'no-cache';
        }

        location /dash {
            root /tmp;
            add_header 'Cache-Control' 'no-cache';
        }

        location /stat {
            #configuration of streaming & recording statistics

            rtmp_stat all;
            rtmp_stat_stylesheet stat.xsl;
        }

        location /stat.xsl {
            root /var/www/rtmp; #specify in where stat.xsl located
        }

        #if JSON style stat needed, no need to specify
        #stat.xsl but a new directive rtmp_stat_format

        #location /stat {
        #    rtmp_stat all;
        #    rtmp_stat_format json;
        #}

        location /control {
            rtmp_control all; #configuration of control module of rtmp
        }
    }
}

rtmp_auto_push on;
rtmp_auto_push_reconnect 1s;
rtmp_socket_dir /tmp;

rtmp {
    out_queue           4096;
    out_cork            8;
    max_streams         128;
    timeout             15s;
    drop_idle_publisher 15s;

    log_interval 5s; #interval used by log module to log in access.log, it is very useful for debug
    log_size     1m; #buffer size used by log module to log in access.log

    server {
        listen 1935;
        server_name www.test.*; #for suffix wildcard matching of virtual host name

        application myapp {
            live on;
            gop_cache on; #open GOP cache for reducing the wating time for the first picture of video
        }

        application hls {
            live on;
            hls on;
            hls_path /tmp/hls;
        }

        application dash {
            live on;
            dash on;
            dash_path /tmp/dash;
        }
    }

    server {
        listen 1935;
        server_name *.test.com; #for prefix wildcard matching of virtual host name

        application myapp {
            live on;
            gop_cache on; #open GOP cache for reducing the wating time for the first picture of video
        }
    }

    server {
        listen 1935;
        server_name www.test.com; #for completely matching of virtual host name

        application myapp {
            live on;
            gop_cache on; #open GOP cache for reducing the wating time for the first picture of video
        }
    }
}

nginx-http-flv-module's People

Contributors

deamos avatar dvershinin avatar ever4kenny avatar ferreus avatar ham3r avatar han4235 avatar heyjupiter avatar plainheart avatar spacewander avatar winshining avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nginx-http-flv-module's Issues

Memory problem with GOP cache enabled

Hi @winshining,
When I start nginx, it consumes about a little memory. When i simulate concurrent downloads using wrk tool, memory of my machine starts to increase up to 4.5G. However, after benchmark, I see that the memory doesn't release at all.
Beside that, I have several questions about GOP cache. Is the size of memory for caching proportional to the number of subscriber/players when GOP cache enable ? Is there any way for me to control size of GOP cache?
Thanks.

on_connect 事件响应出错

server 段出现写了
on_connect 事件之后,flv的播放出现,500内部错误
server段配置:
server {
listen 1935;
notify_method get;
on_connect http://127.0.0.1/my_auth.php;
...
nginx日志:
"GET /flv?port=1935&app=live&stream=s1 HTTP/1.0" 500 193 "-" "NSPlayer/7.10.0.3059"
"GET /my_auth.php?app=live&flashver=flv_live%201.1&swfurl=&tcurl=http://...:80/live&pageurl=&addr=...&epoch=2385077356&call=connect&port=1935&app=live&stream=s1 HTTP/1.0" 200 0 "-" "-"
vlc错误日志:
access_mms error: error: HTTP/1.1 500 Internal Server Error
core error: open of `http://.../flv?port=1935&app=live&stream=s1' failed
版本:
nginx-rtmp-module 1.2.2, nginx 1.12.2

建议在说明中加入nginx版本要求

nginx-http-flv-module要求nginx版本在1.11.1以上,用低版本的nginx或者其他基于低版本的nginx的衍生版(譬如tengine)编译时会出现错误。个人觉得应该在readme里面注明一下。

reload的问题

如果有推流, 然后nginx服务在reload的时候, shut_down的进程关闭不了, 除非推流断开,请问这个有没有啥好的思路来改进一下?

推流意外断开后,重新连接不上

Hi, @winshining

在客户端正常推流过程中,中断网络,恢复网络,客户端重新连接,但是连接不上。

推流采用lib_rtmp,h264视频,无音频。

nginx的stat显示如图

10 100 4 6_stat

配置文件:


#worker_processes  4; #should be 1 for Windows, for it doesn't support Unix domain socket
worker_processes  auto; #from versions 1.3.8 and 1.2.5

#worker_cpu_affinity  0001 0010 0100 1000; #only available on FreeBSD and Linux
worker_cpu_affinity  auto; #from version 1.9.10

error_log logs/error.log error;

#if the module is compiled as a dynamic module and features relevant
#to RTMP are needed, the command below MUST be specified and MUST be
#located before events directive, otherwise the module won't be loaded
#or will be loaded unsuccessfully when NGINX is started
#load_module modules/ngx_rtmp_module.so;

events {
    worker_connections  1024;
}

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

    keepalive_timeout  65;

    server {
        listen       80;

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

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        location /live {
            flv_live on; #open flv live streaming (subscribe)
            chunked_transfer_encoding  on; #open 'Transfer-Encoding: chunked' response

            add_header 'Access-Control-Allow-Origin' '*'; #add additional HTTP header
            add_header 'Access-Control-Allow-Credentials' 'true'; #add additional HTTP header
        }

        location /hls {
            types {
                application/vnd.apple.mpegurl m3u8;
                video/mp2t ts;
            }

            root /tmp;
            add_header 'Cache-Control' 'no-cache';
        }

        location /dash {
            root /tmp;
            add_header 'Cache-Control' 'no-cache';
        }

        location /stat {
            #configuration of push & pull status

            rtmp_stat all;
            rtmp_stat_stylesheet stat.xsl;
        }

        location /stat.xsl {
            root /opt/nginx-http-flv-module/; #specify in where stat.xsl located
        }

        #if JSON style stat needed, no need to specify
        #stat.xsl but a new directive rtmp_stat_format

        #location /stat {
        #    rtmp_stat all;
        #    rtmp_stat_format json;
        #}

        location /control {
            rtmp_control all; #configuration of control module of rtmp
        }
    }
}

rtmp_auto_push on;
rtmp_auto_push_reconnect 1s;
rtmp_socket_dir /tmp;

rtmp {
    out_queue   4096;
    out_cork    8;
    max_streams 64;

    server {
        listen 1935;
        server_name 10.100.4.6; #for suffix wildcard matching of virtual host name

        application myapp {
            live on;
            gop_cache on; #open GOP cache for reducing the wating time for the first picture of video
        }

        application hls {
            live on;
            hls on;
            hls_path /tmp/hls;
        }

        application dash {
            live on;
            dash on;
            dash_path /tmp/dash;
        }
    }

    server {
        listen 1935;
        server_name *.test.com; #for prefix wildcard matching of virtual host name

        application myapp {
            live on;
            gop_cache on; #open GOP cache for reducing the wating time for the first picture of video
        }
    }

    server {
        listen 1935;
        server_name www.test.com; #for completely matching of virtual host name

        application myapp {
            live on;
            gop_cache on; #open GOP cache for reducing the wating time for the first picture of video
        }
    }
}

编译问题

ngx_http_flv_live_module.c:653: error: ‘NGX_HTTP_SERVER_TOKENS_ON’ undeclared (first use in this function)
ngx_http_flv_live_module.c:656: error: ‘NGX_HTTP_SERVER_TOKENS_BUILD’ undeclared (first use in this function)

应该是nginx版本的适配问题, 1.11系列的版本 会出现类似的问题

http-flv pull failed

http-flv pull failed. config as follows:

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

sendfile        on;

keepalive_timeout  65;

server {
    listen       80;

    location / { 
        root   /var/www;
        index  index.html index.htm;
    } 
     
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }
    
    location /live {
        flv_live on;
        chunked  on;
    }
}

}

rtmp_auto_push on;
rtmp_auto_push_reconnect 1s;
rtmp_socket_dir /tmp;

rtmp {
out_queue 4096;
out_cork 8;
max_streams 64;

server {
    listen 1935;

    application myapp {
        live on;
        gop_cache on;

        pull rtmp://live.hkstv.hk.lxdns.com/live/hks;

        on_play http://127.0.0.1:8080/on_play;
        #record all;
        #record_path /tmp;
        #record_suffix -%d-%b-%y-%T.flv;
    }
}

}_

只用 hls 观看 pull 流时不拉流

live on;
pull rtmp://live.hkstv.hk.lxdns.com/live/hks name=hks static;
hls on;

只用 hls 观看时,它不拉流;有 http-flv 或 rtmp 观看时才会拉。

windows
nginx-1.14
nginx-http-flv-module
openssl-1.1.0h
pcre-8.42
zlib-1.2.11

pull的合并思路

nginx rtmp 本身有 rtmp_auto_push 这个指令对多进程的work之间进行流的广播, 从而作出流的合并回源思路, 问题是当pull后端流的时候, 那多进程worker之间如何进行流的广播从而合并回源呢? 今天一直在想这个方案, 没有特别好的思路, 能否给点建议?

obs推流 无法访问指定的频道或者琉密钥


user  root;
worker_processes  1;

events {
    worker_connections  1024;
}


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

    sendfile        on;

    keepalive_timeout  65;

    server {
        listen       80;
        server_name  localhost;

        location / {
            root   html;
            index  index.html index.htm;
        }

        location /hls {
            types {
                application/vnd.apple.mpegurl m3u8;
                video/mp2t ts;
            }
            root html/hls;
            add_header Cache-Control no-cache;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}

rtmp{
    server {
        listen 1935;

        # RTMP 直播流配置
        application rtmplive {
            live on;
        }

        # HLS 直播流配置
        application hls {
            live on;
            hls on;
            hls_path html/hls;
            hls_fragment 5s;
        }
    }
}

以上是我 nginx 的配置,安装的时候我也有添加模块

./configure --prefix=/usr/local/nginx --with-http_ssl_module --add-module=/usr/local/src/nginx-http-flv-module

我在使用OBS推流的时候,会提示我 无法访问指定的频道或者琉密钥

这是我推流的地址,项目是部署在虚拟机里的,防火墙关闭了

rtmp://host:port/rtmplive/streamname

dash 无法播放

ffmpeg -re -i "111.mkv" -r 25 -c:v libx264 -profile:v high -preset veryfast -b:v 1000k -g 50 -s 640x480 -c:a aac -ac 2 -ar 48000 -b:a 64k -f flv "rtmp://192.168.23.71:2935/dash/66"

ffplay http://192.168.23.71:2980/dash/66.mpd
http://192.168.23.71:2980/dash/66.mpd: Invalid data found when processing input

### media="66-$Time$.m4a" is weird

      <Representation
          id="66_AAC"
          mimeType="audio/mp4"
          codecs="mp4a.40.2"
          audioSamplingRate="48000"
          startWithSAP="1"
          bandwidth="62000">
        <SegmentTemplate
            timescale="1000"
            media="66-$Time$.m4a"
            initialization="66-init.m4a">
          <SegmentTimeline>
             <S t="79760" d="6240"/>
             <S t="86000" d="6200"/>
             <S t="92200" d="6280"/>
             <S t="98480" d="6160"/>
             <S t="104640" d="5840"/>
             <S t="110480" d="5520"/>
          </SegmentTimeline>
        </SegmentTemplate>
      </Representation>
    </AdaptationSet>
  </Period>
</MPD>

[bug] compile problems with ngx_rtmp_amf.c

Expected behavior

make completes successfully

Actual behavior

make fails:

/home/sl/Downloads/nginx-http-flv-module/ngx_rtmp_amf.c:331:24: error: this statement may fall through [-Werror=implicit-fallthrough=]
if (elts->type & NGX_RTMP_AMF_OPTIONAL) {
^
/home/sl/Downloads/nginx-http-flv-module/ngx_rtmp_amf.c:334:17: note: here
case NGX_ERROR:
^~~~
/home/sl/Downloads/nginx-http-flv-module/ngx_rtmp_amf.c:398:20: error: this statement may fall through [-Werror=implicit-fallthrough=]
if (ngx_rtmp_amf_get(ctx, &max_index, 4) != NGX_OK) {
^
/home/sl/Downloads/nginx-http-flv-module/ngx_rtmp_amf.c:402:13: note: here
case NGX_RTMP_AMF_OBJECT:
^~~~
/home/sl/Downloads/nginx-http-flv-module/ngx_rtmp_amf.c: In function ‘ngx_rtmp_amf_write’:
/home/sl/Downloads/nginx-http-flv-module/ngx_rtmp_amf.c:592:20: error: this statement may fall through [-Werror=implicit-fallthrough=]
if (ngx_rtmp_amf_put(ctx, &max_index, 4) != NGX_OK) {
^
/home/sl/Downloads/nginx-http-flv-module/ngx_rtmp_amf.c:596:13: note: here
case NGX_RTMP_AMF_OBJECT:
^~~~
cc1: all warnings being treated as errors
objs/Makefile:1310: recipe for target 'objs/addon/nginx-http-flv-module/ngx_rtmp_amf.o' failed
make[1]: *** [objs/addon/nginx-http-flv-module/ngx_rtmp_amf.o] Error 1
make[1]: Leaving directory '/home/sl/Downloads/nginx'
Makefile:8: recipe for target 'build' failed
make: *** [build] Error 2

Steps to reproduce the behavior

follow exact steps to add module via ./configure and then make ; make install

大概率无法播放http-flv: no on_play or relay pull

nginx-1.14.0
我用ffmpeg同时推了多路视频,用vlc通过rtmp://$host/video/chn<1-16>播放是没问题的,但通过http://$host/live?app=video&stream=chn1,基本上无法播放,error.log都是提示:

2018/06/27 11:26:38 [error] 11885#0: *62 flv live: no on_play or relay pull, quit, client: 192.168.11.216, server: 0.0.0.0:1935

通过web(flv.js)播放10次有8次提示500错误,偶尔可以放出来,会不会是nginx版本的问题,我暂时没试过其他1.14以下的版本

还是说我的配置不对,我只需要http-flv直播功能
nginx.conf

worker_processes  auto;

events {
    worker_connections  1024;
}

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

    sendfile        on;
    keepalive_timeout  65;

    server {
        listen       80;

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

	location /live {
            flv_live on;
	    add_header 'Access-Control-Allow-Origin' '*';
	    add_header 'Access-Control-Allow-Credentials' 'true'; 
	}

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /var/www/html;
        }
    }
}

rtmp {
	server {
	    listen 1935;
	    application video {
		live on;
#		gop_cache on;
        }
    }
}

flv live: no on_play and no relay pulls, quit

您好,
我在linux下测试,昨天编译好的,RTMP和HTTP-FLV都可以正常播放。
今天只是重启了nginx进程,RTMP还可以播放,HTTP-FLV就报错flv live: no on_play and no relay pulls, quit。在Windows上测试也遇到了相同的问题。还请大神帮忙看下,万分感谢!
详细log如附件。
error.log

[bug] $connections_active huge number

Returning $connections_active in http call returns huge number (int64/long) instead of active connections. When server first starts it appears number is correct.

Expected behavior

Correct example: 1500.

Actual behavior

But instead getting following result: 18446744073709550135

Steps to reproduce the behavior

Server with few thousand http requests/active connections

nginx 1.13.12

怎么支持https

看了下实例只写了http播放的部分,请问下要怎么配置才能支持https?

Error - not working

Unfortunately I can't get it to work:
Please note that i compiled this as a dynamic module, using the stock nginx deb dist 1.12.2, I hope this should not make major difference.

ffmpeg ouput:
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
av_interleaved_write_frame(): Connection reset by peer
Error writing trailer of rtmp://localhost/myapp/mystream: Connection reset by peerframe= 4 fps=0.0 q=-1.0 Lsize= 7kB time=00:00:00.12 bitrate= 501.1kbits/s speed=1.48x
video:7kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 7.290487%
Conversion failed!

The nginx error log:
2017/11/18 10:20:30 [notice] 11404#11404: using the "epoll" event method
2017/11/18 10:20:30 [notice] 11404#11404: nginx/1.12.2
2017/11/18 10:20:30 [notice] 11404#11404: built by gcc 6.3.0 20170516 (Debian 6.3.0-18)
2017/11/18 10:20:30 [notice] 11404#11404: OS: Linux 4.9.0-4-686-pae
2017/11/18 10:20:30 [notice] 11404#11404: getrlimit(RLIMIT_NOFILE): 1024:4096
2017/11/18 10:20:30 [notice] 11405#11405: start worker processes
2017/11/18 10:20:30 [notice] 11405#11405: start worker process 11408
2017/11/18 10:20:46 [info] 11408#11408: *1 client connected '127.0.0.1'
2017/11/18 10:20:46 [info] 11408#11408: *1 connect: app='myapp' args='' flashver='FMLE/3.0 (compatible; Lavf57.56' swf_url='' tc_url='rtmp://localhost:1935/myapp' page_url='' acodecs=0 vcodecs=0 object_encoding=0, client: 127.0.0.1, server: 0.0.0.0:1935
2017/11/18 10:20:46 [info] 11408#11408: *1 createStream, client: 127.0.0.1, server: 0.0.0.0:1935
2017/11/18 10:20:46 [info] 11408#11408: *1 publish: name='mystream' args='' type=live silent=0, client: 127.0.0.1, server: 0.0.0.0:1935
*** stack smashing detected ***: nginx: worker process terminated
======= Backtrace: =========
/lib/i386-linux-gnu/libc.so.6(+0x6737a)[0xb724f37a]
/lib/i386-linux-gnu/libc.so.6(__fortify_fail+0x37)[0xb72dff37]
/lib/i386-linux-gnu/libc.so.6(+0xf7ef8)[0xb72dfef8]
/usr/lib/nginx/modules/ngx_rtmp_module.so(_fini+0x0)[0xb6abcbc4]
/usr/lib/nginx/modules/ngx_rtmp_module.so(+0x3e545)[0xb6abc545]
/usr/lib/nginx/modules/ngx_rtmp_module.so(+0x12da9)[0xb6a90da9]
/usr/lib/nginx/modules/ngx_rtmp_module.so(ngx_rtmp_amf_message_handler+0x15f)[0xb6a8d11f]
/usr/lib/nginx/modules/ngx_rtmp_module.so(ngx_rtmp_receive_message+0x58)[0xb6a896b8]
/usr/lib/nginx/modules/ngx_rtmp_module.so(+0xbc84)[0xb6a89c84]
nginx: worker process(+0x3e63b)[0x52763b]
nginx: worker process(ngx_process_events_and_timers+0x71)[0x51e211]
nginx: worker process(+0x3c4f4)[0x5254f4]
nginx: worker process(ngx_spawn_process+0x174)[0x523e64]
nginx: worker process(+0x3c711)[0x525711]
nginx: worker process(ngx_master_process_cycle+0x1bd)[0x52628d]
nginx: worker process(main+0xbfb)[0x4fe6ab]
/lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf6)[0xb7200276]
nginx: worker process(+0x15834)[0x4fe834]
======= Memory map: ========
004e9000-00607000 r-xp 00000000 08:01 401607 /usr/sbin/nginx
00607000-00609000 r--p 0011d000 08:01 401607 /usr/sbin/nginx
00609000-0061d000 rw-p 0011f000 08:01 401607 /usr/sbin/nginx
0061d000-00637000 rw-p 00000000 00:00 0
019dc000-01a1e000 rw-p 00000000 00:00 0 [heap]
01a1e000-01a52000 rw-p 00000000 00:00 0 [heap]
b6a0c000-b6a28000 r-xp 00000000 08:01 327685 /lib/i386-linux-gnu/libgcc_s.so.1
b6a28000-b6a29000 r--p 0001b000 08:01 327685 /lib/i386-linux-gnu/libgcc_s.so.1
b6a29000-b6a2a000 rw-p 0001c000 08:01 327685 /lib/i386-linux-gnu/libgcc_s.so.1
b6a3a000-b6a45000 r-xp 00000000 08:01 327931 /lib/i386-linux-gnu/libnss_files-2.24.so
b6a45000-b6a46000 r--p 0000a000 08:01 327931 /lib/i386-linux-gnu/libnss_files-2.24.so
b6a46000-b6a47000 rw-p 0000b000 08:01 327931 /lib/i386-linux-gnu/libnss_files-2.24.so
b6a47000-b6a4d000 rw-p 00000000 00:00 0
b6a4d000-b6a58000 r-xp 00000000 08:01 327939 /lib/i386-linux-gnu/libnss_nis-2.24.so
b6a58000-b6a59000 r--p 0000a000 08:01 327939 /lib/i386-linux-gnu/libnss_nis-2.24.so
b6a59000-b6a5a000 rw-p 0000b000 08:01 327939 /lib/i386-linux-gnu/libnss_nis-2.24.so
b6a5a000-b6a70000 r-xp 00000000 08:01 327916 /lib/i386-linux-gnu/libnsl-2.24.so
b6a70000-b6a71000 r--p 00016000 08:01 327916 /lib/i386-linux-gnu/libnsl-2.24.so
b6a71000-b6a72000 rw-p 00017000 08:01 327916 /lib/i386-linux-gnu/libnsl-2.24.so
b6a72000-b6a74000 rw-p 00000000 00:00 0
b6a74000-b6a7c000 r-xp 00000000 08:01 327924 /lib/i386-linux-gnu/libnss_compat-2.24.so
b6a7c000-b6a7d000 r--p 00007000 08:01 327924 /lib/i386-linux-gnu/libnss_compat-2.24.so
b6a7d000-b6a7e000 rw-p 00008000 08:01 327924 /lib/i386-linux-gnu/libnss_compat-2.24.so
b6a7e000-b6ad5000 r-xp 00000000 08:01 60428 /usr/lib/nginx/modules/ngx_rtmp_module.so
b6ad5000-b6ad6000 r--p 00056000 08:01 60428 /usr/lib/nginx/modules/ngx_rtmp_module.so
b6ad6000-b6adb000 rw-p 00057000 08:01 60428 /usr/lib/nginx/modules/ngx_rtmp_module.so
b6adb000-b71e8000 rw-p 00000000 00:00 0
b71e8000-b7399000 r-xp 00000000 08:01 327858 /lib/i386-linux-gnu/libc-2.24.so
b7399000-b739a000 ---p 001b1000 08:01 327858 /lib/i386-linux-gnu/libc-2.24.so
b739a000-b739c000 r--p 001b1000 08:01 327858 /lib/i386-linux-gnu/libc-2.24.so
b739c000-b739d000 rw-p 001b3000 08:01 327858 /lib/i386-linux-gnu/libc-2.24.so
b739d000-b73a0000 rw-p 00000000 00:00 0
b73a0000-b73b9000 r-xp 00000000 08:01 328191 /lib/i386-linux-gnu/libz.so.1.2.8
b73b9000-b73ba000 r--p 00018000 08:01 328191 /lib/i386-linux-gnu/libz.so.1.2.8
b73ba000-b73bb000 rw-p 00019000 08:01 328191 /lib/i386-linux-gnu/libz.so.1.2.8
b73bb000-b7606000 r-xp 00000000 08:01 459041 /usr/lib/i386-linux-gnu/libcrypto.so.1.1
b7606000-b7607000 ---p 0024b000 08:01 459041 /usr/lib/i386-linux-gnu/libcrypto.so.1.1
b7607000-b7618000 r--p 0024b000 08:01 459041 /usr/lib/i386-linux-gnu/libcrypto.so.1.1
b7618000-b761f000 rw-p 0025c000 08:01 459041 /usr/lib/i386-linux-gnu/libcrypto.so.1.1
b761f000-b7622000 rw-p 00000000 00:00 0
b7622000-b7689000 r-xp 00000000 08:01 459042 /usr/lib/i386-linux-gnu/libssl.so.1.1
b7689000-b768c000 r--p 00066000 08:01 459042 /usr/lib/i386-linux-gnu/libssl.so.1.1
b768c000-b7690000 rw-p 00069000 08:01 459042 /usr/lib/i386-linux-gnu/libssl.so.1.1
b7690000-b7707000 r-xp 00000000 08:01 327846 /lib/i386-linux-gnu/libpcre.so.3.13.3
b7707000-b7708000 r--p 00076000 08:01 327846 /lib/i386-linux-gnu/libpcre.so.3.13.3
b7708000-b7709000 rw-p 00077000 08:01 327846 /lib/i386-linux-gnu/libpcre.so.3.13.3
b7709000-b7712000 r-xp 00000000 08:01 327868 /lib/i386-linux-gnu/libcrypt-2.24.so
b7712000-b7713000 r--p 00008000 08:01 327868 /lib/i386-linux-gnu/libcrypt-2.24.so
b7713000-b7714000 rw-p 00009000 08:01 327868 /lib/i386-linux-gnu/libcrypt-2.24.so
b7714000-b773b000 rw-p 00000000 00:00 0
b773b000-b7754000 r-xp 00000000 08:01 327961 /lib/i386-linux-gnu/libpthread-2.24.so
b7754000-b7755000 r--p 00018000 08:01 327961 /lib/i386-linux-gnu/libpthread-2.24.so
b7755000-b7756000 rw-p 00019000 08:01 327961 /lib/i386-linux-gnu/libpthread-2.24.so
b7756000-b7758000 rw-p 00000000 00:00 0
b7758000-b775b000 r-xp 00000000 08:01 327877 /lib/i386-linux-gnu/libdl-2.24.so
b775b000-b775c000 r--p 00002000 08:01 327877 /lib/i386-linux-gnu/libdl-2.24.so
b775c000-b775d000 rw-p 00003000 08:01 327877 /lib/i386-linux-gnu/libdl-2.24.so
b776a000-b776b000 rw-p 00000000 00:00 0
b776b000-b776c000 rw-s 00000000 00:0d 228956 /[aio] (deleted)
b776c000-b776d000 rw-s 00000000 00:05 228952 /dev/zero (deleted)
b776d000-b776f000 rw-p 00000000 00:00 0
b776f000-b7771000 r--p 00000000 00:00 0 [vvar]
b7771000-b7773000 r-xp 00000000 00:00 0 [vdso]
b7773000-b7796000 r-xp 00000000 08:01 327758 /lib/i386-linux-gnu/ld-2.24.so
b7796000-b7797000 r--p 00022000 08:01 327758 /lib/i386-linux-gnu/ld-2.24.so
b7797000-b7798000 rw-p 00023000 08:01 327758 /lib/i386-linux-gnu/ld-2.24.so
bf90c000-bf92d000 rw-p 00000000 00:00 0 [stack]
2017/11/18 10:20:46 [notice] 11405#11405: signal 17 (SIGCHLD) received
2017/11/18 10:20:46 [alert] 11405#11405: worker process 11408 exited on signal 6

rtmp 可以拉流,http-flv 如何配置才能播放?

Hi~

现在可以使用 exec_pull 拉流,但是使用 flv.js 无法播放 (播放其它源可行),可能是什么原因?

播放地址: http://80.0.0.106:8080/live?port=1935&app=myapp&stream=test

配置如下:

...
http {

location /live {
       flv_live on;
       chunked_transfer_encoding off;
       add_header 'Access-Control-Allow-Origin' '*';
       add_header 'Access-Control-Allow-Credentials' 'true';
    }

 }
 ...

 rtmp {
     server {
         listen 1935;
  
         application myapp {
             live on;
      
             exec_pull ffmpeg -i rtsp://80.0.0.231:554/av0_1 -vcodec copy -acodec copy 
    -f flv rtmp://localhost:1935/myapp/test;
          }    
      }
}

报错如下:

     2018/08/07 01:32:20 [error] 25798#0: *5 flv live: no on_play or relay pull, quit, 
  client: 80.0.0.170, server: 0.0.0.0:1935

似乎是没有配置 http-flv 拉流,该如何配置?

I found x-flv use large memory in a long time ..

when I open flv_live , nginx use large memory in a long time(my server is 32Gb momery,it use all momery in just 6 hour). Is there have any memory leaks?

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
8127 www 20 0 7227172 6.848g 1452 S 0.0 21.9 2:01.04 nginx
8128 www 20 0 4135696 3.899g 1424 S 0.0 12.5 1:12.31 nginx

关于https的支持

nginx部分配置了https

server {
    listen       1443 ssl http2;
    server_name  localhost;

    ssl_certificate      server.crt;
    ssl_certificate_key  server.key;

    ssl_session_cache    shared:SSL:1m;
    ssl_session_timeout  5m;

    ssl_ciphers  HIGH:!aNULL:!MD5;
    ssl_prefer_server_ciphers  on;

    location / {
        root   html;
        index  index.html index.htm;
    }

    location /live {
        flv_live on; #打开HTTP播放FLV直播流功能
        chunked_transfer_encoding on; #支持'Transfer-Encoding: chunked'方式回复

        add_header 'Access-Control-Allow-Origin' '*'; #添加额外的HTTP头
        add_header 'Access-Control-Allow-Credentials' 'true'; #添加额外的HTTP头
    }
}

用播放器直接播放没有问题,但是如果用flv.js会获取不到视频源,fetch 一直是0,请问能不能提供下解决思路

[bug]nginx hung after push stream stopped

Thanks for such a great job. 👍 👍 👍 Had been looking for flv streaming server for a long time.

But yet found two critical issues, which pull and make on 2117/12/12.

  1. nginx totally hang after the publish stream stopped in case of flv client is playing.
    publisher: OBS
    client: flv.js
    nginx conf:
    application foo { live on; proxy_pass rtmp://src; }
    upstream src{ server localhost:1936; }
  • obs push start
  • flv.js play stream
  • obs push stop manually
  • nginx hang. nothing can help except restart nginx
  1. In proxy_pass mode, the stream info lost in rtmp_stat. like a ghost stream but actually working great in background.

Thanks for any help :)

rtmp流无法播放,http可以

流由另一个服务器的nginx使用push推送
配置文件:
#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;
worker_rlimit_nofile 40960;

events {
    use epoll;
    worker_connections  10240;
}

rtmp {
    server {
            listen 9492;
            chunk_size 4096;
            application live {
                    live on;
                    max_connections 10240;
            }
            application hls {
                    live on;
                    gop_cache on;
                    hls on;
                    hls_path /usr/local/nginx/html/app;
                    hls_fragment 3s;
                    hls_playlist_length 30s;
                    hls_sync 100ms;
                    meta copy;
                    recorder chunked {
                            record all;
                            #record_max_size 6200K;
                            record_interval 10s;
                            record_suffix -%Y-%m-%d-%H_%M_%S.flv;
                            record_path /AVA/data/Upload/Rec/Chunked;
                    }
                    recorder all {
                            record all;
                            record_suffix -%Y-%m-%d-%H_%M_%S.flv;
                            record_max_size 6200000K;
                            record_path /AVA/data/Upload/Rec;
                    }
            }
            application Upload {
                    play /ava_app/school/src/tomcat/webapps/admin/upload;
            }
    }
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;

    server {
        listen       9491;
        server_name  localhost;

        location / {
            root   html;
            index  index.html index.htm;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        location /live {
            flv_live on;
            chunked_transfer_encoding off;
            add_header 'Access-Control-Allow-Origin' '*';
            add_header 'Access-Control-Allow-Credentials' 'true';
        }

        location /hls {
                    types {
                            #application/vnd.apple.mpegurl m3u8;
                            application/x-mpegurl m3u8;
                            video/mp2t ts;
                    }
                    alias /usr/local/nginx/html/app;
            }
        location /stat {
            rtmp_stat all;
            rtmp_stat_stylesheet stat.xsl;
        }
        location /stat.xsl {
            root html;
        }
    }
}

编译出错

之前安装过nginx-rtmp-module已经正常运行,现在编译nginx安装nginx-rtmp-module和nginx-http-flv-module出现这个错误,是那里出了问题?(还是只需安装nginx-http-flv-module 不用安装ginx-rtmp-module)

objs/Makefile:1916: recipe for target 'objs/addon/hls/ngx_rtmp_hls_module.o' failed
make[1]: *** [objs/addon/hls/ngx_rtmp_hls_module.o] Error 1
make[1]: Leaving directory '/src/nginx-1.12.1'
Makefile:8: recipe for target 'build' failed
make: *** [build] Error 2

能按需拉流吗?

比如在web点播了流之后,服务器才去调用 ffmpeg 拉流,点播关闭之后,一段延时之后自动关闭掉这个流?

[bug] compile error

Configure:
./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-g -O2 -fdebug-prefix-map=/data/builder/debuild/nginx-1.12.2/debian/debuild-base/nginx-1.12.2=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Wp,-D_FORTIFY_SOURCE=2 -fPIC' --with-ld-opt='-specs=/usr/share/dpkg/no-pie-link.specs -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie' --add-dynamic-module=/usr/src/nginx-ts-module --add-dynamic-module=/usr/src/nginx-http-flv-module

Does not compile, ends with error:

cc -c -fPIC -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -g -O2 -fdebug-prefix-map=/data/builder/debuild/nginx-1.12.2/debian/debuild-base/nginx-1.12.2=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Wp,-D_FORTIFY_SOURCE=2 -fPIC -I src/core -I src/event -I src/event/modules -I src/os/unix -I /usr/src/nginx-http-flv-module -I objs -I src/http -I src/http/modules -I src/http/v2 -I src/mail -I src/stream
-o objs/addon/nginx-http-flv-module/ngx_rtmp_codec_module.o
/usr/src/nginx-http-flv-module/ngx_rtmp_codec_module.c
/usr/src/nginx-http-flv-module/ngx_rtmp_codec_module.c: In function ‘ngx_rtmp_codec_parse_avc_header_in_keyframe’:
/usr/src/nginx-http-flv-module/ngx_rtmp_codec_module.c:433:21: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
if (len + 3 > left) {
^
cc1: all warnings being treated as errors

Many thanks,

can not complie ....

can not compile with nginx, with release 1.2.2.
the nginx version : 1.12.2

cc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g   -I src/core -I src/event -I src/event/modules -I src/os/unix -I /usr/src/nginx-http-flv-module-1.2.2 -I /usr/include/libxml2 -I objs -I src/http -I src/http/modules -I src/http/v2 -I src/mail -I src/stream \
        -o objs/addon/nginx-http-flv-module-1.2.2/ngx_rtmp_live_module.o \
        /usr/src/nginx-http-flv-module-1.2.2/ngx_rtmp_live_module.c
/usr/src/nginx-http-flv-module-1.2.2/ngx_rtmp_live_module.c: In function 'ngx_rtmp_live_data':
/usr/src/nginx-http-flv-module-1.2.2/ngx_rtmp_live_module.c:1191:37: error: variable 'msg_type' set but not used [-Werror=unused-but-set-variable]
     u_char                         *msg_type;
                                     ^~~~~~~~
cc1: all warnings being treated as errors

1.2.3的release版本 内存泄漏将近4G

When you meet a bug, please open the issue including a title prefixed by '[bug]' and describe it as follows:

Expected behavior

Actual behavior

Steps to reproduce the behavior

image

使用了1.2.3的release版本,压测一个小时,内存泄漏将近4G

Error 405 "HTTP method was not 'GET'" for locations without flv_live directive

After adding this module I can no longer do HEAD requests on any path/location/domain on the entire webserver.

For every request I get a log line in the nginx error log:

2018/07/07 21:46:25 [error] 13255#0: *3 flv live: HTTP method was not "GET", client: 192.168.3.1, server: live.mydomain, request: "HEAD /hls/test.m3u8 HTTP/2.0", host: "live.mydomain", referrer: "https://live.mydomain/"
2018/07/07 22:10:41 [error] 14359#0: *994 flv live: HTTP method was not "GET", client: 192.168.3.1, server: unrelateddomain.example, request: "HEAD / HTTP/2.0", host: "unrelateddomain.example", referrer: "https://unrelateddomain.example/"

The location blocks:

    location /hls/ {
        types {
            application/x-mpegURL m3u8;
        }
        alias /mnt/ramdisk/hls/;
        add_header Cache-Control no-cache;
        add_header Access-Control-Allow-Origin *;
        open_file_cache off;
        access_log off;

        gzip off;
        brotli off;
        brotli_static off;
    }

    location /liveflv {
        flv_live on;
        chunked_transfer_encoding  on;
    }

The RTMP block:

rtmp {
    meta off;

    server {
        listen 1935;
        chunk_size 1024;
        buflen 500ms;

        application live {
            live on;
            record off;
            gop_cache off;
            hls on;
            hls_path /mnt/ramdisk/hls;
            hls_fragment 4s;
            hls_max_fragment 4s;
            hls_playlist_length 12s;

            exec_publish_done bash -c "rm /mnt/ramdisk/hls/*.*";
        }
    }
}

This setup worked with the nginx-rtmp-module.

Is this supposed to happen?

关于开启GOP缓存之后客户端无法播放或导致崩溃的问题

尝试了很多版本的Nginx去编译http-flv模块,但始终发现一旦开启 gop_cache on, 客户端将无法正常播放,严重时甚至导致推流暂时断开,好在推流端有断开重连机制,否则连推流端都断了。从错误日志也无法看出有什么问题,烦请作者将您测试时nginx版本及编译配置选项告诉下,我再重新编译试试有没有问题,谢谢!

gop cache 播放假死

hi, gopcache 貌似有点问题, 推流gop是2s的流的时候, 有很大的概率出现,多次打开的时候有部分链接瞬间卡死的情况, 流是正常的。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.