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

  • 相关阅读:
    Compile Groovy/Spock with GMavenPlus
    Jenkins Slave Nodes – using the Swarm Plugin
    [NodeJS]Jenkins-cli
    [CoffeeScript]使用Yield功能
    [JavaScript]String.format
    [CoffeeScript]在WebStorm里运行CoffeeScript
    自动化运维的三阶段理论
    [Ruby]Unzipping a file using rubyzip
    测试文章引用
    敏捷软件测试读书笔记
  • 原文地址:https://www.cnblogs.com/wuchaodzxx/p/8204242.html
Copyright © 2020-2023  润新知