videojs / mpd-parser Goto Github PK
View Code? Open in Web Editor NEWHome Page: https://videojs.github.io/mpd-parser/
License: Other
Home Page: https://videojs.github.io/mpd-parser/
License: Other
Hi, I'm trying the code provided in this example videojs.github.io/mpd-parser and passing to it the url https://dash.edgesuite.net/akamai/bbb_30fps/bbb_30fps.mpd
. However, the resolvedUri
in the returned parser manifest seems to be wrong.
I. e., parsedMpd.playlists[0].segments[0]
map: {uri: "bbb_30fps_1024x576_2500k/bbb_30fps_1024x576_2500k_0.m4v", resolvedUri: "https://videojs.github.io/mpd-parser/bbb_30fps_1024x576_2500k/bbb_30fps_1024x576_2500k_0.m4v"}
number: 1
resolvedUri: "https://videojs.github.io/mpd-parser/bbb_30fps_1024x576_2500k/bbb_30fps_1024x576_2500k_1.m4v"
timeline: 0
uri: "bbb_30fps_1024x576_2500k/bbb_30fps_1024x576_2500k_1.m4v"
I was expected a resolvedUri
such as https://dash.edgesuite.net/akamai/bbb_30fps/bbb_30fps_1024x576_2500k/bbb_30fps_1024x576_2500k_0.m4v
. Am I misunderstanding something?
Hi,
Thanks for creating such an awesome parser! I'm currently migrating a service that parses manifests to use mpd instead of m3u8 manifests. I am trying to find our when the stream's absolute start time is. Similar to the X-PROGRAM-DATE-TIME
of HLS.
Looking at the Docs' parsed output, it looks like there should be a dateTimeObject. In the m3u8 parser, this object definitely exists, and I can see in the code that it gets populated.
I am parsing both Live and Vod mpd manifests but this value never gets populated - and I can't see anywhere in the code where it gets set.
Looking at some Shaka player documentation, I've been able to manually calculate the startTime of my stream as seen here. However, I can't see the variables exposed anywhere, such as timescale
etc.
Hopefully I'm missing something obvious, pretty new to all this.
Thanks.
Exception occur when play follow url:
https://storage.googleapis.com/shaka-demo-assets/angel-one/dash.mpd
video.js:36749 Uncaught TypeError: Cannot set properties of undefined (setting 'discontinuity')
at video.js:36749:44
at Array.forEach ()
at updateSequenceNumbers (video.js:36705:18)
at positionManifestOnTimeline (video.js:36841:5)
at toM3u8 (video.js:37268:14)
at parse (video.js:38645:12)
at parseMainXml (video.js:42611:22)
at DashPlaylistLoader.handleMain_ (video.js:43150:21)
at DashPlaylistLoader.refreshMedia_ (video.js:43254:14)
at DashPlaylistLoader.haveMetadata (video.js:42978:12)
Isn't endList should be set to false if manifest type is "dynamic"?
suggestion:
Line 419 in 3fc0486
should be changed to:
endList: type === 'static'
2.0.5
to 2.0.7
.π¨ View failing branch.
This version is covered by your current version range and after updating it in your project the build failed.
conventional-changelog-cli is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
mpd-parser only parses the protection system specific identifiers.(in src/inheritAttributes.js
)
I'd like to extract the kid with mpd-parser but the generic identifier such as urn:mpeg:dash:mp4protection:2011
is not parsed.
https://dashif.org/identifiers/content_protection/
you can test with this mpd:
https://contents.pallycon.com/bunny/stream.mpd
The following file fails to parse:
<?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:cenc="urn:mpeg:cenc:2013" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-DASH_schema_files/DASH-MPD.xsd" type="static" minBufferTime="PT30S" profiles="urn:mpeg:dash:profile:isoff-main:2011" mediaPresentationDuration="PT1M4.800S">
<Period start="PT0S" duration="PT1M4.800S" id="1">
<AdaptationSet mimeType="video/webm" frameRate="30/1" segmentAlignment="true" subsegmentAlignment="true" startWithSAP="1" subsegmentStartsWithSAP="1" bitstreamSwitching="false">
<Representation id="1" width="1920" height="1080" bandwidth="1800000" codecs="vp9">
<BaseURL>864_vp9.webm</BaseURL>
</Representation>
</AdaptationSet>
<AdaptationSet mimeType="audio/mp4" lang="eng" segmentAlignment="0">
<Representation id="2" bandwidth="96000" audioSamplingRate="48000" codecs="mp4a.40.2">
<BaseURL>864_aac.mp4</BaseURL>
<SegmentBase indexRange="658-961">
<Initialization range="0-657"/>
</SegmentBase>
</Representation>
</AdaptationSet>
</Period>
</MPD>
The problem seems to be in
Lines 21 to 27 in d7261e9
segmentsFn
is not set. The toM3u8
function requires segmentsInfo.segments
to be a list, leading to a error that is hard to debug (trying to call undefined.reduce()
)3.1.1
to 3.1.2
.π¨ View failing branch.
This version is covered by your current version range and after updating it in your project the build failed.
karma is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
The new version differs by 11 commits.
7d4d347
chore: release v3.1.2
5077c18
chore: update contributors
fb05fb1
fix(server): use flatted for json.stringify (#3220)
2682bff
feat(docs): callout the key debug strategies. (#3219)
4e87902
fix(changelog): remove release which does not exist (#3214)
30ff73b
fix(browser): report errors to console during singleRun=false (#3209)
5334d1a
fix(file-list): do not preprocess up-to-date files (#3196)
dc5f5de
fix(deps): upgrade sinon-chai 2.x -> 3.x (#3207)
d38f344
fix(package): bump lodash version (#3203)
ffb41f9
refactor(browser): log state transitions in debug (#3202)
240209f
fix(dep): Bump useragent to fix HeadlessChrome version (#3201)
See the full diff
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
I have dynamic list how to calculate current live segment
I am using video.js which calls the mpd-parser
in the background. An error occurs in mpd-parser
if I call video.js with a blob url of an .mpd file, instead of a url from the internet.
I create the url as follows:
const blob = new Blob([mpdContents], {type: 'application/dash+xml'})
const url = URL.createObjectURL(blob)
It throws the following error:
resolve-url.js?fd22:31 Uncaught TypeError: Failed to construct 'URL': Invalid URL
at resolveUrl (resolve-url.js?fd22:31)
at eval (mpd-parser.es.js?2202:1601)
at Array.map (<anonymous>)
at eval (mpd-parser.es.js?2202:1600)
at Array.map (<anonymous>)
at buildBaseUrls (mpd-parser.es.js?2202:1599)
at inheritAttributes (mpd-parser.es.js?2202:2063)
at parse (mpd-parser.es.js?2202:2176)
at parseMasterXml (video.es.js?7ac5:31399)
at DashPlaylistLoader.handleMaster_ (video.es.js?7ac5:32020)
at eval (video.es.js?7ac5:31929)
at callbackWrapper (video.es.js?7ac5:30636)
at Object.eval [as callback] (video.es.js?7ac5:30661)
at cbOnce (index.js?b664:104)
at XMLHttpRequest.loadFunc (index.js?b664:178)
Are blob urls supported ? It would be great if they were :)
Thanks for your great job. We are looking for Java/Kotlin implementation of this lib to convert mpd to m3u8, if there is open source one it would be great, thanks.
I'm trying to load an audio only MPD in video.js
using http-streaming
.
I've traced down the issue to the following line in the mpd-parser :
Line 271 in c4c0418
master.playlists
is only initialized from the videoPlaylists
(which are empty on an audio only MPD). I've tried simply adding addSegmentInfoFromSidx(audioPlaylists, sidxMapping)
as a quick workaround in the debugger, but that crashes the tab in chrome and triggers out of memory on firefox (after some time).
I'll try to investigate this further but would be thankful for any input regarding the issue.
npm is reporting a security vulnerability in a xmldom which is causing npm audit to fail for users of video.js and mpd-parser. https://www.npmjs.com/advisories/1769
Unfortunately, a fix has not yet been published, so I cannot open a PR to address this yet. xmldom/xmldom#271
At parsed manifest data , all resolved uris wrong normalized.
site running at : http://mesut.ofis:4000
mpd file: http://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd
parsed Playlist first resolved uri : http://mesut.ofis:4000/video/180_250000/dash/init.mp4
location.origin + segment uri -> wrong
manifest uri base + segment uri -> done
In the manifest file:
Total audio tracks are 8 tracks
But using mpd-parser, total audio tracks are 4 tracks
const mpdParser = require('mpd-parser');
mpdParser.parse(response.body)
audio_tracks_counter = Object.keys(parsedManifest.mediaGroups.AUDIO.audio).length;
Note: response.body is the content of the manifest file (in the attachment)
Env: Ubuntu 18.04, mpd-parser version 0.10.1
Hello,
we encountered an issue where during parsing/reading of the adaptation set content protection information from the manifest it does not consider upper case keySystem UUID string on input. The matching is done against fixed lower case UUID string in the videojs/mpd-parser and there shouldn't be any reason not to convert the manifest value to lower case before the keySystem UUID matching.
Of course we considered changing the uuid case in the output manifest but we are sadly unable to do so in the streaming provider delivery application.
Example content protection segment from the manifest.
<ContentProtection
schemeIdUri="urn:uuid:EDEF8BA9-79D6-4ACE-A3C8-27DCD51D21ED">
<cenc:pssh>some base 64 encoded string</cenc:pssh>
</ContentProtection>
KeySystemsMap from inheritAttributes.js
:
const keySystemsMap = {
'urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b': 'org.w3.clearkey',
'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed': 'com.widevine.alpha',
'urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95': 'com.microsoft.playready',
'urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb': 'com.adobe.primetime'
};
The matching itself is done in the generateKeySystemInformation
method:
const generateKeySystemInformation = (contentProtectionNodes) => {
return contentProtectionNodes.reduce((acc, node) => {
const attributes = parseAttributes(node);
const keySystem = keySystemsMap[attributes.schemeIdUri];
if (keySystem) {
acc[keySystem] = { attributes };
const psshNode = findChildren(node, 'cenc:pssh')[0];
if (psshNode) {
const pssh = getContent(psshNode);
const psshBuffer = pssh && decodeB64ToUint8Array(pssh);
acc[keySystem].pssh = psshBuffer;
}
}
return acc;
}, {});
};
Specifically this is the line where keySystems UUID matching is done:
const keySystem = keySystemsMap[attributes.schemeIdUri];
Although it could be argued that according to the UUID RFC spec the UUID string (a-f chars) should be generated as a lowercase string it also mentions it should be treated as case-insensitive on input. Since the key system UUIDs in the keySystemsMap are hardcoded as lowercase in the codebase there isn't any reason not to do .toLowerCase() on the input UUID string from the manifest (at least I could not think of one).
RFC 4122
I created this issue mostly for the reason of hearing your opinions on the matter and whether such a minor change would make sense and whether a subsequent PR would be considered/accepted.
An MPD such as:
<?xml version="1.0"?>
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" profiles="urn:mpeg:dash:profile:full:2011" minBufferTime="PT1.5S">
<Period duration="PT30S">
<BaseURL>main/</BaseURL>
<AdaptationSet mimeType="video/mp2t">
<Representation id="720p" bandwidth="3200000" width="1280" height="720">
<SegmentList timescale="90000" duration="5400000"></SegmentList>
</Representation>
</AdaptationSet>
</Period>
</MPD>
Results in: TypeError: Cannot set property 'duration' of undefined
rather than something defined like MISSING_SEGMENT_INFORMATION
Still working out the specifics.
1.27.6
to 1.27.7
.π¨ View failing branch.
This version is covered by your current version range and after updating it in your project the build failed.
rollup is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
2019-12-01
The new version differs by 4 commits.
c753a7f
1.27.7
1b8a3de
Update changelog
d5651be
Fix incomplete computed property deoptimization (#3267)
d7e3993
Update changelog
See the full diff
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
I try this mpd manifest file , throw this error
Hello , i want to ask you how can i implement this in react-native ?
i mean i did implement it , but the "manifest" part is really confusing to me , can you clarify it a bit pls ?
an example would be wonderful !
Hello,
According to snyk.io, video js present a security issue cause by [email protected] imported by mpd-parser, updating to 0.7.7 would fix it.
Thanks
Thanks for open sourcing this. I've managed to get a basic VOD player playing DASH content from mpd parser input. My next challenge will be live content and multi period content. Are these supported and how are these represented in your schema ?
It would be really helpful to have some basic documentation around your schema explaining how each property relates to DASH XML input.
Thanks
Hi, I'm trying to parse SlingTV manifest, however the uri
and resolvedUri
in the returned parser manifest seems to be wrong.
{ uri: 'audio/stereo/192/$Number%08x$.m4s', timeline: 1, duration: 2.048, resolvedUri: 'http://p-cdn1-c-cg14-linear-cbd46b77.movetv.com/15807/live/CNNHD-DYN/6986bd324cdc11ebb62f0025b5472115/audio/stereo/192/$Number%08x$.m4s', map: [Object], number: 2877 }
The real url should be:
http://p-cdn1-c-cg14-linear-cbd46b77.movetv.com/15807/live/CNNHD-DYN/6986bd324cdc11ebb62f0025b5472115/audio/stereo/192/00000ffc.m4s
I have mpd with both ac-3 and mp4a.40.5 - ac-3 codec is not supported by browsers.
Is it possible to specify the audio track/codec to be used from mpd file? Looking at the code MPDparser picks the last audio track by default. https://github.com/videojs/mpd-parser/blob/main/src/toM3u8.js#L124
At the moment, there isn't any javascript package for writing into MPD from a parsed object. Great to have this functionality
My HTML looks like this:
However, I get this error:
The MPD URL is
What am I doing wrong?
This is a duplication of the following issue:
videojs/http-streaming#645
A playlist like this is not properly parsed:
<AdaptationSet mimeType="text/vtt" lang="de">
<Role schemeIdUri="urn:mpeg:dash:role" value="subtitle"/>
<Label>Deutsch</Label>
<Representation id="4" bandwidth="256">
<BaseURL>dashcaption_de_dash.mpd</BaseURL>
</Representation>
</AdaptationSet>
<AdaptationSet mimeType="text/vtt" lang="de">
<Role schemeIdUri="urn:mpeg:dash:role" value="subtitle"/>
<Label>Forced</Label>
<Representation id="5" bandwidth="256">
<BaseURL>dashcaption_forced_dash.mpd</BaseURL>
</Representation>
</AdaptationSet>```
only the first `de` will be available in the result.
I think this boils down to [this line](https://github.com/videojs/mpd-parser/blob/12387495d2fe472eab2fdd7d0c7f1b4bbc22c7cb/src/toM3u8.js#L181).
**The same applies to audio tracks.**
Using the latest version of mpd-parser causes a security advisory on GitHub
$ npm audit
# npm audit report
@xmldom/xmldom <0.8.3
Severity: moderate
Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution') in @xmldom/xmldom and xmldom - https://github.com/advisories/GHSA-9pgh-qqpf-7wqj
fix available via `npm audit fix --force`
Will install [email protected], which is a breaking change
node_modules/@xmldom/xmldom
mpd-parser >=0.19.0
Depends on vulnerable versions of @xmldom/xmldom
node_modules/mpd-parser
@videojs/http-streaming >=2.10.2
Depends on vulnerable versions of mpd-parser
node_modules/@videojs/http-streaming
video.js >=7.15.3
Depends on vulnerable versions of @videojs/http-streaming
Depends on vulnerable versions of mpd-parser
node_modules/video.js
4 moderate severity vulnerabilities
To address issues that do not require attention, run:
npm audit fix
To address all issues (including breaking changes), run:
npm audit fix --force
It looks like the parser is not including certain values. For example, in this AdaptationSet, we are completely dropping the Accessibility tag
<AdaptationSet contentType="video" minWidth="640" maxWidth="1280" minHeight="360" maxHeight="720" segmentAlignment="true" mimeType="video/mp4" startWithSAP="1">
<ContentProtection schemeIdUri="" value="cenc"/>
<ContentProtection schemeIdUri=""></ContentProtection>
<ContentProtection schemeIdUri="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95">
<Accessibility schemeIdUri="urn:scte:dash:cc:cea-608:2015" value="CC3=spa" id=""/>
<Accessibility schemeIdUri="urn:scte:dash:cc:cea-608:2015" value="CC1=eng" id=""/>
<Representation id="" bandwidth="2700000" width="1280" height="720" frameRate="30000/1001" codecs="avc1.64001F">
<SegmentTemplate media="" initialization="" duration="120120" startNumber="0" timescale="30000"/
</Representation>
I believe its tied to the toM3U8 -
Line 206 in bb89da6
The version of xmldom depended on has a vulnerability which has since been fixed. The dependency needs to be updated to a later version of xmldom.
There are occurrences in the inheritAttributes functionality where this representationInfo
array contains undesired duplicates. This generally occurs when there are multiple BaseURL nodes that are direct children of the MPD node. When we attempt to resolve URLs from a combination of the parent BaseURL and a child BaseURL, and the value does not resolve, we end up returning the child BaseURL multiple times. We need to determine a way to remove these duplicates in a safe way.
See: #17 (comment)
<MPD type="dyanmic">
<BaseURL serviceLocation="alpha">https://cdn1.example.com/</BaseURL>
<BaseURL serviceLocation="beta">https://cdn2.example.com/</BaseURL>
<Period start="PT0S">
...
<AdaptationSet mimeType="text/vtt" lang="en">
<Representation bandwidth="256" id="en">
<BaseURL>https://example.com/en.vtt</BaseURL>
</Representation>
</AdaptationSet>
</Period>
</MPD>
representationInfo: [
{
attributes: {
baseUrl: 'https://cdn1.example.com/',
...
},
segmentInfo: {...}
},
{
attributes: {
baseUrl: 'https://cdn2.example.com/',
...
},
segmentInfo: {...}
},
{
attributes: {
baseUrl: 'https://example.com/en.vtt',
...
},
segmentInfo: {...}
},
{
attributes: {
baseUrl: 'https://example.com/en.vtt',
...
},
segmentInfo: {...}
}
]
representationInfo: [
{
attributes: {
baseUrl: 'https://cdn1.example.com/',
...
},
segmentInfo: {...}
},
{
attributes: {
baseUrl: 'https://cdn2.example.com/',
...
},
segmentInfo: {...}
},
{
attributes: {
baseUrl: 'https://example.com/en.vtt',
...
},
segmentInfo: {...}
}
]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.