From 6d8def491d9b58256177c3e29593d999ff5b4b69 Mon Sep 17 00:00:00 2001 From: Boris Yakubchik Date: Wed, 15 Mar 2023 18:42:37 -0400 Subject: [PATCH] manually add ffmpeg and ffprobe --- .gitignore | 6 ++ README.md | 2 - electron-builder.json | 4 + node/main-extract.ts | 4 +- node/main-support.ts | 6 +- package-lock.json | 213 +++--------------------------------------- package.json | 2 - 7 files changed, 33 insertions(+), 204 deletions(-) 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/README.md b/README.md index fce199ea..e3fe30d4 100644 --- a/README.md +++ b/README.md @@ -80,8 +80,6 @@ This software would not be possible without the tremendous work by other people: - [FFmpeg](https://www.ffmpeg.org/) - [angular-electron](https://github.com/maximegris/angular-electron) - [ngx-virtual-scroller](https://github.com/rintoj/ngx-virtual-scroller) - - [ffmpeg-static](https://github.com/eugeneware/ffmpeg-static) - - [@ffprobe-installer/ffprobe](https://github.com/SavageCore/node-ffprobe-installer) - [ngx-translate](https://github.com/ngx-translate/core) - [fdir](https://github.com/thecodrr/fdir) - [async](https://github.com/caolan/async) 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 d253f883..f52024b7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,16 +1,15 @@ { "name": "video-hub-app-3", - "version": "3.2.0", + "version": "3.2.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "video-hub-app-3", - "version": "3.2.0", + "version": "3.2.1", "hasInstallScript": true, "license": "MIT", "dependencies": { - "@ffprobe-installer/ffprobe": "2.0.0", "@ngx-translate/core": "14.0.0", "an-qrcode": "1.0.7", "async": "3.2.4", @@ -19,7 +18,6 @@ "electron-window-state": "5.0.3", "express": "4.18.2", "fdir": "6.0.1", - "ffmpeg-static": "5.1.0", "fuse.js": "6.6.2", "ip": "1.1.8", "natural-orderby": "3.0.2", @@ -2613,20 +2611,6 @@ "postcss-selector-parser": "^6.0.10" } }, - "node_modules/@derhuerst/http-basic": { - "version": "8.2.4", - "resolved": "https://registry.npmjs.org/@derhuerst/http-basic/-/http-basic-8.2.4.tgz", - "integrity": "sha512-F9rL9k9Xjf5blCz8HsJRO4diy111cayL2vkY2XE4r4t3n0yPXVYy3KD3nJ1qbrSn9743UWSXH4IwuCa/HWlGFw==", - "dependencies": { - "caseless": "^0.12.0", - "concat-stream": "^2.0.0", - "http-response-object": "^3.0.1", - "parse-cache-control": "^1.0.1" - }, - "engines": { - "node": ">=6.0.0" - } - }, "node_modules/@develar/schema-utils": { "version": "2.6.5", "resolved": "https://registry.npmjs.org/@develar/schema-utils/-/schema-utils-2.6.5.tgz", @@ -3035,126 +3019,6 @@ "node": ">=12" } }, - "node_modules/@ffprobe-installer/darwin-arm64": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/@ffprobe-installer/darwin-arm64/-/darwin-arm64-5.0.1.tgz", - "integrity": "sha512-vwNCNjokH8hfkbl6m95zICHwkSzhEvDC3GVBcUp5HX8+4wsX10SP3B+bGur7XUzTIZ4cQpgJmEIAx6TUwRepMg==", - "cpu": [ - "arm64" - ], - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@ffprobe-installer/darwin-x64": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@ffprobe-installer/darwin-x64/-/darwin-x64-5.1.0.tgz", - "integrity": "sha512-J+YGscZMpQclFg31O4cfVRGmDpkVsQ2fZujoUdMAAYcP0NtqpC49Hs3SWJpBdsGB4VeqOt5TTm1vSZQzs1NkhA==", - "cpu": [ - "x64" - ], - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@ffprobe-installer/ffprobe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@ffprobe-installer/ffprobe/-/ffprobe-2.0.0.tgz", - "integrity": "sha512-BT5BHZZSOyFFbHd+3zFdEQCNfBORYwNtqre7l1dMmqvDha60G/7rEDCSeCX4sNLuCcNR4IxvGHicfRQie7SNUA==", - "engines": { - "node": ">=14.21.2" - }, - "optionalDependencies": { - "@ffprobe-installer/darwin-arm64": "5.0.1", - "@ffprobe-installer/darwin-x64": "5.1.0", - "@ffprobe-installer/linux-arm": "5.1.0", - "@ffprobe-installer/linux-arm64": "5.1.0", - "@ffprobe-installer/linux-ia32": "5.1.0", - "@ffprobe-installer/linux-x64": "5.1.0", - "@ffprobe-installer/win32-ia32": "5.1.0", - "@ffprobe-installer/win32-x64": "5.1.0" - } - }, - "node_modules/@ffprobe-installer/linux-arm": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@ffprobe-installer/linux-arm/-/linux-arm-5.1.0.tgz", - "integrity": "sha512-y34AEive/M5/++RcuRJZciICYYRkmTh5gK6th7raydgfQhIYy/8AXAIGKqD5Hn855i6o/RpEIPjk7DWpEuwrdA==", - "cpu": [ - "arm" - ], - "hasInstallScript": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@ffprobe-installer/linux-arm64": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@ffprobe-installer/linux-arm64/-/linux-arm64-5.1.0.tgz", - "integrity": "sha512-u5b3r3/39eZmEV0X4OKUfp6gO3lOyVIpRO4WU+5Eb6omWYy+k0OkVbRffK4qJF1Uz8irwzyiDsmUZ6vE13/abQ==", - "cpu": [ - "arm64" - ], - "hasInstallScript": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@ffprobe-installer/linux-ia32": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@ffprobe-installer/linux-ia32/-/linux-ia32-5.1.0.tgz", - "integrity": "sha512-Uqk4sYYQxz0KQmEQ2xxbVu/KiDX7Pw6wRDpCYv0sW49GI3wpX2Umqi/Kmtr0tpCvxctVoCdf/U71EAxH2Lztdg==", - "cpu": [ - "ia32" - ], - "hasInstallScript": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@ffprobe-installer/linux-x64": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@ffprobe-installer/linux-x64/-/linux-x64-5.1.0.tgz", - "integrity": "sha512-r7cGOjNb8AMnKAEvz5f8N/WsWsre02LhAfDKZX0m5J0bsrYgs2HUlnnQiwjRCH9CYXYerjYqq592o/GXvxDS+Q==", - "cpu": [ - "x64" - ], - "hasInstallScript": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@ffprobe-installer/win32-ia32": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@ffprobe-installer/win32-ia32/-/win32-ia32-5.1.0.tgz", - "integrity": "sha512-5O3vOoNRxmut0/Nu9vSazTdSHasrr+zPT2B3Hm7kjmO3QVFcIfVImS6ReQnZeSy8JPJOqXts5kX5x/3KOX54XQ==", - "cpu": [ - "ia32" - ], - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@ffprobe-installer/win32-x64": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@ffprobe-installer/win32-x64/-/win32-x64-5.1.0.tgz", - "integrity": "sha512-jMGYeAgkrdn4e2vvYt/qakgHRE3CPju4bn5TmdPfoAm1BlX1mY9cyMd8gf5vSzI8gH8Zq5WQAyAkmekX/8TSTg==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "win32" - ] - }, "node_modules/@gar/promisify": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/@gar/promisify/-/promisify-1.1.3.tgz", @@ -5698,6 +5562,7 @@ "version": "6.0.2", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dev": true, "dependencies": { "debug": "4" }, @@ -6638,7 +6503,8 @@ "node_modules/buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", - "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==" + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true }, "node_modules/builder-util": { "version": "22.10.3", @@ -6930,11 +6796,6 @@ } ] }, - "node_modules/caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==" - }, "node_modules/chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", @@ -7260,20 +7121,6 @@ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" }, - "node_modules/concat-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-2.0.0.tgz", - "integrity": "sha512-MWufYdFw53ccGjCA+Ol7XJYpAlW6/prSMzuPOTRnJGcGzuhLn4Scrz7qf6o8bROZ514ltazcIFJZevcfbo0x7A==", - "engines": [ - "node >= 6.0" - ], - "dependencies": { - "buffer-from": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^3.0.2", - "typedarray": "^0.0.6" - } - }, "node_modules/configstore": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.1.tgz", @@ -7717,6 +7564,7 @@ "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, "dependencies": { "ms": "2.1.2" }, @@ -8586,6 +8434,7 @@ "version": "2.2.1", "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==", + "dev": true, "engines": { "node": ">=6" } @@ -9165,21 +9014,6 @@ } } }, - "node_modules/ffmpeg-static": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/ffmpeg-static/-/ffmpeg-static-5.1.0.tgz", - "integrity": "sha512-eEWOiGdbf7HKPeJI5PoJ0oCwkL0hckL2JdS4JOuB/gUETppwkEpq8nF0+e6VEQnDCo/iuoipbTUsn9QJmtpNkg==", - "hasInstallScript": true, - "dependencies": { - "@derhuerst/http-basic": "^8.2.0", - "env-paths": "^2.2.0", - "https-proxy-agent": "^5.0.0", - "progress": "^2.0.3" - }, - "engines": { - "node": ">=16" - } - }, "node_modules/figures": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", @@ -10139,19 +9973,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/http-response-object": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/http-response-object/-/http-response-object-3.0.2.tgz", - "integrity": "sha512-bqX0XTF6fnXSQcEJ2Iuyr75yVakyjIDCqroJQ/aHfSdlM743Cwqoi2nDYMzLGWUcuTWGWy8AAvOKXTfiv6q9RA==", - "dependencies": { - "@types/node": "^10.0.3" - } - }, - "node_modules/http-response-object/node_modules/@types/node": { - "version": "10.17.60", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.60.tgz", - "integrity": "sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw==" - }, "node_modules/http2-wrapper": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-1.0.3.tgz", @@ -10169,6 +9990,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "dev": true, "dependencies": { "agent-base": "6", "debug": "4" @@ -12427,7 +12249,8 @@ "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true }, "node_modules/multicast-dns": { "version": "7.2.5", @@ -13563,11 +13386,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", @@ -14060,6 +13878,7 @@ "version": "2.0.3", "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true, "engines": { "node": ">=0.4.0" } @@ -14435,6 +14254,7 @@ "version": "3.6.0", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", @@ -15641,6 +15461,7 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, "dependencies": { "safe-buffer": "~5.2.0" } @@ -16620,11 +16441,6 @@ "integrity": "sha512-KNNZtayBCtmnNmbo5mG47p1XsCyrx6iVqomjcZnec/1Y5GGARaxPs6r49RnSPeUP3YjNYiU9sQHAtY4BBvnZwg==", "dev": true }, - "node_modules/typedarray": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", - "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==" - }, "node_modules/typedarray-to-buffer": { "version": "3.1.5", "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", @@ -16937,7 +16753,8 @@ "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true }, "node_modules/util/node_modules/inherits": { "version": "2.0.3", diff --git a/package.json b/package.json index 82e47e6b..9ff4f6d4 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,6 @@ "postinstall": "electron-builder install-app-deps" }, "dependencies": { - "@ffprobe-installer/ffprobe": "2.0.0", "@ngx-translate/core": "14.0.0", "an-qrcode": "1.0.7", "async": "3.2.4", @@ -53,7 +52,6 @@ "electron-window-state": "5.0.3", "express": "4.18.2", "fdir": "6.0.1", - "ffmpeg-static": "5.1.0", "fuse.js": "6.6.2", "ip": "1.1.8", "natural-orderby": "3.0.2",