A video encoding method, device, equipment, medium and computer program product

By adjusting the quantization step size and merging the encoded stream, the problem of high noise during the video restoration process is solved, the image quality is improved, and the better decoding effect is achieved.

CN118972582BActive Publication Date: 2025-01-07ZHEJIANG DAHUA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411413805.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-11
Publication Date
2025-01-07
Estimated Expiration
2044-10-11

AI Technical Summary

Technical Problem

In the process of restoring videos, there are strong noise after decoding of the mosaic area and poor image effects, which fails to effectively solve the problem of poor decoding of the mosaic-free video.

Method used

By obtaining the video frame to be encoded and the occluded video frame, adjust the quantization step size according to the area ratio of the occluded area and the entire video image, perform encoding processing, and merge the target code stream and the occluded video code stream, dynamically adjust the quantization step size to optimize Encoding of the area to be blocked.

Benefits of technology

It effectively improves the image quality of the area to be blocked when restoring the encoded code stream, reduces noise, and improves the video image quality after decoding.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118972582B_ABST
    Figure CN118972582B_ABST
Patent Text Reader

Abstract

The present application relates to a video encoding method, device, equipment, medium and computer program product. The method comprises: obtaining a video frame to be encoded and an occluded video frame, wherein the occluded video frame is obtained by occluding a preset occluded area in the video frame to be encoded; encoding the occluded video frame to obtain an occluded video code stream; adjusting the quantization step size based on the ratio between the area of ​​the occluded area and the entire video image to obtain a target quantization step size; encoding the occluded area in the video frame to be encoded based on the target quantization step size to obtain a target encoding code stream; the ratio of the area of ​​the occluded area to the video image is inversely proportional to the value of the quantization step size; merging the target encoding code stream with the occluded video code stream to obtain a target encoding result. The present application can improve the picture quality of the video when decoding and restoring the video.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a video encoding method, apparatus, device, medium and computer program product. Background Art

[0002] In the field of security monitoring, countries are paying more and more attention to the protection of privacy. Europe has introduced the GDPR (General Data Protection Regulation) Act, which requires video surveillance equipment not to directly record faces without police authorization, but to mosaic faces before recording. When replaying the video after a case occurs, there needs to be a way to restore the mosaiced face image.

[0003] In the prior art for video restoration, usually the encoding of the mosaic-free video frames is performed with reference to the mosaic-containing video frames. The mosaic area of ​​the two YUV video frames is quite different, resulting in very strong noise in the mosaic area after the mosaic-free video is decoded, and the image effect is poor.

[0004] Currently, no effective solution has been proposed for the problem of poor decoding effect of mosaic-free videos in the prior art. Summary of the invention

[0005] Based on this, it is necessary to provide a video encoding method, apparatus, device, medium and computer program product to address the above technical issues.

[0006] In a first aspect, the present application provides a video encoding method. The method comprises:

[0007] Acquire a video frame to be encoded and an occluded video frame, wherein the occluded video frame is obtained by performing occlusion processing on a preset occluded area in the video frame to be encoded;

[0008] Encoding the occluded video frame to obtain an occluded video code stream;

[0009] Based on the ratio between the area of ​​the to-be-occluded region and the area of ​​the entire video image, the quantization step size is adjusted to obtain a target quantization step size;

[0010] Based on the target quantization step size, the to-be-occluded area in the to-be-encoded video frame is encoded to obtain a target encoding bitstream; the ratio of the area of ​​the to-be-occluded area to the video image is inversely proportional to the value of the quantization step size;

[0011] The target coding bitstream is combined with the occluded video bitstream to obtain the target coding result.

[0012] In one of the embodiments, the area to be occluded includes at least one sub-area to be occluded, and encoding the area to be occluded in the video frame to be encoded based on the target quantization step size includes:

[0013] Traversing each sub-region to be occluded, and calculating a basic quantization step size based on the acquired preset initial quantization step size, the relative distance between the sub-region to be occluded and the center point of the region to be occluded, and the ratio between the area of ​​the region to be occluded and the area of ​​the entire image; the target quantization step size includes at least one basic quantization step size;

[0014] Based on the basic quantization step size corresponding to each sub-region to be occluded, the corresponding sub-region to be occluded is coded to complete the coding of the sub-region to be occluded.

[0015] In one embodiment, calculating the basic quantization step size includes:

