The invention discloses a video frame encoding method and a terminal. The video frame encoding method comprises the steps of: acquiring an ith video frame of an image group, encoding the ith video frame by a first encoding rule, and carrying out statistics on an actual consumption bit number of the encoded ith video frame; based on the actual consumption bit number, an image group initial averagecode rate, a quantization model and a video frame detection rule, detecting a state of the ith video frame, and when the ith video frame is in a scene switching state, determining a first initial quantization parameter, a first maximum quantization parameter and a first minimum quantization parameter of an (i+1)th video frame; acquiring a compensation length, and based on the compensation length and a compensation model, determining a first compensation allocation bit number of a first to-be-compensated video frame; and when the (i+1)th video frame belongs to the first to-be-compensated videoframe, updating the first encoding rule by the first compensation allocation bit number, the first initial quantization parameter, the first maximum quantization parameter and the first minimum quantization parameter, and encoding the (i+1)th video frame.