FFMetrics -- Yet another program for quality metrics calculation

Kommentare

Musicvid schrieb am 29.10.2022 um 04:11 Uhr

Be aware that the start frames must be visually aligned perfectly; even a one-frame offset can invalidate results from any QMT by a whopping 20%.

nicc schrieb am 07.11.2022 um 10:29 Uhr

@Musicvid you can believe me, that I am aware of this :-)

The fact that ffmpeg still does not really use SMPTE Timecodes for frame alignment, trims and offsets really bothers me. But since I'm in Europe with straight 24 or 25 fps in most assets the conversion to miliseconds isn't too hard ;-)

Howard-Vigorita schrieb am 07.11.2022 um 16:07 Uhr

The way I would trim pre-roll frames from the beginning of of a clip is with ffmpeg using the -ss option ahead of the -i input clip specification. Only complication is the command takes a time specification, not a frame count, so you need to compute it out in advance. Once the 2 clips at least start on the same frame, you can compare them for identity with either ffmetrics or ffmpeg directly. But personally, I wouldn't do the identity comparison that way. I'd use a file checksum/hash utility which would take into account everything including frame count and metadata... the one that comes with Windows is called certutil.

fifonik schrieb am 08.11.2022 um 05:31 Uhr

While trimming before comparison with ffmpeg you should not forgot:

1. In most cases you will need to use "accurate trim" that require video stream decoding and so it is slow, especially if you trimming quite a lot;

2. In most cases re-encoding will occur so you should save as uncompressed/lossless (even slower, require a lot of disk space, you should be careful with colours);

3. In my experiments sometimes -ss before -i does not work as expected. This is the reason ffmetrics uses 'trim' instead that I've found more reliable.

 

I'm not sure how hash/checksum can help as here we are not trying to find out if two files are exactly equal.

Camcorder: Panasonic X1500 + Panasonic X920 + GoPro Hero 11 Black

Desktop: MB: MSI B450M MORTAR TITANIUM, CPU: AMD Ryzen 5700X, RAM: G'Skill 32 GB DDR4@3200, Graphics card: MSI RX6600 8GB, SSD: Samsung 970 Evo+ 1TB (NVMe, OS), HDD WD 4TB, HDD Toshiba 4TB, OS: Windows 10 Pro 22H2

NLE: Vegas Pro [Edit] 11, 12, 13, 15, 17, 18, 19, 22

Author of FFMetrics and FFBitrateViewer

fifonik schrieb am 17.03.2023 um 13:49 Uhr

Version 1.3.2b published
- Bugfix:    High CPU/GPU utilisation caused by hidden Progress Bars with IsIndeterminate="True" (bugfix back-ported from 1.4.7b)


Version 1.4.0b published
- New:    Added a new command line parameter "-exit" that works in conjunction with "-run"
- Change:    Updated components HarfBuzzSharp, SkiaSharp, SkiaSharp.HarfBuzz, SkiaSharp.Views.Desktop.Common and System.Memory
- Bugfix:    Fixed crash that could happen while processing short command line arguments


Version 1.4.1b published
- Change:    Default LAVFI template changed from:
            [0:v]{{main}}[main];[1:v]{{ref}}[ref];[main][ref]{{filter}}
            to:
            [0:v]{{main-trim}},{{main-settb}},{{main-setpts}},{{main-scale}},{{main-setrange}},{{main-format}}[main];[1:v]{{ref-trim}},{{ref-settb}},{{ref-setpts}},{{ref-setrange}},{{ref-format}}[ref];[main][ref]{{filter}}
            All values in double curly brackets are substituted as required.