[0016] Determine the step adjustment value according to the relative distance between the sub-region to be blocked and the center point of the region to be blocked, and the ratio between the area of ​​the region to be blocked and the area of ​​the video image;

[0017] The difference between the initial quantization step size and the step size adjustment value is used as the basic quantization step size.

[0018] In one of the embodiments, merging the target coding bitstream with the occlusion video bitstream to obtain the target coding result includes:

[0019] The target coded bitstream is stored in the supplementary enhancement information field of the occluded video bitstream to obtain the target coding result.

[0020] In one embodiment, the method further comprises:

[0021] The occlusion video code stream is used as a reference frame to encode the video frame to be encoded, wherein the length of the video frame sequence is a preset length sequence value.

[0022] In one embodiment, the method further comprises:

[0023] The type of the area to be blocked includes at least one of the following: a face area, a body area, and a target object area.

[0024] In a second aspect, the present application also provides a video encoding device. The device includes:

[0025] An acquisition module, used for acquiring a video frame to be encoded and an occluded video frame, wherein the occluded video frame is obtained by performing occlusion processing on a preset occluded area in the video frame to be encoded;

[0026] The calculation module is used to encode the occluded video frame to obtain the occluded video code stream; adjust the quantization step size based on the ratio between the area of ​​the to-be-occluded region and the area of ​​the entire video image to obtain the target quantization step size; encode the to-be-occluded region in the to-be-encoded video frame based on the target quantization step size to obtain the target coded code stream; the ratio of the area of ​​the to-be-occluded region to the video image is inversely proportional to the value of the quantization step size;

[0027] The generation module is used to merge the target coding stream with the occlusion video stream to obtain the target coding result.

[0028] In a third aspect, the present application further provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:

[0029] Acquire a video frame to be encoded and an occluded video frame, wherein the occluded video frame is obtained by performing occlusion processing on a preset occluded area in the video frame to be encoded;

[0030] Encoding the occluded video frame to obtain an occluded video code stream;

[0031] Based on the ratio between the area of ​​the to-be-occluded region and the area of ​​the entire video image, the quantization step size is adjusted to obtain a target quantization step size;

[0032] Based on the target quantization step size, the to-be-occluded area in the to-be-encoded video frame is encoded to obtain a target encoding bitstream; the ratio of the area of ​​the to-be-occluded area to the video image is inversely proportional to the value of the quantization step size;

[0033] The target coding bitstream is combined with the occluded video bitstream to obtain the target coding result.

[0034] In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0035] Acquire a video frame to be encoded and an occluded video frame, wherein the occluded video frame is obtained by performing occlusion processing on a preset occluded area in the video frame to be encoded;

[0036] Encoding the occluded video frame to obtain an occluded video code stream;

[0037] Based on the ratio between the area of ​​the to-be-occluded region and the area of ​​the entire video image, the quantization step size is adjusted to obtain a target quantization step size;

[0038] Based on the target quantization step size, the to-be-occluded area in the to-be-encoded video frame is encoded to obtain a target encoding bitstream; the ratio of the area of ​​the to-be-occluded area to the video image is inversely proportional to the value of the quantization step size;

[0039] The target coding bitstream is combined with the occluded video bitstream to obtain the target coding result.

[0040] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0041] Acquire a video frame to be encoded and an occluded video frame, wherein the occluded video frame is obtained by performing occlusion processing on a preset occluded area in the video frame to be encoded;

[0042] Encoding the occluded video frame to obtain an occluded video code stream;

[0043] Based on the ratio between the area of ​​the to-be-occluded region and the area of ​​the entire video image, the quantization step size is adjusted to obtain a target quantization step size;

[0044] Based on the target quantization step size, the to-be-occluded area in the to-be-encoded video frame is encoded to obtain a target encoding bitstream; the ratio of the area of ​​the to-be-occluded area to the video image is inversely proportional to the value of the quantization step size;

[0045] The target coding bitstream is combined with the occluded video bitstream to obtain the target coding result.

[0046] The above-mentioned video encoding method, device, equipment, medium and computer program product first obtain a video frame to be encoded and an occluded video frame, encode the occluded video frame to obtain an occluded video code stream, and adjust the quantization step size based on the ratio between the area of ​​the to-be-occluded area and the area of ​​the entire video image to obtain a target quantization step size, encode the to-be-occluded area in the video frame to be encoded based on the target quantization step size to obtain a target encoding code stream, and finally merge the target encoding code stream with the occluded video code stream to obtain a target encoding result. The present application can effectively solve the common problem of many noise points when restoring the target encoding result by dynamically adjusting the quantization step size of the to-be-occluded area in the video frame to be encoded according to the actual situation. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Figure 1 is a schematic flow chart of a video encoding method in one embodiment;

