Video encoding method, device and storage medium

By dynamically adjusting the quantization parameters of the encoder according to the page turning status of the image to be encoded in the video source, the problem of insufficient video encoding quality and reliability in the existing technology is solved, and a clearer image display effect is achieved.

CN113784127BActive Publication Date: 2025-01-21ZTE CORP
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010525762.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-10
Publication Date
2025-01-21
Estimated Expiration
2040-06-10

AI Technical Summary

Technical Problem

When existing video encoding methods deal with presentations and other scenarios, fixed parameter encoding leads to lower encoding reliability and worse encoding quality, and the image clarity cannot be guaranteed during decoding and display, resulting in blurred handwriting when turning pages.

Method used

By determining the page turning state of the current image to be encoded in the video source, the quantization parameters of the encoder are determined based on the page turning state, and the image is encoded based on these parameters.

Benefits of technology

It improves the reliability and encoding quality of video encoding, ensures the clarity of images during decoding and display, and avoids blurred writing when turning pages.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113784127B_ABST
    Figure CN113784127B_ABST
Patent Text Reader

Abstract

The present application discloses a video encoding method, device and storage medium, belonging to the field of data processing technology, the method comprising: determining the page turning state of the current image to be encoded in the video source; determining the quantization parameter of the encoder according to the page turning state; encoding the image based on the quantization parameter by the encoder. Accurate encoding of the image based on the page turning state of the image is achieved, the reliability and encoding quality of the video encoding are improved, so as to improve the clarity of the image during subsequent decoding and display.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a video encoding method, device and storage medium. Background Art

[0002] In existing video encoding, the video is generally encoded based on a rate control algorithm (such as JVT-G012), which assumes that the scenes before adjacent frames are related and uses the same fixed parameters to encode each frame of the video. In the scenario where the video source is a presentation (PowerPoint, PPT), since the corresponding I macroblocks and residual data are different when the page is turned and when the page is not turned, for example, the number of I macroblocks and residual data that need to be encoded increases when the page is turned, when fixed parameters are used for encoding, not only the reliability of the encoding is reduced and the encoding quality is deteriorated, but also the bandwidth required for the clarity of the image cannot be ensured during the subsequent decoding and display, resulting in blurred handwriting when the PPT page is turned during the subsequent display. Summary of the invention

[0003] The embodiments of the present application provide a video encoding method, device and storage medium, which can improve the reliability and encoding quality of video encoding.

[0004] In a first aspect, an embodiment of the present application provides a video encoding method, including:

[0005] Determine the page turning state of the image to be encoded currently in the video source;

[0006] Determining a quantization parameter of an encoder according to the page turning state;

[0007] The image is encoded by the encoder based on the quantization parameter.

[0008] In a second aspect, an embodiment of the present application further provides a video encoding device, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor calls the computer program in the memory, it executes any one of the video encoding methods provided in the embodiments of the present application.

[0009] In a third aspect, an embodiment of the present application further provides a storage medium for computer-readable storage, wherein the storage medium is used to store a computer program, and the computer program is loaded by a processor to execute any one of the video encoding methods provided in the embodiments of the present application.

[0010] The embodiment of the present application can determine the page turning state of the image to be encoded in the video source, determine the quantization parameter of the encoder according to the page turning state, and encode the image based on the quantization parameter by the encoder. Accurate encoding of the image based on the page turning state of the image is achieved, the reliability and encoding quality of the video encoding are improved, and the clarity of the image during subsequent decoding and display is improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] Figure 1 It is a flowchart of a video encoding method provided by an embodiment of the present application;

[0012] Figure 2 is a flowchart of a video encoding method provided by another embodiment of the present application;

[0013] Figure 3 is a flowchart of a video encoding method provided by another embodiment of the present application;

[0014] Figure 4 It is a structural diagram of a video encoding device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0015] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.

[0016] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.

[0017] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.

[0018] The embodiments of the present application provide a video encoding method, device and storage medium. The video encoding method can be applied to a video encoding device, which can include a mobile phone, a computer or a server.

