Replace ffprobe static with ffprobe bin

This commit is contained in:
AnimeDL 2023-08-22 20:14:43 -07:00
parent e75aa80c3a
commit 5b43fdcc77
6 changed files with 17 additions and 20 deletions

View file

@ -1,2 +1,3 @@
ffmpeg: "ffmpeg.exe"
mkvmerge: "mkvmerge.exe"
ffprobe: "ffprobe.exe"

View file

@ -21,6 +21,7 @@ This application is not endorsed by or affiliated with *Funimation*, *Crunchyrol
By default this application uses the following paths to programs (main executables):
* `ffmpeg.exe` (From PATH)
* `ffprobe.exe` (From PATH)
* `mkvmerge.exe` (From PATH)
To change these paths you need to edit `bin-path.yml` in `./config/` directory.

View file

@ -81,7 +81,8 @@ export type ConfigObject = {
},
bin: {
ffmpeg?: string,
mkvmerge?: string
mkvmerge?: string,
ffprobe?: string
},
cli: {
[key: string]: any
@ -143,8 +144,9 @@ const loadBinCfg = async () => {
const binCfg = loadYamlCfgFile<ConfigObject['bin']>(binCfgFile);
// binaries
const defaultBin = {
ffmpeg: '${wdir}/bin/ffmpeg/ffmpeg',
mkvmerge: '${wdir}/bin/mkvtoolnix/mkvmerge',
ffmpeg: 'ffmpeg',
mkvmerge: 'mkvmerge',
ffprobe: 'ffprobe'
};
const keys = Object.keys(defaultBin) as (keyof typeof defaultBin)[];
for(const dir of keys){

View file

@ -1,4 +1,5 @@
import * as iso639 from 'iso-639';
import * as yamlCfg from './module.cfg-loader';
import { fontFamilies, fontMime } from './module.fontsData';
import path from 'path';
import fs from 'fs';
@ -7,7 +8,6 @@ import { AvailableMuxer } from './module.args';
import { exec } from './sei-helper-fixes';
import { console } from './log';
import ffprobe from 'ffprobe';
import ffprobeStatic from 'ffprobe-static';
import lookssame from 'looks-same';
import readline from 'readline';
@ -80,10 +80,11 @@ class Merger {
public async createDelays() {
if (this.options.videoAndAudio.length > 1) {
const bin = await yamlCfg.loadBinCfg();
const vnas = this.options.videoAndAudio;
//get and set durations on each videoAndAudio Stream
for (const [vnaIndex, vna] of vnas.entries()) {
const streamInfo = await ffprobe(vna.path, { path: ffprobeStatic.path });
const streamInfo = await ffprobe(vna.path, { path: bin.ffprobe as string });
const videoInfo = streamInfo.streams.filter(stream => stream.codec_type == 'video');
vnas[vnaIndex].duration = videoInfo[0].duration;
vnas[vnaIndex].frameRate = eval(videoInfo[0].avg_frame_rate) as number;
@ -95,7 +96,7 @@ class Merger {
});
fs.mkdirSync('tmp/main-frames', { recursive: true });
exec('ffmpeg', 'ffmpeg', `-hide_banner -loglevel error -i "${vnas[0].path}" -t ${MAX_OFFSET_SEC} tmp/main-frames/%03d.png`, false, true);
exec('ffmpeg', bin.ffmpeg as string, `-hide_banner -loglevel error -i "${vnas[0].path}" -t ${MAX_OFFSET_SEC} tmp/main-frames/%03d.png`, false, true);
const start = vnas[0];
@ -116,7 +117,7 @@ class Merger {
outer: for (let i = 1; i < (items.length); i++) {
console.info(`Trying to match likeness with frame ${i+offset}`);
const closeness = [];
exec('ffmpeg', 'ffmpeg', `-hide_banner -loglevel error -i tmp/main-frames/${items[i]} -i "${vna.path}" -t ${MAX_OFFSET_SEC} -lavfi "ssim=f=tmp/stats-${i}.log;[0:v][1:v]psnr" -f null -`, false, true);
exec('ffmpeg', bin.ffmpeg as string, `-hide_banner -loglevel error -i tmp/main-frames/${items[i]} -i "${vna.path}" -t ${MAX_OFFSET_SEC} -lavfi "ssim=f=tmp/stats-${i}.log;[0:v][1:v]psnr" -f null -`, false, true);
filesToRemove.push(`tmp/stats-${i}.log`);
const fileStream = fs.createReadStream(`tmp/stats-${i}.log`);
const rl = readline.createInterface({
@ -144,7 +145,7 @@ class Merger {
if (frame.overall > LIKENESS_TARGET) {
for (let b = i; b < Math.min(items.length, i + SECURITY_FRAMES); b++) {
console.info(`Verifying Security Frame ${b}...`);
exec('ffmpeg', 'ffmpeg', `-hide_banner -loglevel error -i tmp/main-frames/${items[b]} -i "${vna.path}" -t ${MAX_OFFSET_SEC} -lavfi "ssim=f=tmp/stats-${i}-${b}.log;[0:v][1:v]psnr" -f null -`, false, true);
exec('ffmpeg', bin.ffmpeg as string, `-hide_banner -loglevel error -i tmp/main-frames/${items[b]} -i "${vna.path}" -t ${MAX_OFFSET_SEC} -lavfi "ssim=f=tmp/stats-${i}-${b}.log;[0:v][1:v]psnr" -f null -`, false, true);
filesToRemove.push(`tmp/stats-${i}-${b}.log`);
const fileStream = fs.createReadStream(`tmp/stats-${i}-${b}.log`);
const rl = readline.createInterface({

View file

@ -51,7 +51,6 @@
"eslint-plugin-import": "^2.27.5",
"express": "^4.18.2",
"ffprobe": "^1.1.2",
"ffprobe-static": "^3.1.0",
"form-data": "^4.0.0",
"fs-extra": "^11.1.1",
"got": "^11.8.6",

View file

@ -1,5 +1,9 @@
lockfileVersion: '6.0'
settings:
autoInstallPeers: true
excludeLinksFromLockfile: false
dependencies:
'@babel/core':
specifier: ^7.22.9
@ -28,9 +32,6 @@ dependencies:
ffprobe:
specifier: ^1.1.2
version: 1.1.2
ffprobe-static:
specifier: ^3.1.0
version: 3.1.0
form-data:
specifier: ^4.0.0
version: 4.0.0
@ -3541,10 +3542,6 @@ packages:
dependencies:
reusify: 1.0.4
/ffprobe-static@3.1.0:
resolution: {integrity: sha512-Dvpa9uhVMOYivhHKWLGDoa512J751qN1WZAIO+Xw4L/mrUSPxS4DApzSUDbCFE/LUq2+xYnznEahTd63AqBSpA==}
dev: false
/ffprobe@1.1.2:
resolution: {integrity: sha512-a+oTbhyeM7Z8PRy+mpzmVUAnATZT7z4BO94HSKeqHupdmjiKZ1djzcZkyoyXA21zCOCG7oVRrsBMmvvtmzoz4g==}
dependencies:
@ -5534,7 +5531,3 @@ packages:
/yocto-queue@0.1.0:
resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==}
engines: {node: '>=10'}
settings:
autoInstallPeers: true
excludeLinksFromLockfile: false