nginx实现hls自动切片--nginx-vod-module

下载nginx

http://nginx.org/en/download.html

下载模块nginx-vod-module

git clone https://github.com/kaltura/nginx-vod-module

编译安装

./configure --prefix=/usr/local/nginx \
--with-file-aio \
--with-http_mp4_module \
--with-http_flv_module \
--with-http_gzip_static_module \
--with-http_gunzip_module \
--with-http_stub_status_module \
--with-pcre \
--add-module=/opt/software/nginx-vod-module \
--with-threads \
--with-debug

配置文件

worker_processes 24;
worker_rlimit_nofile 204800;
  events {
  worker_connections 102400;
  use epoll;
 }


http {
    include mime.types;
    default_type application/octet-stream;
    limit_conn_zone $binary_remote_addr zone=addr:10m;
    limit_req_zone $binary_remote_addr zone=req_one:10m rate=100r/m;
    sendfile on;
    tcp_nopush on;
    keepalive_timeout 300;
    server_tokens off;
    etag off;
    client_body_timeout 3s;
    client_header_timeout 5s;
    proxy_connect_timeout 30s;
    proxy_read_timeout 30s;
    proxy_send_timeout 30s;
    proxy_buffer_size 32k;
    proxy_buffers 32 64k;
    proxy_busy_buffers_size 64k;
    proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
    include vhost/*.conf;
}


server {
    listen 8080;
    serverer_name localhost;
    open_file_cache max=1000 inactive=5m;
    open_file_cache_valid 2m;
    open_file_cache_min_uses 1;
    open_file_cache_errors on;
    location / {
        vod hls;
        vod_hls_absolute_index_urls off;
        vod_align_segments_to_key_frames on;
        vod_secret_key "4kgd$vod_filepath";
       # vod_hls_encryption_method aes-128;

        root /opt/video;

        gzip on;
        gzip_types application/vnd.apple.mpegurl;

        expires 100d;
     }
 }

ps:现在只支持MP4,模块生效后普通访问nginx报400

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值