An image encoding method, comprising: obtaining a to-be-encoded video sequence and a knowledge-base image set, wherein the knowledge-base image set comprises one or more of: a background image in the to-be-encoded video sequence, a scene switching image in the to-be-encoded video sequence, an image obtained through modeling of an image in the to-be-encoded video sequence, and an image obtained through composition of an image in the to-be-encoded video sequence; designating an image type of each image in the knowledge-base image set as a preset first type, wherein the preset first type indicates that the image is an image in the knowledge-base image set, and setting different identification information for each image, wherein the identification information includes sequence number information of the image and quality layer information of the image, wherein the quality layer information indicates at least one of a resolution and a bitstream bit rate of the image; obtaining a to-be-encoded image in the to-be-encoded video sequence and designating an image type of the to-be-encoded image as a preset second type, wherein the preset second type indicates that encoding data of the to-be-encoded image is obtained through inter frame encoding based on an image in the knowledge-base image set; obtaining at least one knowledge-base image in the knowledge base image set, and selecting a reference image of the to-be-encoded image from the at least one knowledge-base image, wherein a quality layer information of the selected reference image corresponds to a preset quality layer of the to-be-encoded video sequence; performing intra-frame encoding on the reference image to obtain encoded data of the reference image; performing reconstruction based on the encoded data of the reference image and the preset quality layer to obtain a reconstructed image that is of the reference image and that corresponds to the preset quality layer; performing inter-frame encoding on the to-be-encoded image based on the reconstructed image that is of the reference image and that corresponds to the preset quality layer; adding bitstream data of the reference image to a Network Abstraction Layer Unit, NALU, corresponding to the reference image and sending the NALU to a decoder, wherein the bitstream data of the reference image includes the preset first type as a nal_unit_type, the sequence number information of the reference image and the quality layer information of the reference image; and adding bitstream data of the to-be-encoded image to a NALU corresponding to the to-be-encoded image and sending the NALU to the decoder, wherein the bitstream data of the to-be-encoded image includes the preset second type as a nal_unit_type, the sequence number information of the reference image and the quality layer information of the reference image. obtaining a to-be-encoded video sequence and a knowledge-base image set, wherein the knowledge-base image set comprises one or more of: a background image in the to-be-encoded video sequence, a scene switching image in the to-be-encoded video sequence, an image obtained through modeling of an image in the to-be-encoded video sequence, and an image obtained through composition of an image in the to-be-encoded video sequence; designating an image type of each image in the knowledge-base image set as a preset first type, wherein the preset first type indicates that the image is an image in the knowledge-base image set, and setting different identification information for each image, wherein the identification information includes sequence number information of the image and quality layer information of the image, wherein the quality layer information indicates at least one of a resolution and a bitstream bit rate of the image; obtaining a to-be-encoded image in the to-be-encoded video sequence and designating an image type of the to-be-encoded image as a preset second type, wherein the preset second type indicates that encoding data of the to-be-encoded image is obtained through inter frame encoding based on an image in the knowledge-base image set; obtaining at least one knowledge-base image in the knowledge base image set, and selecting a reference image of the to-be-encoded image from the at least one knowledge-base image, wherein a quality layer information of the selected reference image corresponds to a preset quality layer of the to-be-encoded video sequence; performing intra-frame encoding on the reference image to obtain encoded data of the reference image; performing reconstruction based on the encoded data of the reference image and the preset quality layer to obtain a reconstructed image that is of the reference image and that corresponds to the preset quality layer; performing inter-frame encoding on the to-be-encoded image based on the reconstructed image that is of the reference image and that corresponds to the preset quality layer; adding bitstream data of the reference image to a Network Abstraction Layer Unit, NALU, corresponding to the reference image and sending the NALU to a decoder, wherein the bitstream data of the reference image includes the preset first type as a nal_unit_type, the sequence number information of the reference image and the quality layer information of the reference image; and adding bitstream data of the to-be-encoded image to a NALU corresponding to the to-be-encoded image and sending the NALU to the decoder, wherein the bitstream data of the to-be-encoded image includes the preset second type as a nal_unit_type, the sequence number information of the reference image and the quality layer information of the reference image.