move ffprobe to ffmpeg.ts

This commit is contained in:
waveringana 2023-10-31 13:13:22 -04:00
parent 9fedc71337
commit 7a86ad95b4
2 changed files with 17 additions and 15 deletions

View file

@ -1,6 +1,6 @@
import { extension, videoExtensions, imageExtensions } from "./lib";
import ffmpeg from 'fluent-ffmpeg';
import ffmpeg, { FfprobeData, ffprobe } from 'fluent-ffmpeg';
import ffmpegInstaller from '@ffmpeg-installer/ffmpeg';
import ffprobeInstaller from '@ffprobe-installer/ffprobe';
import which from 'which';
@ -173,4 +173,13 @@ export const ffmpegConvert = (path: string, filename: string, extension: string)
.on("error", (e) => reject(e))
.run();
});
}
export const ffProbe = (path: string, filename: string, extension: string) => {
return new Promise<FfprobeData>((resolve, reject) => {
ffprobe(path, (err, data) => {
if (err) reject (err);
resolve(data);
});
});
}