Video resolution real-time adjustment method and device, equipment and medium

By acquiring the quantization parameters of video frames in real time and calculating the quantization deviation value, the video resolution is adjusted to solve the problem of low adjustment accuracy in existing technologies, thus achieving higher quality video playback.

CN121924313APending Publication Date: 2026-04-24BEIJING JIAXUN FEIHONG ELECTRIC CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING JIAXUN FEIHONG ELECTRIC CO LTD
Filing Date
2026-01-16
Publication Date
2026-04-24

AI Technical Summary

Technical Problem

Existing video resolution adjustment methods suffer from low adjustment accuracy, resulting in poor video playback quality, especially when network bandwidth fluctuates and scene changes occur, making it difficult to maintain image quality.

Method used

By acquiring the current resolution and normalized bitrate of the target video, the quantization parameters of the video frames are obtained in real time, the quantization deviation value is calculated, and the video resolution is adjusted according to the deviation value to meet preset conditions, thereby achieving real-time adjustment of the video resolution.

Benefits of technology

It improves the precision of video resolution adjustment, enhances video playback quality, reduces stuttering and sudden changes in image quality, and improves the viewing experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121924313A_ABST
    Figure CN121924313A_ABST
Patent Text Reader

Abstract

The invention discloses a video resolution real-time adjustment method and device, equipment and a medium. The method comprises the following steps: acquiring a current resolution and a current normalized code rate of a target video, and acquiring a current video frame and a quantization parameter matched with the current video frame in real time; when the quantization parameter of the current video frame does not conform to the preset quantization interval, continuously acquiring a preset number of continuous video frames matched with the current video frame to obtain a video frame sequence; calculating a quantization deviation value of each video frame in the video frame sequence, and obtaining a target resolution matched with each video frame according to each quantization deviation value; and if each target resolution satisfies a preset resolution adjustment condition, configuring the target video based on each target resolution to perform resolution adjustment operation on the target video. Through the technical scheme of the invention, the real-time adjustment of the video resolution can be realized, the adjustment precision of the video resolution is improved, and the playing quality of the video is further improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of video optimization, and more particularly to a method, apparatus, device, and medium for real-time adjustment of video resolution. Background Technology

[0002] In the field of real-time video communication, encoding standards such as H.264, H.265, and VC1 are widely used due to their high compression rates. The quality of the encoded video mainly depends on the bitrate and the scene of the video sequence to be encoded. Taking the mainstream H.265 encoder as an example, when encoding test sequences of the same resolution and frame rate using the ducks_take_off and old_town_cross standards, the required bitrate difference can be close to 10 times if the same video quality is maintained. If the upper limit of the bitrate is limited to make the output bitrate consistent, significant fluctuations in encoding quality will occur. It is evident that it is difficult to match a suitable resolution solely with the bitrate, making ensuring video quality an engineering challenge.

[0003] Existing solutions typically estimate the video resolution corresponding to a given bitrate based on the video encoder type, then scale the camera-captured image before encoding. While this approach offers slight improvement over fixed resolution, its core flaw remains unresolved, resulting in low precision in video resolution adjustment and ultimately impacting playback quality. Specifically, existing technologies suffer from two major shortcomings: First, it's difficult to accurately determine the appropriate encoding resolution based on the network-assessed bitrate upper limit for different scenarios. Too high a resolution leads to image quality degradation, while too low a resolution results in lost image details and a blurry appearance. Second, within the same scene, when numerous objects are moving at high speeds, insufficient bitrate can cause a significant drop in image quality. Even if the moving objects subsequently stop and the bitrate becomes sufficient, scene image details may still fail to recover their clarity. These issues severely restrict the experience of real-time video communication, necessitating a high-precision real-time video resolution adjustment solution.

[0004] In summary, existing methods for adjusting video resolution suffer from low precision, resulting in poor video playback quality. Summary of the Invention

