Skip to content

Commit ade1699

Browse files
committed
Replace deprecated package 'ffmpeg-binaries' with dropin replacement 'ffmpeg-static'
1 parent 2976397 commit ade1699

File tree

5 files changed

+3175
-3100
lines changed

5 files changed

+3175
-3100
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ Make sure you have [ffmpeg](https://ffmpeg.org/) installed and added to your pat
1212
npm install [-g] media-split
1313
```
1414

15-
If you don't have ffmpeg installed, you can install [this](https://www.npmjs.com/package/ffmpeg-binaries) or [this](https://www.npmjs.com/package/@ffmpeg-installer/ffmpeg) package which
15+
If you don't have ffmpeg installed, you can install [this](https://www.npmjs.com/package/ffmpeg-static) or [this](https://www.npmjs.com/package/@ffmpeg-installer/ffmpeg) package which
1616
comes with a bundled ffmpeg, and media-split will automatically detect and use it.
1717

1818
```bash
19-
npm install [-g] ffmpeg-binaries
19+
npm install [-g] ffmpeg-static
2020
```
2121
or
2222
```bash

lib/FFmpeg.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function global (lib) {
1111
const libs = {
1212
// local installation
1313
'@ffmpeg-installer/ffmpeg': (lib) => require(lib).path,
14-
'ffmpeg-binaries': (lib) => require(lib),
14+
'ffmpeg-static': (lib) => require(lib),
1515
ffmpeg: (lib) => {
1616
const proc = spawnSync(lib)
1717
if (proc.error instanceof Error) {
@@ -21,7 +21,7 @@ const libs = {
2121
}
2222
},
2323
[ global('@ffmpeg-installer/ffmpeg') ]: (lib) => require(lib).path,
24-
[ global('ffmpeg-binaries') ]: (lib) => require(lib)
24+
[ global('ffmpeg-static') ]: (lib) => require(lib)
2525
}
2626

2727
module.exports = null

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
"ytdl-core": "^3.2.2"
3434
},
3535
"peerDependencies": {
36-
"ffmpeg-binaries": "^4.0.0",
37-
"@ffmpeg-installer/ffmpeg": "^1.0.20"
36+
"@ffmpeg-installer/ffmpeg": "^1.0.20",
37+
"ffmpeg-static": "^4.2.7"
3838
},
3939
"bin": {
4040
"mp3-split": "cli/index.js",

spec/FFmpeg.spec.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@ describe('FFmpeg', function () {
2626
expect(require1).to.be.equals('foo')
2727
})
2828

29-
it('should fallback to ffmpeg-binaries', function () {
29+
it('should fallback to ffmpeg-static', function () {
3030
mockRequire('@ffmpeg-installer/ffmpeg', errorModule)
31-
mockRequire('ffmpeg-binaries', 1)
31+
mockRequire('ffmpeg-static', 1)
3232
const require1 = require(moduleName)
3333
expect(require1).to.be.equals(1)
3434
})
3535

3636
it('should fallback to ffmpeg on $PATH', function () {
3737
let called = false
3838
mockRequire('@ffmpeg-installer/ffmpeg', errorModule)
39-
mockRequire('ffmpeg-binaries', errorModule)
39+
mockRequire('ffmpeg-static', errorModule)
4040
childProcess.spawnSync = function (cmd) {
4141
called = true
4242
expect(cmd).to.be.equals('ffmpeg')
@@ -48,18 +48,18 @@ describe('FFmpeg', function () {
4848

4949
it('should fallback to global @ffmpeg-installer', function () {
5050
mockRequire('@ffmpeg-installer/ffmpeg', errorModule)
51-
mockRequire('ffmpeg-binaries', errorModule)
51+
mockRequire('ffmpeg-static', errorModule)
5252
childProcess.spawnSync = errorSpawn
5353
mockRequire(path.join(global, '@ffmpeg-installer/ffmpeg'), { path: 'qux' })
5454
expect(require(moduleName)).to.be.equals('qux')
5555
})
5656

57-
it('should fallback to global ffmpeg-binaries', function () {
57+
it('should fallback to global ffmpeg-static', function () {
5858
mockRequire('@ffmpeg-installer/ffmpeg', errorModule)
59-
mockRequire('ffmpeg-binaries', errorModule)
59+
mockRequire('ffmpeg-static', errorModule)
6060
childProcess.spawnSync = errorSpawn
6161
mockRequire(path.join(global, '@ffmpeg-installer/ffmpeg'), errorModule)
62-
mockRequire(path.join(global, 'ffmpeg-binaries'), 2)
62+
mockRequire(path.join(global, 'ffmpeg-static'), 2)
6363
expect(require(moduleName)).to.be.equals(2)
6464
})
6565

0 commit comments

Comments
 (0)