ffmpeg - dashjs 在manifest.mpd 上找不到初始化段

标签 ffmpeg video-streaming webm dash.js

我正在关注this tutorial流式传输 WebM。我运行 ffmpeg 命令来生成视频/音频/ list 文件没有任何问题,但当我尝试在本地运行它时,根本没有视频或音频,并且 dashjs 充斥着控制台:

Searching for initialization.    
Start searching for initialization.     
Perform init search: http://localhost:8080/video_1280x720_500k.webm    
Perform SIDX load: http://localhost:8080/video_640x360_750k.webm     
Perform SIDX load: http://localhost:8080/video_1280x720_500k.webm 

将其写入控制台,直到我停止服务器。我尝试过使用其他 mpd 文件,例如 this ,用于 dashjs quickstart并且播放视频没有任何问题。

我用了this guideUbuntu 14.04 LTS 上安装最新版本的 ffmpeg:

ffmpeg version N-79688-g3cb3ddd Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 5.3.0 (Ubuntu 5.3.0-3ubuntu1~14.04) 20151204
configuration: --prefix=/home/ab/cpp/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/ab/cpp/ffmpeg_build/include --extra-ldflags=-L/home/ab/cpp/ffmpeg/lib --bindir=/home/ab/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
libavutil      55. 23.100 / 55. 23.100
libavcodec     57. 38.100 / 57. 38.100
libavformat    57. 34.103 / 57. 34.103
libavdevice    57.  0.101 / 57.  0.101
libavfilter     6. 44.100 /  6. 44.100
libswscale      4.  1.100 /  4.  1.100
libswresample   2.  0.101 /  2.  0.101
libpostproc    54.  0.100 / 54.  0.100

在 ffmpeg 上运行时:

ffmpeg \
 -f webm_dash_manifest -i video_160x90_250k.webm \
 -f webm_dash_manifest -i video_320x180_500k.webm \
 -f webm_dash_manifest -i video_640x360_750k.webm \
 -f webm_dash_manifest -i video_640x360_1000k.webm \
 -f webm_dash_manifest -i video_1280x720_500k.webm \
 -f webm_dash_manifest -i audio_128k.webm \
 -c copy -map 0 -map 1 -map 2 -map 3 -map 4 -map 5 \
 -f webm_dash_manifest \
 -adaptation_sets "id=0,streams=0,1,2,3,4 id=1,streams=5" \
 manifest.mpd

它生成以下ma​​nifest.mpd:

<?xml version="1.0" encoding="UTF-8"?>
<MPD
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns="urn:mpeg:DASH:schema:MPD:2011" xsi:schemaLocation="urn:mpeg:DASH:schema:MPD:2011" type="static" mediaPresentationDuration="PT117.726S" minBufferTime="PT1S" profiles="urn:webm:dash:profile:webm-on-demand:2012">
  <Period id="0" start="PT0S" duration="PT117.726S">
    <AdaptationSet id="0" mimeType="video/webm" codecs="vp9" lang="eng" bitstreamSwitching="true" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
      <Representation id="0" bandwidth="198155" width="160" height="90">
        <BaseURL>video_160x90_250k.webm</BaseURL>
        <SegmentBase indexRange="2007834-2008211">
          <Initialization range="0-437" />
        </SegmentBase>
      </Representation>
      <Representation id="1" bandwidth="459264" width="320" height="180">
        <BaseURL>video_320x180_500k.webm</BaseURL>
        <SegmentBase indexRange="4459996-4460374">
          <Initialization range="0-439" />
        </SegmentBase>
      </Representation>
      <Representation id="2" bandwidth="718495" width="640" height="360">
        <BaseURL>video_640x360_750k.webm</BaseURL>
        <SegmentBase indexRange="6614036-6614414">
          <Initialization range="0-441" />
        </SegmentBase>
      </Representation>
      <Representation id="3" bandwidth="931445" width="640" height="360">
        <BaseURL>video_640x360_1000k.webm</BaseURL>
        <SegmentBase indexRange="8309082-8309460">
          <Initialization range="0-441" />
        </SegmentBase>
      </Representation>
      <Representation id="4" bandwidth="821274" width="1280" height="720">
        <BaseURL>video_1280x720_500k.webm</BaseURL>
        <SegmentBase indexRange="8728812-8729190">
          <Initialization range="0-441" />
        </SegmentBase>
      </Representation>
    </AdaptationSet>
    <AdaptationSet id="1" mimeType="audio/webm" codecs="vorbis" lang="eng" audioSamplingRate="44100" bitstreamSwitching="true" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
      <Representation id="5" bandwidth="107104">
        <BaseURL>audio_128k.webm</BaseURL>
        <SegmentBase indexRange="1538710-1539184">
          <Initialization range="0-4112" />
        </SegmentBase>
      </Representation>
    </AdaptationSet>
  </Period>
</MPD>

index.html 有一些更改,因为 dash.js 更改了播放器的初始化方式。

<!doctype html>
<html>
    <head>
        <title>Video Streaming</title>
        <style>
            video {
                width: 640px;
                height: 360px;
            }
        </style>
        <script src="http://cdn.dashjs.org/latest/dash.all.debug.js"></script>
    </head>
    <body>
        <div>
            <video data-dashjs-player src="manifest.mpd" controls></video>
        </div>
    </body>
</html>

这是 Chromium 的 log file 。我正在转换this webm来自this site.

如果我错过了任何其他相关信息,或者有人可以引导我走向正确的方向,请告诉我。

编辑:

就像 Will Law 提到的那样,使用 Shaka 播放器对我当前的 list 没有任何问题。希望这对其他人有帮助。

最佳答案

@Abelardo - 该文章是针对 1.x 版本的 dash.js 播放器编写的。在 2.x 版本中,页面嵌入和初始化指令已更改(正如您所指出的)。此外,dash.webm.min.js 库自 2.x 以来尚未更新。 dash.js 项目的大多数参与者关注的焦点是 AVC 和 ISOBMFF。虽然我们希望 dash.webm.min.js 得到更新和维护,但它并没有,所以我不希望你为它的工作而绞尽脑汁。我希望 Shaka 播放器作为 Google 的一项举措,能够与 WebM 保持同步——这对你有用吗?如果您想深入了解并更新 dash.webm.min,这对社区来说是有好处的。

关于ffmpeg - dashjs 在manifest.mpd 上找不到初始化段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36929303/

相关文章:

java - 如何从视频java中提取帧?

ios - iOS 编程支持的实时视频流格式

base64 - MediaRecorder 的 Webm blob 产生损坏的视频

html - 并非所有 webm 文件都在 firefox 中播放

ffmpeg - 使用 FFMPEG 录制 IP 摄像机流

video - 无法使用ffmpeg更改视频字幕编解码器

ios - iOS 中的交互式视频 : Is it possible to trigger specific actions in code by tapping discrete parts in the video?

video-streaming - 还有其他选项可以在不使用 azure 媒体服务的情况下直接流式传输 blob 视频吗?

flash - Html5 视频和 Flash 方法

ffmpeg - 添加 GIF 作为水印和循环 FFMPEG