[0005] This invention provides a method, apparatus, device, and medium for real-time adjustment of video resolution, which can solve the problem that existing video resolution adjustment methods have low adjustment accuracy, resulting in poor video playback quality.

[0006] In a first aspect, embodiments of the present invention provide a method for real-time adjustment of video resolution, the method comprising:

[0007] In response to the reading operation of the target video, the current resolution and current normalized bit rate of the target video are obtained, and the current video frame and the quantization parameters matching the current video frame are obtained in real time.

[0008] When the quantization parameters of the current video frame do not conform to the preset quantization range, a preset number of consecutive video frames matching the current video frame are continuously acquired to obtain a video frame sequence.

[0009] Calculate the quantization deviation value of each video frame in the video frame sequence, and obtain the target resolution that matches each video frame based on each quantization deviation value;

[0010] If each target resolution meets the preset resolution adjustment conditions, the target video is configured based on each target resolution to perform a resolution adjustment operation on the target video.

[0011] Secondly, embodiments of the present invention provide a real-time video resolution adjustment device, the device comprising:

[0012] The data acquisition module is used to respond to the reading operation of the target video, obtain the current resolution and current normalized bit rate of the target video, and obtain the current video frame and the quantization parameters matching the current video frame in real time.

[0013] The video frame acquisition module is used to continuously acquire a preset number of consecutive video frames that match the current video frame when the quantization parameters of the current video frame do not conform to the preset quantization range, so as to obtain a video frame sequence.

[0014] The resolution calculation module is used to calculate the quantization deviation value of each video frame in the video frame sequence, and obtain the target resolution that matches each video frame based on each quantization deviation value.

[0015] The resolution adjustment module is used to configure the target video based on each target resolution if each target resolution meets the preset resolution adjustment conditions, so as to perform a resolution adjustment operation on the target video.

[0016] Thirdly, embodiments of the present invention provide an electronic device, the electronic device comprising:

[0017] At least one processor; and

[0018] A memory communicatively connected to the at least one processor; wherein,

[0019] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform a real-time video resolution adjustment method according to any embodiment of the present invention.

[0020] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing computer instructions that, when executed by a processor, implement a real-time video resolution adjustment method as described in any embodiment of the present invention.

[0021] The technical solution of this invention, in response to a target video reading operation, obtains the current resolution and current normalized bitrate of the target video, and acquires the current video frame and the quantization parameters matching the current video frame in real time. When the quantization parameters of the current video frame do not conform to a preset quantization range, a preset number of consecutive video frames matching the current video frame are continuously acquired to obtain a video frame sequence. Then, the quantization deviation value of each video frame in the video frame sequence is calculated, and the target resolution matching each video frame is obtained based on each quantization deviation value. If each target resolution meets a preset resolution adjustment condition, the target video is configured based on each target resolution to perform a resolution adjustment operation on the target video. This solves the problem of low video resolution adjustment accuracy in existing video resolution adjustment methods, which leads to poor video playback quality. It realizes real-time adjustment of video resolution, improves the adjustment accuracy of video resolution, and thus improves the playback quality of video.

[0022] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

[0023] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0024] Figure 1 This is a flowchart of a real-time video resolution adjustment method according to Embodiment 1 of the present invention;

[0025] Figure 2 This is a flowchart of a real-time video resolution adjustment method according to Embodiment 2 of the present invention;

[0026] Figure 3 This is a schematic diagram of the structure of a real-time video resolution adjustment device according to Embodiment 3 of the present invention;

[0027] Figure 4 This is a schematic diagram of the structure of an electronic device that implements a real-time video resolution adjustment method according to an embodiment of the present invention. Detailed Implementation

[0028] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0029] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, any variations of the terms "comprising" and "having" are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0030] Example 1

