vuality
v1.1.7
Published
Video Quality Assessment Utility for Node.js
Downloads
15
Maintainers
Readme
vuality
Video Quality Assessment Utility for Node.js
This package is a kind of wrapper of FFmpeg to compare quality between two videos.
Currently vuality provides two Video Quality Assessment methods to compare quality - PSNR and SSIM.
Prerequisites
vuality uses ffmpeg internally. Please install ffmpeg, or download pre-built ffmpeg before using vuality package.
Usage
Install vuality
to get up and running.
$ npm install vuality
Then:
import { Vuality } from "vuality";
const vuality = new Vuality();
// or
const vuality = new Vuality("/path/to/ffmpeg");
// Then either:
const psnr = await vuality.psnr("input.mp4", "reference.mp4");
// or:
const ssim = await vuality.ssim("input.mp4", "reference.mp4");
API
vuality.psnr(input: Buffer | string, reference: string, options: AssessmentOption): Promise<PSNRStat>
Returns PSNR Stats
If scale
option is provided, Vuality tries to scale video streams as given resolution before computing PSNR.
export interface PSNRStat {
avg?: number;
y?: number;
u?: number;
v?: number;
r?: number;
g?: number;
b?: number;
a?: number;
}
export interface PSNRFrame {
n: number;
mse: PSNRStat;
psnr: PSNRStat;
}
export interface PSNR {
psnr: PSNRStat;
mse: PSNRStat;
frames: PSNRFrame[];
}
vuality.psnrSync(input: Buffer | string, reference: string, options: AssessmentOption): PSNRStat
Sync version of vuality.psnr
.
vuality.ssim(input: Buffer | string, reference: string, options: AssessmentOption): Promise<SSIMStat>
Returns SSIM Stats
If scale
option is provided, Vuality tries to scale video streams as given resolution before computing SSIM.
export interface SSIMStat {
all?: number;
y?: number;
u?: number;
v?: number;
r?: number;
g?: number;
b?: number;
}
export interface SSIMFrame {
n: number;
ssim: SSIMStat;
}
export interface SSIM {
ssim: SSIMStat;
frames: SSIMFrame[];
}
vuality.ssimSync(input: Buffer | string, reference: string, options: AssessmentOption): SSIMStat
Sync version of vuality.ssim
.
Changelog
See CHANGELOG.
Testing
$ npm run test
Building
$ npm run build
License
See full license on mooyoul.mit-license.org