diff --git a/.gitignore b/.gitignore index 5ce0d11e..9a260d86 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,12 @@ /remote /.idea +/ffmpeg/ffmpeg +/ffmpeg/ffprobe + +/ffmpeg/ffmpeg.exe +/ffmpeg/ffprobe.exe + *.js *.js.map *.log diff --git a/electron-builder.json b/electron-builder.json index 3caff620..573af7f8 100644 --- a/electron-builder.json +++ b/electron-builder.json @@ -17,6 +17,10 @@ "!tslint.json" ], "extraResources": [ + { + "from": "ffmpeg", + "to": "ffmpeg" + }, { "from": "src/assets/icons/mac/touch-bar", "to": "assets" diff --git a/node/main-extract.ts b/node/main-extract.ts index ce58b1c0..337b2d91 100644 --- a/node/main-extract.ts +++ b/node/main-extract.ts @@ -1,3 +1,5 @@ +import { app } from "electron"; + /** * This file contains all the logic for extracting: * first thumbnail, @@ -25,7 +27,7 @@ const fs = require('fs'); import * as path from 'path'; const spawn = require('child_process').spawn; -const ffmpegPath = require('ffmpeg-static').replace('app.asar', 'app.asar.unpacked'); +const ffmpegPath: string = app.isPackaged ? './resources/ffmpeg/ffmpeg' : './ffmpeg/ffmpeg'; import { GLOBALS } from './main-globals'; diff --git a/node/main-support.ts b/node/main-support.ts index a5c8e1f5..8fe34923 100644 --- a/node/main-support.ts +++ b/node/main-support.ts @@ -1,3 +1,5 @@ +import { app } from "electron" + /* * This whole file is meant to contain only PURE functions * @@ -12,7 +14,9 @@ import { GLOBALS } from './main-globals'; // TODO -- eliminate dependence on `GL import * as path from 'path'; const exec = require('child_process').exec; -const ffprobePath = require('@ffprobe-installer/ffprobe').path.replace('app.asar', 'app.asar.unpacked'); + +const ffprobePath: string = app.isPackaged ? './resources/ffmpeg/ffprobe' : './ffmpeg/ffprobe'; + const fs = require('fs'); const hasher = require('crypto').createHash; import type { Stats } from 'fs'; diff --git a/package-lock.json b/package-lock.json index 470de18b..61543ca5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14931,11 +14931,6 @@ "node": ">=6" } }, - "node_modules/parse-cache-control": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parse-cache-control/-/parse-cache-control-1.0.1.tgz", - "integrity": "sha512-60zvsJReQPX5/QP0Kzfd/VrpjScIQ7SHBW6bFCYfEP+fp0Eppr1SHhIO5nd1PjZtvclzSzES9D/p5nFJurwfWg==" - }, "node_modules/parse-json": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz",