Video coding method and device, equipment and medium
By collecting system operating status and encoding time in real time, and dynamically adjusting the encoding strategy, the problem of compression efficiency and real-time encoding requirements for video encoding on low-power devices is solved, achieving precise adaptation to device load and improving encoding stability and frame rate.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-08
- Publication Date
- 2026-04-14
AI Technical Summary
Existing video encoding methods struggle to balance compression efficiency and real-time encoding requirements on low-power devices. In particular, the high complexity of the AV1 encoding standard on high-performance servers or desktop CPUs makes it impossible for low-power devices such as mobile terminals and embedded processors to support real-time encoding.
By collecting real-time data on system operation and the actual encoding time of video frames, the complexity of the encoding strategy is dynamically adjusted to generate a new encoding strategy that corresponds to the current computing power supply and demand status, thereby achieving precise adaptation between video encoding and device load.
It solves the problems of insufficient computing power and wasted computing power caused by insufficient computing power in traditional fixed strategies, improves the encoding stability of low-power devices, reduces stuttering and frame rate jumps, and is suitable for all scenarios from low-power to high-performance devices.
Smart Images

Figure CN121864976A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence, and the solution can be applied to the medical and financial fields, and in particular to a video encoding method, apparatus, device and medium. Background Technology
[0002] With the widespread adoption of online video, video conferencing, and mobile multimedia applications, as well as the large-scale application of professional scenarios such as remote medical consultations, surgical guidance, remote financial account opening, and real-time risk control video verification, the demand for video encoding technology to adapt to various devices continues to rise. As a new generation of high-efficiency video encoding standard, the AV1 encoding standard, with its superior compression efficiency, provides better visual quality at the same bitrate compared to H.264 or HEVC, especially meeting the core requirements of medical scenarios for high-definition details (such as lesion features and surgical procedures) and financial scenarios for image realism (such as facial details for identity verification and real-time recording of transactions).
[0003] However, AV1's high compression efficiency relies on complex prediction modes, flexible block structures, rich loop filters, and diverse transformation tools, making its encoding complexity significantly higher than traditional standards and placing stringent demands on processor computing power and energy consumption. On high-performance servers or desktop CPUs, open-source encoders like libaom-av1 can achieve near real-time encoding speeds through multi-threaded optimization. However, on low-power devices (such as mobile terminals, embedded processors, IoT nodes, portable medical consultation devices, and financial remote verification terminals), limitations in CPU clock speed and parallel processing capabilities often prevent the full-featured real-time encoding of AV1. For example, at 720p or 1080p resolutions, keyframe encoding in medical surgical guidance videos and real-time risk control verification videos in financial scenarios can easily become a performance bottleneck, leading to insufficient frame rates and increased latency. This affects the real-time performance and accuracy of medical diagnoses and may also reduce the security and user experience of financial transactions.
[0004] Therefore, existing video coding methods have the problem of not being able to balance compression efficiency and real-time coding requirements on low-power devices. Summary of the Invention
[0005] This invention provides a video encoding method, apparatus, device, and medium, aiming to solve the problem that existing video encoding methods struggle to balance compression efficiency and real-time encoding requirements on low-power devices.
[0006] In a first aspect, embodiments of the present invention provide a video encoding method, the method comprising: The original video is encoded according to a preset encoding strategy; During the encoding process, the system's operating status and the actual encoding time of video frames are collected in real time. Based on the system's operating status and the actual encoding time, the encoding complexity of the encoding strategy is dynamically adjusted to generate a new encoding strategy that corresponds to the current computing power supply and demand status. The original video is encoded according to the new encoding strategy.
[0007] Secondly, embodiments of the present invention also provide a video encoding apparatus, the apparatus comprising: The first encoding unit is used to encode the original video according to a preset encoding strategy; The acquisition unit is used to acquire the system's operating status and the actual encoding time of video frames in real time during the encoding process. The adjustment unit is used to dynamically adjust the encoding complexity of the encoding strategy according to the system operating status and the actual encoding time, and generate a new encoding strategy corresponding to the current computing power supply and demand status. The second encoding unit is used to encode the original video according to the new encoding strategy.
[0008] Thirdly, embodiments of the present invention also provide an electronic device, which includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the method described in the first aspect above.
[0009] Fourthly, embodiments of the present invention also provide a computer-readable storage medium storing a computer program, the computer program including program instructions that, when executed by a processor, can implement the method described in the first aspect.
[0010] This invention provides a video encoding method, apparatus, device, and medium. The method includes: encoding an original video according to a preset encoding strategy; during the encoding process, real-time acquisition of system operating status and actual encoding time of video frames; dynamically adjusting the encoding complexity of the encoding strategy based on the system operating status and the actual encoding time, generating a new encoding strategy corresponding to the current computing power supply and demand status; and encoding the original video according to the new encoding strategy. This invention achieves precise adaptation between video encoding and device load through a closed-loop mechanism of "real-time acquisition - dynamic adjustment - adaptive encoding"; it captures system operating status and actual encoding time in real time during the encoding process, dynamically adjusting the encoding complexity to completely solve the problems of "insufficient computing power causing stuttering, and surplus computing power causing waste" associated with traditional fixed strategies; this invention is adaptable to all scenarios from low-power to high-performance devices, effectively overcoming the problem of limited encoding resources for low-power devices, reducing stuttering and frame rate jumps, and improving encoding stability. Attached Figure Description
[0011] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0012] Figure 1 A flowchart illustrating the video encoding method provided in an embodiment of the present invention; Figure 2 This is a schematic block diagram of a video encoding apparatus provided in an embodiment of the present invention; Figure 3 A schematic block diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0013] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0014] It should be understood that, when used in this specification and the appended claims, the terms "comprising" and "including" indicate the presence of the described features, integrals, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.
[0015] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.
[0016] It should also be further understood that the term "and / or" as used in this specification and the appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes such combinations. Embodiments of this invention provide a video encoding method, apparatus, device, and medium. The video encoding method can be applied to a terminal device or a server. The terminal device can be an electronic device such as a mobile phone, tablet computer, laptop computer, desktop computer, personal digital assistant, and wearable device; the server can be a single server or a server cluster consisting of multiple servers. The invention will now be described in detail through specific embodiments.
[0017] Figure 1 This is a flowchart illustrating the video encoding method provided in an embodiment of the present invention. Figure 1 As shown, the method includes the following steps S110-S140.
[0018] S110. Encode the original video according to the preset encoding strategy.
[0019] In this embodiment, the encoding strategy is pre-configured based on the device's basic computing power and the needs of medical / financial scenarios. It includes an initial encoding complexity level, basic activation rules for each core encoding tool, and scenario-specific adaptation requirements (high-quality image fidelity, low latency, and compliant evidence storage). The initial encoding complexity is set to a medium level, ensuring clear preservation of key information such as lesions / anatomical structures in medical images and facial / contract text in financial scenarios, while also meeting the real-time requirements of remote consultations and face-to-face financial signing.
[0020] S120. During the encoding process, the system operation status and the actual encoding time of video frames are collected in real time.
[0021] In this embodiment, the system operating status is the CPU utilization rate, and the actual encoding time is the encoding time of key frames in the original video.
[0022] Preferably, a sliding window mechanism is adopted to statistically analyze the average CPU utilization and the average encoding time of each video frame within a preset time window. The encoding complexity of the encoding strategy is dynamically adjusted based on the average CPU utilization and the average encoding time to avoid single fluctuations affecting the decision.
[0023] S130. Based on the system operating status and the actual encoding time, dynamically adjust the encoding complexity of the encoding strategy to generate a new encoding strategy corresponding to the current computing power supply and demand status.
[0024] In this embodiment, the encoding complexity of the encoding strategy is dynamically adjusted based on the system operating status and the actual encoding time, generating a new encoding strategy corresponding to the current computing power supply and demand status. Specifically, the encoding complexity can be accurately adapted to the current computing power supply and demand by gradually adjusting the activation rules of each core encoding tool (such as block search tool, pattern decision tool, motion estimation tool, transform search tool, rate distortion optimization tool, loop filtering tool, etc.).
[0025] In one embodiment, step S130 includes: if the system operating status is greater than a first threshold, or the actual encoding time is greater than a second threshold, then gradually reduce the encoding complexity of the encoding strategy to generate a new encoding strategy corresponding to the current computing power supply and demand status.
[0026] In this embodiment, if the system operating status (such as CPU utilization) is greater than a first threshold (such as 80%), or the actual encoding time is greater than a second threshold (such as 60ms), the encoding complexity of the encoding strategy is gradually reduced to generate a new encoding strategy corresponding to the current computing power supply and demand status.
[0027] In one embodiment, the stepwise reduction of the encoding complexity of the encoding strategy includes: gradually reducing the encoding complexity of the encoding strategy in descending order of tool priority.
[0028] In this embodiment, when the CPU is busy (e.g., CPU utilization > 80%, or actual encoding time > 60ms), the encoding complexity of the encoding strategy is gradually reduced in descending order of tool priority. That is, when reducing load, tools with high computing power consumption and low image quality dependence are turned off or weakened first to avoid a significant drop in core encoding effect. The tool priority is as follows: block search tool > pattern decision tool > motion estimation tool > transform search tool > rate distortion optimization tool > loop filtering tool.
[0029] In one embodiment, the step of gradually reducing the encoding complexity of the encoding strategy according to tool priority in descending order includes: gradually limiting the depth size of the block search tool; if the depth size of the block search tool is a preset depth size and the current computing power supply and demand state is still under high load, then gradually reducing the number of candidate patterns of the pattern decision tool; if the number of candidate patterns is a preset minimum number and the current computing power supply and demand state is still under high load, then gradually narrowing the search range of the motion estimation tool; if the search range is a first search range and the current computing power supply and demand state is still under high load, then gradually limiting the transformation size of the transformation search tool; if the transformation size is a preset minimum transformation size and the current computing power supply and demand state is still under high load, then simplifying the filtering logic of the rate distortion optimization tool; if the current computing power supply and demand state is still under high load, then gradually reducing the filtering function of the loop filtering tool.
[0030] In this embodiment, the coding complexity is adjusted step by step during load reduction according to the following logic: 1. First, gradually limit the depth size of the block search tool. The block search tool supports recursive search from 128×128 to 4×4 by default. When reducing load, first increase the upper limit of the split depth from 4×4 to 8×8, and then further increase it to 16×16. When the depth size of the block search tool reaches the preset depth size (16×16) and is still under high load, proceed to the next adjustment step. Preferably, before limiting the depth size of the block search tool, first close the global motion and composite prediction tool to release the high computing power occupied by the tool, and at the same time avoid limiting the block size too early, which would damage the encoding quality of core information in medical / financial scenarios (such as lesion edges and contract text details). 2. Gradually reduce the number of candidate modes in the mode decision tool: The mode decision tool includes a full range of modes by default, such as 56 directional modes, 5 non-directional modes, and 5 recursive filtering modes. When reducing load, first reduce the advanced angle modes, then retain the core modes, until the number of candidate modes is reduced to the preset minimum (only horizontal, vertical, and DC brightness modes). If the preset minimum number has been reached and the system is still under high load, continue to adjust. 3. Gradually reduce the search range of the motion estimation tool and decrease the number of reference frames: The motion estimation tool supports a dynamic search radius range of 32 pixels to 8 pixels by default, and calls 8 reference frames and enables 1 / 8 pixel subpixel search by default; when reducing load, adjust these two parameters simultaneously, reducing the search radius from 32 pixels to 24 pixels, and reducing the number of reference frames from 8 to 4; if the high load is not relieved, continue to reduce the search radius to 16 pixels (i.e., the first search range), further reduce the number of reference frames to 1, and turn off 1 / 8 pixel subpixel search; when the search range has reached 16 pixels and the number of reference frames has dropped to 1, and it is still in a high load state, then proceed to the next adjustment; 4. Gradually limit the transformation size of the transformation search tool: The transformation search tool supports full-size DCT (Discrete Cosine Transform) search of 16×16, 8×8, and 4×4 by default. When reducing load, first turn off the 16×16 transformation, and only keep the 8×8 and 4×4 transformations, and then further turn off the 8×8 transformation; when the transformation size is reduced to the preset minimum transformation size (4×4) and is still under high load, proceed to the next step. 5. Simplify the filtering logic of the rate-distortion optimization tool: The rate-distortion optimization tool performs a full RD (Rate-Distortion Evaluation) assessment of "bitrate R + distortion D" for each candidate coding mode by default. When reducing load, it is directly simplified to a fast filtering logic that only calculates the bitrate R value and skips the distortion D value calculation. If the load is still high after simplification, the loop filtering tool is adjusted last. 6. Gradually reduce the filtering functions of the loop filtering tool: The loop filtering tool enables deblocking filtering, CDEF filtering, and loop recovery filtering by default. When reducing load, first turn off the loop recovery filtering, then turn off the CDEF filtering, and finally only retain the basic deblocking filtering function to maximize the release of computing power to ensure real-time encoding.
[0031] In one embodiment, step S130 includes: if the system operating status is less than a third threshold, or the actual encoding time is less than a fourth threshold, then gradually increase the encoding complexity of the encoding strategy to generate a new encoding strategy corresponding to the current computing power supply and demand status.
[0032] In this embodiment, if the system operating status (such as CPU utilization) is less than the third threshold (such as 50%), or the actual encoding time is less than the fourth threshold (such as 40ms), the encoding complexity of the encoding strategy is gradually increased to generate a new encoding strategy corresponding to the current computing power supply and demand status.
[0033] In one embodiment, the stepwise increase in the coding complexity of the coding strategy includes: gradually increasing the coding complexity of the coding strategy in ascending order according to tool priority.
[0034] In this embodiment, when the CPU is idle (e.g., CPU utilization < 50%, or actual encoding time < 40ms), the encoding complexity of the encoding strategy is gradually increased in order from low to high according to the tool priority; wherein, the load increase logic and the load decrease logic are opposite to each other; when increasing the load, tools with low computing power consumption and high image quality gain are restored first to avoid sudden increases in computing power causing changes in the encoding frame rate and increased latency.
[0035] In one embodiment, the step of gradually increasing the coding complexity of the coding strategy according to tool priority in ascending order includes: gradually restoring the full functionality of the loop filtering tool; if the filtering function reaches a preset maximum function set and the current computing power supply and demand state is still in a low-load state, then gradually restoring the filtering logic of the rate distortion optimization tool; if the filtering logic is a complete filtering logic and the current computing power supply and demand state is still in a low-load state, then gradually expanding the transformation size of the transformation search tool; if the transformation size has covered a preset full-size range and the current computing power supply and demand state is still in a low-load state, then gradually increasing the search range of the motion estimation tool; if the search range is a second search range and the current computing power supply and demand state is still in a low-load state, then gradually increasing the number of candidate modes of the pattern decision tool; if the number of candidate modes is a preset maximum number and the current computing power supply and demand state is still in a low-load state, then gradually expanding the depth size of the block search tool.
[0036] In this embodiment, the coding complexity is adjusted step by step during load balancing according to the following logic: 1. Gradually restore the full functionality of the loop filter tool: Addressing the core requirement for detail fidelity in medical images (including lesion edges, anatomical structures, and equipment parameters) and financial scenario content (including facial features, contract text, and transaction interface elements), if the loop filter tool only retains basic deblocking filtering due to previous load reduction, the functionality should be restored in the order of "preserving details first, then improving quality" during load upgrade. Specifically, first enable CDEF filtering to accurately optimize the lesion contours and vascular textures in medical images and the edges of handwriting and signature strokes in financial text through edge detail enhancement algorithms, avoiding misjudgments caused by blurriness; then enable loop restoration filtering to reduce equipment noise in medical images and transmission interference in financial images through adaptive smoothing processing, without compromising the accuracy of key information; once the filtering function reaches the preset maximum function set (i.e., simultaneously enabling deblocking filtering, CDEF filtering, and loop restoration filtering) and remains under low load, ensuring that both the real-time interaction (remote consultation, online signing) and information fidelity requirements of medical and financial scenarios are met, proceed to the next adjustment step. 2. Gradually restore the filtering logic of the rate-distortion optimization tool: If the rate-distortion optimization tool only calculates the bitrate R value, when upgrading, first supplement the simplified calculation of the distortion D value, and then transition to the complete "bitrate R + distortion D" joint evaluation logic (i.e. the preset complete filtering logic); if the complete filtering logic has been enabled and is still in a low-load state, continue to adjust. 3. Gradually expand the transformation size of the transformation search tool: If the transformation search tool only enables 4×4 DCT (Discrete Cosine Transform) search, when increasing the load, first restore 8×8 DCT search (to adapt to medium texture areas), and then restore 16×16 DCT search (to adapt to large smooth areas); when the transformation size covers the preset full size range (16×16, 8×8, 4×4) and is still in a low load state, proceed to the next step; 4. Gradually increase the search range of the motion estimation tool and restore the number of reference frames: If the search radius of the motion estimation tool is 16 pixels, there is only 1 reference frame, and subpixel search is disabled, when upgrading, first increase the search radius to 24 pixels and restore the number of reference frames to 4, then increase the search radius to 32 pixels (i.e., the second search range) and restore the number of reference frames to 8, and re-enable 1 / 8 pixel subpixel search; if the 32-pixel search range has been reached and the number of reference frames is 8, and the current state is still low load, then proceed to the next step; 5. Gradually increase the number of candidate modes in the mode decision tool: If the multi-mode decision tool only retains three brightness modes (horizontal, vertical, and DC), restore the core mode first, then restore the advanced angle mode, and finally increase it to the preset maximum number (56 directional modes, 5 non-directional modes, and 5 recursive filtering modes) when increasing the load; if the preset maximum number has been reached and it is still in a low load state, adjust the block search tool. 6. Gradually expand the depth size of the tile search tool: If the tool only allows a 16×16 split depth, expand it to an 8×8 split depth (to retain more detail textures) during the load, and then expand it to a 4×4 split depth; until the depth size covers the complete recursive search range from 128×128 to 4×4, making full use of idle computing power to improve the image detail. At this point, if it is still in a low load state, enable the global motion and composite prediction tool.
[0037] S140. Encode the original video according to the new encoding strategy.
[0038] In this embodiment, the encoding strategy is dynamically adjusted based on the system operating status and the actual encoding time. The adjusted new encoding strategy is always precisely adapted to the current computing power supply and demand status, so that the system operating status approaches and stabilizes between the first threshold and the third threshold, and the actual encoding time approaches and stabilizes between the second threshold and the fourth threshold, until a compressed video file in the preset encoding format (AV1 format) is output.
[0039] In summary, this invention achieves precise adaptation between video encoding and device load through a closed-loop mechanism of "real-time acquisition - dynamic adjustment - adaptive encoding." During the encoding process, it captures the system's operating status and actual encoding time in real time, dynamically adjusting the encoding complexity to completely solve the problems of "insufficient computing power leading to stuttering, and surplus computing power leading to waste" in traditional fixed strategies. This invention is adaptable to all scenarios from low-power to high-performance devices, effectively overcoming the problem of limited encoding resources on low-power devices, reducing stuttering and frame rate jumps, and improving encoding stability.
[0040] Figure 2 This is a schematic block diagram of a video encoding apparatus provided in an embodiment of the present invention. Figure 2 As shown, corresponding to the above video encoding methods, the present invention also provides a video encoding apparatus. The apparatus is configured in a terminal device or a server. The terminal device can be an electronic device such as a mobile phone, tablet computer, laptop computer, desktop computer, personal digital assistant, or wearable device. The server can be a single server or a server cluster composed of multiple servers. For details, please refer to... Figure 2 The video encoding device 700 includes: The first encoding unit 701 is used to encode the original video according to a preset encoding strategy; The acquisition unit 702 is used to acquire the system operating status and the actual encoding time of video frames in real time during the encoding process. The adjustment unit 703 is used to dynamically adjust the encoding complexity of the encoding strategy according to the system operating status and the actual encoding time, and generate a new encoding strategy corresponding to the current computing power supply and demand status. The second encoding unit 704 is used to encode the original video according to the new encoding strategy.
[0041] In some embodiments, when the adjustment unit 703 performs the step of dynamically adjusting the encoding complexity of the encoding strategy based on the system operating status and the actual encoding time, and generating a new encoding strategy corresponding to the current computing power supply and demand status, it is specifically used for: If the system operating status is greater than the first threshold, or the actual encoding time is greater than the second threshold, the encoding complexity of the encoding strategy is gradually reduced to generate a new encoding strategy corresponding to the current computing power supply and demand status.
[0042] In some embodiments, when performing the step of gradually reducing the encoding complexity of the encoding strategy, the adjustment unit 703 is specifically used for: The coding complexity of the coding strategy is gradually reduced in descending order of tool priority.
[0043] In some embodiments, when the adjustment unit 703 performs the step of gradually reducing the coding complexity of the coding strategy according to tool priority in descending order, it is specifically used for: The depth size of the block search tool is gradually limited; if the depth size of the block search tool is a preset depth size and the current computing power supply and demand status is still under high load, the number of candidate patterns in the pattern decision tool is gradually reduced; if the number of candidate patterns is a preset minimum number and the current computing power supply and demand status is still under high load, the search range of the motion estimation tool is gradually narrowed; if the search range is a first search range and the current computing power supply and demand status is still under high load, the transformation size of the transformation search tool is gradually limited; if the transformation size is a preset minimum transformation size and the current computing power supply and demand status is still under high load, the filtering logic of the rate distortion optimization tool is simplified; if the current computing power supply and demand status is still under high load, the filtering function of the loop filtering tool is gradually reduced.
[0044] In some embodiments, when the adjustment unit 703 performs the step of dynamically adjusting the encoding complexity of the encoding strategy based on the system operating status and the actual encoding time, and generating a new encoding strategy corresponding to the current computing power supply and demand status, it is specifically used for: If the system operating status is less than the third threshold, or the actual encoding time is less than the fourth threshold, the encoding complexity of the encoding strategy is gradually increased to generate a new encoding strategy corresponding to the current computing power supply and demand status.
[0045] In some embodiments, when performing the step of gradually increasing the encoding complexity of the encoding strategy, the adjustment unit 703 is specifically used for: The coding complexity of the coding strategy is gradually increased in ascending order of tool priority.
[0046] In some embodiments, when the adjustment unit 703 performs the step of progressively increasing the encoding complexity of the encoding strategy according to tool priority from low to high, it is specifically used for: The loop filtering tool's full functionality is gradually restored. If the filtering function reaches a preset maximum function set and the current computing power supply and demand status is still under low load, the rate distortion optimization tool's filtering logic is gradually restored. If the filtering logic is a complete filtering logic and the current computing power supply and demand status is still under low load, the transformation size of the transformation search tool is gradually expanded. If the transformation size covers a preset full size range and the current computing power supply and demand status is still under low load, the search range of the motion estimation tool is gradually increased. If the search range is a second search range and the current computing power supply and demand status is still under low load, the number of candidate modes in the pattern decision tool is gradually increased. If the number of candidate modes is a preset maximum number and the current computing power supply and demand status is still under low load, the depth size of the block search tool is gradually expanded.
[0047] It should be noted that those skilled in the art can clearly understand that the specific implementation process of the above-mentioned video encoding device and each unit can be referred to the corresponding description in the foregoing method embodiments. For the sake of convenience and brevity, it will not be repeated here.
[0048] The aforementioned video encoding device can be implemented as a computer program, which can, for example... Figure 3 It runs on the electronic device shown.
[0049] Please see Figure 3 , Figure 3 This is a schematic block diagram of an electronic device provided in an embodiment of the present invention. The electronic device 800 can be a terminal or a server. The terminal can be an electronic device with communication functions. The server can be a standalone server or a server cluster composed of multiple servers.
[0050] See Figure 3 The electronic device 800 includes a processor 802, a memory, and a network interface 805 connected via a system bus 801. The memory may include a non-volatile storage medium 803 and internal memory 804.
[0051] The non-volatile storage medium 803 may store an operating system 8031 and a computer program 8032. The computer program 8032 includes program instructions that, when executed, cause the processor 802 to perform a video encoding method.
[0052] The processor 802 provides computing and control capabilities to support the operation of the entire electronic device 800.
[0053] The internal memory 804 provides an environment for the execution of the computer program 8032 in the non-volatile storage medium 803. When the computer program 8032 is executed by the processor 802, the processor 802 can execute a video encoding method.
[0054] This network interface 805 is used for network communication with other devices. Those skilled in the art will understand that... Figure 3 The structure shown is merely a block diagram of a portion of the structure related to the present invention and does not constitute a limitation on the electronic device 800 to which the present invention is applied. The specific electronic device 800 may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0055] The processor 802 is used to run a computer program 8032 stored in the memory to perform the following steps: The original video is encoded according to a preset encoding strategy; during the encoding process, the system operation status and the actual encoding time of the video frames are collected in real time; based on the system operation status and the actual encoding time, the encoding complexity of the encoding strategy is dynamically adjusted to generate a new encoding strategy corresponding to the current computing power supply and demand status; the original video is encoded according to the new encoding strategy.
[0056] In some embodiments, when the processor 802 dynamically adjusts the encoding complexity of the encoding strategy based on the system operating status and the actual encoding time, and generates a new encoding strategy corresponding to the current computing power supply and demand status, the specific steps are as follows: If the system operating status is greater than the first threshold, or the actual encoding time is greater than the second threshold, the encoding complexity of the encoding strategy is gradually reduced to generate a new encoding strategy corresponding to the current computing power supply and demand status.
[0057] In some embodiments, when implementing the step of gradually reducing the encoding complexity of the encoding strategy, the processor 802 specifically implements the following steps: The coding complexity of the coding strategy is gradually reduced in descending order of tool priority.
[0058] In some embodiments, when implementing the step of progressively reducing the encoding complexity of the encoding strategy according to tool priority in descending order, the processor 802 specifically implements the following steps: The depth size of the block search tool is gradually limited; if the depth size of the block search tool is a preset depth size and the current computing power supply and demand status is still under high load, the number of candidate patterns in the pattern decision tool is gradually reduced; if the number of candidate patterns is a preset minimum number and the current computing power supply and demand status is still under high load, the search range of the motion estimation tool is gradually narrowed; if the search range is a first search range and the current computing power supply and demand status is still under high load, the transformation size of the transformation search tool is gradually limited; if the transformation size is a preset minimum transformation size and the current computing power supply and demand status is still under high load, the filtering logic of the rate distortion optimization tool is simplified; if the current computing power supply and demand status is still under high load, the filtering function of the loop filtering tool is gradually reduced.
[0059] In some embodiments, when the processor 802 dynamically adjusts the encoding complexity of the encoding strategy based on the system operating status and the actual encoding time, and generates a new encoding strategy corresponding to the current computing power supply and demand status, the specific steps are as follows: If the system operating status is less than the third threshold, or the actual encoding time is less than the fourth threshold, the encoding complexity of the encoding strategy is gradually increased to generate a new encoding strategy corresponding to the current computing power supply and demand status.
[0060] In some embodiments, when implementing the step of gradually increasing the encoding complexity of the encoding strategy, the processor 802 specifically implements the following steps: The coding complexity of the coding strategy is gradually increased in ascending order of tool priority.
[0061] In some embodiments, when implementing the step of progressively increasing the encoding complexity of the encoding strategy according to tool priority in ascending order, the processor 802 specifically implements the following steps: The loop filtering tool's full functionality is gradually restored. If the filtering function reaches a preset maximum function set and the current computing power supply and demand status is still under low load, the rate distortion optimization tool's filtering logic is gradually restored. If the filtering logic is a complete filtering logic and the current computing power supply and demand status is still under low load, the transformation size of the transformation search tool is gradually expanded. If the transformation size covers a preset full size range and the current computing power supply and demand status is still under low load, the search range of the motion estimation tool is gradually increased. If the search range is a second search range and the current computing power supply and demand status is still under low load, the number of candidate modes in the pattern decision tool is gradually increased. If the number of candidate modes is a preset maximum number and the current computing power supply and demand status is still under low load, the depth size of the block search tool is gradually expanded.
[0062] It should be understood that, in this embodiment of the invention, the processor 802 may be a Central Processing Unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.
[0063] It will be understood by those skilled in the art that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program includes program instructions and can be stored in a storage medium, which is a computer-readable storage medium. The program instructions are executed by at least one processor in the computer system to implement the process steps of the embodiments of the above methods.
[0064] Therefore, the present invention also provides a storage medium. This storage medium can be a computer-readable storage medium. The storage medium stores a computer program, wherein the computer program includes program instructions. When executed by a processor, the program instructions cause the processor to perform the following steps: The original video is encoded according to a preset encoding strategy; during the encoding process, the system operation status and the actual encoding time of the video frames are collected in real time; based on the system operation status and the actual encoding time, the encoding complexity of the encoding strategy is dynamically adjusted to generate a new encoding strategy corresponding to the current computing power supply and demand status; the original video is encoded according to the new encoding strategy.
[0065] In one embodiment, when the processor executes the program instructions to dynamically adjust the encoding complexity of the encoding strategy based on the system operating status and the actual encoding time, and generates a new encoding strategy corresponding to the current computing power supply and demand status, the specific implementation steps are as follows: If the system operating status is greater than the first threshold, or the actual encoding time is greater than the second threshold, the encoding complexity of the encoding strategy is gradually reduced to generate a new encoding strategy corresponding to the current computing power supply and demand status.
[0066] In one embodiment, when the processor executes the program instructions to implement the step of gradually reducing the coding complexity of the coding strategy, it specifically implements the following steps: The coding complexity of the coding strategy is gradually reduced in descending order of tool priority.
[0067] In one embodiment, when the processor executes the program instructions to implement the step of progressively reducing the coding complexity of the coding strategy according to tool priority in descending order, the specific steps are as follows: The depth size of the block search tool is gradually limited; if the depth size of the block search tool is a preset depth size and the current computing power supply and demand status is still under high load, the number of candidate patterns in the pattern decision tool is gradually reduced; if the number of candidate patterns is a preset minimum number and the current computing power supply and demand status is still under high load, the search range of the motion estimation tool is gradually narrowed; if the search range is a first search range and the current computing power supply and demand status is still under high load, the transformation size of the transformation search tool is gradually limited; if the transformation size is a preset minimum transformation size and the current computing power supply and demand status is still under high load, the filtering logic of the rate distortion optimization tool is simplified; if the current computing power supply and demand status is still under high load, the filtering function of the loop filtering tool is gradually reduced.
[0068] In one embodiment, when the processor executes the program instructions to dynamically adjust the encoding complexity of the encoding strategy based on the system operating status and the actual encoding time, and generates a new encoding strategy corresponding to the current computing power supply and demand status, the specific implementation steps are as follows: If the system operating status is less than the third threshold, or the actual encoding time is less than the fourth threshold, the encoding complexity of the encoding strategy is gradually increased to generate a new encoding strategy corresponding to the current computing power supply and demand status.
[0069] In one embodiment, when the processor executes the program instructions to implement the step of gradually increasing the coding complexity of the coding strategy, it specifically implements the following steps: The coding complexity of the coding strategy is gradually increased in ascending order of tool priority.
[0070] In one embodiment, when the processor executes the program instructions to implement the step of progressively increasing the coding complexity of the coding strategy according to tool priority from low to high, the specific steps are as follows: The loop filtering tool's full functionality is gradually restored. If the filtering function reaches a preset maximum function set and the current computing power supply and demand status is still under low load, the rate distortion optimization tool's filtering logic is gradually restored. If the filtering logic is a complete filtering logic and the current computing power supply and demand status is still under low load, the transformation size of the transformation search tool is gradually expanded. If the transformation size covers a preset full size range and the current computing power supply and demand status is still under low load, the search range of the motion estimation tool is gradually increased. If the search range is a second search range and the current computing power supply and demand status is still under low load, the number of candidate modes in the pattern decision tool is gradually increased. If the number of candidate modes is a preset maximum number and the current computing power supply and demand status is still under low load, the depth size of the block search tool is gradually expanded.
[0071] The storage medium can be any computer-readable storage medium capable of storing program code, such as a USB flash drive, portable hard drive, read-only memory (ROM), magnetic disk, or optical disk.
[0072] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0073] In the several embodiments provided by this invention, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For example, the division of each unit is merely a logical functional division, and there may be other division methods in actual implementation. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed.
[0074] The steps in the method of this invention can be adjusted, merged, or reduced in order according to actual needs. The units in the device of this invention can be merged, divided, or reduced according to actual needs. Furthermore, the functional units in the various embodiments of this invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0075] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause an electronic device (which may be a personal computer, a terminal, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention.
[0076] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A video encoding method, characterized in that, The method includes: The original video is encoded according to a preset encoding strategy; During the encoding process, the system's operating status and the actual encoding time of video frames are collected in real time. Based on the system's operating status and the actual encoding time, the encoding complexity of the encoding strategy is dynamically adjusted to generate a new encoding strategy that corresponds to the current computing power supply and demand status. The original video is encoded according to the new encoding strategy.
2. The video encoding method according to claim 1, characterized in that, The step of dynamically adjusting the encoding complexity of the encoding strategy based on the system operating status and the actual encoding time, and generating a new encoding strategy corresponding to the current computing power supply and demand status, includes: If the system operating status is greater than the first threshold, or the actual encoding time is greater than the second threshold, the encoding complexity of the encoding strategy is gradually reduced to generate a new encoding strategy corresponding to the current computing power supply and demand status.
3. The video encoding method according to claim 2, characterized in that, The gradual reduction of the encoding complexity of the encoding strategy includes: The coding complexity of the coding strategy is gradually reduced in descending order of tool priority.
4. The video encoding method according to claim 3, characterized in that, The stepwise reduction of the encoding complexity of the encoding strategy according to tool priority in descending order includes: Gradually limit the depth size of the block search tool; If the depth size of the block search tool is a preset depth size and the current computing power supply and demand status is still in a high load state, then the number of candidate patterns of the pattern decision tool will be gradually reduced. If the number of candidate modes is the preset minimum and the current computing power supply and demand status is still under high load, then the search range of the motion estimation tool will be gradually narrowed. If the search range is the first search range and the current computing power supply and demand status is still under high load, then the transformation size of the transformation search tool is gradually restricted. If the transformation size is the preset minimum transformation size and the current computing power supply and demand status is still in a high load state, then simplify the filtering logic of the rate distortion optimization tool; If the current computing power supply and demand status is still under high load, then gradually reduce the filtering function of the loop filter tool.
5. The video encoding method according to claim 1, characterized in that, The step of dynamically adjusting the encoding complexity of the encoding strategy based on the system operating status and the actual encoding time, and generating a new encoding strategy corresponding to the current computing power supply and demand status, includes: If the system operating status is less than the third threshold, or the actual encoding time is less than the fourth threshold, the encoding complexity of the encoding strategy is gradually increased to generate a new encoding strategy corresponding to the current computing power supply and demand status.
6. The video encoding method according to claim 5, characterized in that, The gradual increase in the encoding complexity of the encoding strategy includes: The coding complexity of the coding strategy is gradually increased in ascending order of tool priority.
7. The video encoding method according to claim 6, characterized in that, The stepwise increase of the encoding complexity of the encoding strategy according to tool priority in ascending order includes: Gradually restore the full functionality of the loop filter tool; If the filtering function reaches the preset maximum function set and the current computing power supply and demand status is still in a low load state, then the filtering logic of the rate distortion optimization tool will be gradually restored. If the filtering logic is a complete filtering logic and the current computing power supply and demand status is still in a low load state, then gradually expand the transformation size of the transformation search tool; If the transformed size has covered the preset full size range and the current computing power supply and demand status is still in a low load state, then the search range of the motion estimation tool is gradually increased; If the search range is the second search range and the current computing power supply and demand status is still in a low load state, then the number of candidate patterns of the pattern decision tool will be gradually increased. If the number of candidate modes is the preset maximum and the current computing power supply and demand status is still in a low load state, then the depth dimension of the block search tool is gradually expanded.
8. A video encoding device, characterized in that, The device includes: The first encoding unit is used to encode the original video according to a preset encoding strategy; The acquisition unit is used to acquire the system's operating status and the actual encoding time of video frames in real time during the encoding process. The adjustment unit is used to dynamically adjust the encoding complexity of the encoding strategy according to the system operating status and the actual encoding time, and generate a new encoding strategy corresponding to the current computing power supply and demand status. The second encoding unit is used to encode the original video according to the new encoding strategy.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the video encoding method as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which includes program instructions that, when executed by a processor, cause the processor to perform the video encoding method as described in any one of claims 1-7.