[0048] Figure 2 A schematic diagram of a process of encoding and merging video frames in one embodiment;

[0049] Figure 3A schematic diagram of a flow chart of a video encoding method in a preferred embodiment;

[0050] Figure 4 is a structural block diagram of a video encoding device in one embodiment;

[0051] Figure 5 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0052] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0053] In one embodiment, Figure 1 As shown, a video encoding method is provided, comprising the following steps:

[0054] Step S110 , obtaining a video frame to be encoded and an occluded video frame, wherein the occluded video frame is obtained by performing occlusion processing on a preset occluded area in the video frame to be encoded.

[0055] Specifically, obtain a video frame to be encoded and an occluded video frame, wherein the video frame to be encoded is a video that needs to be smeared and occluded in the occluded area but has not been occluded, that is, the original video collected. Copy the video frame to be encoded, and perform occlusion processing on the occluded area to obtain the above-mentioned occluded video frame, wherein the occlusion processing includes but is not limited to smearing the occluded area, or adding mosaics to the occluded area, etc. This application does not impose too many restrictions on the method of occluding the occluded area, as long as the occlusion of the occluded area can be achieved.

[0056] Step S120, encode the occluded video frame to obtain an occluded video code stream; adjust the quantization step size based on the ratio between the area of ​​the to-be-occluded region and the area of ​​the entire video image to obtain a target quantization step size; encode the to-be-occluded region in the to-be-encoded video frame based on the target quantization step size to obtain a target encoded code stream; the ratio of the area of ​​the to-be-occluded region to the video image is inversely proportional to the value of the quantization step size.

[0057] Specifically, the occluded video frame is encoded to obtain an occluded video code stream. The present application does not limit the order of encoding the video frame to be encoded and the occluded video frame, and there is no need to use the above-mentioned adjusted target quantization step value when encoding the occluded video frame. This is because, during decoding and restoration, the image information in the area to be occluded is mainly obtained by decoding the target encoded code stream, and in the prior art, the area to be occluded is prone to the problem of many noise points after restoration. Therefore, this embodiment is mainly used to optimize the encoding process of the area to be occluded in the video frame to be encoded.

[0058] Further, the ratio between the area of ​​the area to be blocked and the area of ​​the entire video image in the video frame to be blocked is calculated, and the quantization step size is adjusted based on the ratio value to obtain the target quantization step size. It can be understood that the quantization step size is also called the quantization matrix, which is an important parameter of the quantizer. In video coding, quantization is the process of approximating and reducing the precision of the transform coefficients (such as the frequency domain information coefficients obtained after DCT (Discrete Cosine Transform) or DST (Discrete Sine Transform) transformation). The quantization step size determines the interval size of mapping continuous values ​​to discrete levels. After calculating the adjusted target quantization step size, the area to be blocked in the video frame to be blocked is encoded based on the target quantization step size to obtain the target encoding code stream. Among them, the ratio of the area of ​​the area to be blocked and the video image is inversely proportional to the value of the quantization step size. It should be noted that in this embodiment, only the quantization step size of the area to be blocked in the video frame to be encoded is adjusted, and the quantization step size before adjustment is still used for other areas in the video image.

[0059] Step S130, merging the target coding bitstream with the occlusion video bitstream to obtain a target coding result.

[0060] Specifically, after the occluded video frame is encoded to obtain the occluded video code stream, and the to-be-encoded video frame is encoded to obtain the target coded code stream, the target coded code stream is merged with the occluded video code stream. In some preferred embodiments, the target coded code stream can be stored in the SEI field of the occluded video code stream. The SEI field is an H265 / 264 standard field and can be used to store user-defined data, thereby obtaining a new code stream, that is, the above-mentioned target encoding result.

[0061] Through steps S110 to S130, in this embodiment, based on the ratio between the area of ​​the to-be-occluded area and the area of ​​the entire video image, the quantization step size of the to-be-occluded area in the encoded video frame is dynamically adjusted, thereby effectively improving the image quality of the to-be-occluded area when restoring the encoded bitstream.