[0031] Figure 1 This is a flowchart of a real-time video resolution adjustment method provided in Embodiment 1 of the present invention. This embodiment is applicable to situations where the resolution of a playing video is adjusted in real time. The method can be executed by a real-time video resolution adjustment device, which can be implemented in hardware and / or software. The real-time video resolution adjustment device can be configured in a terminal or server with real-time video resolution adjustment function.

[0032] like Figure 1 As shown, the method includes:

[0033] S110. In response to the reading operation of the target video, obtain the current resolution and current normalized bit rate of the target video, and obtain the current video frame and the quantization parameters matching the current video frame in real time.

[0034] The video reading operation can be triggered by application scenarios such as video playback, editing, or bitrate optimization. The normalized bitrate refers to the relative bitrate value obtained by standardizing the video encoding bitrate at different resolutions according to a preset benchmark. Its core function is to eliminate the interference of resolution differences on bitrate evaluation, make the bitrates at different resolutions horizontally comparable, and provide a unified reference standard for subsequent bitrate optimization decisions.

[0035] Before obtaining the current resolution and current normalized bitrate of the target video, the process includes: obtaining at least one test frame and a preset resolution test set, wherein the test quantization parameters of each test frame are the same, and the resolution test set includes at least one preset resolution; performing encoding tests on each test frame based on the resolution test set to obtain the target encoding bitrate that matches each preset resolution; obtaining any preset resolution in the resolution test set as a reference resolution, and calculating the bitrate ratio between the target encoding bitrate matched by each preset resolution and the target encoding bitrate corresponding to the reference resolution; statistically analyzing each preset resolution and each bitrate ratio to obtain a resolution ratio table that matches the reference resolution, wherein the resolution ratio table includes the mapping relationship between each preset resolution and each bitrate ratio; and returning to the operation of obtaining any preset resolution as a reference resolution in the resolution test set until there is no preset resolution in the resolution test set that is not used as a reference resolution.

[0036] The encoding test employs an encoding algorithm consistent with the original encoding standard of the target video, and fixes core parameters such as encoding complexity level and frame rate, changing only the resolution variable to encode each test frame.

[0037] Furthermore, the resolution ratio table includes a mapping relationship between each preset resolution and each bitrate ratio. Each entry contains at least three types of information: preset resolution identifier, target encoding bitrate, and bitrate ratio. A one-to-one correspondence between preset resolutions and bitrate ratios is established in the form of key-value pairs, facilitating quick subsequent lookup and retrieval. The core value of this ratio table lies in converting absolute bitrates at different resolutions into relative ratios, providing a direct basis for subsequent normalized bitrate calculations.

[0038] S120. When the quantization parameters of the current video frame do not conform to the preset quantization range, continuously acquire a preset number of consecutive video frames that match the current video frame to obtain a video frame sequence.

[0039] The quantization range can be set and adjusted by the user according to the actual implementation scenario, and this embodiment does not limit its specific value.

[0040] S130. Calculate the quantization deviation value of each video frame in the video frame sequence, and obtain the target resolution that matches each video frame based on each quantization deviation value.

[0041] S140. If each target resolution meets the preset resolution adjustment conditions, then the target video is configured based on each target resolution to perform a resolution adjustment operation on the target video.

[0042] If each target resolution meets the preset resolution adjustment conditions, the target video is configured based on each target resolution, including: determining whether each target resolution is consistent; if consistent, determining that the preset resolution adjustment conditions are met, and adjusting the output resolution of the target video to the target resolution; and returning to perform the operation of real-time acquisition of the current video frame and the quantization parameters matching the current video frame.

[0043] Furthermore, after determining whether the target resolutions are consistent, the process also includes: if the target resolutions are not completely consistent, discard the calculation results of each target resolution, and return to perform the operation of real-time acquisition of the current video frame and the quantization parameters matching the current video frame.

