mpeg-dash - mpeg-dash mpd 文件和段不在同一台服务器上。如何修改段网址?
问题描述
我使用 MP4Box 生成了分段文件和 .mpd 清单文件。我将片段上传到 Firebase 存储。然后我将 .mpd 文件的段 url 更改为 firebase 存储下载 url。但这给了我一个无效的 mpd 文件。
MP4Box 生成后的 .mpd 文件:
<?xml version="1.0"?>
<!-- MPD file Generated with GPAC version 0.8.0-revrelease at 2019-08-06T09:00:00.629Z-->
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.500S" type="static" mediaPresentationDuration="PT0H0M38.080S" maxSegmentDuration="PT0H0M5.005S" profiles="urn:mpeg:dash:profile:full:2011">
<ProgramInformation moreInformationURL="http://gpac.io">
<Title>try_1.mpd generated by GPAC</Title>
</ProgramInformation>
<Period duration="PT0H0M38.080S">
<AdaptationSet segmentAlignment="true" maxWidth="1280" maxHeight="720" maxFrameRate="24000/1001" par="16:9" lang="und" startWithSAP="1">
<ContentComponent id="1" contentType="video" />
<ContentComponent id="2" contentType="audio" />
<Representation id="1" mimeType="video/mp4" codecs="avc1.64001F,mp4a.40.2" width="1280" height="720" frameRate="24000/1001" sar="1:1" audioSamplingRate="48000" bandwidth="1545875">
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
<SegmentList timescale="1000" duration="4000">
<Initialization sourceURL="segment_init.mp4"/>
<SegmentURL media="segment_1.m4s"/>
<SegmentURL media="segment_2.m4s"/>
<SegmentURL media="segment_3.m4s"/>
<SegmentURL media="segment_4.m4s"/>
<SegmentURL media="segment_5.m4s"/>
<SegmentURL media="segment_6.m4s"/>
<SegmentURL media="segment_7.m4s"/>
<SegmentURL media="segment_8.m4s"/>
</SegmentList>
</Representation>
</AdaptationSet>
</Period>
</MPD>
更改 SegmentURL 后的 .mpd 文件:
<?xml version="1.0"?>
<!-- MPD file Generated with GPAC version 0.8.0-revrelease at 2019-08-06T09:00:00.629Z-->
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.500S" type="static" mediaPresentationDuration="PT0H0M38.080S" maxSegmentDuration="PT0H0M5.005S" profiles="urn:mpeg:dash:profile:full:2011">
<ProgramInformation moreInformationURL="http://gpac.io">
<Title>try_1.mpd generated by GPAC</Title>
</ProgramInformation>
<Period duration="PT0H0M38.080S">
<AdaptationSet segmentAlignment="true" maxWidth="1280" maxHeight="720" maxFrameRate="24000/1001" par="16:9" lang="und" startWithSAP="1">
<ContentComponent id="1" contentType="video" />
<ContentComponent id="2" contentType="audio" />
<Representation id="1" mimeType="video/mp4" codecs="avc1.64001F,mp4a.40.2" width="1280" height="720" frameRate="24000/1001" sar="1:1" audioSamplingRate="48000" bandwidth="1545875">
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
<SegmentList timescale="1000" duration="4000">
<Initialization sourceURL="https://firebasestorage.googleapis.com/v0/b/angar-fashion.appspot.com/o/dash-mpeg%2Fsegment_init.mp4?alt=media&token=52f0a3e4-8994-4538-876e-14aaa4d5ab29"/>
<SegmentURL media="https://firebasestorage.googleapis.com/v0/b/angar-fashion.appspot.com/o/dash-mpeg%2Fsegment_1.m4s?alt=media&token=ec1c7959-3191-4774-8187-ad4f8358a91c"/>
<SegmentURL media="https://firebasestorage.googleapis.com/v0/b/angar-fashion.appspot.com/o/dash-mpeg%2Fsegment_2.m4s?alt=media&token=7cca4f12-c295-45b9-b094-0115f2415c95"/>
<SegmentURL media="https://firebasestorage.googleapis.com/v0/b/angar-fashion.appspot.com/o/dash-mpeg%2Fsegment_3.m4s?alt=media&token=6aef7cb0-a637-4abb-9e92-c9cb44805d27"/>
<SegmentURL media="https://firebasestorage.googleapis.com/v0/b/angar-fashion.appspot.com/o/dash-mpeg%2Fsegment_4.m4s?alt=media&token=01df0576-401d-4b2a-8434-6f11ecdb74bf"/>
<SegmentURL media="https://firebasestorage.googleapis.com/v0/b/angar-fashion.appspot.com/o/dash-mpeg%2Fsegment_5.m4s?alt=media&token=2ec2692f-5178-4b74-bfa8-cf862fc7e2b4"/>
<SegmentURL media="https://firebasestorage.googleapis.com/v0/b/angar-fashion.appspot.com/o/dash-mpeg%2Fsegment_6.m4s?alt=media&token=a18b54ea-2e81-4ec6-8030-459a67893ff5"/>
<SegmentURL media="https://firebasestorage.googleapis.com/v0/b/angar-fashion.appspot.com/o/dash-mpeg%2Fsegment_7.m4s?alt=media&token=c6f820b7-f3f3-4625-b8bd-2118ff7e9635"/>
<SegmentURL media="https://firebasestorage.googleapis.com/v0/b/angar-fashion.appspot.com/o/dash-mpeg%2Fsegment_8.m4s?alt=media&token=99d2b5b4-1746-491d-8f85-7782e5fdf488"/>
</SegmentList>
</Representation>
</AdaptationSet>
</Period>
</MPD>
我已经尝试过 BaseURL 标签。但它也没有奏效。
<?xml version="1.0"?>
<!-- MPD file Generated with GPAC version 0.8.0-revrelease at 2019-08-06T09:00:00.629Z-->
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.500S" type="static" mediaPresentationDuration="PT0H0M38.080S" maxSegmentDuration="PT0H0M5.005S" profiles="urn:mpeg:dash:profile:full:2011">
<ProgramInformation moreInformationURL="http://gpac.io">
<Title>try_1.mpd generated by GPAC</Title>
</ProgramInformation>
<BaseURL>https://firebasestorage.googleapis.com/v0/b/angar-fashion.appspot.com/o/</BaseURL>
<Period duration="PT0H0M38.080S">
<AdaptationSet segmentAlignment="true" maxWidth="1280" maxHeight="720" maxFrameRate="24000/1001" par="16:9" lang="und" startWithSAP="1">
<ContentComponent id="1" contentType="video" />
<ContentComponent id="2" contentType="audio" />
<Representation id="1" mimeType="video/mp4" codecs="avc1.64001F,mp4a.40.2" width="1280" height="720" frameRate="24000/1001" sar="1:1" audioSamplingRate="48000" bandwidth="1545875">
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
<SegmentList timescale="1000" duration="4000">
<Initialization sourceURL="dash-mpeg%2Fsegment_init.mp4?alt=media&token=52f0a3e4-8994-4538-876e-14aaa4d5ab29"/>
<SegmentURL media="dash-mpeg%2Fsegment_1.m4s?alt=media&token=ec1c7959-3191-4774-8187-ad4f8358a91c"/>
<SegmentURL media="dash-mpeg%2Fsegment_2.m4s?alt=media&token=7cca4f12-c295-45b9-b094-0115f2415c95"/>
<SegmentURL media="dash-mpeg%2Fsegment_3.m4s?alt=media&token=6aef7cb0-a637-4abb-9e92-c9cb44805d27"/>
<SegmentURL media="dash-mpeg%2Fsegment_4.m4s?alt=media&token=01df0576-401d-4b2a-8434-6f11ecdb74bf"/>
<SegmentURL media="dash-mpeg%2Fsegment_5.m4s?alt=media&token=2ec2692f-5178-4b74-bfa8-cf862fc7e2b4"/>
<SegmentURL media="dash-mpeg%2Fsegment_6.m4s?alt=media&token=a18b54ea-2e81-4ec6-8030-459a67893ff5"/>
<SegmentURL media="dash-mpeg%2Fsegment_7.m4s?alt=media&token=c6f820b7-f3f3-4625-b8bd-2118ff7e9635"/>
<SegmentURL media="dash-mpeg%2Fsegment_8.m4s?alt=media&token=99d2b5b4-1746-491d-8f85-7782e5fdf488"/>
</SegmentList>
</Representation>
</AdaptationSet>
</Period>
</MPD>
更改 SegmentURLs 和 BaseURL 后的 .mpd 文件无效。
解决方案
&
在 URL 中需要转义,因为它是 XML 中的控制字符。
将其替换为&
。
推荐阅读
- jqgrid - JQGrid 本地搜索多列
- c# - “您的意思是运行 dotnet SDK 命令吗?请在 Windows 命令提示符下安装 dotnetsdk”
- python - 通过蓝牙将音乐从带有 Ubuntu 的 PC 流式传输到音频设备
- c - 将自动变量的指针传递给 DMA 函数
- c# - 如何在C#中将项目添加到数组中
- python-3.x - 如何使用字符串在文本文件中添加数字
- html - 类别列表中的 Anchor 标签
- rabbitmq - 均匀分布rabbitmq消息
- javascript - 如何使事件(js)与由“for”(php)创建的输入收音机一起工作?
- ios - Instagram 故事编辑器的 iOS Swift 实现