[0062] In one of the embodiments, the area to be occluded includes at least one sub-area to be occluded, and encoding the area to be occluded in the video frame to be encoded based on the target quantization step size includes:

[0063] Traversing each sub-region to be occluded, and calculating a basic quantization step size based on the acquired preset initial quantization step size, the relative distance between the sub-region to be occluded and the center point of the region to be occluded, and the ratio between the area of ​​the region to be occluded and the area of ​​the entire image; the target quantization step size includes at least one basic quantization step size;

[0064] Based on the basic quantization step size corresponding to each sub-region to be occluded, the corresponding sub-region to be occluded is coded to complete the coding of the sub-region to be occluded.

[0065] Specifically, in this embodiment, the quantization step value of the encoding is adjusted at the macroblock level. The area to be occluded generally includes multiple sub-areas to be occluded, and the value of the basic quantization step corresponding to each sub-area to be occluded is calculated one by one, so as to achieve better picture quality when decoding and restoring the video. The above-mentioned initial quantization step is usually a preset quantization step value. In practical applications, the common setting range of the quantization step value is between 0 and 51, among which smaller quantization step values ​​(such as 8 to 20) are suitable for high quality requirements, and larger quantization step values ​​(such as 30 to 50) are suitable for low bandwidth or low storage requirements. Obtain the relative distance between the above-mentioned sub-area to be occluded and the center point of the area to be occluded. In practical applications, the relative distance is generally obtained by calculating the relative distance between the center point of the sub-area to be occluded and the center point of the area to be occluded. In summary, this embodiment calculates the basic quantization step of each sub-region to be blocked based on the preset initial quantization step, the relative distance between the sub-region to be blocked and the center point of the region to be blocked, and the ratio between the area of ​​the region to be blocked and the area of ​​the entire image, and performs encoding processing based on the basic quantization step of each sub-region to be blocked, thereby completing the encoding of the region to be blocked. Through this embodiment, the encoding processing of the region to be blocked is completed more finely with each sub-region to be blocked as a unit, further improving the video image quality when decoding and restoring the video.

[0066] In one embodiment, calculating the basic quantization step size includes:

[0067] Determine the step adjustment value according to the relative distance between the sub-region to be blocked and the center point of the region to be blocked, and the ratio between the area of ​​the region to be blocked and the area of ​​the video image;

[0068] The difference between the initial quantization step size and the step size adjustment value is used as the basic quantization step size.

[0069] Specifically, the adjustment of the quantization step size needs to satisfy the following functional relationship:

[0070] QP=qp-w×(1-1 / (1+e n / 32 ))

[0071] Wherein, QP is the target quantization step size, qp is the initial quantization step size, n is the relative distance of the pixel point of the sub-region to be occluded from the center point of the region to be occluded, w is a constant, the value of which depends on the ratio between the area of ​​the region to be occluded and the area of ​​the video image, and e represents a natural constant, whose value is 2.7. In some preferred embodiments, the value strategy of w is as follows:

[0072] When the ratio between the area of ​​the to-be-occluded region and the area of ​​the video image is greater than or equal to 1 / 25 (i.e., the ratio between the height and / or width of the to-be-occluded region and the video image is greater than or equal to 1 / 5), w is 3;

[0073] When the ratio between the area of ​​the to-be-occluded region and the area of ​​the video image is less than 1 / 25 (i.e., the ratio between the height and / or width of the to-be-occluded region and the video image is less than 1 / 5), w is 5;

[0074] When the ratio between the area of ​​the to-be-occluded region and the area of ​​the video image is less than 1 / 400 (ie, the ratio between the height and / or width of the to-be-occluded region and the video image is less than 1 / 20), w is set to 10.

[0075] In summary, through the above formula and value-taking strategy, the basic quantization step size corresponding to each sub-region to be occluded can be calculated, so that the corresponding sub-region to be occluded is encoded based on the basic quantization step size, and finally the encoding processing of the sub-region to be occluded is realized.

[0076] In one of the embodiments, merging the target coding bitstream with the occlusion video bitstream to obtain the target coding result includes:

[0077] The target coded bitstream is stored in the supplementary enhancement information field of the occluded video bitstream to obtain the target coding result.