[0044] Specifically, if the consistency check results show that the target resolutions are not completely consistent, the calculation results for each target resolution are discarded. Typical scenarios where this inconsistency may include: sudden fluctuations in network bandwidth causing bitrate data distortion, thus affecting the target resolution calculation; special scenes appearing in consecutive video frames causing frame-level target resolution calculation deviations; and temporary changes in terminal device adaptation information not being synchronized to the calculation module. The purpose of discarding invalid calculation results is to avoid performing resolution adjustments based on erroneous data, preventing unpleasant experiences such as frequent resolution switching, screen stuttering, and sudden changes in image quality.

[0045] The technical solution of this invention, in response to a target video reading operation, obtains the current resolution and current normalized bitrate of the target video, and acquires the current video frame and the quantization parameters matching the current video frame in real time. When the quantization parameters of the current video frame do not conform to a preset quantization range, a preset number of consecutive video frames matching the current video frame are continuously acquired to obtain a video frame sequence. Then, the quantization deviation value of each video frame in the video frame sequence is calculated, and the target resolution matching each video frame is obtained based on each quantization deviation value. If each target resolution meets a preset resolution adjustment condition, the target video is configured based on each target resolution to perform a resolution adjustment operation on the target video. This achieves real-time adjustment of video resolution, improves the adjustment accuracy of video resolution, and thus improves the playback quality of the video.

[0046] Example 2

[0047] Figure 2 This is a flowchart of a real-time video resolution adjustment method provided in Embodiment 2 of the present invention. This embodiment is a refinement based on the above embodiment. Specifically, this embodiment refines the method of calculating the quantization deviation value of each video frame in the video frame sequence and obtaining the target resolution that matches each video frame based on each quantization deviation value.

[0048] like Figure 2As shown, the method includes:

[0049] S210, in response to the reading operation of the target video, obtain the current resolution and current normalized bit rate of the target video, and obtain the current video frame and the quantization parameters matching the current video frame in real time.

[0050] Before obtaining the current resolution and current normalized bitrate of the target video, the process further includes: obtaining at least one test frame and a preset resolution test set, wherein the test quantization parameters of each test frame are the same, and the resolution test set includes at least one preset resolution; performing encoding tests on each test frame based on the resolution test set to obtain the target encoding bitrate that matches each preset resolution; obtaining any preset resolution as a reference resolution from the resolution test set, and calculating the bitrate ratio between the target encoding bitrate matched by each preset resolution and the target encoding bitrate corresponding to the reference resolution; and statistically analyzing each preset resolution and each bitrate ratio to obtain a resolution ratio table that matches the reference resolution, wherein the resolution ratio table includes the mapping relationship between each preset resolution and each bitrate ratio.

[0051] Return to the operation of obtaining any preset resolution as a reference resolution in the resolution test set until there is no preset resolution in the resolution test set that has not been used as a reference resolution.

[0052] S220. When the quantization parameters of the current video frame do not conform to the preset quantization range, continuously acquire a preset number of consecutive video frames that match the current video frame to obtain a video frame sequence.

[0053] S230. Obtain the target quantization parameters for each video frame in the video frame sequence.

[0054] The target quantization parameter is a real-time measurement of the actual quantization state of the video frame.

[0055] Optionally, the specific steps for obtaining the target quantization parameters are as follows: First, select the appropriate acquisition method based on the video encoder type: For encoders that support quantization parameter output interfaces, the frame-level quantization parameter values ​​of each video frame can be directly acquired by calling the built-in debugging interface or the parameter callback function provided by the SDK. The acquisition latency can be controlled within milliseconds to meet real-time adjustment requirements. For encoders that do not support direct output of quantization parameters, the parameters are obtained through a bitstream parsing scheme: Parse the syntax elements in the encoded bitstream, extract the initial quantization parameter values, and then combine them with the quantization parameter offset syntax information of the encoding unit to calculate the accurate quantization parameter values ​​for each frame, ensuring that actual acquisition can be achieved even without a dedicated interface. Second, perform frame type filtering and validity verification: Due to the difference in encoding strategies between I-frames and P-frames, to avoid abnormal quantization parameter values ​​of a few I-frames interfering with subsequent calculations, only the actual quantization parameter values ​​of P-frames are retained as the target quantization parameters. At the same time, verify whether the actual quantization parameter values ​​are within the valid range of the corresponding encoding standard. If abnormal values ​​that exceed the range occur, replace them with a sliding average of the valid actual quantization parameter values ​​of three adjacent frames to ensure the reliability of the target quantization parameters for each frame. Finally, the selected measured quantization parameter values ​​are stored in frame order to form a set of target quantization parameters that correspond one-to-one with the video frame sequence, providing data support for subsequent frame-by-frame deviation calculation.

