简体   繁体   English

nginx 中的 Mpeg-dash 支持

[英]Mpeg-dash support in nginx

I searched enough but couldn't sort out how to configure mpeg-dash vod in nginx using nginx_vod_module .我搜索了足够多,但无法弄清楚如何使用 nginx_vod_module 在 nginx 中配置 mpeg-dash vod。

Configuration inside http server block for enabling dash is用于启用破折号的 http 服务器块内的配置是

  location /voddash {
        vod dash;
        vod_mode local;
        root /usr/share/nginx/html;
        gzip on;
        gzip_types application/dash+xml mpd;
        add_header Access-Control-Allow-Headers "origin,range,accept-encoding,referer";
        add_header Access-Control-Expose-Headers "Server,range,Content-Length,Content-Range";
        add_header Access-Control-Allow-Methods "GET, HEAD, OPTIONS";
        add_header Access-Control-Allow-Origin "*";
        expires 100d;
        add_header Last-Modified "Sun, 19 Nov 2000 08:52:00 GMT";
    }

Request url is http://localhost/voddash/Input.mp4/manifest.mpd .请求 url 是http://localhost/voddash/Input.mp4/manifest.mpd I have placed only Input.mp4 in dash location.我只将 Input.mp4 放在破折号位置。 How can i stream dash content .Also is there anything like streaming of precreated manifest and chunks in nginx for mpeg dash?我怎样才能流式传输破折号内容。还有什么东西像在 nginx 中为 mpeg 破折号流式传输预先创建的清单和块?

For VoD its probably much simpler and effective to encode the content by your own to MPEG-DASH/HLS with ffmpeg as shown for example here , or using services such as bitcodin or zencoder. 对于视频点播它可能更简单,有效的通过自己对MPEG-DASH / HLS与ffmpeg的内容编码例如如图这里 ,或者使用诸如bitcodin或zencoder。

Using this solution you can encode the content to multiple different resolutions and bitrates which will give your clients a better streaming experience. 使用此解决方案,您可以将内容编码为多种不同的分辨率和比特率,从而为您的客户提供更好的流媒体体验。 For HTTP based streaming like MPEG-DASH and HLS there is no logic needed on the server side. 对于像MPEG-DASH和HLS这样的基于HTTP的流,在服务器端不需要逻辑。 You just need to place the segments and the index (MPD or M3U8) at an ordinary HTTP server such as nginx or also others and it works. 您只需要将段和索引(MPD或M3U8)放置在普通的HTTP服务器(例如nginx或其他)上,即可正常工作。

I have the same configuration on my server and use the following html + js code to play the dynamically generated manifest.mpd file: 我在服务器上具有相同的配置,并使用以下html + js代码播放动态生成的manifest.mpd文件:

<!doctype html>
<html>
    <head>
        <title>Dash.js Rocks</title>
        <style>
            video {
                width: 640px;
                height: 360px;
            }
        </style>
    </head>
    <body>
        <div>
            <video id="videoPlayer" controls></video>
        </div>
        <script src="http://dashif.org/reference/players/javascript/nightly/dash.js/dist/dash.all.min.js"></script>
        <script>
            (function(){
                var url = "http://localhost/voddash/Input.mp4/manifest.mpd";
                var player = dashjs.MediaPlayer().create();
                player.initialize(document.querySelector("#videoPlayer"), url, true);
            })();
        </script>
    </body>
</html>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM