🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

ffmpeg-static

Package Overview
Dependencies
Maintainers
4
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ffmpeg-static - npm Package Compare versions

Comparing version
5.1.0
to
5.2.0
+19
-6
index.js
'use strict'
if (process.env.FFMPEG_BIN) {
module.exports = process.env.FFMPEG_BIN
const pkg = require('./package.json')
const {
'binary-path-env-var': BINARY_PATH_ENV_VAR,
'executable-base-name': executableBaseName,
} = pkg[pkg.name]
if ('string' !== typeof BINARY_PATH_ENV_VAR) {
throw new Error(`package.json: invalid/missing ${pkg.name}.binary-path-env-var entry`)
}
if ('string' !== typeof executableBaseName) {
throw new Error(`package.json: invalid/missing ${pkg.name}.executable-base-name entry`)
}
if (process.env[BINARY_PATH_ENV_VAR]) {
module.exports = process.env[BINARY_PATH_ENV_VAR]
} else {

@@ -19,12 +32,12 @@ var os = require('os')

var ffmpegPath = path.join(
let binaryPath = path.join(
__dirname,
platform === 'win32' ? 'ffmpeg.exe' : 'ffmpeg'
executableBaseName + (platform === 'win32' ? '.exe' : ''),
)
if (!binaries[platform] || binaries[platform].indexOf(arch) === -1) {
ffmpegPath = null
binaryPath = null
}
module.exports = ffmpegPath
module.exports = binaryPath
}

@@ -14,4 +14,12 @@ 'use strict'

const {pipeline} = require('stream')
var ffmpegPath = require(".");
const binaryPath = require('.')
var pkg = require("./package");
const {
'executable-base-name': executableBaseName,
'binary-release-tag-env-var': RELEASE_ENV_VAR,
'binaries-url-env-var': BINARIES_URL_ENV_VAR,
} = pkg[pkg.name]
if ('string' !== typeof executableBaseName) {
throw new Error(`package.json: invalid/missing ${pkg.name}.executable-base-name entry`)
}

@@ -27,9 +35,9 @@ const exitOnError = (err) => {

if (!ffmpegPath) {
exitOnError('ffmpeg-static install failed: No binary found for architecture')
if (!binaryPath) {
exitOnError(`${pkg.name} install failed: No binary found for architecture`)
}
try {
if (fs.statSync(ffmpegPath).isFile()) {
console.info('ffmpeg is installed already.')
if (fs.statSync(binaryPath).isFile()) {
console.info(`${executableBaseName} is installed already.`)
process.exit(0)

@@ -60,4 +68,4 @@ }

const query = Array.from(url.searchParams.entries())
.filter(([key]) => key.slice(0, 6).toLowerCase() !== 'x-amz-')
.reduce((query, [key, val]) => ({...query, [key]: val}), {})
.filter(([key]) => key.slice(0, 6).toLowerCase() !== 'x-amz-')
.reduce((query, [key, val]) => ({...query, [key]: val}), {})
url.search = encodeQuery(query)

@@ -106,3 +114,3 @@ return url.href

if (err || response.statusCode !== 200) {
err = err || new Error('Download failed.')
err = err || new Error(`Failed to download ${executableBaseName} ${release}.`)
if (response) {

@@ -148,3 +156,3 @@ err.url = response.url

if (!progressBar) {
progressBar = new ProgressBar(`Downloading ffmpeg ${releaseName} [:bar] :percent :etas `, {
progressBar = new ProgressBar(`Downloading ${executableBaseName} ${release} [:bar] :percent :etas `, {
complete: "|",

@@ -161,30 +169,26 @@ incomplete: " ",

const release = (
process.env.FFMPEG_BINARY_RELEASE ||
pkg['ffmpeg-static']['binary-release-tag']
process.env[RELEASE_ENV_VAR] ||
pkg[pkg.name]['binary-release-tag']
)
const releaseName = (
pkg['ffmpeg-static']['binary-release-name'] ||
release
)
const arch = process.env.npm_config_arch || os.arch()
const platform = process.env.npm_config_platform || os.platform()
const downloadsUrl = (
process.env.FFMPEG_BINARIES_URL ||
'https://github.com/eugeneware/ffmpeg-static/releases/download'
process.env[BINARIES_URL_ENV_VAR] ||
'https://github.com/eugeneware/ffmpeg-static/releases/download'
)
const baseUrl = `${downloadsUrl}/${release}`
const downloadUrl = `${baseUrl}/${platform}-${arch}.gz`
const downloadUrl = `${baseUrl}/${executableBaseName}-${platform}-${arch}.gz`
const readmeUrl = `${baseUrl}/${platform}-${arch}.README`
const licenseUrl = `${baseUrl}/${platform}-${arch}.LICENSE`
downloadFile(downloadUrl, ffmpegPath, onProgress)
downloadFile(downloadUrl, binaryPath, onProgress)
.then(() => {
fs.chmodSync(ffmpegPath, 0o755) // make executable
fs.chmodSync(binaryPath, 0o755) // make executable
})
.catch(exitOnError)
.then(() => downloadFile(readmeUrl, `${ffmpegPath}.README`))
.catch(exitOnErrorOrWarnWith('Failed to download the ffmpeg README.'))
.then(() => downloadFile(readmeUrl, `${binaryPath}.README`))
.catch(exitOnErrorOrWarnWith(`Failed to download the ${executableBaseName} README.`))
.then(() => downloadFile(licenseUrl, `${ffmpegPath}.LICENSE`))
.catch(exitOnErrorOrWarnWith('Failed to download the ffmpeg LICENSE.'))
.then(() => downloadFile(licenseUrl, `${binaryPath}.LICENSE`))
.catch(exitOnErrorOrWarnWith(`Failed to download the ${executableBaseName} LICENSE.`))
{
"name": "ffmpeg-static",
"version": "5.1.0",
"description": "ffmpeg static binaries for Mac OSX and Linux and Windows",
"main": "index.js",
"files": [
"index.js",
"install.js",
"example.js",
"types"
],
"types": "types/index.d.ts",
"scripts": {
"install": "node install.js",
"test": "node test.js",
"lint": "eslint .",
"prepublishOnly": "npm run lint && npm run install && npm test"
},
"ffmpeg-static": {
"binary-release-tag": "b5.0.1",
"binary-release-name": "5.0.1"
},
"repository": {
"type": "git",
"url": "https://github.com/eugeneware/ffmpeg-static"
},
"keywords": [
"ffmpeg",
"static",
"library",
"binary",
"binaries",
"mac",
"linux",
"windows"
],
"authors": [
"Eugene Ware <eugene@noblesamurai.com>",
"Jannis R <mail@jannisr.de>"
],
"contributors": [
"Thefrank (https://github.com/Thefrank)"
],
"license": "GPL-3.0-or-later",
"bugs": {
"url": "https://github.com/eugeneware/ffmpeg-static/issues"
},
"engines": {
"node": ">=16"
},
"dependencies": {
"@derhuerst/http-basic": "^8.2.0",
"env-paths": "^2.2.0",
"https-proxy-agent": "^5.0.0",
"progress": "^2.0.3"
},
"devDependencies": {
"any-shell-escape": "^0.1.1",
"eslint": "^8.6.0"
}
}
"name": "ffmpeg-static",
"version": "5.2.0",
"description": "ffmpeg binaries for macOS, Linux and Windows",
"scripts": {
"install": "node install.js",
"prepublishOnly": "npm run install"
},
"ffmpeg-static": {
"binary-path-env-var": "FFMPEG_BIN",
"binary-release-tag-env-var": "FFMPEG_BINARY_RELEASE",
"binary-release-tag": "b6.0",
"binaries-url-env-var": "FFMPEG_BINARIES_URL",
"executable-base-name": "ffmpeg"
},
"repository": {
"type": "git",
"url": "https://github.com/eugeneware/ffmpeg-static"
},
"keywords": [
"ffmpeg",
"static",
"binary",
"binaries",
"mac",
"linux",
"windows"
],
"authors": [
"Eugene Ware <eugene@noblesamurai.com>",
"Jannis R <mail@jannisr.de>"
],
"contributors": [
"Thefrank (https://github.com/Thefrank)",
"Emil Sivervik <emil@sivervik.com>"
],
"license": "GPL-3.0-or-later",
"bugs": {
"url": "https://github.com/eugeneware/ffmpeg-static/issues"
},
"engines": {
"node": ">=16"
},
"dependencies": {
"@derhuerst/http-basic": "^8.2.0",
"env-paths": "^2.2.0",
"https-proxy-agent": "^5.0.0",
"progress": "^2.0.3"
},
"devDependencies": {
"any-shell-escape": "^0.1.1"
},
"main": "index.js",
"files": [
"index.js",
"install.js",
"example.js",
"types"
],
"types": "types/index.d.ts"
}
# ffmpeg-static
**[ffmpeg](https://ffmpeg.org) static binaries for Mac OSX, Linux, Windows.**
Static **[ffmpeg](https://ffmpeg.org) binaries for macOS, Linux, Windows.**
Supports macOS (64-bit and arm64), Linux (32 and 64-bit, armhf, arm64), Windows (32 and 64-bit). [The ffmpeg version currently used is `5.0.1`.](https://github.com/eugeneware/ffmpeg-static/releases/tag/b5.0.1)
Supports macOS (64-bit and arm64), Linux (32 and 64-bit, armhf, arm64), Windows (32 and 64-bit). [The ffmpeg version currently used is `6.0`.](https://github.com/eugeneware/ffmpeg-static/releases/tag/b6.0)

@@ -16,4 +16,2 @@ [![npm version](https://img.shields.io/npm/v/ffmpeg-static.svg)](https://www.npmjs.com/package/ffmpeg-static)

This module is installed via npm:
``` bash

@@ -23,3 +21,3 @@ $ npm install ffmpeg-static

*Note:* During installation, it will download the appropriate `ffmpeg` binary from the [`b5.0.1` GitHub release](https://github.com/eugeneware/ffmpeg-static/releases/tag/b5.0.1). Use and distribution of the binary releases of FFmpeg are covered by their respective license.
*Note:* During installation, it will download the appropriate `ffmpeg` binary from the [`b6.0` GitHub release](https://github.com/eugeneware/ffmpeg-static/releases/tag/b6.0). Use and distribution of the binary releases of `ffmpeg` are covered by their respective license.

@@ -44,10 +42,7 @@ ### Custom binaries url

``` js
var pathToFfmpeg = require('ffmpeg-static');
console.log(pathToFfmpeg);
const pathToFfmpeg = require('ffmpeg-static')
console.log(pathToFfmpeg)
// /Users/j/playground/node_modules/ffmpeg-static/ffmpeg
```
```
/Users/j/playground/node_modules/ffmpeg-static/ffmpeg
```
Check the [example script](example.js) for a more thorough example.

@@ -57,3 +52,3 @@

[The build script](build/index.sh) downloads binaries from these locations:
The binaries downloaded by `ffmpeg-static` are from these locations:

@@ -65,4 +60,2 @@ - [Windows x64 builds](https://www.gyan.dev/ffmpeg/builds/)

The build script extracts build information and (when possible) the license file from the downloaded package or the distribution server. Please consult the individual build's project site for exact source versions, which you can locate based on the version information included in the README file.
## Show your support

@@ -74,5 +67,1 @@

- **macOS builds**: [Helmut K. C. Tessarek](https://evermeet.cx/ffmpeg/#donations)
## Building the project
The `unzip`, `tar` CLI executables need to be installed. On macOS, use `brew install gnu-tar xz`.