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播放测试

  • 相关阅读:
    png 图片的缩放
    数据结构>图的最短路径
    2007年7月25日在博客园的排名上升到前400名
    C# 汉字转拼音(全拼)
    修改 Linux 主机名
    C# 事件的继承
    一个实现了 IDisposable 接口的基类
    Windows 防火墙上也有端口映射功能
    网上邻居不能访问的问题
    令网站提速的7大秘方
  • 原文地址:https://www.cnblogs.com/wuchaodzxx/p/8204242.html
Copyright © 2011-2022 走看看