From 67c85f5df8554964b5823480681bc1df942fdee7 Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Tue, 27 Dec 2022 16:34:07 +0100 Subject: [PATCH] Improve README --- README.md | 67 +++++++++++++++++++++++++++++++++++++++++++++---- source/index.ts | 4 +-- 2 files changed, 64 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index c84609d..9b07aeb 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,76 @@ # js-vmaf: Simple, but effective VMAF comparison tool This is a simple wrapper around FFmpeg and VMAF to handle comparison of files. +``` +$node . --help +usage: js-vmaf [--help] [--hide_banner] [-q] [-v] --ffmpeg FFMPEG --ffprobe FFPROBE [--vmaf VMAF] -r + REFERENCE [-o OUTPUT] [--flip] [-cs COLOR_SPACE] [-cp COLOR_PRIMARIES] [-ct COLOR_TRC] + [-cr COLOR_RANGE] [-p FORMAT] [-w WIDTH] [-h HEIGHT] [--fps FPS] [-f FEATURE] [-m MODEL] + [-t THREADS] + Path [Path ...] + +A simple, yet effective tool to quickly compare one or more videos using VMAF. + +positional arguments: + Path One or more paths to a distorted file or a directory containing distorted files. + +optional arguments: + --help show this help message and exit + --hide_banner Hide license banner. + -q, --quiet Be quiet. + -v, --verbose Be verbose. + --ffmpeg FFMPEG Path to the FFmpeg binary to use. + --ffprobe FFPROBE Path to the FFprobe binary to use. + --vmaf VMAF Path to the VMAF binary to use. Will fall back to FFmpeg if not provided + -r REFERENCE, --reference REFERENCE + Reference file + -o OUTPUT, --output OUTPUT + The file name, including formatters, for the output log file. + --flip Scale, convert and resample to distorted file instead of reference file. + -cs COLOR_SPACE, --color_space COLOR_SPACE + Define the color space of the reference file. + -cp COLOR_PRIMARIES, --color_primaries COLOR_PRIMARIES + Define the color primaries of the reference file. + -ct COLOR_TRC, --color_trc COLOR_TRC + Define the color transfer characteristics of the reference file. + -cr COLOR_RANGE, --color_range COLOR_RANGE + Define the color range of the reference file. + -p FORMAT, --format FORMAT + Define the format for comparison. + -w WIDTH, --width WIDTH + Define the width for the comparision. + -h HEIGHT, --height HEIGHT + Define the height for the comparision. + --fps FPS Define the FPS for comparison. + -f FEATURE, --feature FEATURE + Enable (and configure) a feature + -m MODEL, --model MODEL + Enable (and configure) a model + -t THREADS, --threads THREADS + Number of threads to use. +``` + + ## Installing ``` npm install npm run build ``` -## Usage +## Examples + +##### Compare all files in a directory ``` -node . --help +$(prog) --ffmpeg ffmpeg --ffprobe ffprobe -r /mnt/usb0/ref.mp4 /mnt/usb1/ ``` -## Examples -### Compare all files in a directory +##### Use the distorted files as the target size +The following command converts the reference to the same format, resolution, framerate and color as the distorted files. Ideal for bitrate optimization. ``` -node . --ffmpeg ./ffmpeg --ffprobe ./ffprobe -r /mnt/usb0/reference.mp4 /mnt/usb1/ +$(prog) --ffmpeg ffmpeg --ffprobe ffprobe --flip -r /mnt/usb0/ref.mp4 /mnt/usb1/ +``` + +##### Resize everything to 1080p and convert to yuv420p +``` +$(prog) --ffmpeg ffmpeg --ffprobe ffprobe -h 1080 -p yuv420p -r /mnt/usb0/ref.mp4 /mnt/usb1/ ``` diff --git a/source/index.ts b/source/index.ts index 5d63598..df6fe03 100644 --- a/source/index.ts +++ b/source/index.ts @@ -298,7 +298,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AN // Convert format. if (this._args.format || (this._ref.video[0].pix_fmt !== fref.video[0].pix_fmt)) { - chain.push(`format=pix_fmts=${valueOrDefault(this._args.format, valueOrDefault(fref.video[0].pix_fmt, "yuv420p"))}`) + chain.push(`format=pix_fmts=${valueOrDefault(this._args.format, valueOrDefault(fref.video[0].pix_fmt, "yuv420p"))}`); } filters.push(`[0:v:0]${chain.join(",")}[ref]`); @@ -355,7 +355,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AN // Convert format. if (this._args.format || (cmp.video[0].pix_fmt !== fref.video[0].pix_fmt)) { - chain.push(`format=pix_fmts=${valueOrDefault(this._args.format, valueOrDefault(fref.video[0].pix_fmt, "yuv420p"))}`) + chain.push(`format=pix_fmts=${valueOrDefault(this._args.format, valueOrDefault(fref.video[0].pix_fmt, "yuv420p"))}`); } filters.push(`[1:v:0]${chain.join(",")}[dst]`);