[0056] Those skilled in the art should understand that the method of measuring the quantization parameters of video frames to obtain the target quantization parameters is a mature existing technology. This embodiment only introduces its steps, and its principles and specific implementation algorithms are not described in detail here.

[0057] S240. Calculate the quantization deviation value of each video frame based on each target quantization parameter and quantization interval.

[0058] The calculation of the quantization deviation value for each video frame based on each target quantization parameter and quantization interval includes: obtaining the beginning and end values ​​of the quantization interval; calculating the average of the beginning and end values ​​and rounding the result to obtain the target preset value; and calculating the difference between the target quantization parameter and the target preset value to obtain the target difference. This is based on the formula: The quantization deviation value of the video frame is calculated, where r is the quantization deviation value and dqp is the target difference value.

[0059] In a specific implementation scenario of this embodiment, if the preset quantization interval (image quality tolerance interval) is [lowqp=25, highqp=31], where lowqp is the front-end value, corresponding to the acceptable optimal image quality; and highqp is the back-end value, corresponding to the acceptable minimum image quality; and the measured target quantization parameter is 34. During the calculation and target difference extraction process, based on the definition of the quantization interval endpoint values, the front-end value lowqp=25 and the back-end value highqp=31 are determined; then, the target preset value is calculated to be 28, and based on the target preset value 28 and the target quantization parameter 34, the target difference 34-28=6 is calculated. In summary, the final calculation result is: {"Target Quantization Parameter":34,"Quantization Interval":[25,31],"Target Difference":6,"}.

[0060] S250. Calculate the target resolution that matches each video frame based on the current normalized bitrate of the target video and each quantization deviation value.

[0061] The process of calculating the target resolution matching each video frame based on the current normalized bitrate and quantization deviation values ​​of the target video includes: calculating the target bitrate ratio of each video frame based on the formula: Target bitrate ratio = Current normalized bitrate × quantization deviation value; obtaining a target resolution ratio table matching the target video based on the current resolution of the target video; and finding the target resolution matching each video frame in the target resolution ratio table based on the target bitrate ratio of each video frame.

[0062] Furthermore, based on the target bitrate ratio of each video frame, the target resolution matching each video frame is found in the target resolution ratio table: First, all bitrate ratios in the target resolution ratio table are traversed, and the absolute value of the difference between each entry and the target bitrate ratio is calculated; second, a matching threshold is set, and entries with an absolute difference ≤ the threshold are filtered out. If a unique match exists, the corresponding resolution is the target resolution of that frame; if multiple matches exist, the resolution with the bitrate ratio closest to the target value is selected; if no match exists, the boundary value of a preset resolution range is taken to avoid exceeding the resolution range allowed by the hardware or service. For example, if the target bitrate ratio is 0.382, the bitrate ratio of 640×360 in the target resolution ratio table is 0.35 (difference 0.032 ≤ 0.1), and the bitrate ratio of 848×480 is 0.56 (difference 0.178 > 0.1), then 640×360 is selected as the target resolution.

[0063] S260. If each target resolution meets the preset resolution adjustment conditions, then the target video is configured based on each target resolution to perform a resolution adjustment operation on the target video.

[0064] The technical solution of this invention, in response to a target video reading operation, obtains the current resolution and current normalized bitrate of the target video, and acquires the current video frame and the quantization parameters matching the current video frame in real time. When the quantization parameters of the current video frame do not conform to a preset quantization range, a preset number of consecutive video frames matching the current video frame are continuously acquired to obtain a video frame sequence. Then, the target quantization parameters of each video frame in the video frame sequence are acquired respectively, and the quantization deviation value of each video frame is calculated based on each target quantization parameter and the quantization range. Then, the target resolution matching each video frame is calculated based on the current normalized bitrate of the target video and each quantization deviation value. If each target resolution meets a preset resolution adjustment condition, the target video is configured based on each target resolution to perform a resolution adjustment operation on the target video. This achieves real-time adjustment of video resolution, improves the adjustment accuracy of video resolution, and thus improves the playback quality of the video.

[0065] Example 3

[0066] Figure 3 This is a schematic diagram of a real-time video resolution adjustment device provided in Embodiment 3 of the present invention.

[0067] like Figure 3 As shown, the device includes:

[0068] The data acquisition module 310 is used to respond to the reading operation of the target video, acquire the current resolution and current normalized bit rate of the target video, and acquire the current video frame and the quantization parameters matching the current video frame in real time.

[0069] The video frame acquisition module 320 is used to continuously acquire a preset number of consecutive video frames that match the current video frame when the quantization parameters of the current video frame do not conform to the preset quantization range, so as to obtain a video frame sequence.

[0070] The resolution calculation module 330 is used to calculate the quantization deviation value of each video frame in the video frame sequence, and obtain the target resolution that matches each video frame based on each quantization deviation value.

[0071] The resolution adjustment module 340 is used to configure the target video based on each target resolution if each target resolution meets the preset resolution adjustment conditions, so as to perform a resolution adjustment operation on the target video.

[0072] The technical solution of this invention, in response to a target video reading operation, obtains the current resolution and current normalized bitrate of the target video, and acquires the current video frame and the quantization parameters matching the current video frame in real time. When the quantization parameters of the current video frame do not conform to a preset quantization range, a preset number of consecutive video frames matching the current video frame are continuously acquired to obtain a video frame sequence. Then, the quantization deviation value of each video frame in the video frame sequence is calculated, and the target resolution matching each video frame is obtained based on each quantization deviation value. If each target resolution meets a preset resolution adjustment condition, the target video is configured based on each target resolution to perform a resolution adjustment operation on the target video. This achieves real-time adjustment of video resolution, improves the adjustment accuracy of video resolution, and thus improves the playback quality of the video.

[0073] Based on the above embodiments, the resolution calculation module 330 includes:

[0074] The parameter acquisition unit is used to acquire the target quantization parameters of each video frame in the video frame sequence.

[0075] The deviation value calculation unit is used to calculate the quantization deviation value of each video frame based on each target quantization parameter and quantization interval.

[0076] The resolution calculation unit is used to calculate the target resolution that matches each video frame based on the current normalized bitrate of the target video and each quantization deviation value.

[0077] Based on the above embodiments, the data acquisition module 310 is further configured to: before acquiring the current resolution and current normalized bitrate of the target video, acquire at least one test frame and a preset resolution test set, wherein the test quantization parameters of each test frame are the same, and the resolution test set includes at least one preset resolution; perform encoding tests on each test frame based on the resolution test set to obtain target encoding bitrates that match each preset resolution respectively; acquire any preset resolution as a reference resolution in the resolution test set, and calculate the bitrate ratio between the target encoding bitrate matched by each preset resolution and the target encoding bitrate corresponding to the reference resolution; perform statistics on each preset resolution and each bitrate ratio to obtain a resolution ratio table that matches the reference resolution, wherein the resolution ratio table includes the mapping relationship between each preset resolution and each bitrate ratio; return to perform the operation of acquiring any preset resolution as a reference resolution in the resolution test set until there is no preset resolution in the resolution test set that is not used as a reference resolution.

[0078] Based on the above embodiments, the resolution calculation unit includes:

[0079] The bitrate ratio calculation unit is used to calculate the target bitrate ratio of each video frame based on the formula: Target bitrate ratio = Current normalized bitrate × quantization deviation value;

[0080] The ratio table acquisition unit is used to acquire a target resolution ratio table that matches the target video based on the current resolution of the target video;

[0081] The resolution lookup unit is used to find the target resolution that matches each video frame in the target resolution ratio table based on the target bitrate ratio of each video frame.

[0082] Based on the above embodiments, the deviation value calculation unit includes:

[0083] An endpoint value acquisition unit is used to acquire the beginning and end endpoint values ​​of the quantization interval.

[0084] The difference calculation unit is used to calculate the average value of the front end point value and the rear end point value and round the calculation result to obtain the target preset value;

[0085] A numerical comparison unit is used to calculate the difference between the target quantization parameter and the target preset value to obtain the target difference.

[0086] The quantization deviation value calculation unit is used based on the formula: The quantization deviation value of the video frame is calculated, where r is the quantization deviation value and dqp is the target difference value.

[0087] Based on the above embodiments, the resolution adjustment module 340 includes:

[0088] The consistency judgment unit is used to determine whether the resolutions of each target are consistent.

[0089] An adjustment unit is used to determine, if consistent, that the preset resolution adjustment conditions are met, and to adjust the output resolution of the target video to the target resolution.

[0090] Return to the execution unit, used to return the operation of acquiring the current video frame and the quantization parameters matching the current video frame in real time.

[0091] Based on the above embodiments, the consistency judgment unit is further configured to: after judging whether each target resolution is consistent, if each target resolution is not completely consistent, discard the calculation results of each target resolution, and return to perform the operation of real-time acquisition of the current video frame and the quantization parameters matching the current video frame.

[0092] The real-time video resolution adjustment device provided in this embodiment of the invention can execute the real-time video resolution adjustment method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the method.

[0093] Example 4

[0094] Figure 4 A schematic diagram of an electronic device 10 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0095] like Figure 4 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded into the RAM 13 from storage unit 18. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0096] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0097] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as a method for real-time adjustment of video resolution.