[0078] Specifically, the supplementary enhancement information field in the occluded video code stream can be used to store the custom data content required by the user. In this embodiment, the encoded target coded code stream is stored in the supplementary enhancement information field of the occluded video code stream to achieve the merging of the target coded code stream and the occluded video code stream, and obtain the above-mentioned target coding result. When decoding the target coding result, the target coding result is first sent to the decoder for decoding, wherein for decoding, the target coding result is equivalent to the occluded video code stream. At this time, the decoder will ignore the content of the supplementary enhancement information field in the target coding result, and then decode the target coded code stream, and finally obtain a complete picture including the unoccluded area to be occluded. It can be understood that in the above decoding process, when decoding the target coded code stream, it is necessary to perform an inverse quantization operation on each sub-region to be occluded according to the basic quantization step corresponding to each sub-region to be occluded calculated above, so that the quantized value can be mapped back to the original value or a range close to the original value. The scheme provided by this embodiment can help data transmission and decoding operations, improve data security and the quality of decoded video images.

[0079] In one embodiment, the method further comprises:

[0080] The occlusion video code stream is used as a reference frame to encode the video frame to be encoded, wherein the length of the video frame sequence is a preset length sequence value.

[0081] Specifically, Figure 2The figure is a flow chart of encoding and merging video frames in an embodiment. It can be understood that the I frame (intra picture) in the figure is a key frame, which contains all the information of the image. In the decoding process, only the data of the I frame itself needs to be decoded to completely reconstruct the image without referring to other frames. The above P frame (predictive frame) is a predicted frame. The P frame is not a complete picture and needs to refer to the image information of the previous frame for decoding. The P frame only stores the difference information between the previous frame and the previous frame. In the figure, YUV-a0, YUV-a1, ..., YUV-aN-1 are occluded video frames, and YUV-A0, YUV-A1, ..., YUV-AN-1 are video frames to be encoded; framei-a0, framei-a1, ..., framei-aN-1 are the above-mentioned occluded video code streams, and framei-A0, framei-A1, ..., framei-AN-1 are the above-mentioned target coded code streams. It can be seen from the figure that in this embodiment, the target coded code stream is stored in the supplementary enhancement information field of the occluded video code stream, and the occluded video code stream is used as a reference frame to encode the video frame to be encoded. In summary, the code stream sequence output by the encoder is {framei-a0, framei-A0, framei-a1, framei-A1, ..., framei-aN-1, framei-AN-1}, where N is the above-mentioned length sequence value, that is, the GOP (Group of Pictures) length.

[0082] In one embodiment, the method further comprises:

[0083] The type of the area to be blocked includes at least one of the following: a face area, a body area, and a target object area.

[0084] Specifically, the area to be blocked that needs to be blocked can be identified in the original video frame to be encoded, and the video frame to be encoded is copied, and the area to be blocked in the copied video frame is blocked, so as to obtain the above-mentioned blocked video frame. The above-mentioned target recognition can be any target recognition algorithm. The area to be blocked in this embodiment includes but is not limited to the face area, the human body area, the target object area, etc. In actual applications, other types of areas to be blocked can also be set according to actual needs, which can be achieved by modifying the algorithm by relevant technical personnel.

[0085] The present application also provides a preferred embodiment of a video encoding method. Figure 3 FIG. 4 is a flow chart of a video encoding method in a preferred embodiment.

[0086] Step S310, copy the collected video frame YUV-A to be encoded, and perform occlusion processing on the area to be occluded in the copied video frame to obtain an occluded video frame YUV-a. The occlusion processing includes but is not limited to mosaic or monochrome smearing, as long as the purpose of occlusion can be achieved.

[0087] Step S320, sending the occlusion video frame YUV-a to the encoder for encoding to obtain the occlusion video code stream framei-a.

[0088] Step S330, taking the sub-region to be occluded as a unit, calculates the basic quantization step of each sub-region to be occluded in the region to be occluded by obtaining a preset initial quantization step, the relative distance between the sub-region to be occluded and the center point of the region to be occluded, and the ratio between the area of ​​the sub-region to be occluded and the area of ​​the entire image.

[0089] Step S340: Send the unoccluded video frame to be encoded and the calculated basic quantization step size to the encoder for encoding to obtain a target encoded code stream framei-A.

[0090] Step S350: encrypt the target coded code stream framei-A and store it in the supplementary enhancement information field of framei-a to obtain the target coding result framei'.

