@backendsuraj/offline-ffmpeg 8.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/README.md +45 -0
- package/index.js +43 -0
- package/package.json +19 -0
package/README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# @backendsuraj/offline-ffmpeg
|
|
2
|
+
|
|
3
|
+
A platform-independent, offline-friendly binary installer of **FFmpeg** for Node.js projects.
|
|
4
|
+
|
|
5
|
+
> **FFmpeg Version: 8.0.0**
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## Why this package?
|
|
9
|
+
Most FFmpeg wrappers download the binary at runtime or install time. This fails in strict corporate environments with firewalls or proxies.
|
|
10
|
+
This package **bundles the binaries directly**, so `npm install` is all you need.
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
### Standard Node.js
|
|
15
|
+
```javascript
|
|
16
|
+
import ffmpeg from '@backendsuraj/offline-ffmpeg';
|
|
17
|
+
import { spawn } from 'child_process';
|
|
18
|
+
|
|
19
|
+
const ffmpegPath = ffmpeg.path;
|
|
20
|
+
spawn(ffmpegPath, ['-version'], { stdio: 'inherit' });
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### With `fluent-ffmpeg`
|
|
24
|
+
```javascript
|
|
25
|
+
import fluentFfmpeg from 'fluent-ffmpeg';
|
|
26
|
+
import ffmpegBinary from '@backendsuraj/offline-ffmpeg';
|
|
27
|
+
|
|
28
|
+
// Manually set the path to the bundled binary
|
|
29
|
+
fluentFfmpeg.setFfmpegPath(ffmpegBinary.path);
|
|
30
|
+
|
|
31
|
+
// Use fluent-ffmpeg as usual
|
|
32
|
+
fluentFfmpeg('input.mp4').save('output.mp3');
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Binary Details
|
|
36
|
+
- **Source**: [BtbN/FFmpeg-Builds](https://github.com/BtbN/FFmpeg-Builds/releases)
|
|
37
|
+
- **Version**: 8.0.0
|
|
38
|
+
- **License**: LGPL 3.0
|
|
39
|
+
|
|
40
|
+
## Supported Platforms
|
|
41
|
+
| OS | Architecture | Status |
|
|
42
|
+
| :--- | :--- | :--- |
|
|
43
|
+
| **Windows** | x64 | ✅ Supported |
|
|
44
|
+
| **Linux** | x64 | ✅ Supported |
|
|
45
|
+
| **MacOS** | Any | ⏳ Coming Soon |
|
package/index.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
var os = require('os');
|
|
2
|
+
var path = require('path');
|
|
3
|
+
|
|
4
|
+
var platform = os.platform();
|
|
5
|
+
var arch = os.arch();
|
|
6
|
+
|
|
7
|
+
if (platform !== 'linux' && platform !== 'darwin' && platform !== 'win32') {
|
|
8
|
+
console.error('Unsupported platform: ' + platform);
|
|
9
|
+
console.error('ffmpeg-installer only supports linux, darwin and win32 systems');
|
|
10
|
+
process.exit(1);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (arch !== 'x64' && arch !== 'arm64') {
|
|
14
|
+
// We only have x64 binaries, but keeping check generic for now
|
|
15
|
+
// Actually we strictly have x64 in this repo
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
var ffmpegPath = path.join(
|
|
19
|
+
__dirname,
|
|
20
|
+
'node_modules',
|
|
21
|
+
'@backendsuraj',
|
|
22
|
+
'offline-ffmpeg-' + platform + '-' + arch,
|
|
23
|
+
'bin',
|
|
24
|
+
platform === 'win32' ? 'ffmpeg.exe' : 'ffmpeg'
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
// Fallback to checking if it is installed at the same level (flattened deps)
|
|
28
|
+
var fs = require('fs');
|
|
29
|
+
if (!fs.existsSync(ffmpegPath)) {
|
|
30
|
+
ffmpegPath = path.join(
|
|
31
|
+
__dirname,
|
|
32
|
+
'..',
|
|
33
|
+
'offline-ffmpeg-' + platform + '-' + arch,
|
|
34
|
+
'bin',
|
|
35
|
+
platform === 'win32' ? 'ffmpeg.exe' : 'ffmpeg'
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Even deeper fallback for some package managers?
|
|
40
|
+
// For now, let's keep it simple. If we are in a monorepo locally, the path might be different.
|
|
41
|
+
|
|
42
|
+
exports.path = ffmpegPath;
|
|
43
|
+
exports.version = '8.0.0';
|
package/package.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@backendsuraj/offline-ffmpeg",
|
|
3
|
+
"version": "8.0.0",
|
|
4
|
+
"description": "Platform independent binary installer of FFmpeg for node projects (Offline Friendly)",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "node test.js"
|
|
8
|
+
},
|
|
9
|
+
"author": "Suraj",
|
|
10
|
+
"license": "LGPL-3.0",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/backendsuraj/offline-ffmpeg"
|
|
14
|
+
},
|
|
15
|
+
"optionalDependencies": {
|
|
16
|
+
"@backendsuraj/offline-ffmpeg-win32-x64": "8.0.0",
|
|
17
|
+
"@backendsuraj/offline-ffmpeg-linux-x64": "8.0.0"
|
|
18
|
+
}
|
|
19
|
+
}
|