PDA

View Full Version : How to read .stats file


Sigmatador
22nd September 2002, 17:28
is there a documentation or someone to explain me how to extract informations( type of frame: i or p, size, number etc...) from the xvid first pass stats file plz ?

thx ^^
@++

NiTroGen
22nd September 2002, 18:42
Here is the structure of the record of each frame in the Stats file.
FrameLength: Integer (4 Bytes)
dk_v, dk_u, dk_y, dd_v,
dd_u, dd_y, mk_u, mk_y,
md_u, md_y: Integer (4 Bytes each)
Quantizer: Integer (4 Bytes)
Keyblocks, MotionBlocks, UnchangedBlocks: Integer (4 Bytes each)
Lum_noise: Double (8 Bytes)

The first 4 bytes of the file is the signature. Must be -20 for a valid stats file. Then we have the record of each frame.

The number of frames can be found easily using this formula:
TotalFrames = (StatsFileSize - 4) / 68

FrameLength is the size of the frame in bytes.
dk_v is the size of the frame header in bytes (don't know exactly what is this)
dk_u, dk_y, dd_v, dd_u, dd_y, mk_u, mk_y, md_u, md_y are ignored.
Quantizer is the size of the quantizer (must be 2 for 1st pass). If bit 31 of Quantizer is set to 1, then it's a keyframe.
Keyblocks, MotionBlocks, UnchangedBlocks are the summary of 16x16 pixel macroblocks in the frame.
Lum_noise is the value of luminance noise in the frame.

Here's an example of the record type in Visual Basic
Private Type frameRec
FrameSize As Long
dk_v As Long
dk_u As Long
dk_y As Long
dd_v As Long
dd_u As Long
dd_y As Long
mk_u As Long
mk_y As Long
md_u As Long
md_y As Long
quant As Long
kblk As Long
mblk As Long
ublk As Long
lum_noise As Double
End Type

bergi
23rd September 2002, 12:15
http://forum.doom9.org/showthread.php?threadid=31762&highlight=stats+file

Sigmatador
26th September 2002, 14:09
thanks ^c^