[0098] Accordingly, the method includes:

[0099] In response to the reading operation of the target video, the current resolution and current normalized bit rate of the target video are obtained, and the current video frame and the quantization parameters matching the current video frame are obtained in real time.

[0100] When the quantization parameters of the current video frame do not conform to the preset quantization range, a preset number of consecutive video frames matching the current video frame are continuously acquired to obtain a video frame sequence.

[0101] Calculate the quantization deviation value of each video frame in the video frame sequence, and obtain the target resolution that matches each video frame based on each quantization deviation value;

[0102] If each target resolution meets the preset resolution adjustment conditions, the target video is configured based on each target resolution to perform a resolution adjustment operation on the target video.

[0103] In some embodiments, a real-time video resolution adjustment method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the real-time video resolution adjustment method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform a real-time video resolution adjustment method by any other suitable means (e.g., by means of firmware).

[0104] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0105] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0106] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0107] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0108] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0109] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0110] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

Claims

1. A method for real-time adjustment of video resolution, characterized in that, include: In response to the reading operation of the target video, the current resolution and current normalized bit rate of the target video are obtained, and the current video frame and the quantization parameters matching the current video frame are obtained in real time. When the quantization parameters of the current video frame do not conform to the preset quantization range, a preset number of consecutive video frames matching the current video frame are continuously acquired to obtain a video frame sequence. Calculate the quantization deviation value of each video frame in the video frame sequence, and obtain the target resolution that matches each video frame based on each quantization deviation value; If each target resolution meets the preset resolution adjustment conditions, the target video is configured based on each target resolution to perform a resolution adjustment operation on the target video.

