[FFmpeg-user] How do I determine quantization of an mp4 file?

David Niklas doark at mail.com
Fri Apr 30 22:35:03 EEST 2021

On Fri, 30 Apr 2021 09:48:48 +0200
Tobias Rapp <t.rapp at noa-archive.com> wrote:

> On 29.04.2021 16:47, David Niklas wrote:
> > [...]
> >
> > But when I try to come up with a useful value from that data I get a
> > very large value. Much higher than the typical 24-60 or so for
> > quantization that I see in files I encode.
> >
> > Have I gotten the formula correct?
> >
> > Size WxH  BPP FPS    Duration       Bitrate
> > (1920*1080*12*29.97*((22*60)+09.2))/1074000
> Likely I was confused about the meaning of the term "quantization"
> here. Maybe you mean the ratio between compressed and uncompressed
> video stream?

I know that there are lossless methods of compression that are probably
used as part of the lossy codecs. But I couldn't think of a way to
account for that just using the info from ffprobe.
My solution above is pretty dumb in that respect.
In fact, what ffmpeg is done encoding it typically spits out different
quantization values for each frame type.

Feel free to share any ideas you have as to how I could improve the
method of determining quantization.

> If "Bitrate" stands for the data rate of the MP4 video
> stream (excluding audio and container) in bits per second, the formula
> for the compression ratio in percent should look like:
> Bitrate * 100 / (Frame Width * Height * BitsPerPixel * FrameRate)
> Where a value of 100% means no compression and a value of 20% means
> that the output stream size takes one fifth of the input stream size.
> In your scenario the compression ratio is around 14%.
> Regards,
> Tobias

That method works well enough for the simple examination I'm doing.

More information about the ffmpeg-user mailing list