[0019] See also Figure 1 , Figure 1 1 is a flow chart of a video encoding method provided by an embodiment of the present application. The video encoding method may include but is not limited to steps S10 to S30, etc., and may be specifically as follows:

[0020] S10: Determine the page turning state of the image to be encoded currently in the video source.

[0021] The video source may be a PPT video source or other types of video sources, and the video source may be composed of multiple frames of images. The video encoding device may obtain a pre-stored video source from a local database, or the video encoding device may generate a video source, or the video encoding device may send an acquisition request to a server and receive a video source returned by the server based on the acquisition request.

[0022] Among them, the page turning state may include states such as page turning occurring and page turning not occurring, and the page turning state of the current image to be encoded in the video source may be determined. For example, when encoding starts, the first frame image in the video source may be used as the current image to be encoded, and the page turning state of the first frame image may be set to no page turning occurring. During the encoding process, the second frame image may be used as the current image to be encoded, and the page turning state of the second frame image may be determined, or the third frame image may be used as the current image to be encoded, and the page turning state of the third frame image may be determined; and so on.

[0023] In one embodiment, determining the page turning state of the image to be encoded currently in the video source may include: recognizing the image through a trained recognition model, and determining the page turning state of the image according to the recognition result.

[0024] In order to improve the flexibility and accuracy of determining the page turning state of an image, the page turning state of an image can be determined by a trained recognition model. The trained recognition model can be flexibly set according to actual needs. For example, the recognition model can be a target detection algorithm SSD or YOLO. The recognition model can also be a convolutional neural network R-CNN or FasterR-CNN, etc. For example, multiple sample images containing different page turning states can be obtained, and the recognition model can be trained based on the multiple sample images to obtain a trained recognition model. At this time, the image can be recognized by the trained recognition model, and the page turning state of the image can be accurately determined according to the recognition result. For example, the feature information of the image can be extracted by the trained recognition model, and the page turning state of the image can be determined according to the feature information, or the previous frame image can be compared with the previous image to be encoded by the trained recognition model, and the page turning state of the image can be determined according to the comparison result.

[0025] Reference Figure 2 In one embodiment, step S10 may include but is not limited to steps S11 to S14, etc., which may be specifically as follows:

[0026] S11, obtaining the current image to be encoded in the video source and the previous frame of the image;

[0027] S12, obtaining a pixel deviation value between each pixel point at a corresponding position in the image and the previous frame image;

[0028] S13, when the pixel deviation value is greater than a preset pixel threshold, determining that the page turning state of the image is page turning;

[0029] S14: When the pixel deviation value is less than or equal to the preset pixel threshold, determining that the page turning state of the image is that no page turning occurs.

[0030] In order to improve the accuracy and reliability of determining the page turning state of an image, the page turning state of an image may be determined by comparing the current image to be encoded with the previous frame of image. Specifically, the current image to be encoded in the video source and the previous frame of image to be encoded may be obtained, and the previous frame of image may be cached, wherein the previous frame of image may be:

[0031] FramePre={FramePre(i,j);0<=i<=PicWidth,0<=j<=PicHeight}

[0032] Among them, FramePre represents the previous frame image, PicWidth represents the image width, PicHeight represents the image height, and FramePre(i,j) represents the pixel point in the previous frame image.

[0033] Then, the pixel deviation value between each pixel point at the corresponding position in the current image to be encoded and the cached previous frame image can be obtained. In one embodiment, obtaining the pixel deviation value between each pixel point at the corresponding position in the image and the previous frame image can include: obtaining the absolute value of the difference between each pixel point at the corresponding position in the image and the previous frame image to obtain the difference of each pixel point; and setting the average value of the difference of each pixel point as the pixel deviation value.

[0034] For example, the absolute value of the difference between each pixel in the current image to be encoded and the corresponding position in the previous frame of the cached image can be calculated to obtain the difference of each pixel, and the average value of the difference of each pixel can be taken to obtain ∑ δ , will ∑ δ As a pixel deviation value, it can be specifically as follows:

[0035] FrameCur={FrameCur(i,j);0<=i<=PicWidth,0<=j<=PicHeight}

[0036]

[0037] Wherein, FrameCur represents the current image to be encoded, PicWidth represents the image width, PicHeight represents the image height, FrameCur(i,j) represents the pixel point in the current image to be encoded, ∑ δ Indicates the pixel deviation value.

[0038] At this time, the pixel deviation value can be compared with the preset pixel threshold to determine whether the pixel deviation value is greater than the preset pixel threshold. The preset pixel threshold can be flexibly set according to actual needs, and the specific content is not limited here. When the pixel deviation value is greater than the preset pixel threshold, it is determined that the page turning state of the image is that page turning has occurred; when the pixel deviation value is less than or equal to the preset pixel threshold, it is determined that the page turning state of the image is that page turning has not occurred.

[0039] For example, the pixel deviation value may be compared with a threshold value Π (i.e., a preset pixel threshold value). If the pixel deviation value is greater than the threshold value Π, it is determined that a PPT page turning occurs (pageTurning=1). Otherwise, it is determined that a PPT page turning does not occur (pageTurning=0). Specifically, the following may be performed:

[0040] pageTurning=Σ δ ≥Π? 1:0

[0041] Among them, the pageTurning expression indicates whether a page has been turned.

[0042] In one embodiment, the video encoding method may further include: obtaining a training data set containing multiple different video sources; obtaining a first deviation value between pixel points of multiple frame images in which page turning occurs in the training data set, and obtaining a second deviation value between pixel points of multiple frame images in which page turning does not occur in the training data set; and determining a preset pixel threshold based on the average of the first deviation value and the second deviation value.

[0043] In order to improve the accuracy of setting the threshold value Π (i.e., the preset pixel threshold), a training data set can be used to determine the threshold value Π. Specifically, a training data set containing multiple different video sources is obtained, the size of the training data set can be set to N, and multiple frames of images with page turning can be screened out from the training data set:

[0044] FrameSetPageTurning={FramePageTurning k ; 0<k<=N}

[0045] Among them, FrameSetPageTurning represents the image set of N frames where page turning occurs. k An image indicating that a page turn has occurred.

[0046] And, filter out multiple frames of images without page turning from the training data set:

[0047] FrameSetNoPageTurning={FrameNoPageTurning k ; 0<k<=N}

[0048] Among them, FrameSetNoPageTurning represents an image set of N frames of images that have not been turned over. k Indicates that no page turning has occurred.

[0049] Then, the first deviation value between the pixel points of the N frames of images where page turning occurs in the training data set can be obtained, that is, the absolute value Σ of the difference between the pixel points of the N frames of images where page turning occurs is calculated. δ,k , the absolute value Σ δ,k The first deviation value may be specifically as follows:

[0050]

[0051] Among them, Σ δ,k Indicates the first deviation value, PicWidth indicates the image width, PicHeight indicates the image height, FramePageTurning k (i, j) represents the pixel point in the image where the page turns in the Kth frame, FramePageTurning k-1 (i, j) represents the pixel point in the image where the page turns in the K-1th frame, and N represents the number of frames of the image where the page turns.

[0052] And, obtaining the second deviation value between the pixel points of N frames of images in which no page turning occurs in the training data set, that is, calculating the absolute value ∑′ of the difference between the pixel points of N frames of images in which no page turning occurs δ,k , the absolute value ∑′ δ,k The second deviation value may be specifically as follows:

[0053]

[0054] Among them, ∑′ δ,k Indicates the first deviation value, PicWidth indicates the image width, PicHeight indicates the image height, FrameNoPageTurning k (i, j) represents the pixel in the image where no page turning occurs in the Kth frame, FrameNoPageTurning k-1 (i, j) represents a pixel point in the image of the K-1th frame where no page turning occurs, and N represents the number of frames of the image where no page turning occurs.

