The present application relates to an image and video
compression method, comprising: step a: using the perceptual characteristics of the human
visual system to respectively calculate the perceptual
distortion of a group of images, an image, and a
coding tree unit, respectively establish a relationship model between the perceptual
distortion and the
bit rate of the group of images, the image, and the
coding tree unit, and calculate the
perceptual weighting factor of the group of images, the image, and the
coding tree unit through the relationship model; step b: calculating the optimal number of bits allocated to the group of images, the image, and the coding tree unit according to the
perceptual weighting factor, and performing
bit allocation for the group of images, the image, and the coding tree unit according to the calculation result of the optimal number of bits; step c: after performing the
bit allocation, calculating the optimal quantization parameter of the group of images, the image, and the coding tree unit to be encoded, and encoding the group of images, the image, and the coding tree unit to be encoded according to the optimal quantization parameter. The implementation of the present application can improve the video compression performance.