Использование ffmpeg для генерации манифеста тире, и его нельзя воспроизвести с помощью dash.js

Я использую ffmpeg для кодирования входящего потока по протоколу rtmp, код выглядит следующим образом:

ffmpeg -re -i rtmp://localhost:1935${StreamPath} -use_timeline 1 /
-use_template 1 -window_size 10 -min_seg_duration 5000 -f dash out.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"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xsi:schemaLocation="urn:mpeg:DASH:schema:MPD:2011 
http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-
DASH_schema_files/DASH-MPD.xsd"
    profiles="urn:mpeg:dash:profile:isoff-live:2011"
    type="static"
    mediaPresentationDuration="PT1M36.4S"
    minBufferTime="PT8.3S">
    <ProgramInformation>
    </ProgramInformation>
    <Period start="PT0.0S">
        <AdaptationSet contentType="video" segmentAlignment="true" bitstreamSwitching="true" frameRate="30/1">
        <Representation id="0" mimeType="video/mp4" codecs="avc1.640028" width="1920" height="1080" frameRate="30/1">
            <SegmentTemplate timescale="15360" initialization="init-stream$RepresentationID$.m4s" media="chunk-stream$RepresentationID$-$Number%05d$.m4s" startNumber="4">
                <SegmentTimeline>
                    <S t="384000" d="128000" />
                    <S d="71680" />
                    <S d="128000" r="4" />
                    <S d="56832" />
                    <S d="128000" />
                    <S d="72704" />
                </SegmentTimeline>
            </SegmentTemplate>
        </Representation>
    </AdaptationSet>
    <AdaptationSet contentType="audio" segmentAlignment="true" bitstreamSwitching="true">
        <Representation id="1" mimeType="audio/mp4" codecs="mp4a.40.2" bandwidth="128000" audioSamplingRate="44100">
            <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2" />
            <SegmentTemplate timescale="44100" initialization="init-stream$RepresentationID$.m4s" media="chunk-stream$RepresentationID$-$Number%05d$.m4s" startNumber="4">
                <SegmentTimeline>
                    <S t="1099755" d="367616" />
                    <S d="205824" />
                    <S d="367616" r="4" />
                    <S d="162816" />
                    <S d="367616" />
                    <S d="207872" />
                </SegmentTimeline>
            </SegmentTemplate>
        </Representation>
    </AdaptationSet>
</Period>

When I try to play it on dash.js player, a error occured:

[112] Parsing complete: ( xml2json: 3.50ms, objectiron: 1.76ms, total: 0.00526s) Debug.js:127 
[116] SegmentTimeline detected using calculated Live Edge Time Debug.js:127 
[118] MediaSource attached to element.  Waiting on open... Debug.js:127 
[119] Manifest has been refreshed at Tue Jan 02 2018 01:57:35 GMT+0800 [1514829455.1] Debug.js:127 
[155] MediaSource is open! Debug.js:127 
[156] Duration successfully set to: 96.4 Debug.js:127 
[157] Added 0 inline events Debug.js:127 
[158] video codec: video/mp4;codecs="avc1.640028" Stream.js:225 
Uncaught TypeError: Cannot read property 'type' of null
    at z (Stream.js:225)
    at C (Stream.js:285)
    at D (Stream.js:373)
    at E (Stream.js:398)
    at Object.d [as activate] (Stream.js:107)
    at y (StreamController.js:363)
    at MediaSource.c (StreamController.js:342)

затем он не воспроизводится ...

Это потому, что я не установил параметры прямо в ffmpeg или это ошибка в dash.js?

Я действительно застрял здесь!


person Punkhead    schedule 01.01.2018    source источник


Ответы (1)


У меня была такая же проблема, и я отлаживал реализацию в dash.js.

Добавление bandwidth="<XYZ>" к тегу <Representation/> в вашем манифесте решает эту проблему, по крайней мере, для меня. (где <XYZ> больше 0 и в идеале правильно)

Раздражающе ffmpeg не добавил это в файлы .mpd автоматически, и когда dash.js инициализирует проигрыватель selectInitialTrack(tracks) итерирует дорожки getTracksWithHighestBitrate(), выбирая тот, у которого самый высокий битрейт / пропускная способность, имея только 1 свойство not bandwith, получается пустой список , вместо

person Christopher    schedule 22.05.2018