如何在网站中使用破折号或hls进行视频流式处理

时间:2019-07-05 06:59:21

标签: nginx video-streaming html5-video hlsl mpeg-dash

如何在网络中使用破折号或hls进行视频流处理。我可以在网络中进行实时摄像广播,也可以与其他计算机一起观看。但我无法在网络上做到这一点。

rtmp {
    server {
            listen 1935;
            chunk_size 4096;

            application src {
            live on;

            exec ffmpeg -i rtmp://localhost/src/$name
              -c:a libfdk_aac -b:a 32k  -c:v libx264 -b:v 128K -f flv rtmp://localhost/hls/$name_low
              -c:a libfdk_aac -b:a 64k  -c:v libx264 -b:v 256k -f flv rtmp://localhost/hls/$name_mid
              -c:a libfdk_aac -b:a 128k -c:v libx264 -b:v 512K -f flv rtmp://localhost/hls/$name_hi;
            }

            application live {
                    live on;
                    #allow publish 127.0.0.1;
                    #deny publish all;
                    #allow play 192.168.0.0/24;
                    #deny play all;

                    #HLS PARAMETERS 
                    hls on;
                    hls_path /usr/share/nginx/hls; #file path for save
                    hls_fragment 1s;
                    hls_playlist_length 10m; #Sets HLS playlist length. Defaults to 30 seconds 
                    #Sets HLS timestamp synchronization threshold. Default is 2ms. This feature prevents crackling noises after conversion from low-resolution RTMP (1KHz) to high-resolution MPEG-TS (90KHz).
                    hls_sync 100ms;
                    hls_continuous on;


                    #DASH PARAMETERS
                    dash on;
                    dash_path /usr/share/nginx/dash; #file path for save 
                    dash_fragment 1s; #Sets MPEG-DASH fragment length. Defaults to 5 seconds.
                    dash_playlist_length 10m; #Sets MPEG-DASH playlist length. Defaults to 30 seconds.

                    dash_cleanup off;                   
                    record off;
                    #exec ffmpeg -i rtmp://localhost/live/$name -threads 1 -c:v libx264 -profile:v baseline -b:v 350K -s 640x360 -f flv -c:a aac -ac 1 -strict -2 -b:a 56k rtmp://localhost/live360p/$name;
            }
            application live360p {
                    live on;
                    record off;

        }
    } 


<script src="http://cdn.dashjs.org/latest/dash.all.min.js"></script>

  <body>
    <video width="640" height="480" controls autoplay
           src="http://127.0.0.1:8000/usr/share/nginx/hls/hakan.m3u8">
    </video>
  </body>

  <body>
    <video data-dashjs-player
           width="640" height="480" controls autoplay
           src="http://127.0.0.1:8000/usr/share/nginx/dash/hakan.mpd">
    </video>
  </body>

如何从浏览器观看广播。如何填写html页面。 请帮助我。 我确实使用OBS进行广播,并且使用VLC播放器。

0 个答案:

没有答案