[0055] At this time, according to the first deviation value Σ δ,k and the second deviation value ∑′ δ,k The threshold value Π is determined by the mean of the data set Σ δ,k The mean M of the data set ∑′ δ,k The mean M′ of the average is taken as follows:

[0056]

[0057]

[0058]

[0059] S20: Determine a quantization parameter of the encoder according to the page turning state.

[0060] After obtaining the page turning state corresponding to the current image to be encoded, the mapping relationship between different page turning states and quantization parameters can be obtained, and the quantization parameter corresponding to the page turning state of the current image to be encoded is determined according to the mapping relationship, wherein the value of the quantization parameter can be an integer from 0 to 51.

[0061] In one embodiment, determining the quantization parameter of the encoder according to the page turning state may include: when the page turning state of the image is that page turning has occurred, setting the quantization parameter of the encoder to a first quantization parameter; when the page turning state of the image is that page turning has not occurred, setting the quantization parameter of the encoder to a second quantization parameter; wherein the first quantization parameter is smaller than the second quantization parameter.

[0062] In order to improve the encoding quality of the image, for example, when the page turning state of the image is page turning, the quantization parameter (qpMin, qpMax) of the encoder can be set to the first quantization parameter (qpMin b ,qpMax b ), when the page turning state of the image is that no page turning occurs, the quantization parameter (qpMin, qpMax) of the encoder can be set to (qpMin a ,qpMax a ), which can be specifically as follows:

[0063] (qpMin, qpMax) = (pageTurning==1)? (qpMin b ,qpMax b ):(qpMin a ,qpMax a )

[0064] In one embodiment, the video encoding method may further include: obtaining a training data set containing multiple different video sources; obtaining a first peak signal-to-noise ratio of multiple frames of images in the training data set where page turning occurs, and obtaining a first number of bytes corresponding to the multiple frames of images in the training data set after page turning occurs; determining a first quantization parameter based on the first peak signal-to-noise ratio and the first number of bytes; and obtaining a second peak signal-to-noise ratio of multiple frames of images in the training data set where page turning does not occur, and obtaining a second number of bytes corresponding to the multiple frames of images in the training data set where page turning does not occur after page turning occurs; determining a second quantization parameter based on the second peak signal-to-noise ratio and the second number of bytes.

[0065] In order to improve the accuracy of quantization parameter determination and ensure the quality of image encoding, the quantization parameter can be determined based on parameters such as the peak signal-to-noise ratio and number of bytes of the image. Specifically, taking the PPT video source as an example, a training data set containing multiple different video sources can be obtained. The size of the training data set can be N, and multiple frames of images with page turning can be screened out from the training data set:

[0066] FrameSetPageTurning={FramePageTurning k ; 0<k<=N}

[0067] Among them, FrameSetPageTurning represents the image set of N frames where page turning occurs. k An image indicating that a page turn has occurred.

[0068] Determine the first peak signal-to-noise ratio of the multi-frame images where page turning occurs, and obtain the first byte number corresponding to the multi-frame images where page turning occurs in the training data set after encoding, that is, when calculating the N groups of PPT page turning, the quantization parameter of the encoder is (qpMin k ,qpMax k ) corresponds to the first peak signal-to-noise ratio psnr of the image k And the first byte number of the image after the page is turned FrameBytes k .

[0069] (FrameBufPageTurning k ,FrameBytes k )=Encoder(FramePageTurning k ,qpMin k ,qpMax k )

[0070] psnr k =PSNR(FramePageTurning k,Decoder(FrameBufPageTurning k ,FrameBytes k ))

[0071] Among them, FrameBufPageTurning k Indicates the encoded image (the image that turns pages after encoding), FramePageTurning k Indicates the image to be encoded (the image to be encoded that is to be paged).

[0072] At this time, the first quantization parameter can be determined based on the first peak signal-to-noise ratio and the first byte number. In one embodiment, determining the first quantization parameter based on the first peak signal-to-noise ratio and the first byte number may include: selecting an image with the largest difference between the peak signal-to-noise ratio and the byte number from multiple frames of images where page turning occurs, to obtain a first target image; and searching the quantization parameter corresponding to the number of the first target image from the quantization parameter list to obtain the first quantization parameter.

