move ffprobe to ffmpeg.ts
This commit is contained in:
parent
9fedc71337
commit
7a86ad95b4
2 changed files with 17 additions and 15 deletions
|
@ -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);
|
||||
});
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue