Создать читабельные манифест при помощи ffmpeg

<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="dynamic" minimumUpdatePeriod="PT500S" suggestedPresentationDelay="PT8S" availabilityStartTime="2025-01-13T14:44:01.404Z" publishTime="2025-01-13T15:27:29.698Z" maxSegmentDuration="PT9.0S" minBufferTime="PT16.0S">
<ProgramInformation></ProgramInformation>
<ServiceDescription id="0"> </ServiceDescription>
<Period id="0" start="PT0.0S">
    <AdaptationSet id="0" contentType="video" startWithSAP="1" segmentAlignment="true" bitstreamSwitching="true" maxFrameRate="30/1" maxWidth="430" maxHeight="240" par="120:67">
        <Representation id="1" mimeType="video/webm" codecs="vp09.00.11.08" bandwidth="60000" width="258" height="144" sar="2880:2881" frameRate="30/1">
            <SegmentTemplate timescale="1000000" duration="9000000" initialization="i-$RepresentationID$.webm" media="s-$RepresentationID$-$Number%05d$.webm" startNumber="1"> </SegmentTemplate>
        </Representation>
        <Representation id="2" mimeType="video/webm" codecs="vp09.00.20.08" bandwidth="150000" width="430" height="240" sar="2880:2881" frameRate="30/1">
            <SegmentTemplate timescale="1000000" duration="9000000" initialization="i-$RepresentationID$.webm" media="s-$RepresentationID$-$Number%05d$.webm" startNumber="1"> </SegmentTemplate>
        </Representation>
    </AdaptationSet>
    </Period>

Это пожалуй максимум чего смогла добиться путем выполнения команды

ffmpeg -i FILE -deadline good
    -c:a libopus -c:v libvpx-vp9 -pix_fmt yuv420p 
    -map 0:a:0 -b:a:0 128k 
    -map 0:v:0 -filter:v:0 scale=-1:144 -frame_rate 30 -b:v:0 60k 
    -map 0:v:0 -filter:v:1 scale=-1:240 -frame_rate 30 -b:v:1 150k 
    -init_seg_name "i-$RepresentationID$.$ext$"
    -media_seg_name "s-$RepresentationID$-$Number%05d$.$ext$"
    -dash_segment_type webm 
    -use_template 1 -use_timeline 0 -seg_duration 9 
    -adaptation_sets "id=0, streams=v id=1, streams=a" 
    -f dash /manifest.mpd

В целом все работает, но рассчитываю добиться такой структуры

https://dash.akamaized.net/akamai/bbb_30fps/bbb_30fps.mpd

<MPD mediaPresentationDuration="PT634.566S" minBufferTime="PT2.00S" profiles="urn:hbbtv:dash:profile:isoff-live:2012,urn:mpeg:dash:profile:isoff-live:2011" type="static" xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:mpeg:DASH:schema:MPD:2011 DASH-MPD.xsd">
 <BaseURL>./</BaseURL>
 <Period>
  <AdaptationSet mimeType="video/mp4" contentType="video" subsegmentAlignment="true" subsegmentStartsWithSAP="1" par="16:9">
   <SegmentTemplate duration="120" timescale="30" media="$RepresentationID$/$RepresentationID$_$Number$.m4v" startNumber="1" initialization="$RepresentationID$/$RepresentationID$_0.m4v"/>
   <Representation id="bbb_30fps_1024x576_2500k" codecs="avc1.64001f" bandwidth="3134488" width="1024" height="576" frameRate="30" sar="1:1" scanType="progressive"/>
   <Representation id="bbb_30fps_1280x720_4000k" codecs="avc1.64001f" bandwidth="4952892" width="1280" height="720" frameRate="30" sar="1:1" scanType="progressive"/>
   <Representation id="bbb_30fps_1920x1080_8000k" codecs="avc1.640028" bandwidth="9914554" width="1920" height="1080" frameRate="30" sar="1:1" scanType="progressive"/>
   <Representation id="bbb_30fps_320x180_200k" codecs="avc1.64000d" bandwidth="254320" width="320" height="180" frameRate="30" sar="1:1" scanType="progressive"/>
   <Representation id="bbb_30fps_320x180_400k" codecs="avc1.64000d" bandwidth="507246" width="320" height="180" frameRate="30" sar="1:1" scanType="progressive"/>
   <Representation id="bbb_30fps_480x270_600k" codecs="avc1.640015" bandwidth="759798" width="480" height="270" frameRate="30" sar="1:1" scanType="progressive"/>
   <Representation id="bbb_30fps_640x360_1000k" codecs="avc1.64001e" bandwidth="1254758" width="640" height="360" frameRate="30" sar="1:1" scanType="progressive"/>
   <Representation id="bbb_30fps_640x360_800k" codecs="avc1.64001e" bandwidth="1013310" width="640" height="360" frameRate="30" sar="1:1" scanType="progressive"/>
   <Representation id="bbb_30fps_768x432_1500k" codecs="avc1.64001e" bandwidth="1883700" width="768" height="432" frameRate="30" sar="1:1" scanType="progressive"/>
   <Representation id="bbb_30fps_3840x2160_12000k" codecs="avc1.640033" bandwidth="14931538" width="3840" height="2160" frameRate="30" sar="1:1" scanType="progressive"/>
  </AdaptationSet>
  <AdaptationSet mimeType="audio/mp4" contentType="audio" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
   <Accessibility schemeIdUri="urn:tva:metadata:cs:AudioPurposeCS:2007" value="6"/>
   <Role schemeIdUri="urn:mpeg:dash:role:2011" value="main"/>
   <SegmentTemplate duration="192512" timescale="48000" media="$RepresentationID$/$RepresentationID$_$Number$.m4a" startNumber="1" initialization="$RepresentationID$/$RepresentationID$_0.m4a"/>
   <Representation id="bbb_a64k" codecs="mp4a.40.5" bandwidth="67071" audioSamplingRate="48000">
    <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
   </Representation>
  </AdaptationSet>
 </Period>
</MPD>

Один общий тег SegmentTemplate на все видеопотоки. Перечитала всю документацию, вроде бы есть решение как это сделать. Но почему то у меня ничего не выходит...

Возможно ли сразу на выходе сделать данную структуру по шаблону или остается только в ручную либо писать еще код...

Интересен вариант решения когда на выходе получаем готовый, писать еще код после обработки ffmpeg, не актульно. Актуально когда сразу на выде получить готовую структуру по шаблону


Ответы (0 шт):