dasha 4.0.1 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +35 -3
- package/package.json +3 -3
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2023-
|
|
3
|
+
Copyright (c) 2023-2026 Vitaly Gashkov <vitalygashkov@vk.com>
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
[](https://www.npmjs.com/package/dasha)
|
|
5
5
|
[](https://www.npmjs.com/package/dasha)
|
|
6
6
|
|
|
7
|
-
Library for working with MPEG-DASH (`.mpd`) and HLS (`.m3u8`)
|
|
7
|
+
Library for working with MPEG-DASH (`.mpd`) manifests and HLS (`.m3u8`) playlists through a Mediabunny-compatible Input API. Made with the purpose of obtaining a simplified representation convenient for further downloading of segments by URLs and getting basic metadata about the tracks.
|
|
8
8
|
|
|
9
9
|
## Install
|
|
10
10
|
|
|
@@ -14,7 +14,9 @@ npm install dasha
|
|
|
14
14
|
|
|
15
15
|
## Usage
|
|
16
16
|
|
|
17
|
-
### HLS
|
|
17
|
+
### Reading HLS
|
|
18
|
+
|
|
19
|
+
In the example below, we read the segment information for a specific video track and save it to a file.
|
|
18
20
|
|
|
19
21
|
```ts
|
|
20
22
|
import fs from 'node:fs/promises';
|
|
@@ -54,7 +56,9 @@ async function saveVideo() {
|
|
|
54
56
|
};
|
|
55
57
|
```
|
|
56
58
|
|
|
57
|
-
### DASH
|
|
59
|
+
### Reading DASH
|
|
60
|
+
|
|
61
|
+
Everything here is identical to the example above, with the sole exception that an URL to a DASH manifest is used instead of an HLS playlist.
|
|
58
62
|
|
|
59
63
|
```ts
|
|
60
64
|
import fs from 'node:fs/promises';
|
|
@@ -89,6 +93,34 @@ async function saveDashVideo() {
|
|
|
89
93
|
}
|
|
90
94
|
```
|
|
91
95
|
|
|
96
|
+
### Mediabunny with DASH support
|
|
97
|
+
|
|
98
|
+
> Only reading is supported
|
|
99
|
+
|
|
100
|
+
Similar to [downloading an HLS playlist as an MP4](https://github.com/Vanilagy/mediabunny/blob/hls/docs/blog/mediabunny-now-supports-hls.md#downloading-an-hls-playlist-as-an-mp4) you can do this:
|
|
101
|
+
|
|
102
|
+
```ts
|
|
103
|
+
import { Conversion, FilePathTarget, Mp4OutputFormat, Output, Input, UrlSource } from 'mediabunny';
|
|
104
|
+
import { DASH_FORMATS } from 'dasha';
|
|
105
|
+
|
|
106
|
+
const input = new Input({
|
|
107
|
+
source: new UrlSource('https://example.com/manifest.mpd'),
|
|
108
|
+
formats: DASH_FORMATS,
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
const output = new Output({
|
|
112
|
+
format: new Mp4OutputFormat(),
|
|
113
|
+
target: new FilePathTarget('output.mp4'),
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
const conversion = await Conversion.init({ input, output });
|
|
117
|
+
await conversion.execute();
|
|
118
|
+
|
|
119
|
+
// Done
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
See [reading HLS](https://github.com/Vanilagy/mediabunny/blob/hls/docs/guide/reading-hls.md) guide for more use cases (many things can be used with DASH as well).
|
|
123
|
+
|
|
92
124
|
## Credits
|
|
93
125
|
|
|
94
126
|
[mediabunny](https://github.com/Vanilagy/mediabunny)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dasha",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"description": "Streaming manifest parser",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
}
|
|
46
46
|
],
|
|
47
47
|
"engines": {
|
|
48
|
-
"node": ">=22.
|
|
48
|
+
"node": ">=22.18"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@xmldom/xmldom": "^0.9.10",
|
|
52
|
-
"mediabunny": "1.42.0
|
|
52
|
+
"mediabunny": "1.42.0",
|
|
53
53
|
"temporal-polyfill": "^0.3.2"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|