[0091] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0092] Based on the same inventive concept, the embodiment of the present application also provides a video encoding device for implementing the above-mentioned video encoding method. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above-mentioned method, so the specific limitations in the one or more video encoding device embodiments provided below can refer to the above-mentioned limitations on the video encoding method, and will not be repeated here.

[0093] In one embodiment, Figure 4As shown, a video encoding device is provided, including: an acquisition module 41, a calculation module 42 and a generation module 43, wherein:

[0094] An acquisition module 41 is used to acquire a video frame to be encoded and a blocked video frame, wherein the blocked video frame is obtained by performing a blocking process on a preset blocked area in the video frame to be encoded;

[0095] The calculation module 42 is used to encode the occluded video frame to obtain an occluded video code stream; adjust the quantization step size based on the ratio between the area of ​​the to-be-occluded region and the area of ​​the entire video image to obtain a target quantization step size; encode the to-be-occluded region in the to-be-encoded video frame based on the target quantization step size to obtain a target coded code stream; the ratio of the area of ​​the to-be-occluded region to the video image is inversely proportional to the value of the quantization step size;

[0096] The generating module 43 is used to merge the target coding code stream with the occlusion video code stream to obtain a target coding result.

[0097] Specifically, the acquisition module 41 acquires the video frame to be encoded and the occluded video frame, wherein the occluded video frame is obtained by performing occlusion processing on the preset occluded area in the video frame to be encoded; the video frame to be encoded and the occluded video frame are sent to the calculation module 42, the calculation module 42 adjusts the quantization step size based on the ratio between the area of ​​the occluded area and the entire video image, obtains the target quantization step size, and encodes the occluded area in the video frame to be encoded based on the target quantization step size to obtain the target encoding code stream; wherein the ratio of the area size of the occluded area to the video image is inversely proportional to the value of the quantization step size, the occluded video frame is encoded to obtain the occluded video code stream; the occluded video code stream and the target encoding code stream are sent to the generation module 43, the generation module 43 merges the target encoding code stream with the occluded video code stream to obtain the target encoding result.

[0098] Each module in the above video encoding device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.

[0099] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 5As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data related to the video encoding algorithm. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a video encoding method is implemented.

[0100] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0101] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0102] Acquire a video frame to be encoded and an occluded video frame, wherein the occluded video frame is obtained by performing occlusion processing on a preset occluded area in the video frame to be encoded;

[0103] Encoding the occluded video frame to obtain an occluded video code stream;

[0104] Based on the ratio between the area of ​​the to-be-occluded region and the area of ​​the entire video image, the quantization step size is adjusted to obtain a target quantization step size;

[0105] Based on the target quantization step size, the to-be-occluded area in the to-be-encoded video frame is encoded to obtain a target encoding bitstream; the ratio of the area of ​​the to-be-occluded area to the video image is inversely proportional to the value of the quantization step size;

[0106] The target coding code stream is combined with the occluded video code stream to obtain a target coding result.

[0107] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0108] Acquire a video frame to be encoded and an occluded video frame, wherein the occluded video frame is obtained by performing occlusion processing on a preset occluded area in the video frame to be encoded;

[0109] Encoding the occluded video frame to obtain an occluded video code stream;

[0110] Based on the ratio between the area of ​​the to-be-occluded region and the area of ​​the entire video image, the quantization step size is adjusted to obtain a target quantization step size;

[0111] Based on the target quantization step size, the to-be-occluded area in the to-be-encoded video frame is encoded to obtain a target encoding bitstream; the ratio of the area of ​​the to-be-occluded area to the video image is inversely proportional to the value of the quantization step size;

[0112] The target coding code stream is combined with the occluded video code stream to obtain a target coding result.

[0113] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:

[0114] Acquire a video frame to be encoded and an occluded video frame, wherein the occluded video frame is obtained by performing occlusion processing on a preset occluded area in the video frame to be encoded;

[0115] Encoding the occluded video frame to obtain an occluded video code stream;

[0116] Based on the ratio between the area of ​​the to-be-occluded region and the area of ​​the entire video image, the quantization step size is adjusted to obtain a target quantization step size;

[0117] Based on the target quantization step size, the to-be-occluded area in the to-be-encoded video frame is encoded to obtain a target encoding bitstream; the ratio of the area of ​​the to-be-occluded area to the video image is inversely proportional to the value of the quantization step size;