[0073] For example, the first peak signal-to-noise ratio psnr k Subtract the first byte number FrameBytes k As the objective function f(k), find the subscript k corresponding to the maximum value of the objective function b :

[0074]

[0075] in, That is what we want (qpMin b ,qpMax b ).

[0076] Among them, the subscript k b It can be the serial number of the first target image, and the quantization parameter corresponding to the serial number of the first target image is searched in the quantization parameter list to obtain the first quantization parameter. The quantization parameter list can include quantization parameters corresponding to serial numbers of multiple images, and specific values ​​of quantization parameters in the quantization parameter list can be flexibly set according to actual needs.

[0077] By analogy, multiple frames of images without page turning can be screened out from the training data set, the second peak signal-to-noise ratio of the multiple frames of images without page turning can be determined, and the second number of bytes of the multiple frames of images with page turning in the training data set can be obtained, that is, the second peak signal-to-noise ratio corresponding to the quantization parameter of the encoder and the second number of bytes after encoding the images without page turning can be calculated when N groups of PPTs have not turned over. At this time, the second quantization parameter can be determined based on the second peak signal-to-noise ratio and the second number of bytes. In one embodiment, determining the second quantization parameter based on the second peak signal-to-noise ratio and the second number of bytes can include: screening out the image with the largest difference between the peak signal-to-noise ratio and the number of bytes from the multiple frames of images without page turning, to obtain the second target image; searching the quantization parameter corresponding to the number of the second target image from the quantization parameter list to obtain the second quantization parameter. For example, the second peak signal-to-noise ratio minus the second number of bytes can be used as the objective function, and the subscript k corresponding to the maximum value of the objective function can be calculated. b , the subscript k b It may be the serial number of the second target image, and the quantization parameter corresponding to the serial number of the second target image is searched in the quantization parameter list to obtain the second quantization parameter.

[0078] S30 . Encode the image based on the quantization parameter by an encoder.

[0079] After determining the quantization parameter, the image can be encoded by the encoder based on the quantization parameter. For example, in a PPT page turning scenario based on the DM8148 video conferencing system, the image can be encoded in H.264 based on the quantization parameter to achieve rapid convergence of video clarity, that is, rapid convergence of clarity can be achieved when the PPT video source turns pages, and when the frame rate of the video conference is low, the time required for the PPT to go from blurry to clear after turning the page can be significantly shortened.

[0080] It should be noted that for images with page turning (i.e., the changed part), I macroblock encoding is adopted (the QP value can be appropriately increased), while for images without page turning (i.e., the non-changed part), P macroblock encoding is adopted, thereby improving the encoding quality while reducing the bit rate.

[0081] Reference Figure 3 In one embodiment, the video encoding method may also include but is not limited to step S40 and step S50, etc., which may be specifically as follows:

[0082] Step S40: After encoding each frame of the video source, an encoded video is obtained.

[0083] Step S50: storing the encoded video, and / or sending the encoded video to a display terminal, so that the display terminal decodes the encoded video and displays the decoded video.

[0084] After encoding each frame of the video source, an encoded video can be obtained, and the encoded video can be stored at this time, for example, the encoded video can be stored in a local storage space of a video encoding device, or the encoded video can be stored in a server, etc. The encoded video can also be sent to a display terminal, which can be a mobile phone or a computer, so that the display terminal decodes the encoded video and displays the decoded video.

[0085] In one embodiment, a method for a display terminal to decode a video may include: obtaining an encoded video, and obtaining a quantization parameter corresponding to each frame image in the encoded video; decoding the encoded video according to the quantization parameter corresponding to each frame image to obtain a decoded video containing multiple frames of images; and displaying the decoded video.

