added build-in ffmpeg

This commit is contained in:
Daniel Haller 2024-04-20 19:16:29 +02:00
parent 51e8ef8191
commit 682de20fb2
4 changed files with 83 additions and 5 deletions

View File

@ -45,6 +45,8 @@
"electron-updater": "^5.3.0",
"express": "^4.19.2",
"fastify": "^4.26.2",
"ffmpeg-static": "^5.2.0",
"ffprobe-static": "^3.1.0",
"fluent-ffmpeg": "^2.1.2",
"mpd-parser": "^1.3.0",
"node-cache": "^5.1.2",
@ -52,5 +54,12 @@
"sequelize": "^6.37.2",
"sqlite3": "5.1.6",
"uuid": "^9.0.1"
},
"build": {
"asarUnpack": [
"node_modules/ffmpeg-static/bin/${os}/${arch}/ffmpeg",
"node_modules/ffmpeg-static/index.js",
"node_modules/ffmpeg-static/package.json"
]
}
}

View File

@ -368,7 +368,7 @@ const refetchEpisodes = async () => {
const switchToSeason = async () => {
isFetchingSeasons.value++
if (!ADNselectedShow.value && !CRselectedShow.value && !url) {
if (!ADNselectedShow.value && !CRselectedShow.value && !url.value) {
isFetchingSeasons.value--
return
}
@ -388,7 +388,7 @@ const switchToSeason = async () => {
tab.value = 2
}
if (url.value && url.value.includes('crunchyroll')) {
if (url.value && url.value.includes('crunchyroll') && !CRselectedShow.value) {
const seriesID = url.value.split('/')
seasons.value = await listSeasonCrunchy(seriesID[5])
if (!seasons.value) {

67
pnpm-lock.yaml generated
View File

@ -35,6 +35,12 @@ dependencies:
fastify:
specifier: ^4.26.2
version: 4.26.2
ffmpeg-static:
specifier: ^5.2.0
version: 5.2.0
ffprobe-static:
specifier: ^3.1.0
version: 3.1.0
fluent-ffmpeg:
specifier: ^2.1.2
version: 2.1.2
@ -553,6 +559,16 @@ packages:
postcss: 8.4.38
dev: true
/@derhuerst/http-basic@8.2.4:
resolution: {integrity: sha512-F9rL9k9Xjf5blCz8HsJRO4diy111cayL2vkY2XE4r4t3n0yPXVYy3KD3nJ1qbrSn9743UWSXH4IwuCa/HWlGFw==}
engines: {node: '>=6.0.0'}
dependencies:
caseless: 0.12.0
concat-stream: 2.0.0
http-response-object: 3.0.2
parse-cache-control: 1.0.1
dev: false
/@develar/schema-utils@2.6.5:
resolution: {integrity: sha512-0cp4PsWQ/9avqTVMCtZ+GirikIA36ikvjtHweU4/j8yLtgObI0+JUPhYFScgwlteveGB1rt3Cm8UhN04XayDig==}
engines: {node: '>= 8.9.0'}
@ -2158,6 +2174,10 @@ packages:
resolution: {integrity: sha512-0ikrnug3/IyneSHqCBeslAhlK2aBfYek1fGo4bP4QnZPmiqSGRK+Oy7ZMisLWkesffJvQ1cqAcBnJC+8+nxIAg==}
dev: false
/@types/node@10.17.60:
resolution: {integrity: sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw==}
dev: false
/@types/node@16.18.95:
resolution: {integrity: sha512-z9w+CcR7ahc7UhsKe+PGB25nmPmCERQBAdLdFHhoZ6+FfgSr7gUvdQI0eLH2t7ue8u5wKsLdde6cHKPjhC8vGg==}
dev: true
@ -3741,7 +3761,6 @@ packages:
/buffer-from@1.1.2:
resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==}
dev: true
/buffer@5.7.1:
resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==}
@ -3944,6 +3963,10 @@ packages:
/caniuse-lite@1.0.30001607:
resolution: {integrity: sha512-WcvhVRjXLKFB/kmOFVwELtMxyhq3iM/MvmXcyCe2PNf166c39mptscOc/45TTS96n2gpNV2z7+NakArTWZCQ3w==}
/caseless@0.12.0:
resolution: {integrity: sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==}
dev: false
/chalk@2.4.2:
resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==}
engines: {node: '>=4'}
@ -4182,6 +4205,16 @@ packages:
/concat-map@0.0.1:
resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==}
/concat-stream@2.0.0:
resolution: {integrity: sha512-MWufYdFw53ccGjCA+Ol7XJYpAlW6/prSMzuPOTRnJGcGzuhLn4Scrz7qf6o8bROZ514ltazcIFJZevcfbo0x7A==}
engines: {'0': node >= 6.0}
dependencies:
buffer-from: 1.1.2
inherits: 2.0.4
readable-stream: 3.6.2
typedarray: 0.0.6
dev: false
/concurrently@8.2.2:
resolution: {integrity: sha512-1dP4gpXFhei8IOtlXRE/T/4H88ElHgTiUzh71YUmtjTEHMSRS2Z/fgOxHSxxusGHogsRfxNq1vyAwxSC+EVyDg==}
engines: {node: ^14.13.0 || >=16.0.0}
@ -5693,6 +5726,23 @@ packages:
pend: 1.2.0
dev: true
/ffmpeg-static@5.2.0:
resolution: {integrity: sha512-WrM7kLW+do9HLr+H6tk7LzQ7kPqbAgLjdzNE32+u3Ff11gXt9Kkkd2nusGFrlWMIe+XaA97t+I8JS7sZIrvRgA==}
engines: {node: '>=16'}
requiresBuild: true
dependencies:
'@derhuerst/http-basic': 8.2.4
env-paths: 2.2.1
https-proxy-agent: 5.0.1
progress: 2.0.3
transitivePeerDependencies:
- supports-color
dev: false
/ffprobe-static@3.1.0:
resolution: {integrity: sha512-Dvpa9uhVMOYivhHKWLGDoa512J751qN1WZAIO+Xw4L/mrUSPxS4DApzSUDbCFE/LUq2+xYnznEahTd63AqBSpA==}
dev: false
/file-entry-cache@6.0.1:
resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==}
engines: {node: ^10.12.0 || >=12.0.0}
@ -6372,6 +6422,12 @@ packages:
- supports-color
dev: true
/http-response-object@3.0.2:
resolution: {integrity: sha512-bqX0XTF6fnXSQcEJ2Iuyr75yVakyjIDCqroJQ/aHfSdlM743Cwqoi2nDYMzLGWUcuTWGWy8AAvOKXTfiv6q9RA==}
dependencies:
'@types/node': 10.17.60
dev: false
/http-shutdown@1.2.2:
resolution: {integrity: sha512-S9wWkJ/VSY9/k4qcjG318bqJNruzE4HySUhFYknwmu6LBP97KLLfwNf+n4V1BHurvFNkSKLFnK/RsuUnRTf9Vw==}
engines: {iojs: '>= 1.0.0', node: '>= 0.12.0'}
@ -8379,6 +8435,10 @@ packages:
callsites: 3.1.0
dev: true
/parse-cache-control@1.0.1:
resolution: {integrity: sha512-60zvsJReQPX5/QP0Kzfd/VrpjScIQ7SHBW6bFCYfEP+fp0Eppr1SHhIO5nd1PjZtvclzSzES9D/p5nFJurwfWg==}
dev: false
/parse-git-config@3.0.0:
resolution: {integrity: sha512-wXoQGL1D+2COYWCD35/xbiKma1Z15xvZL8cI25wvxzled58V51SJM04Urt/uznS900iQor7QO04SgdfT/XlbuA==}
engines: {node: '>=8'}
@ -8999,7 +9059,6 @@ packages:
/progress@2.0.3:
resolution: {integrity: sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==}
engines: {node: '>=0.4.0'}
dev: true
/promise-inflight@1.0.1:
resolution: {integrity: sha512-6zWPyEOFaQBJYcGMHBKTKJ3u6TBsnMFOIZSa6ce1e/ZrrsOlnHRHbabMjLiBYKp+n44X9eUI6VUPaukCXHuG4g==}
@ -10522,6 +10581,10 @@ packages:
rxjs: 7.8.1
dev: false
/typedarray@0.0.6:
resolution: {integrity: sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==}
dev: false
/typescript@5.4.4:
resolution: {integrity: sha512-dGE2Vv8cpVvw28v8HCPqyb08EzbBURxDpuhJvTrusShUfGnhHBafDsLdS1EhhxyL6BJQE+2cT3dDPAv+MQ6oLw==}
engines: {node: '>=14.17'}

View File

@ -13,6 +13,8 @@ import { finished } from 'stream/promises'
import { v4 as uuidv4 } from 'uuid'
import { app } from 'electron'
var cron = require('node-cron')
const ffmpegPath = require('ffmpeg-static').replace('app.asar', 'app.asar.unpacked')
const ffprobePath = require('ffprobe-static').path.replace('app.asar', 'app.asar.unpacked')
const crErrors = [
{
@ -743,6 +745,8 @@ async function mergeParts(parts: { filename: string; url: string }[], downloadID
return new Promise((resolve, reject) => {
Ffmpeg()
.setFfmpegPath(ffmpegPath)
.setFfprobePath(ffprobePath)
.input(concatenatedFile)
.outputOptions('-c copy')
.save(dir + `/${tempname}.mp4`)
@ -770,6 +774,8 @@ async function mergePartsAudio(parts: { filename: string; url: string }[], tmp:
return new Promise((resolve, reject) => {
Ffmpeg()
.setFfmpegPath(ffmpegPath)
.setFfprobePath(ffprobePath)
.input(concatenatedFile)
.outputOptions('-c copy')
.save(`${dir}/${name}.aac`)
@ -814,7 +820,7 @@ async function mergeFile(video: string, audios: Array<string>, subs: Array<strin
]
return new Promise((resolve, reject) => {
var output = Ffmpeg()
var output = Ffmpeg().setFfmpegPath(ffmpegPath).setFfprobePath(ffprobePath)
var ffindex = 1
output.addInput(video)
var options = ['-map_metadata -1', '-c copy', '-metadata:s:v:0 VARIANT_BITRATE=0', '-map 0']