[0118] The target coding code stream is combined with the occluded video code stream to obtain a target coding result.

[0119] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.

[0120] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0121] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0122] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A video encoding method, characterized in that: The method comprises: Acquire a video frame to be encoded and an occluded video frame, wherein the occluded video frame is obtained based on occlusion processing of a preset occluded area in the video frame to be encoded; Encoding the occlusion video frame to obtain an occlusion video code stream; Based on the ratio between the area of ​​the to-be-shielded area and the area of ​​the entire video image, the quantization step size is adjusted to obtain a target quantization step size; Based on the target quantization step, the area to be occluded in the video frame to be encoded is encoded to obtain a target encoding code stream; the ratio of the area size of the area to be occluded to the video image is inversely proportional to the value of the quantization step; wherein the area to be occluded includes at least one sub-area to be occluded, and calculating the basic quantization step corresponding to each sub-area to be occluded includes: calculating the relative distance between the sub-area to be occluded and the center point of the area to be occluded, and calculating the first element based on a preset first natural constant and the relative distance between the sub-area to be occluded and the center point of the area to be occluded, calculating the product of the first element and a preset second constant to obtain a second element, and calculating the basic quantization step corresponding to each sub-area to be occluded based on the difference between a preset initial quantization step and the second element, and the target quantization step includes at least one basic quantization step; The target coding code stream is combined with the occluded video code stream to obtain a target coding result.

2. The method according to claim 1, characterized in that: The encoding process of the to-be-occluded area in the to-be-encoded video frame based on the target quantization step size includes: Traversing each of the sub-regions to be blocked, and calculating a basic quantization step size based on the acquired preset initial quantization step size, the relative distance between the sub-region to be blocked and the center point of the region to be blocked, and the ratio between the area of ​​the region to be blocked and the area of ​​the entire image; Based on the basic quantization step corresponding to each sub-region to be blocked, encoding processing is performed on the corresponding sub-region to be blocked, so as to complete the encoding of the sub-region to be blocked.

3. The method according to claim 2, characterized in that Calculating the basic quantization step size includes: Determine a step adjustment value according to a relative distance between the sub-region to be blocked and the center point of the region to be blocked, and a ratio between an area of ​​the region to be blocked and an area of ​​the video image; The difference between the initial quantization step size and the step size adjustment value is used as the basic quantization step size.

4. The method according to claim 1, characterized in that: The step of merging the target coded code stream with the occluded video code stream to obtain a target coding result includes: The target coded code stream is stored in the supplemental enhancement information field of the occluded video code stream to obtain the target coding result.

5. The method according to claim 1, characterized in that The method further comprises: The to-be-encoded video frame is encoded using the occlusion video code stream as a reference frame, wherein the length of the video frame sequence is a preset length sequence value.

6. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: The type of the area to be blocked includes at least one of the following: a face area, a body area, and a target object area.

7. A video encoding device, characterized in that: The device comprises: An acquisition module, used for acquiring a video frame to be encoded and an occluded video frame, wherein the occluded video frame is obtained by performing occlusion processing on a preset occluded area in the video frame to be encoded; A calculation module, used for encoding the occluded video frame to obtain an occluded video code stream; adjusting the quantization step size based on the ratio between the area of ​​the to-be-occluded area and the entire video image to obtain a target quantization step size; encoding the to-be-occluded area in the to-be-encoded video frame based on the target quantization step size to obtain a target coded code stream; the ratio of the area of ​​the to-be-occluded area to the video image is inversely proportional to the value of the quantization step size; wherein the to-be-occluded area includes at least one to-be-occluded sub-area, and calculating the basic quantization step size corresponding to each to-be-occluded sub-area includes: calculating the relative distance between the to-be-occluded sub-area and the center point of the to-be-occluded area, and calculating a first element based on a preset first natural constant and the relative distance between the to-be-occluded sub-area and the center point of the to-be-occluded area, calculating the product of the first element and a preset second constant to obtain a second element, and calculating the basic quantization step size corresponding to each to-be-occluded sub-area based on the difference between a preset initial quantization step size and the second element, and the target quantization step size includes at least one basic quantization step size; The generating module is used to merge the target coding code stream with the occlusion video code stream to obtain a target coding result.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Video frame processing method and video encoder

    CN101867799A

  • Video encoding method, video decoding method, encoder, decoder and computer storage medium

    CN117395425A