fifonik / FFMetrics

Visualizes Video Quality Metrics (PSNR, SSIM & VMAF) calculated by ffmpeg.exe
570 stars 22 forks source link

Use in-built in ffmpeg vmaf models if available #86

Closed fifonik closed 2 years ago

ls-milkyway commented 2 years ago

Here are the commands for in-built models working for all new FFMPEGS:

ffmpeg.exe -f lavfi -i color=c=black:s=640x480:d=1 -filter_complex "[0:v][0:v]libvmaf=model=version=vmaf_v0.6.1" -f null - & FOR 4K: ffmpeg.exe -f lavfi -i color=c=black:s=640x480:d=1 -filter_complex "[0:v][0:v]libvmaf=model=version=vmaf_4k_v0.6.1" -f null -

Similarly, you can find commands for all in-built models included on the vmaf site.......this I have tested them on: BtbN master latest static gpl , Gyan's git full version for Windows. and even on my new compiled version with VIM (xxd.exe).

Plz Note: Gyan also has FFmpeg release version which does not include in-built models... & most importantly it's working on my build also .....even FFmetrics 1.0.0 is now able to detect VMAF with my compiled FFmpeg......

It was nothing but a missing essential package xxd.exe which is part of VIM ....causing absolute path to be broken.... so please do not try to run in-built model on FFmpeg which I sent you earlier (unless you want to use libfdk-aac).

Further I would like to suggest you to adopt logical flow (GUI with progress bar):

STEP1: Detect if FFmpeg is present in the FFmetrics folder...if no goto step 2 else goto step3 STEP2: Throw error FFmpeg not found ....download & extract it from https://github.com/BtbN/FFmpeg-Builds/releases [I would recommend BtbN over Gyan because it is smaller than Gyan (has 2 releases ...can cause confusion)....plus it is less prone to errors as it is cross-compiled] STEP3: Detect CPU cores for parallelization....then detect mediainfo, detect VMAF....etc. STEP4: If VMAF is not detected then throw a warning "vmaf not found in the version....plz download latest from (BtBn url)....ready to compute PSNR & SSIM only".

VMAF Detection: Just go in for in-built models detection based on gathered mediainfo.....OR you can make your app more universal by downloading vmaf-models folder (by the user consent if he is using old ffmpeg) ...but I guess later will complicate the things as in-built is the future.....(hence force the user to download a FFmpeg with in-built models)...it's up to you.

Thanks for your support & discussion (sorry...most of which was unnecessary due to path problems caused by missing xxd,exe) and you can close those issues now.

fifonik commented 2 years ago

I hate the libvmaf. They have different escaping if model path specified in old format (model_path=...) and in new format (model=path=...).

I did not know that modern gyan/btbn builds have build-in vmaf models. Tested and already implemented built-in models auto detection. It will be available in the next version.

ls-milkyway commented 2 years ago

I hate the libvmaf. They have different escaping if model path specified in old format (model_path=...) and in new format (model=path=...).

You can't do anything about it...I have used Vapoursynth & others to calculate VMAF ...but it's huge, error prone and complicated ......change is inevitable in this world.... ffmpeg is at least warning about depreciated model_path=......there are other sh*t-head projects who change their API (json structure) without notice/warning. Simply force user to use new versions. by providing download links. Even FFmpeg git & many gits used by it get updated in matter of minutes ....huge task for the team to maintain, compile & keep it up.

I did not know that modern gyan/btbn builds have build-in vmaf models.

Me too ...found it official ffmpeg discussions.. while troubleshooting path problem....the command is new ....ffmpeg/vmaf docs are cryptic & poor...internet is full of old commands...it was hard to find. In BtbN it was working....in gyan it was not working ...& that because I was using 5.0.1 release & inbuilt models in VMAF was added to ffmpeg after the 5.0 release branch was cut

fifonik commented 2 years ago

Implemented in v1.3.0 beta 1