2. The method according to claim 1, characterized in that, Calculate the quantization deviation value for each video frame in the video frame sequence, and obtain the target resolution that matches each video frame based on the quantization deviation value, including: Obtain the target quantization parameters for each video frame in the video frame sequence; The quantization deviation value of each video frame is calculated based on the target quantization parameters and quantization intervals. The target resolution matching each video frame is calculated based on the current normalized bitrate of the target video and each quantization deviation value.

3. The method according to claim 1, characterized in that, Before obtaining the current resolution and current normalized bitrate of the target video, the following steps are also included: At least one test frame and a preset resolution test set are obtained, wherein the test quantization parameters of each test frame are the same, and the resolution test set includes at least one preset resolution; Based on the resolution test set, an encoding test is performed on each test frame to obtain the target encoding bitrate that matches each preset resolution. In the resolution test set, any preset resolution is obtained as the reference resolution, and the ratio of the target coding bitrate matched by each preset resolution to the target coding bitrate corresponding to the reference resolution is calculated. Statistical analysis is performed on each preset resolution and each bitrate ratio to obtain a resolution ratio table that matches the baseline resolution. The resolution ratio table includes the mapping relationship between each preset resolution and each bitrate ratio. Return to the operation of obtaining any preset resolution as a reference resolution in the resolution test set until there is no preset resolution in the resolution test set that has not been used as a reference resolution.

