QP — the Quantization Parameter — is the single number the encoder uses to decide how aggressively to throw away detail in each block of a video. Low QP keeps almost all the original information (high quality, big file); high QP discards more (lower quality, smaller file). In H.264 and HEVC, QP ranges from 0 (lossless) to 51 (catastrophic); a change of 6 roughly doubles or halves the resulting bitrate. It is the closest thing video has to a single quality dial.
Mechanically, QP controls how the encoder rounds the numbers produced by the dct transform. Each DCT coefficient gets divided by a step size derived from QP, then rounded to an integer; the bigger the step size, the more coefficients round down to zero, and zeros compress to almost nothing through entropy coding. That's where the file shrinks — and where quality is lost, since the decoder can't recover what's been rounded away.
Modern encoders rarely use a single fixed QP. Instead, rate-control modes like crf and VBR vary QP block-by-block and frame-by-frame: lower on I-frames so they're sharp anchors for everything else, higher on B-frames where you can hide more, lower on faces where people will look, higher on grass where they won't. Even on a single frame, perceptual quantization tools push QP up on busy textures where the eye won't notice and down on flat skin where banding would be visible. So while QP is the underlying quality knob, almost no one sets it directly anymore — you set CRF, the encoder picks QP per block automatically.

