1
回答
nginx hls直播摄像头的内容,网页无显示!
终于搞明白,存储TCO原来是这样算的>>>   

worker_processes  1;

 

error_log  logs/error.log debug;

 

events {

    worker_connections  1024;

}

 

rtmp {

    server {

        listen 1935;

 

        application myapp {

                 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;

        }

application hls {  

             live on;  

             hls on;  

             hls_path /tmp/app;  

             hls_fragment 5s;  

        }  

    }

}

 

http {

    server {

        listen      8080;

 

 location / {

            root /home/camerahttp/nginx-rtmp-module-1.2.0/test/hls;

        }

 

location /hls {  

           #server hls fragments  

           types{  

              application/vnd.apple.mpegurl m3u8;  

              video/mp2t ts;  

           }  

           alias /tmp/app;  

            expires -1;  

        }  

 

        location /stat {

            rtmp_stat all;

            rtmp_stat_stylesheet stat.xsl;

        }

 

        location /stat.xsl {

            root /home/camerahttp/nginx-rtmp-module-1.2.0;

        }

 

        location /control {

            rtmp_control all;

        }

 

        #location /publish {

        #    return 201;

        #}

 

        #location /play {

        #    return 202;

        #}

 

        #location /record_done {

        #    return 203;

        #}

        

    }

}

 

 

 

Index.html

 

<!DOCTYPE html>

<html>

<head>

    <title>HLS Player</title>

</head>

<body>

<video height="640" width="480" controls>

   <source src="cam.m3u8" type="application/vnd.apple.mpegurl" />

    <p class="warning">Your browser does not support HTML5 video.</p >

</video>

</body>

</html>

 

推送的命令

ffmpeg -f video4linux2 -i /dev/video0 -c:v libx264 -an -f flv rtmp://localhost:1935/hls/cam

 

产生了.m3u8文件

网页显示:一个播放器,但是无内容(像白纸一样)

 

举报
chuangc
发帖于2个月前 1回/45阅
顶部