4. The method according to any one of claims 2-3, characterized in that, The target resolution matching each video frame is calculated based on the current normalized bitrate and quantization deviation values ​​of the target video, including: Based on the formula: Target bitrate ratio = Current normalized bitrate × Quantization deviation value, the target bitrate ratio of each video frame is calculated respectively; Obtain a target resolution ratio table that matches the target video based on the current resolution of the target video; Based on the target bitrate ratio of each video frame, the target resolution that matches each video frame is found in the target resolution ratio table.

5. The method according to claim 2, characterized in that, The quantization deviation value of each video frame is calculated based on the target quantization parameters and quantization intervals, including: Obtain the beginning and end values ​​of the quantization interval; Calculate the average of the front end point value and the rear end point value, and round the result to obtain the target preset value; Calculate the difference between the target quantization parameter and the target preset value to obtain the target difference; Based on the formula: The quantization deviation value of the video frame is calculated, where r is the quantization deviation value and dqp is the target difference value.

6. The method according to claim 1, characterized in that, If each target resolution meets the preset resolution adjustment conditions, then the target video is configured based on each target resolution, including: Determine whether the resolution of each target is consistent; If they match, then the preset resolution adjustment conditions are met, and the output resolution of the target video is adjusted to the target resolution. Returns to the operation of acquiring the current video frame and the quantization parameters that match the current video frame in real time.

7. The method according to claim 6, characterized in that, After determining whether the resolutions of all targets are consistent, the process also includes: If the target resolutions are not completely consistent, the calculation results for each target resolution are discarded, and the operation of obtaining the current video frame and the quantization parameters matching the current video frame in real time is returned.

8. A real-time video resolution adjustment device, characterized in that, include: The data acquisition module is used to respond to the reading operation of the target video, obtain the current resolution and current normalized bit rate of the target video, and obtain the current video frame and the quantization parameters matching the current video frame in real time. The video frame acquisition module is used to continuously acquire a preset number of consecutive video frames that match the current video frame when the quantization parameters of the current video frame do not conform to the preset quantization range, so as to obtain a video frame sequence. The resolution calculation module is used to calculate the quantization deviation value of each video frame in the video frame sequence, and obtain the target resolution that matches each video frame based on each quantization deviation value. The resolution adjustment module is used to configure the target video based on each target resolution if each target resolution meets the preset resolution adjustment conditions, so as to perform a resolution adjustment operation on the target video.

9. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform a real-time video resolution adjustment method according to any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute a method for real-time adjustment of video resolution as described in any one of claims 1-7.