【问题标题】:Nginx-rtmp module and mpeg-dash(Dash industry dash.js)Nginx-rtmp 模块和 mpeg-dash(Dash 行业 dash.js)
【发布时间】:2016-03-23 04:18:35
【问题描述】:

Mpeg 短跑流媒体

我正在撰写关于直播的论文。我使用了带有 rtmp 模块的 ffmpeg、ngix 服务器和来自Dash industry 的 dash.js。我通过ffmpeg开始流到服务器,并通过dash播放,播放器运行良好,但出现了一些问题。

播放器仅在 mpd-dash 播放列表仍有块 t=0 时播放,因此每当用户请求播放器和 *.mpd 更新时没有块 t=0 播放器不会运行。

我将我的 *.mpd 文件上传到 Dash Validator 并得到错误:“Schematron 验证不成功 – DASH 无效!”。但是播放器是由 nginx - rtmp 模块而不是我生成的。

在搜索了一些论坛后,我得到了一些信息,表明 nginx-rtmp 模块生成了错误的破折号播放列表 *.mpd Nginx rtmp module -bug,并且可能是该错误已修复并合并到 github 中的 master(我认为是 Mered - report)。但是我尝试下载最新的nginx和rtmp模块,播放器也播放不正确。

如果我在 2 年前使用 dash.all.js 版本播放:如果播放列表 *.mpd 中存在块 t=0 或播放器不播放(在中间播放),视频只能播放良好(播放到结束)流媒体) 如果我使用 dash.all.js 持续版本:视频播放并很快停止播放或循环播放。

我真的需要一些帮助,我的截止日期快到了。

这是我的 nginx 配置(主配置):

    rtmp {

    server {
        listen 1935;
        ping 30s;
        notify_method get;
        chunk_size 4000;
        allow play all;

        application myapp {
            live on;
            dash on;
            dash_path /tmp/dash;

            hls on;
            hls_cleanup on;
            hls_sync 100ms;
            hls_fragment 2s;
            hls_path /tmp/hls;

            allow play all;


        }
    }
}

和其他一些配置:

location /hls {
        # Serve HLS fragments
        types {
            application/vnd.apple.mpegurl m3u8;
            video/mp2t ts;
        }
        root /tmp;
        add_header Cache-Control no-cache;
        add_header Access-Control-Allow-Origin *;
    }
    location /dash.js {
        root /usr/share/nginx/html;
    }

    location /streaminghls {
        root /usr/share/nginx/html;
    }

    location /dash {
        # Serve DASH fragments
        root /tmp;
        add_header Access-Control-Allow-Origin *;            

    }

在 html 播放器中:

 <script src="dash-old.all.js"></script>

        <script>
            function getUrlVars() {
                var vars = {};
                var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
                    vars[key] = value;
                });
                return vars;
            }
            function startVideo() {
                var vars = getUrlVars(),
                    url = "http://192.168.100.107:80/dash/Screen.mpd",
                    video,
                    context,
                    player;
                if (vars && vars.hasOwnProperty("url")) {
                    url = vars.url;
                }
                video = document.querySelector(".dash-video-player video");
                context = new Dash.di.DashContext();
                player = new MediaPlayer(context);
                player.startup();
                player.attachView(video);
                player.setAutoPlay(true);
                player.attachSource(url);
            }
        </script>

Hls 发挥出色,但不破折号。我尝试通过重新编译更改 nginx 配置和 rtmp-module 的 C 源中的 dash 配置,但没有改变。

我的mpd播放列表:

    <MPD xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xsi="http://www.w3.org/2011/XMLSchema-instance" type="dynamic" availabilityStartTime="2015-12-17T03:17:07+07:00" availabilityEndTime="2015-12-17T03:18:23+07:00" minimumUpdatePeriod="PT5S" minBufferTime="PT5S" timeShiftBufferDepth="PT0H0M0.00S" suggestedPresentationDelay="PT10S" profiles="urn:hbbtv:dash:profile:isoff-live:2012,urn:mpeg:dash:profile:isoff-live:2011" xsi:schemaLocation="urn:mpeg:DASH:schema:MPD:2011 DASH-MPD.xsd">
<Period start="PT0S" id="dash">
<AdaptationSet id="1" segmentAlignment="true" maxWidth="320" maxHeight="240" maxFrameRate="20">
<Representation id="Screen_H264" mimeType="video/mp4" codecs="avc1.64000c" width="320" height="240" frameRate="20" sar="1:1" startWithSAP="1" bandwidth="192000">
<SegmentTemplate presentationTimeOffset="0" timescale="1000" media="Screen-$Time$.m4v" initialization="Screen-init.m4v">

<SegmentTimeline>
<S t="0" d="12500"/>
<S t="12500" d="12500"/>
<S t="25000" d="10550"/>
<S t="35550" d="15700"/>
<S t="51250" d="12500"/>
<S t="63750" d="12500"/>
</SegmentTimeline>
</SegmentTemplate>
</Representation>
</AdaptationSet>
<AdaptationSet id="2" segmentAlignment="true">
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="1"/>
<Representation id="Screen_AAC" mimeType="audio/mp4" codecs="mp4a.40.2" audioSamplingRate="22050" startWithSAP="1" bandwidth="62000">
<SegmentTemplate presentationTimeOffset="0" timescale="1000" media="Screen-$Time$.m4a" initialization="Screen-init.m4a">
<SegmentTimeline>
<S t="0" d="12500"/>
<S t="12500" d="12500"/>
<S t="25000" d="10550"/>
<S t="35550" d="15700"/>
<S t="51250" d="12500"/>
<S t="63750" d="12500"/>
</SegmentTimeline>
</SegmentTemplate>
</Representation>
</AdaptationSet>
</Period>
</MPD>

我真的需要帮助。

感谢您的阅读,对我的英语不好感到非常抱歉。

【问题讨论】:

    标签: nginx video-streaming rtmp mpeg-dash dash.js


    【解决方案1】:

    虽然此问题已在 nginx-rtmp 中修复,但看起来原始存储库已过时 - 该修复仅在某些分支中可用。尝试从 https://github.com/sergey-dryabzhinsky/nginx-rtmp-modulehttps://github.com/mattpepin/nginx-rtmp-module 编译 nginx-rtmp - 两者似乎都有修复它的提交。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-11-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-28
      • 1970-01-01
      • 1970-01-01
      • 2013-08-13
      相关资源
      最近更新 更多