shaka-packager 2.4.2 → 3.0.0
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 +59 -0
- package/README.md +110 -0
- package/index.js +22 -6
- package/package.json +7 -6
- package/prepublish.js +62 -20
package/LICENSE
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
Copyright 2014, Google LLC. All rights reserved.
|
|
2
|
+
|
|
3
|
+
Redistribution and use in source and binary forms, with or without
|
|
4
|
+
modification, are permitted provided that the following conditions are
|
|
5
|
+
met:
|
|
6
|
+
|
|
7
|
+
* Redistributions of source code must retain the above copyright
|
|
8
|
+
notice, this list of conditions and the following disclaimer.
|
|
9
|
+
* Redistributions in binary form must reproduce the above
|
|
10
|
+
copyright notice, this list of conditions and the following disclaimer
|
|
11
|
+
in the documentation and/or other materials provided with the
|
|
12
|
+
distribution.
|
|
13
|
+
* Neither the name of Google LLC. nor the names of its
|
|
14
|
+
contributors may be used to endorse or promote products derived from
|
|
15
|
+
this software without specific prior written permission.
|
|
16
|
+
|
|
17
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
18
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
19
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
20
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
21
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
22
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
23
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
24
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
25
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
26
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
27
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
28
|
+
|
|
29
|
+
------------------------------------------------------------------------
|
|
30
|
+
|
|
31
|
+
*** LICENSE addendum from the Chromium-LICENSE file. ***
|
|
32
|
+
|
|
33
|
+
// Copyright 2014 The Chromium Authors. All rights reserved.
|
|
34
|
+
//
|
|
35
|
+
// Redistribution and use in source and binary forms, with or without
|
|
36
|
+
// modification, are permitted provided that the following conditions are
|
|
37
|
+
// met:
|
|
38
|
+
//
|
|
39
|
+
// * Redistributions of source code must retain the above copyright
|
|
40
|
+
// notice, this list of conditions and the following disclaimer.
|
|
41
|
+
// * Redistributions in binary form must reproduce the above
|
|
42
|
+
// copyright notice, this list of conditions and the following disclaimer
|
|
43
|
+
// in the documentation and/or other materials provided with the
|
|
44
|
+
// distribution.
|
|
45
|
+
// * Neither the name of Google LLC. nor the names of its
|
|
46
|
+
// contributors may be used to endorse or promote products derived from
|
|
47
|
+
// this software without specific prior written permission.
|
|
48
|
+
//
|
|
49
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
50
|
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
51
|
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
52
|
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
53
|
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
54
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
55
|
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
56
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
57
|
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
58
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
59
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
[comment]: # (While not ideal, absolute URLs are used here as it is the )
|
|
2
|
+
[comment]: # (simplest way to make the links work on GitHub and Docker Hub. )
|
|
3
|
+
[comment]: # (These links in cloned repositories will point back to the main )
|
|
4
|
+
[comment]: # (repository and if it is an issue, we suggest updating the links )
|
|
5
|
+
[comment]: # (in the cloned repository. )
|
|
6
|
+
[comment]: # (See https://github.com/shaka-project/shaka-packager/issues/408 for the )
|
|
7
|
+
[comment]: # (full background. )
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
Shaka Packager is a tool and a media packaging SDK for
|
|
12
|
+
[DASH](http://dashif.org/) and [HLS](https://developer.apple.com/streaming/)
|
|
13
|
+
packaging and encryption. It can prepare and package media content for online
|
|
14
|
+
streaming.
|
|
15
|
+
|
|
16
|
+
Shaka Packager supports:
|
|
17
|
+
|
|
18
|
+
- Both Video-On-Demand and Live.
|
|
19
|
+
- Streaming formats:
|
|
20
|
+
- [DASH](http://dashif.org/)
|
|
21
|
+
- [HLS](https://developer.apple.com/streaming/)
|
|
22
|
+
- Key systems:
|
|
23
|
+
- [Widevine](http://www.widevine.com/)
|
|
24
|
+
- [PlayReady](https://www.microsoft.com/playready/)¹
|
|
25
|
+
- [FairPlay](https://developer.apple.com/streaming/fps/)¹
|
|
26
|
+
- [Marlin](https://www.intertrust.com/marlin-drm/)¹
|
|
27
|
+
- Encryption standards:
|
|
28
|
+
- [CENC](https://en.wikipedia.org/wiki/MPEG_Common_Encryption)
|
|
29
|
+
- [SAMPLE-AES](https://developer.apple.com/library/content/documentation/AudioVideo/Conceptual/HLS_Sample_Encryption/Intro/Intro.html)
|
|
30
|
+
- Media Containers and codecs
|
|
31
|
+
|
|
32
|
+
| Codecs | ISO-BMFF | WebM | MPEG2-TS | WVM | Packed Audio²|
|
|
33
|
+
|:-----------------:|:------------:|:------------:|:------------:|:-----------:|:------------:|
|
|
34
|
+
| H264 (AVC) | I / O | - | I / O | I | - |
|
|
35
|
+
| H265 (HEVC) | I / O | - | I | - | - |
|
|
36
|
+
| VP8 | I / O | I / O | - | - | - |
|
|
37
|
+
| VP9 | I / O | I / O | - | - | - |
|
|
38
|
+
| AV1 | I / O | I / O | - | - | - |
|
|
39
|
+
| AAC | I / O | - | I / O | I | O |
|
|
40
|
+
| MP3 | O | - | I / O | - | O |
|
|
41
|
+
| Dolby AC3 | I / O | - | I / O | - | O |
|
|
42
|
+
| Dolby EAC3 | I / O | - | O | - | O |
|
|
43
|
+
| MPEG-H Audio | I / O | - | - | - | - |
|
|
44
|
+
| Dolby AC4 | I / O | - | - | - | - |
|
|
45
|
+
| DTS | I / O | - | - | - | - |
|
|
46
|
+
| FLAC | I / O | - | - | - | - |
|
|
47
|
+
| Opus | I / O³ | I / O | - | - | - |
|
|
48
|
+
| Vorbis | - | I / O | - | - | - |
|
|
49
|
+
|
|
50
|
+
NOTES:
|
|
51
|
+
- I for input and O for output.
|
|
52
|
+
- ²: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-3.4
|
|
53
|
+
- ³: Opus support in ISO-BMFF is experimental.
|
|
54
|
+
- Subtitles
|
|
55
|
+
|
|
56
|
+
| Format | Input | Output |
|
|
57
|
+
|:-------------:|:--------:|:------:|
|
|
58
|
+
| Text WebVTT | Y | Y |
|
|
59
|
+
| WebVTT in MP4 | [#405][] | Y |
|
|
60
|
+
| Text TTML | ⁴ | Y |
|
|
61
|
+
| TTML in MP4 | - | Y |
|
|
62
|
+
| DVB-SUB | Y | - |
|
|
63
|
+
| Teletext | [#272][] | - |
|
|
64
|
+
|
|
65
|
+
- ⁴: TTML input is only supported with TTML output (pass-through, DASH only),
|
|
66
|
+
see also [#584][].
|
|
67
|
+
|
|
68
|
+
[#272]: https://github.com/shaka-project/shaka-packager/issues/272
|
|
69
|
+
[#405]: https://github.com/shaka-project/shaka-packager/issues/405
|
|
70
|
+
[#584]: https://github.com/shaka-project/shaka-packager/issues/584
|
|
71
|
+
|
|
72
|
+
- Platforms
|
|
73
|
+
- Linux
|
|
74
|
+
- Mac
|
|
75
|
+
- Windows
|
|
76
|
+
- Cross compiling for ARM is also supported.
|
|
77
|
+
|
|
78
|
+
<sup>1: Limited support</sup>
|
|
79
|
+
|
|
80
|
+
# Getting Shaka Packager
|
|
81
|
+
|
|
82
|
+
There are several ways you can get Shaka Packager.
|
|
83
|
+
|
|
84
|
+
- Using [Docker](https://www.docker.com/whatisdocker).
|
|
85
|
+
Instructions are available
|
|
86
|
+
[here](https://github.com/shaka-project/shaka-packager/blob/main/docs/source/docker_instructions.md).
|
|
87
|
+
- Get prebuilt binaries from
|
|
88
|
+
[release](https://github.com/shaka-project/shaka-packager/releases).
|
|
89
|
+
- Built from source, see
|
|
90
|
+
[Build Instructions](https://github.com/shaka-project/shaka-packager/blob/main/docs/source/build_instructions.md)
|
|
91
|
+
for details.
|
|
92
|
+
|
|
93
|
+
# Useful Links
|
|
94
|
+
|
|
95
|
+
- [Announcement List](https://groups.google.com/forum/#!forum/shaka-packager-users)
|
|
96
|
+
(join for infrequent announcements and surveys)
|
|
97
|
+
- Subscribe to releases by following
|
|
98
|
+
[instructions from this blog](https://www.jessesquires.com/blog/2020/07/30/github-tip-watching-releases/)- [Documentation](https://shaka-project.github.io/shaka-packager/html/)
|
|
99
|
+
- [Tutorials](https://shaka-project.github.io/shaka-packager/html/tutorials/tutorials.html)
|
|
100
|
+
- Several open source players:
|
|
101
|
+
- [DASH and HLS on Web: Shaka Player](https://github.com/shaka-project/shaka-player)
|
|
102
|
+
- [DASH on Web: dash.js](https://github.com/Dash-Industry-Forum/dash.js)
|
|
103
|
+
- [HLS on Web: hls.js](https://github.com/video-dev/hls.js)
|
|
104
|
+
- [DASH and HLS on Android: ExoPlayer](https://github.com/google/ExoPlayer)
|
|
105
|
+
|
|
106
|
+
# Contributing
|
|
107
|
+
|
|
108
|
+
If you have improvements or fixes, we would love to have your contributions.
|
|
109
|
+
See https://github.com/shaka-project/shaka-packager/blob/main/CONTRIBUTING.md for
|
|
110
|
+
details.
|
package/index.js
CHANGED
|
@@ -4,15 +4,31 @@
|
|
|
4
4
|
var path = require('path');
|
|
5
5
|
var spawnSync = require('child_process').spawnSync;
|
|
6
6
|
|
|
7
|
-
// Command names per-platform
|
|
7
|
+
// Command names per-platform (process.platform) and per-architecture
|
|
8
|
+
// (process.arch):
|
|
8
9
|
var commandNames = {
|
|
9
|
-
linux:
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
linux: {
|
|
11
|
+
'x64': 'packager-linux-x64',
|
|
12
|
+
'arm64': 'packager-linux-arm64',
|
|
13
|
+
},
|
|
14
|
+
darwin: {
|
|
15
|
+
'x64': 'packager-osx-x64',
|
|
16
|
+
},
|
|
17
|
+
win32: {
|
|
18
|
+
'x64': 'packager-win-x64.exe',
|
|
19
|
+
},
|
|
12
20
|
};
|
|
13
21
|
|
|
14
22
|
// Find the platform-specific binary:
|
|
15
|
-
|
|
23
|
+
if (!(process.platform in commandNames)) {
|
|
24
|
+
throw new Error('Platform not supported: ' + process.platform);
|
|
25
|
+
}
|
|
26
|
+
if (!(process.arch in commandNames[process.platform])) {
|
|
27
|
+
throw new Error(
|
|
28
|
+
'Architecture not supported: ' + process.platform + '/' + process.arch);
|
|
29
|
+
}
|
|
30
|
+
var commandName = commandNames[process.platform][process.arch];
|
|
31
|
+
var binaryPath = path.resolve(__dirname, 'bin', commandName);
|
|
16
32
|
|
|
17
33
|
// Find the args to pass to that binary:
|
|
18
34
|
// argv[0] is node itself, and argv[1] is the script.
|
|
@@ -20,7 +36,7 @@ var binaryPath = path.resolve(__dirname, 'bin', commandNames[process.platform]);
|
|
|
20
36
|
var args = process.argv.slice(2);
|
|
21
37
|
|
|
22
38
|
var options = {
|
|
23
|
-
detached: false,
|
|
39
|
+
detached: false, // Do not let the child process continue without us
|
|
24
40
|
stdio: 'inherit', // Pass stdin/stdout/stderr straight through
|
|
25
41
|
};
|
|
26
42
|
|
package/package.json
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shaka-packager",
|
|
3
3
|
"description": "A media packaging tool and SDK.",
|
|
4
|
-
"version": "
|
|
5
|
-
"
|
|
4
|
+
"version": "3.0.0",
|
|
5
|
+
"private": false,
|
|
6
|
+
"homepage": "https://github.com/shaka-project/shaka-packager",
|
|
6
7
|
"author": "Google",
|
|
7
8
|
"maintainers": [
|
|
8
9
|
{
|
|
9
|
-
"name": "
|
|
10
|
-
"email": "
|
|
10
|
+
"name": "Joey Parrish",
|
|
11
|
+
"email": "joeyparrish@google.com"
|
|
11
12
|
}
|
|
12
13
|
],
|
|
13
14
|
"main": "index.js",
|
|
14
15
|
"repository": {
|
|
15
16
|
"type": "git",
|
|
16
|
-
"url": "https://github.com/
|
|
17
|
+
"url": "https://github.com/shaka-project/shaka-packager.git"
|
|
17
18
|
},
|
|
18
19
|
"bugs": {
|
|
19
|
-
"url": "https://github.com/
|
|
20
|
+
"url": "https://github.com/shaka-project/shaka-packager/issues"
|
|
20
21
|
},
|
|
21
22
|
"license": "See LICENSE",
|
|
22
23
|
"scripts": {
|
package/prepublish.js
CHANGED
|
@@ -5,25 +5,37 @@ var fs = require('fs');
|
|
|
5
5
|
var path = require('path');
|
|
6
6
|
var spawnSync = require('child_process').spawnSync;
|
|
7
7
|
|
|
8
|
-
// Command names per-platform
|
|
8
|
+
// Command names per-platform (process.platform) and per-architecture
|
|
9
|
+
// (process.arch):
|
|
9
10
|
var commandNames = {
|
|
10
|
-
linux:
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
linux: {
|
|
12
|
+
'x64': 'packager-linux-x64',
|
|
13
|
+
'arm64': 'packager-linux-arm64',
|
|
14
|
+
},
|
|
15
|
+
darwin: {
|
|
16
|
+
'x64': 'packager-osx-x64',
|
|
17
|
+
},
|
|
18
|
+
win32: {
|
|
19
|
+
'x64': 'packager-win-x64.exe',
|
|
20
|
+
},
|
|
13
21
|
};
|
|
14
22
|
|
|
15
23
|
// Get the current package version:
|
|
16
24
|
var package = require(path.resolve(__dirname, 'package.json'));
|
|
17
25
|
console.log('Preparing Shaka Packager v' + package.version);
|
|
18
26
|
|
|
27
|
+
// Calculate the repo name. In GitHub Actions context, this will pull binaries
|
|
28
|
+
// correctly from a fork. When run by hand, it will default to the official
|
|
29
|
+
// repo.
|
|
30
|
+
var repo = process.env.GITHUB_REPOSITORY || 'shaka-project/shaka-packager';
|
|
31
|
+
|
|
19
32
|
// For fetching binaries from GitHub:
|
|
20
|
-
var urlBase =
|
|
21
|
-
'https://github.com/google/shaka-packager/releases/download/v' +
|
|
33
|
+
var urlBase = 'https://github.com/' + repo + '/releases/download/v' +
|
|
22
34
|
package.version + '/';
|
|
23
35
|
|
|
24
36
|
// For spawning curl subprocesses:
|
|
25
37
|
var options = {
|
|
26
|
-
detached: false,
|
|
38
|
+
detached: false, // Do not let the child process continue without us
|
|
27
39
|
stdio: 'inherit', // Pass stdin/stdout/stderr straight through
|
|
28
40
|
};
|
|
29
41
|
|
|
@@ -40,26 +52,56 @@ fs.readdirSync(binFolderPath).forEach(function(childName) {
|
|
|
40
52
|
});
|
|
41
53
|
|
|
42
54
|
for (var platform in commandNames) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
55
|
+
for (var arch in commandNames[platform]) {
|
|
56
|
+
// Find the destination for this binary:
|
|
57
|
+
var command = commandNames[platform][arch];
|
|
58
|
+
var binaryPath = path.resolve(binFolderPath, command);
|
|
59
|
+
|
|
60
|
+
try {
|
|
61
|
+
download(urlBase + command, binaryPath);
|
|
62
|
+
fs.chmodSync(binaryPath, 0755);
|
|
63
|
+
} catch (error) {
|
|
64
|
+
if (arch == 'arm64') {
|
|
65
|
+
// Optional. Forks may not have arm64 builds available. Ignore.
|
|
66
|
+
} else {
|
|
67
|
+
// Required. Re-throw and fail.
|
|
68
|
+
throw error;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Fetch LICENSE and README files from the same tag, and include them in the
|
|
75
|
+
// package.
|
|
76
|
+
var licenseUrl = 'https://raw.githubusercontent.com/' + repo + '/' +
|
|
77
|
+
'v' + package.version + '/LICENSE';
|
|
78
|
+
download(licenseUrl, 'LICENSE');
|
|
79
|
+
|
|
80
|
+
var readmeUrl = 'https://raw.githubusercontent.com/' + repo + '/' +
|
|
81
|
+
'v' + package.version + '/README.md';
|
|
82
|
+
download(readmeUrl, 'README.md');
|
|
46
83
|
|
|
84
|
+
console.log('Done!');
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
// Generic download helper
|
|
88
|
+
function download(url, outputPath) {
|
|
47
89
|
// Curl args:
|
|
48
90
|
var args = [
|
|
49
91
|
'-L', // follow redirects
|
|
50
|
-
'-
|
|
51
|
-
|
|
52
|
-
|
|
92
|
+
'-f', // fail if the request fails
|
|
93
|
+
// output destination:
|
|
94
|
+
'-o',
|
|
95
|
+
outputPath,
|
|
96
|
+
'--show-error', // show errors
|
|
97
|
+
'--silent', // but no progress bar
|
|
98
|
+
url,
|
|
53
99
|
];
|
|
54
100
|
|
|
55
101
|
// Now fetch the binary and fail the script if that fails:
|
|
56
|
-
console.log('Downloading',
|
|
102
|
+
console.log('Downloading', url, 'to', outputPath);
|
|
57
103
|
var returnValue = spawnSync('curl', args, options);
|
|
58
|
-
if (returnValue.
|
|
59
|
-
|
|
104
|
+
if (returnValue.status != 0) {
|
|
105
|
+
throw new Error('Download of ' + url + ' failed: ' + returnValue.status);
|
|
60
106
|
}
|
|
61
|
-
|
|
62
|
-
fs.chmodSync(binaryPath, 0755);
|
|
63
107
|
}
|
|
64
|
-
|
|
65
|
-
console.log('Done!');
|