0

サーバーからのビデオのアダプティブ ビット レート ストリーミングに mpeg ダッシュを使用しています。

ffmpeg と MP4Box を使用して、ソース .mp4 から 4 つの異なる品質のビデオ ファイルを生成しました。

生成された .mpd ファイルには、以下のコードがあります

<?xml version="1.0"?>
<!-- MPD file Generated with GPAC version 0.5.1-DEV-rev5619  on 2015-07-14T11:07:18Z-->
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.500000S" type="static" mediaPresentationDuration="PT0H3M1.42S" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011">
 <ProgramInformation moreInformationURL="http://gpac.sourceforge.net">
  <Title>test/test.mpd generated by GPAC</Title>
 </ProgramInformation>

 <Period duration="PT0H3M1.42S">
  <AdaptationSet segmentAlignment="true" maxWidth="1920" maxHeight="1080" maxFrameRate="24" par="16:9" lang="und" subsegmentStartsWithSAP="1">
   <Representation id="1" mimeType="video/mp4" codecs="avc1.64000d" width="320" height="240" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="375715">
    <BaseURL>400_dashinit.mp4</BaseURL>
    <SegmentBase indexRangeExact="true" indexRange="904-1403">
      <Initialization range="0-903"/>
    </SegmentBase>
   </Representation>
   <Representation id="2" mimeType="video/mp4" codecs="avc1.640015" width="420" height="270" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="644824">
    <BaseURL>700_dashinit.mp4</BaseURL>
    <SegmentBase indexRangeExact="true" indexRange="905-1404">
      <Initialization range="0-904"/>
    </SegmentBase>
   </Representation>
   <Representation id="3" mimeType="video/mp4" codecs="avc1.64001f" width="1024" height="576" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="1349484">
    <BaseURL>1500_dashinit.mp4</BaseURL>
    <SegmentBase indexRangeExact="true" indexRange="905-1404">
      <Initialization range="0-904"/>
    </SegmentBase>
   </Representation>
   <Representation id="4" mimeType="video/mp4" codecs="avc1.64001f" width="1280" height="720" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="2264379">
    <BaseURL>2500_dashinit.mp4</BaseURL>
    <SegmentBase indexRangeExact="true" indexRange="905-1404">
      <Initialization range="0-904"/>
    </SegmentBase>
   </Representation>
   <Representation id="5" mimeType="video/mp4" codecs="avc1.640028" width="1920" height="1080" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="3633049">
    <BaseURL>4000_dashinit.mp4</BaseURL>
    <SegmentBase indexRangeExact="true" indexRange="906-1405">
      <Initialization range="0-905"/>
    </SegmentBase>
   </Representation>
  </AdaptationSet>
 </Period>
</MPD>

クライアント側で mpeg ダッシュ コンテンツを再生するために、dash.js と一緒に video.js を使用しています。問題は、Chrome 開発ツールからネットワーク条件をシミュレートすると、ビデオが完全に再生されないことです。

それは時々機能し、他の人には機能しません。たとえば、ストリームは 400kbps のビット レートで開始し、利用可能な十分な帯域幅を検出して 2500kbps に切り替えます。次に、帯域幅を再び 400kbps に下げると、ある時点でビデオがフリーズします。

ストリームを切り替えようとすると、再生の最初の数秒後にビデオがフリーズすることがあります。ffmpeg を介してビデオ ファイルを生成するとき、または MP4Box を介して .mpd ファイルを生成するときに、欠落しているコマンド ライン パラメーターがあると思います。

以下は、ffmpeg と MP4Box に使用するコマンドです。

ffmpeg -y -i inputfile -c:a libfdk_aac -ac 2 -ab 128k -c:v libx264 -r 24 – g 24 -b:v 1500k -maxrate 1500k -bufsize 1000k -vf "scale=-1:720" outputfile.mp4


MP4Box -dash [DURATION] -rap -frag-rap -profile [PROFILE] -out [path/to/outpout.file] [path/to/input1.file] [path/to/input2.file] [path/to/input3.file]

また、MP4Box 経由で .mpd ファイルを生成しているときに、コンソールで警告を下回っています

[DASH]: Files have non-proportional track layouts (320x240 vs 420x270) but sample size and aspect ratio match, assuming precision issue
[DASH]: Files have non-proportional track layouts (320x240 vs 1024x576) but sample size and aspect ratio match, assuming precision issue
[DASH]: Files have non-proportional track layouts (320x240 vs 1280x720) but sample size and aspect ratio match, assuming precision issue
[DASH]: Files have non-proportional track layouts (320x240 vs 1920x1080) but sample size and aspect ratio match, assuming precision issue

ビデオの再生が停止するたびに、Chrome コンソールにこれらのログが記録されます

Number of times the buffer has run dry: 25
Apply STRONG to buffer rule.
Quit switching bit rates.

バッファが枯渇し、ビットレートの切り替えが停止する理由についての手がかりはありません。

プロセスで主に間違っていることはありますか?

4

0 に答える 0