[0086] Among them, the encoded video is a video obtained by encoding according to the above-mentioned video encoding method. The display terminal can receive the encoded video sent by the video encoding device, or the display terminal can download the encoded video pre-stored by the video encoding device from the server. Then, the quantization parameter corresponding to each frame image in the encoded video can be obtained, and the encoded video can be decoded according to the quantization parameter corresponding to each frame image to obtain a decoded video containing multiple frames of images, and the decoded video can be displayed. Thereby, the display terminal can accurately decode the image based on the quantization parameter corresponding to each frame image, and realize the rapid convergence of video clarity, that is, it can realize the rapid convergence of clarity when the PPT video source turns the page, and in the case of a low frame rate of the video conference, it can significantly shorten the time required for the PPT to change from blur to clarity after turning the page.

[0087] The embodiment of the present application can determine the page turning state of the image to be encoded in the video source, determine the quantization parameter of the encoder according to the page turning state, and encode the image based on the quantization parameter by the encoder. Accurate encoding of the image based on the page turning state of the image is achieved, the reliability and encoding quality of the video encoding are improved, and the clarity of the image during subsequent decoding and display is improved.

[0088] See also Figure 4 , Figure 4 It is a schematic block diagram of the structure of a video encoding device provided in an embodiment of the present application.

[0089] like Figure 4 As shown, the video encoding device 300 may include a processor 302, a memory 303, and a communication interface 304 connected via a system bus 301, wherein the memory 303 may include a non-volatile computer-readable storage medium and an internal memory.

[0090] The non-volatile computer-readable storage medium can store a computer program, which includes program instructions, and when the program instructions are executed, the processor can execute any video encoding method.

[0091] The processor 302 is used to provide computing and control capabilities to support the operation of the entire video encoding device.

[0092] The memory 303 provides an environment for the operation of a computer program in a non-volatile computer-readable storage medium. When the computer program is executed by the processor 302, the processor 302 can execute any video encoding method.

[0093] The communication interface 304 is used for communication. Those skilled in the art will appreciate that Figure 4 The structure shown in the figure is merely a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the video encoding device 300 to which the scheme of the present application is applied. The specific video encoding device 300 may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0094] It should be understood that the bus 301 is, for example, an I2C (Inter-integrated Circuit) bus, the memory 303 may be a Flash chip, a read-only memory (ROM) disk, an optical disk, a USB flash drive or a mobile hard disk, etc., the processor 302 may be a central processing unit (CPU), and the processor 302 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0095] In some embodiments, the processor 302 is used to run a computer program stored in the memory 303 to perform the following steps:

[0096] The page turning state of the current image to be encoded in the video source is determined, the quantization parameter of the encoder is determined according to the page turning state, and the image is encoded by the encoder based on the quantization parameter.

[0097] In one embodiment, when determining the page turning state of the image to be encoded currently in the video source, the processor 302 further executes: recognizing the image through a trained recognition model, and determining the page turning state of the image according to the recognition result; the trained recognition model is obtained by training based on multiple sample images containing different page turning states.

[0098] In one embodiment, when determining the page turning state of the image to be encoded currently in the video source, the processor 302 further executes: obtaining the image to be encoded currently in the video source, and the previous frame of the image; obtaining the pixel deviation value between each pixel point at the corresponding position in the image and the previous frame of the image; when the pixel deviation value is greater than a preset pixel threshold, determining that the page turning state of the image is that page turning has occurred; when the pixel deviation value is less than or equal to the preset pixel threshold, determining that the page turning state of the image is that page turning has not occurred.

[0099] In one embodiment, when obtaining the pixel deviation value between each pixel point at the corresponding position in the image and the previous frame image, the processor 302 also executes: obtaining the absolute value of the difference between each pixel point at the corresponding position in the image and the previous frame image to obtain the difference of each pixel point; and setting the average value of the difference of each pixel point as the pixel deviation value.

[0100] In one embodiment, the processor 302 further performs: obtaining a training data set comprising a plurality of different video sources; obtaining a first deviation value between pixel points of a plurality of frames of images in which page turning occurs in the training data set, and obtaining a second deviation value between pixel points of a plurality of frames of images in which page turning does not occur in the training data set; and determining a preset pixel threshold value based on an average of the first deviation value and the second deviation value.

