Log in

View Full Version : hevcqp - macroblocks QP statistics for hevc


hellgauss
6th October 2025, 13:17
I created a small command line Windows utility which perform QP macroblocks statistical analysis of hevc video (as well as h264), in a similar fashion of avinaptic but more precisely.

The package needs a standard build of ffmpeg to be installed or in the same dir (not included). It also needs a custom version of ffprobe (included as LGPL binary).

Link:
https://github.com/HG3112/hevcqp

USAGE:
USAGE:

1) hevcqp.exe inputFile
2) hevcqp.exe inputFile outputStatsFile

This script displays on stdout general QP statistics for hevc/h264 video in inputFile

Optionally, it writes detailed statistics for each frame in outputStatsFile

Log messages are on stderr

Requires ffmpeg.exe and ffprobe or ffprobe_mod.exe in same (current) dir or PATH

... ...

For fast use, drag and drop video file in DragNDropHere.bat. A .txt file with general statistic will be generated in the same dir as the input


More info in the readme file.

OUTPUT EXAMPLE

STDOUT redirect:
hevcqp report - Build 250922 - by HG

Input file : my_video.mkv
Codec : hevc
Macroblocks per frame : 32400

General statistics:
Number of frames : 2182
Total Size : 36358217
Average Size : 16662.794225
AVERAGE QP : 22.387821
StdDev (frames) : 2.503542
StdDev (MB) : 2.732424

--------------------------------

B:
Number of frames : 1624 ( 74.427131 % )
Total Size : 8677818 ( 23.867557 % )
Average Size : 5343.483990
AVERAGE QP : 23.570110
StdDev (frames) : 1.455173
StdDev (MB) : 1.731092

P:
Number of frames : 526 ( 24.106324 % )
Total Size : 24737214 ( 68.037478 % )
Average Size : 47028.923954
AVERAGE QP : 19.050270
StdDev (frames) : 1.514513
StdDev (MB) : 2.110422

K+I:
Number of frames : 32 ( 1.466544 % )
Total Size : 2943185 ( 8.094965 % )
Average Size : 91974.531250
AVERAGE QP : 17.247608
StdDev (frames) : 1.322972
StdDev (MB) : 1.828512

K:
Number of frames : 30 ( 1.374885 % )
Total Size : 2807698 ( 7.722320 % )
Average Size : 93589.933333
AVERAGE QP : 17.241274
StdDev (frames) : 1.362611
StdDev (MB) : 1.859341

I:
Number of frames : 2 ( 0.091659 % )
Total Size : 135487 ( 0.372645 % )
Average Size : 67743.500000
AVERAGE QP : 17.342623
StdDev (frames) : 0.379228
StdDev (MB) : 1.276117

P+B:
Number of frames : 2150 ( 98.533456 % )
Total Size : 33415032 ( 91.905035 % )
Average Size : 15541.875349
AVERAGE QP : 22.464326
StdDev (frames) : 2.436360
StdDev (MB) : 2.669905

--------------------------------

Consecutive B-Frames (number of B-Frames in each group)
1 : 78 ( 4.802956 % )
2 : 104 ( 6.403941 % )
3 : 303 ( 18.657635 % )
4 : 228 ( 14.039409 % )
5 : 350 ( 21.551724 % )
6 : 144 ( 8.866995 % )
7 : 98 ( 6.034483 % )
8 : 104 ( 6.403941 % )
9 : 54 ( 3.325123 % )
10 : 30 ( 1.847291 % )
11 : 22 ( 1.354680 % )
12 : 12 ( 0.738916 % )
13 : 52 ( 3.201970 % )
14 : 14 ( 0.862069 % )
15 : 15 ( 0.923645 % )
16 : 16 ( 0.985222 % )

Detailed analysis
my_video.mkv
hevc
2182 32400
K 37906 0 18.281975 0.975057 14 23
B 140 52642 24.999506 0.022217 24 25
B 154 52782 24.047901 0.215857 23 25
B 582 52060 22.051512 0.527662 18 25
B 148 52936 23.107716 0.450380 23 25
B 160 53084 26.902284 0.430067 25 27
P 14154 37906 18.206883 0.888616 15 23
B 169 57554 24.352593 0.477777 24 25
B 206 57723 24.706543 0.824281 23 26
B 454 57100 21.907284 1.160639 19 24
B 144 57929 24.940679 0.236224 24 25
B 223 58073 24.084938 1.237558 23 28
P 3856 53244 18.558611 1.421123 15 23
B 1631 79539 23.475154 1.511132 21 27
... etc ...