特定の MPEG-DASH マニフェストを作成するための FFMpeg コマンドライン

特定の MPEG-DASH マニフェストを作成するための FFMpeg コマンドライン

私は、以下のマニフェストを生成する FFMpeg コマンドを取得しようとしました。以下は、私が作成しようとした FFmpeg コマンドですが、サード パーティ システムからのストリームを複製して、自分のストリームをそのシステムに追加し、実際に再生できるようにしようとしているのと同じマニフェスト ファイルが作成されませんでした。

"$ffmpeg_path" \
    -i "$input_file" \
    -r 30000/1001 \
    -vf "scale=3840:1080" \
    -c:v libx265 \
    -c:a aac -b:a 128k \
    -ar 48000 \
    -f dash \
    -use_timeline 1 \
    -use_template 1 \
    -init_seg_name "init-stream\$RepresentationID\$.m4s" \
    -media_seg_name "chunk-stream\$RepresentationID\$-\$Number%05d\$.m4s" \
    -seg_duration 3 \
    "$output_file"

上記のコードにより、以下のような構造のマニフェストが生成されます。

<?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="PT1M35.1S"
    maxSegmentDuration="PT3.0S"
    minBufferTime="PT16.8S">
    <ProgramInformation>
    </ProgramInformation>
    <ServiceDescription id="0">
    </ServiceDescription>
    <Period id="0" start="PT0.0S">
        <AdaptationSet id="0" contentType="video" startWithSAP="1" segmentAlignment="true" bitstreamSwitching="true" frameRate="30000/1001" maxWidth="3840" maxHeight="1080" par="32:9">
            <Representation id="0" mimeType="video/mp4" codecs="hev1" bandwidth="2227590" width="3840" height="1080" sar="1:1">
                <SegmentTemplate timescale="30000" initialization="init-stream$RepresentationID$.m4s" media="chunk-stream$RepresentationID$-$Number%05d$.m4s" startNumber="1">
                    <SegmentTimeline>
                        <S t="0" d="247247" />
                        <S d="250250" r="9" />
                        <S d="104104" />
                    </SegmentTimeline>
                </SegmentTemplate>
            </Representation>
        </AdaptationSet>
        <AdaptationSet id="1" contentType="audio" startWithSAP="1" segmentAlignment="true" bitstreamSwitching="true">
            <Representation id="1" mimeType="audio/mp4" codecs="mp4a.40.2" bandwidth="128000" audioSamplingRate="48000">
                <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="1" />
                <SegmentTemplate timescale="48000" initialization="init-stream$RepresentationID$.m4s" media="chunk-stream$RepresentationID$-$Number%05d$.m4s" startNumber="1">
                    <SegmentTimeline>
                        <S t="0" d="143360" />
                        <S d="144384" r="29" />
                        <S d="93120" />
                    </SegmentTimeline>
                </SegmentTemplate>
            </Representation>
        </AdaptationSet>
    </Period>
</MPD>

問題は、マニフェストが以下のマニフェストのように見えるストリームを作成する必要があることです。以下のように見えたり機能しなかったりすると、このサードパーティ システムでは正しく再生されません。

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" profiles="urn:mpeg:dash:profile:isoff-live:2011" type="static" mediaPresentationDuration="PT1M35.7S" minBufferTime="PT5.9S" xsi:schemaLocation="urn:mpeg:DASH:schema:MPD:2011 http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-DASH_schema_files/DASH-MPD.xsd">
    <ProgramInformation />
    <Period id="0" start="PT0.0S">
        <AdaptationSet id="0" contentType="video" segmentAlignment="true" bitstreamSwitching="true">
            <Representation id="0" bandwidth="12000000" width="3840" height="1080" frameRate="30000/1001" mimeType="video/mp4" codecs="hev1">
                <SegmentTemplate media="chunk-stream$RepresentationID$-$Number%05d$.m4s" initialization="init-stream$RepresentationID$.m4s" startNumber="1" timescale="30000">
                    <SegmentTimeline>
                        <S t="0" d="89089" r="31" />
                        <S d="21021" />
                    </SegmentTimeline>
                </SegmentTemplate>
            </Representation>
        </AdaptationSet>
        <AdaptationSet id="1" contentType="audio" segmentAlignment="true" bitstreamSwitching="true">
            <Representation id="1" bandwidth="1536000" audioSamplingRate="48000" mimeType="audio/mp4" codecs="mp4a.40.2">
                <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="16" />
                <SegmentTemplate media="chunk-stream$RepresentationID$-$Number%05d$.m4s" initialization="init-stream$RepresentationID$.m4s" startNumber="1" timescale="48000">
                    <SegmentTimeline>
                        <S t="0" d="143360" />
                        <S d="142336" r="2" />
                        <S d="143360" />
                        <S d="142336" r="3" />
                        <S d="143360" />
                        <S d="142336" r="3" />
                        <S d="143360" />
                        <S d="142336" r="3" />
                        <S d="143360" />
                        <S d="142336" r="3" />
                        <S d="143360" />
                        <S d="142336" r="3" />
                        <S d="143360" />
                        <S d="142336" r="1" />
                        <S d="32768" />
                    </SegmentTimeline>
                </SegmentTemplate>
            </Representation>
        </AdaptationSet>
    </Period>
</MPD>

関連情報