zoukankan      html  css  js  c++  java
  • nginx配置hls

    备注:本来是想用浏览器播放hls,后来没有成功,最后使用flash播放rtmp的方案。所以下面的配置未使用。

    修改/usr/local/nginx/conf/nginx.conf文件内容如下:

    worker_processes  1;
    error_log  logs/error.log debug;
    events {
        worker_connections  1024;
    }
    rtmp {
        server {
            listen 1936;
            application live{
                live on;
                #record keyframes;
                #record_path /tmp;
                #record_max_size 128K;
                #record_interval 30s;
                #record_suffix .this.is.flv;
                #on_publish http://localhost:8080/publish;
                #on_play http://localhost:8080/play;
                #on_record_done http://localhost:8080/record_done;
            }
        }
    }
    rtmp {
        server {
            listen 1935;
            chunk_size 4000;
            #HLS
            application hls {
                live on;
                hls on;
                hls_path /usr/local/nginx/html/hls;
                hls_fragment 5s;
            }
        }
    }
    http {
        server {
            listen  8080;
            location /hls {
                # Serve HLS fragments
                types {
                    application/vnd.apple.mpegurl m3u8;
                    video/mp2t ts;
                }
                root html;
                expires -1;
            }
        }
        server {
            listen      8081;
            location /stat {
                rtmp_stat all;
                rtmp_stat_stylesheet stat.xsl;
            }
            location /stat.xsl {
                root /html/nginx-rtmp-module/;
            }
            location /control {nginx-rtmp-module/
                rtmp_control all;
            }
            location / {
                root /html/nginx-rtmp-module/test/www;
            }
        }
    }
    

     如果推流地址为:“rtmp://192.168.1.104/hls/mystream” ,则访问路径为“http://192.168.1.104:8080/hls/mystream.m3u8”,可以使用VLC播放测试

  • 相关阅读:
    mybatis几种开发方式
    SpringData,JPA,MongoDB,Solr,Elasticsearch底层逻辑关系
    简论远程通信(RPC,Webservice,RMI,JMS的区别)
    spring/spring boot/spring mvc中用到的注解
    Centos常用命名
    Mybatis详解
    Java成长之路
    Hibernate 与Mybatis之比较
    Struts2 与SpringMVC之比较
    Maven 配置文件详解
  • 原文地址:https://www.cnblogs.com/wuchaodzxx/p/8204242.html
Copyright © 2011-2022 走看看