Version 1.4.2b published
- Change:    Updated components: System.Drawing.Common (6.0.0 => 7.0.0), Newtonsoft.Json (13.0.1 => 13.0.2), OxyPlot.Core, OxyPlot.SkiaSharp, OxyPlot.SkiaSharp.Wpf, OxyPlot.Wpf, OxyPlot.Wpf.Shared (all Oxy*: 2.1.0 => 2.1.2)
- Change:    Changes to make sure that external program (ffmpeg.exe) is closed (possible fix for crash while extracting bad frames)
- Bugix:    For ffmpeg with in-build VMAF models option 'model=path=file.json' is used for external json models instead of old option 'model_path=file.json'. The old option claimed as deprecated, but in fact does not work at all (#107)


Version 1.4.3b published
- New:    A number of bad frames that should be extracted can be configured in FFMetrics.conf (see FFMetrics.conf.example)
- New:    FFMpeg arguments for getting FFMpeg version info, checking VMAF models, getting media info, extracting bad frames and getting thumbnails can be defined in FFMetrics.conf (see FFMetrics.conf.example)
- Change:    Timeout for extracting bad frames increased to 30 seconds.
- Change:    FFMetrics.conf format is changed (see FFMetrics.conf.example)


Version 1.4.3b2 published
- Bugfix:    Fixed bug with escaping FFMpeg command line parameters (introduced in 1.4.3b)


Version 1.4.5b published
- New:    FFMpeg arguments for getting metrics can be defined in FFMetrics.conf (see FFMetrics.conf.example)
- Change:    -r <framerate> added before -i <filespec> to FFMpeg arguments while getting metrics (as per VMAF recommendation)
- Change:    TBR is used instead of FPS if available and not differ too much from FPS (should help with some VFR footage)
- Bugfix:    Skip was ignored when extracting bad frames
- Bugfix:    Project options were not always restored correctly on program startup


Version 1.4.6b published
- New:    Click on metric column header order files by metric value (#98)


Version 1.4.7b published
- Bugfix:    High CPU/GPU utilisation caused by hidden Progress Bars with IsIndeterminate="True"


Version 1.4.8b published
- Change:    "Action | Show plots window" in menu should not be tickable option
- Change:    Updated component: Newtonsoft.Json (13.0.2 => 13.0.3)
 

Camcorder: Panasonic X1500 + Panasonic X920 + GoPro Hero 11 Black

Desktop: MB: MSI B450M MORTAR TITANIUM, CPU: AMD Ryzen 5700X, RAM: G'Skill 32 GB DDR4@3200, Graphics card: MSI RX6600 8GB, SSD: Samsung 970 Evo+ 1TB (NVMe, OS), HDD WD 4TB, HDD Toshiba 4TB, OS: Windows 10 Pro 22H2

NLE: Vegas Pro [Edit] 11, 12, 13, 15, 17, 18, 19, 22

Author of FFMetrics and FFBitrateViewer

andreas-l schrieb am 07.04.2023 um 15:22 Uhr

Great Tool, but I had bad results with 1.3.1 (marked latest on Github). Frame 2,5,8,11,... showed very low values in all 3 Tabs, VMAF below 10 on a libx265 recode with CRF 28. The extracted images did not show this and even recode with CRF 1 had this issue. Finally I now use 1.4.8b and everything is fine.

Howard-Vigorita schrieb am 19.04.2023 um 18:13 Uhr

Seeing a big drop in metrics across the board from beta v1.4.5b onward. Here is a comparison with same everything except the beta versions:

All the earlier versions agree with the v1.4.3b2 results.

Another data point... much less of a difference if the render is done with Voukoder v13.1 (uses ffmpeg6 libs):

The 1st render with the big difference was done with Magix Hevc default template. Both renders qsv.

fifonik schrieb am 20.04.2023 um 08:52 Uhr

How big are these mov/mp4 files? Can you share them so I investigate?

Camcorder: Panasonic X1500 + Panasonic X920 + GoPro Hero 11 Black

Desktop: MB: MSI B450M MORTAR TITANIUM, CPU: AMD Ryzen 5700X, RAM: G'Skill 32 GB DDR4@3200, Graphics card: MSI RX6600 8GB, SSD: Samsung 970 Evo+ 1TB (NVMe, OS), HDD WD 4TB, HDD Toshiba 4TB, OS: Windows 10 Pro 22H2

NLE: Vegas Pro [Edit] 11, 12, 13, 15, 17, 18, 19, 22

Author of FFMetrics and FFBitrateViewer

Howard-Vigorita schrieb am 20.04.2023 um 18:28 Uhr

The reference file (also in my signature) is pretty big... link here. I just did a smaller Magix qsv default hevc10 render, link here. Difference between versions is similar:

Also just did a quick spot-check of the PSNR & SSIM with a simplified ffmpeg v4 script whose averages are similar to your earlier versions:

ffmpeg.exe-i 'D:\temp\ffm_v20.mp4' -i 'D:\test ffmetrics\hevc-lossless-an.mov' -lavfi psnr -f null -
ffmpeg.exe-i 'D:\temp\ffm_v20.mp4' -i 'D:\test ffmetrics\hevc-lossless-an.mov' -lavfi ssim -f null -

Output:
PSNR y:42.307164 u:54.153887 v:54.924041 average:43.939596 min:37.049516 max:52.728227
SSIM Y:0.968056 (14.956086) U:0.997327 (25.729503) V:0.997748 (26.473767) All:0.977883 (16.552730)

 

fifonik schrieb am 21.04.2023 um 00:22 Uhr

UPDATE: downloaded, investigating.

Zuletzt geändert von fifonik am 21.04.2023, 10:41, insgesamt 2-mal geändert.

Camcorder: Panasonic X1500 + Panasonic X920 + GoPro Hero 11 Black

Desktop: MB: MSI B450M MORTAR TITANIUM, CPU: AMD Ryzen 5700X, RAM: G'Skill 32 GB DDR4@3200, Graphics card: MSI RX6600 8GB, SSD: Samsung 970 Evo+ 1TB (NVMe, OS), HDD WD 4TB, HDD Toshiba 4TB, OS: Windows 10 Pro 22H2

NLE: Vegas Pro [Edit] 11, 12, 13, 15, 17, 18, 19, 22

Author of FFMetrics and FFBitrateViewer

fifonik schrieb am 21.04.2023 um 12:03 Uhr

I checked your files and for me it looks something wrong with them.

FFProbe shows that their framerate, duration and timebase are different:

 

FFMetrics before 1.4.5 do not use '-r framerate' and use ffmpeg commands similar to commands you provided.

When I run such command, I see warning and error:

For me these errors means that all frames of one stream were shifted to one frame and results are incorrect.

 

VMAF developers recommend to use the '-r framerate' option (this is what was implemented in FFMetrics 1.4.5)

If I run command with this option, I do not see any warning and/or error any longer:

 

When I tried to calculate PSNR metric using VQMT 12 (free), I saw errors in log related to different framerates:

 

Finally, I calculated graphs using VQMT 12, FFMetrics 1.3.1 & 1.4.8b:

1. I would not expect so big spikes as I see on 1.3.1 graph. Their presense is red flag that something is not right;

2. VQMT 12 & FFMetrics 1.4.8 graphs looks similar (VQMT 12 free does not allow to work with large frames so I cropped it, as a result, frames metrics cannot be compared directly).

 

To be honest, I do not know how correctly calculate metrics using ffmpeg with files you provided :(

 

However, you can return old behaviour by creating FFMetrics.conf with this content:

{
    "Metric": {
        "Template": "-hide_banner -nostdin -i {{main-src}} -i {{ref-src}} -frames:v {{duration}} -lavfi {{lavfi}} -f null -"
    }
}


 

Zuletzt geändert von fifonik am 21.04.2023, 12:18, insgesamt 4-mal geändert.

Camcorder: Panasonic X1500 + Panasonic X920 + GoPro Hero 11 Black

Desktop: MB: MSI B450M MORTAR TITANIUM, CPU: AMD Ryzen 5700X, RAM: G'Skill 32 GB DDR4@3200, Graphics card: MSI RX6600 8GB, SSD: Samsung 970 Evo+ 1TB (NVMe, OS), HDD WD 4TB, HDD Toshiba 4TB, OS: Windows 10 Pro 22H2

NLE: Vegas Pro [Edit] 11, 12, 13, 15, 17, 18, 19, 22

Author of FFMetrics and FFBitrateViewer

Howard-Vigorita schrieb am 21.04.2023 um 17:54 Uhr

Thanks. That worked. It'll let me use your latest beta which I prefer for the way it does not remember previously loaded clips if I save my user-config with just the reference clip. Your original pre-release worked like that.

Btw, the frame rates are identical for those 2 clips. The reference is zraw straight from the camera which happens to use hevc-lossless as it's internal compression format. Which any app that reads hevc can load if moved into an hevc container. The render was made by Vegas with the Magix qsv default hevc preset set to 10-bit.

Apparently ffmpeg is squawking about some difference between the hevc clips but it's not frame-rate:

Reference clip:
 --- codec: HEVC
 --- content width: 3840
 --- content height: 2160
 --- frame rate: 29.97
 --- bit depth: 10
 --- frame count: 921
 --- start offset: 2
 --- duration (sec): 30.664
 --- GOP histogram : 1 @ 0 : 1 @ 246 : 2 @ 250 [ maxGOPlen=250 ]
 --- max GOP length: 250
 --- profile and level: 0x2ba

Vegas qsv render:
 --- codec: HEVC
 --- content width: 3840
 --- content height: 2160
 --- frame rate: 29.97
 --- bit depth: 10
 --- frame count: 921
 --- start offset: 3
 --- duration (sec): 30.6306
 --- GOP histogram : 1 @ 0 : 65 @ 14 [ maxGOPlen=14 ]
 --- max GOP length: 14
 --- profile and level: 0x296

Update: did some more testing with ffmpeg and every render format I tried with Vegas when compared to my reference clip generates that warning message about a timebase mismatch and possibly inaccurate results. Including Voukoder. Comparing my reference clip to an ffmpeg or resolve render does not generate that warning. I think the zcam-created reference clip was made with ffmpeg libs.

fifonik schrieb am 05.05.2024 um 07:15 Uhr

Version v1.4.9b 1 published on Feb 2024

  • Change: File ordering re-implemented
  • Change: Extension m4v added to accepted files list
  • Change: Accepted files list can be configured (see FFMetrics.conf.example)
  • Change: Updated components: System Drawing Common (7.0.0 => 8.0.2), HarfBuzzSharp (2.8.2.3 => 7.3.0.1), SkiaSharp (2.88.3 => 2.88.7)
  • Bugfix: Searching line with file metric returned by FFMpeg is more reliable

 

Version v1.5.0b 1 published on May 2024

  • New: VMAF subsample option added
  • Change: File ordering re-implemented. More work as original issue was not fixed in 1.4.9b1
  • Change: Updated components: System Drawing Common (8.0.2 => 8.0.4), HarfBuzzSharp (7.3.0.1 => 7.3.0.2), SkiaSharp (2.88.7 => 2.88.8)
  • Bugfix: Temp dir availability and write access is checked on program starup
  • Bugfix: Message displayed if log file cannot be created
  • Bugfix: Fixed crash that might happening while drag & dropping distorted items

Zuletzt geändert von fifonik am 05.05.2024, 07:16, insgesamt 1-mal geändert.

Camcorder: Panasonic X1500 + Panasonic X920 + GoPro Hero 11 Black

Desktop: MB: MSI B450M MORTAR TITANIUM, CPU: AMD Ryzen 5700X, RAM: G'Skill 32 GB DDR4@3200, Graphics card: MSI RX6600 8GB, SSD: Samsung 970 Evo+ 1TB (NVMe, OS), HDD WD 4TB, HDD Toshiba 4TB, OS: Windows 10 Pro 22H2

NLE: Vegas Pro [Edit] 11, 12, 13, 15, 17, 18, 19, 22

Author of FFMetrics and FFBitrateViewer

grafomonk schrieb am 08.11.2024 um 20:18 Uhr

Unable to select any metrics - checkboxes are inactive. Also unable to log - "Logging is disabled".
Tried to change ffmpeg and ffmetrics locations - the same. Checkboxes are do nothing.
The Start button is dead too.
Please help. What am I doing wrong?

fifonik schrieb am 05.05.2025 um 08:08 Uhr

Version v1.5.0b2 published on May 2024

  • Change: Use absolute path to VMAF models if FFMpeg.exe located not in FFMetrics folder as in this case models cannot be found by FFMpeg
  • Bugfix: FFMpeg.exe location detection was broken
  • Bugfix: Fixed bug in VMAF filter (introduced in 1.5.0b)

 

Version v1.5.0b3 published on May 2024

  • Bugfix: Fixed crash when removing files, introduced in 1.5.0b2

 

Version v1.5.0b4 published on May 2024

  • Change: Improved long file path shortening logic
  • Bugfix: Fixed a bug when a distorted file could be swapped with ref while adding a new file with File Chooser and double clicking on file name

 

Version v1.5.0b5 published on May 2024

  • New: Added buttons for playing distorted files with system associated program
  • New: Now FFMetrics also parses streams' metadata returned by FFMpeg to find bitrate

 

Version v1.5.0b6 published on May 2024

  • Bugfix: Crash while finding associated program when filespec = null (introduced in 1.5.0b5)

 

Version v1.5.0b7 published on May 2024

  • Bugfix: Proper fix for issue in finding associated program
  • Bugfix: More work for preventing ref/distorted swapping caused by File Dialogs

 

Version v1.5.0b8 published on June 2024

  • Change: FFMetrics.conf.example updated with current built-in defaults
  • Change: More values added to Skip dropdown (be careful, high values are slow)
  • Change: Default metrcis columns width slightly increased
  • Change: Updated components: System Drawing Common (8.0.4 => 8.0.6)
  • Bugfix: Frames Harmonic Mean & Std Dev values in popup fixed (the bug introduced in 1.5.0b)

 

Version v1.5.0b9 (rc1) published on October 2024

  • New: Plot control hints added in plot window
  • Change: FFMpeg version check timeout increased to 10 seconds (from 5 seconds)
  • Change: Updated components: System.Drawing.Common (8.0.6 => 8.0.10), OxyPlot.Core, OxyPlot.SkiaSharp, OxyPlot.SkiaSharp.Wpf, OxyPlot.Wpf, OxyPlot.Wpf.Shared (all Oxy*: 2.1.2 => 2.2.0), Microsoft.NETFramework.ReferenceAssemblies (1.0.2 => 1.0.3)

 

Version v1.5.0b10 (rc2) published on October 2024

  • Change: Plot control hints slightly adjusted
  • Change: Default timeouts increased:
  • Bad frame extract: 30 seconds => 60 seconds
  • Media info extract: 10 seconds => 30 seconds
  • Thumbnail extract: 5 seconds => 30 seconds
  • FFMpeg version check: 10 seconds => 30 seconds

 

Version v1.5.0b11 (rc3) published on October 2024

  • Bugfix: Timeout errors must always be logged, not only when program started with -log-level=debug
  • Change: Plot control hints slightly adjusted & fixed

 

Version v1.5.0b12 (rc4) published on November 2024

  • Change: FPS detection improved
  • Change: Field type detection heuristics adjusted
  • Change: A number of frames used for media info detection increased from 30 to 60 frames (this is slowing down media info extraction process, but making it a bit more reliable)
  • Change: Media info extraction timeout increased from 30 to 60 seconds
  • Change: Unknown field type displayed as '-unknown-' in media info popup and '?' in media info strings
  • Change: Extracted images should have more accurate colours
  • Bugfix: Plots left margin increased and Y-values rotated 45 CCW, so SSIM values truncated not so badly
  • Bugfix: Missed FPS causing program to crash on media info mouse hover

 

Version v1.5.0b13 (rc5) published on November 2024

  • Change: Display filename without path for distorted files that are located in the same folder with ref file

 

Version v1.5.0 release published on November 2024

  • Bugfix: FFMetrics unable to detect available FFMpeg quality metrics under some circumstances

 

Version v1.5.1b1 published on December 2024

  • Change: More logging added
  • Change: Updated components: System.Buffers (4.5.1 => 4.6.0), System.Drawing.Common (8.0.10 => 9.0.0), System.Memory (4.5.5 => 4.6.0), System.Numerics.Vectors (4.5.0 => 4.6.0), System.Runtime.CompilerServices.Unsafe (6.0.0 => 6.1.0), HarfBuzzSharp (7.3.0.2 => 7.3.0.3), SkiaSharp (2.88.8 => 2.88.9)

 

Version v1.6.0b1 published on May 2025

  • New: Automatic pixel format conversion implemented. A list of currently supported formats: yuv420p (default), yuv422p, yuv444p.
  • If ref's pixel format is not on the supported list, it will be converted to default format.
  • Distorted file will be converted to ref's pixel format.
  • New: Processing metric and file name are displayed in progress bar on plot window
  • Change: Pixel format added to media info tooltip
  • Change: Thumbnail position changed from min(duration, 1) to min(duration / 2, 5) (in seconds)
  • Change: Plots margins adjusted
  • Change: Axis titles added
  • Change: Files' & metrics' checkboxes as well as play preview buttons are disabled while processing
  • Change: Updated components: System.Buffers (4.6.0 => 4.6.1), System.Drawing.Common (9.0.0 => 9.0.4), System.Memory (4.6.0 => 4.6.3), System.Numerics.Vectors (4.6.0 => 4.6.1), System.Runtime.CompilerServices.Unsafe (6.1.0 => 6.1.2)
  • Bugfix: Issues with uppercasing/lowercasing strings in some locales

Camcorder: Panasonic X1500 + Panasonic X920 + GoPro Hero 11 Black

Desktop: MB: MSI B450M MORTAR TITANIUM, CPU: AMD Ryzen 5700X, RAM: G'Skill 32 GB DDR4@3200, Graphics card: MSI RX6600 8GB, SSD: Samsung 970 Evo+ 1TB (NVMe, OS), HDD WD 4TB, HDD Toshiba 4TB, OS: Windows 10 Pro 22H2

NLE: Vegas Pro [Edit] 11, 12, 13, 15, 17, 18, 19, 22

Author of FFMetrics and FFBitrateViewer