[0101] In one embodiment, when determining the quantization parameter of the encoder according to the page turning state, the processor 302 further executes: when the page turning state of the image is that page turning has occurred, setting the quantization parameter of the encoder to a first quantization parameter; when the page turning state of the image is that page turning has not occurred, setting the quantization parameter of the encoder to a second quantization parameter; wherein the first quantization parameter is less than the second quantization parameter.

[0102] In one embodiment, the processor 302 further executes: obtaining a training data set comprising a plurality of different video sources; obtaining a first peak signal-to-noise ratio of a plurality of frames of images in which page turning occurs in the training data set, and obtaining a first number of bytes corresponding to the encoding of the plurality of frames of images in which page turning occurs in the training data set; determining a first quantization parameter based on the first peak signal-to-noise ratio and the first number of bytes; and obtaining a second peak signal-to-noise ratio of a plurality of frames of images in which page turning does not occur in the training data set, and obtaining a second number of bytes corresponding to the encoding of the plurality of frames of images in which page turning does not occur in the training data set; and determining a second quantization parameter based on the second peak signal-to-noise ratio and the second number of bytes.

[0103] In one embodiment, when determining the first quantization parameter based on the first peak signal-to-noise ratio and the first number of bytes, the processor 302 further executes: filtering out the image with the largest difference between the peak signal-to-noise ratio and the number of bytes from the multiple frames of images where page turning occurs, to obtain the first target image; searching the quantization parameter corresponding to the number of the first target image from the quantization parameter list, to obtain the first quantization parameter.

[0104] In one embodiment, when determining the second quantization parameter based on the second peak signal-to-noise ratio and the second number of bytes, the processor 302 further executes: filtering out an image having the largest difference between the peak signal-to-noise ratio and the number of bytes from multiple frames of images in which page turning has not occurred, to obtain a second target image; and searching the quantization parameter corresponding to the number of the second target image from the quantization parameter list to obtain the second quantization parameter.

[0105] In one embodiment, the processor 302 further executes: after encoding each frame of the video source, obtaining an encoded video; storing the encoded video, and / or sending the encoded video to a display terminal so that the display terminal decodes the encoded video and displays the decoded video.

[0106] In the above embodiments, the description of each embodiment has its own emphasis. For the part that is not described in detail in a certain embodiment, please refer to the detailed description of the video encoding method above, and will not be repeated here.

[0107] The embodiment of the present application also provides a storage medium, which is a computer-readable storage medium, and the computer-readable storage medium stores a computer program, which includes program instructions, and the processor executes the program instructions to implement any video encoding method provided in the embodiment of the present application. For example, the computer program is loaded by the processor and can execute the following steps:

[0108] The page turning state of the current image to be encoded in the video source is determined, the quantization parameter of the encoder is determined according to the page turning state, and the image is encoded by the encoder based on the quantization parameter.

[0109] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0110] The computer-readable storage medium may be an internal storage unit of the mobile terminal of the aforementioned embodiment, such as a hard disk or memory of the mobile terminal. The computer-readable storage medium may also be an external storage device of the mobile terminal, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, a flash card (Flash Card), etc. equipped on the mobile terminal.

[0111] Since the computer program stored in the computer-readable storage medium can execute any one of the video encoding methods provided in the embodiments of the present application, the beneficial effects that can be achieved by any one of the video encoding methods provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.

[0112] It should be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0113] It should also be understood that the term "and / or" used in the specification of this application and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, including these combinations. It should be noted that, in this article, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "including a..." does not exclude the presence of other identical elements in the process, method, article or system including the element.

[0114] The serial numbers of the embodiments of the present application are for description only and do not represent the advantages and disadvantages of the embodiments. The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.

Claims

