Skip to content

Commit

Permalink
support $FFMPEG_BINARIES_URL to configure the location of ffmpeg bina…
Browse files Browse the repository at this point in the history
…ries 📝

fixes #99
  • Loading branch information
derhuerst committed Jul 31, 2022
1 parent 50ace82 commit fa0c1b3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ $ 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.

### Custom binaries url

By default, the `ffmpeg` binary will get downloaded from `https://github.com/eugeneware/ffmpeg-static/releases/download`. To customise this, e.g. when using a mirror, set the `FFMPEG_BINARIES_URL` environment variable.

```shell
export FFMPEG_BINARIES_URL=https://cdn.npmmirror.com/binaries/ffmpeg-static
npm install ffmpeg-static
```

### Electron & other cross-platform packaging tools

Because `ffmpeg-static` will download a binary specific to the OS/platform, you need to purge `node_modules` before (re-)packaging your app *for a different OS/platform* ([read more in #35](https://github.com/eugeneware/ffmpeg-static/issues/35#issuecomment-630225392)).
Expand Down
7 changes: 5 additions & 2 deletions install.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,11 @@ const releaseName = (
)
const arch = process.env.npm_config_arch || os.arch()
const platform = process.env.npm_config_platform || os.platform()

const baseUrl = `https://github.com/eugeneware/ffmpeg-static/releases/download/${release}`
const downloadsUrl = (
process.env.FFMPEG_BINARIES_URL ||
'https://github.com/eugeneware/ffmpeg-static/releases/download'
)
const baseUrl = `${downloadsUrl}/${release}`
const downloadUrl = `${baseUrl}/${platform}-${arch}.gz`
const readmeUrl = `${baseUrl}/${platform}-${arch}.README`
const licenseUrl = `${baseUrl}/${platform}-${arch}.LICENSE`
Expand Down

0 comments on commit fa0c1b3

Please sign in to comment.