MPD解析:标签有很多信息?

时间:2019-04-04 01:15:04

标签: python xml elementtree

我尝试使用ElementTree解析MPD文件

scrollTo
<?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="PT12M14.1S"
    minBufferTime="PT16.0S">
    <ProgramInformation>
    </ProgramInformation>
    <Period id="0" start="PT0.0S">
        <AdaptationSet id="0" contentType="video" segmentAlignment="true" bitstreamSwitching="true">
            <Representation id="0" mimeType="video/mp4" codecs="avc1.640033" bandwidth="53739" width="4096" height="1714" frameRate="24/1">
                <SegmentTemplate timescale="12288" initialization="init-stream$RepresentationID$.mp4" media="chunk-stream$RepresentationID$-$Number%05d$.mp4" startNumber="1">
                    <SegmentTimeline>

它不仅给我import xml.etree.ElementTree as ET tree = ET.parse(mpd_file[0]) root = tree.getroot() for node in tree.iter(): if 'Representation' in node.tag: rep_node = node break print(rep_node.tag, rep_node.attrib) ,而且还给我:

Representation

此外,我无法直接获得所有带有标签('{urn:mpeg:dash:schema:mpd:2011}Representation', {'mimeType': 'video/mp4', 'width': '4096', 'bandwidth': '56271', 'codecs': 'avc1.640033', 'frameRate': '24/1', 'id': '0', 'height': '1714'}) 的节点。我必须遍历整棵树。

0 个答案:

没有答案