1. A video encoding method, characterized in that: include: Determine the page turning state of the image to be encoded currently in the video source; Determining a quantization parameter of an encoder according to the page turning state; encoding the image based on the quantization parameter by the encoder; The step of determining the quantization parameter of the encoder according to the page turning state comprises: When the page turning state of the image is that page turning occurs, the quantization parameter of the encoder is set to a first quantization parameter; when the page turning state of the image is that page turning does not occur, the quantization parameter of the encoder is set to a second quantization parameter; wherein the first quantization parameter is smaller than the second quantization parameter.

2. The video encoding method according to claim 1, characterized in that: Determining the page turning state of the current image to be encoded in the video source includes: The image is recognized by a trained recognition model, and the page turning state of the image is determined according to the recognition result; the trained recognition model is obtained by training based on a plurality of sample images containing different page turning states.

3. The video encoding method according to claim 1, characterized in that: Determining the page turning state of the current image to be encoded in the video source includes: Acquire the current image to be encoded in the video source, and the previous frame of the image; Obtaining a pixel deviation value between the image and the previous frame image; When the pixel deviation value is greater than a preset pixel threshold, determining that the page turning state of the image is page turning; When the pixel deviation value is less than or equal to the preset pixel threshold, determining that the page turning state of the image is that no page turning occurs; The step of obtaining the pixel deviation value between the image and the previous frame image comprises: Obtaining the absolute value of the difference between each pixel at a corresponding position in the image and the previous frame image to obtain the difference of each pixel; The average value of the difference of each pixel point is set as the pixel deviation value.

4. The video encoding method according to claim 3, characterized in that: The video encoding method further comprises: Obtain a training dataset containing multiple different video sources; Acquire a first deviation value between pixel points of a plurality of frames of images in which page turning occurs in the training data set, and acquire a second deviation value between pixel points of a plurality of frames of images in which page turning does not occur in the training data set; The preset pixel threshold is determined according to an average of the first deviation value and the second deviation value.

5. The video encoding method according to claim 1, characterized in that: The video encoding method further comprises: Obtain a training dataset containing multiple different video sources; Obtaining a first peak signal-to-noise ratio of a plurality of frames of images in which page turning occurs in the training data set, and obtaining a first number of bytes corresponding to the plurality of frames of images in which page turning occurs in the training data set after being encoded; determining the first quantization parameter according to the first peak signal-to-noise ratio and the first number of bytes; and Obtaining a second peak signal-to-noise ratio of a plurality of frames of images in the training data set without page turning, and obtaining a second number of bytes corresponding to the plurality of frames of images in the training data set after being encoded without page turning; The second quantization parameter is determined according to the second peak signal-to-noise ratio and the second number of bytes.

6. The video encoding method according to claim 5, characterized in that: The determining the first quantization parameter according to the first peak signal-to-noise ratio and the first number of bytes includes: Filter out the image with the largest difference between the peak signal-to-noise ratio and the number of bytes from the multiple frames of images in which page turning occurs, and obtain a first target image; Searching for a quantization parameter corresponding to the serial number of the first target image in the quantization parameter list to obtain a first quantization parameter; The determining the second quantization parameter according to the second peak signal-to-noise ratio and the second number of bytes includes: Filter out the image with the largest difference between the peak signal-to-noise ratio and the number of bytes from the multiple frames of images in which page turning has not occurred, and obtain a second target image; The quantization parameter corresponding to the serial number of the second target image is searched in the quantization parameter list to obtain a second quantization parameter.

7. The video encoding method according to any one of claims 1 to 6, characterized in that: The video encoding method further comprises: After encoding each frame of the video source, an encoded video is obtained; The encoded video is stored, and / or the encoded video is sent to a display terminal, so that the display terminal decodes the encoded video and displays the decoded video.

8. A video encoding device, characterized in that: The method comprises a processor and a memory, wherein a computer program is stored in the memory, and when the processor calls the computer program in the memory, the video encoding method according to any one of claims 1 to 7 is executed.

9. A storage medium for computer-readable storage, characterized in that: The storage medium is used to store a computer program, and the computer program is loaded by a processor to execute the video encoding method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Self-adapting code rate control method

    CN101252689A

  • Encoding method of monitoring video and device

    CN104053009A