Video plug flow bandwidth dynamic planning method and device, electronic equipment and storage medium
By dynamically planning the video streaming bandwidth in the WebRTC architecture, the problem of unreasonable bandwidth allocation during concurrent requests of multiple video streams is solved, and the optimization of video streaming quality and improvement of transmission stability is achieved.
Patent Information
- Application Number
- CN202411514638.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-28
- Publication Date
- 2025-02-18
AI Technical Summary
When the existing WebRTC architecture handles concurrent requests for multiple video streams, the bandwidth allocation is unreasonable, resulting in the video stream being unable to load, the played video being stuck or disconnected, affecting the efficiency of property management and the stability of video surveillance.
By setting the initial push quality of the multiple video stream to the lowest video quality, and according to the bandwidth allocation algorithm, bandwidth allocation is performed based on the total real-time bandwidth of the intranet, the total real-time bandwidth of the external network, and the real-time bandwidth requirements of each video. At the same time, the step value of bandwidth allocation is dynamically adjusted until the preset boundary conditions are met to ensure the stability and quality of video push streaming.
It realizes reasonable bandwidth allocation, optimizes the quality of video streaming, improves the stability of video transmission, avoids video lag and interruption, and meets the property management's demand for high-quality video streaming.
Smart Images

Figure CN119484901A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a method, device, electronic device and storage medium for dynamic planning of video streaming bandwidth. Background Art
[0002] Modern property operations have put forward higher and higher demands on video surveillance systems, especially in multi-property scenarios. The video surveillance platform needs to upload local videos to the cloud in real time so that surveillance videos of designated areas of the property can be viewed at any time in any network environment. With the expansion of property scale and the complexity of management requirements, frequent or continuous stable output of high-quality videos has become an indispensable technical requirement in property operations.
[0003] At present, standardized video streaming technologies represented by WebRTC have gradually replaced traditional streaming solutions based on Flash technology or private technology. WebRTC, with its point-to-point communication method, can better achieve low-latency transmission of video streams. However, with the development of AI technology, more and more AI-based visual recognition technologies are being used in property management to improve security and management efficiency. For these AI-based video processing applications, video streams need to have high quality, long duration, and multi-concurrency characteristics.
[0004] However, the existing WebRTC architecture has obvious limitations, especially when processing concurrent requests for multiple video streams, the problem of unreasonable bandwidth allocation gradually emerges. Due to the point-to-point communication method of WebRTC, when the edge gateway processes a large number of video requests at the same time, the following problems often occur: new video streams cannot be loaded, and the already played videos are severely stuck or even disconnected. This bandwidth allocation problem has seriously affected the efficiency of property management and the stability of video surveillance in the context of the continuous expansion of property scale and the extensive application of AI technology. Summary of the invention
[0005] In view of this, the embodiments of the present application provide a method, device, electronic device and storage medium for dynamic planning of video streaming bandwidth to solve the problems of unreasonable bandwidth allocation, stability and quality reduction of video transmission in the prior art.
[0006] According to a first aspect of an embodiment of the present application, a method for dynamic planning of video streaming bandwidth is provided, comprising: setting the initial push quality of multiple video streams to the lowest video quality, and allocating bandwidth according to a bandwidth allocation algorithm based on the real-time total bandwidth of the intranet, the real-time total bandwidth of the extranet, and the real-time bandwidth requirement of each video; judging whether the current bandwidth can be fully allocated, and when it is judged that it cannot be fully allocated, maintaining the current video push state; when it is judged that the bandwidth allocation is completed, judging the preset boundary conditions, wherein the boundary conditions include the intranet bandwidth, the extranet bandwidth, the minimum bandwidth requirement of each video stream, and the computing resources of the edge gateway; when it is judged that the boundary conditions are not met, maintaining the current video push state, and when it is judged that the boundary conditions are met, increasing the step value of the bandwidth allocation, and re-allocating the bandwidth; when the bandwidth allocation fails or does not meet the boundary conditions, reducing the step value of the bandwidth allocation, and re-allocating the bandwidth until the bandwidth allocation and the boundary conditions meet the preset requirements.
[0007] According to a second aspect of an embodiment of the present application, a device for dynamically planning bandwidth for video streaming is provided, comprising: a first allocation module, configured to set the initial push quality of multiple video streams to the lowest video quality, and perform bandwidth allocation based on the real-time total bandwidth of the intranet, the real-time total bandwidth of the extranet, and the real-time bandwidth requirement of each video according to a bandwidth allocation algorithm; a first judgment module, configured to judge whether the current bandwidth can be fully allocated, and when it is judged that it cannot be fully allocated, maintain the current video push state; a second judgment module, configured to judge the preset boundary conditions when it is judged that the bandwidth allocation is completed, wherein the boundary conditions include the intranet bandwidth, the extranet bandwidth, the minimum bandwidth requirement of each video stream, and the computing resources of the edge gateway; the second allocation module, configured to maintain the current video push state when it is judged that the boundary conditions are not met, and when it is judged that the boundary conditions are met, increase the step value of the bandwidth allocation, and re-allocate the bandwidth; a third allocation module, configured to reduce the step value of the bandwidth allocation when the bandwidth allocation fails or does not meet the boundary conditions, and re-allocate the bandwidth until the bandwidth allocation and the boundary conditions meet the preset requirements.
[0008] According to a third aspect of an embodiment of the present application, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the steps of the above method are implemented when the processor executes the computer program.
[0009] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, which stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0010] At least one of the above technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects:
[0011] By setting the initial push quality of multiple video streams to the lowest video quality, and according to the bandwidth allocation algorithm, bandwidth is allocated based on the real-time total bandwidth of the intranet, the real-time total bandwidth of the extranet, and the real-time bandwidth requirements of each video; judging whether the current bandwidth can be fully allocated, when it is judged that it cannot be fully allocated, maintaining the current video push state; when it is judged that the bandwidth allocation is completed, judging the preset boundary conditions, wherein the boundary conditions include the intranet bandwidth, the extranet bandwidth, the minimum bandwidth requirements of each video stream and the computing resources of the edge gateway; when it is judged that the boundary conditions are not met, maintaining the current video push state, when it is judged that the boundary conditions are met, increasing the step value of the bandwidth allocation, and reallocating the bandwidth; when the bandwidth allocation fails or does not meet the boundary conditions, reducing the step value of the bandwidth allocation, and reallocating the bandwidth until the bandwidth allocation and boundary conditions meet the preset requirements. This application can reasonably allocate bandwidth, optimize the quality of video push streaming, and improve the stability of video transmission. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0013] Figure 1 It is a schematic diagram of the overall implementation process of the video streaming bandwidth dynamic planning algorithm provided in the embodiment of the present application;
[0014] Figure 2 It is a flowchart of a method for dynamically planning bandwidth for video streaming provided by an embodiment of the present application;
[0015] Figure 3 It is a structural schematic diagram of a video streaming bandwidth dynamic planning device provided in an embodiment of the present application;
[0016] Figure 4 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0017] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0018] It should be understood that the various steps described in the method implementation of the present application can be performed in different orders and / or performed in parallel. In addition, the method implementation may include additional steps and / or omit the steps shown. The scope of the present application is not limited in this respect.
[0019] In modern property operations, video surveillance systems are an indispensable part, especially in multi-property scenarios. In order to improve management efficiency, property companies often need to upload surveillance videos to the cloud in real time to ensure that managers can view videos of designated areas of the property through the network at any time and any place. This demand becomes increasingly important as the scale of properties expands and the complexity of management increases. At the same time, with the development of artificial intelligence (AI) technology, AI-based video analysis functions are also increasingly used in property management, such as replacing manual inspections with visual recognition technology to improve security and automation levels.
[0020] In order to meet the above requirements, a variety of technical solutions are currently used in the market, among which WebRTC (Web Real-Time Communication) is a standardized technology that is gradually being widely used, replacing the early streaming solutions based on Flash or private protocols. WebRTC can provide point-to-point video streaming transmission with real-time and low latency characteristics, so it is suitable for scenarios such as property monitoring that require real-time video transmission.
[0021] However, as the scale of the property continues to expand, the single WebRTC point-to-point communication method has exposed some bottleneck problems when processing a large number of concurrent requests. Specifically, although the point-to-point communication method adopted by WebRTC can ensure low latency, its ability to manage bandwidth is limited. When the edge gateway needs to process multiple video streams at the same time, the bandwidth allocation is often unreasonable, resulting in the following problems:
[0022] 1. Newly requested videos cannot be played: In some cases, the system cannot allocate sufficient bandwidth for new video streams, resulting in video loading failure.
[0023] 2. The played video freezes or is interrupted: The played video stream frequently freezes or is even interrupted, affecting the stability and continuity of monitoring.
[0024] Based on the limitations of the above existing technologies, the video surveillance system in property management faces the following key problems:
[0025] 1. Unreasonable bandwidth allocation: Due to the characteristics of WebRTC point-to-point communication, when there are a large number of concurrent video requests, the bandwidth allocation efficiency of the edge gateway is low and cannot be reasonably allocated to multiple video streams, resulting in reduced video quality or inability to play.
[0026] 2. Unable to support high-quality, long-term, and multi-concurrent video transmission: Modern property operations, especially AI visual recognition, require high quality, long-term, and multi-concurrent video streams, but the existing WebRTC architecture can hardly meet these requirements, resulting in the inability to guarantee the stability and quality of video transmission.
[0027] In general, existing technologies cannot effectively support property management's demand for high-quality video streams in multiple concurrent scenarios. Especially with the continuous expansion of property scale and the widespread application of AI technology, problems such as video freezes and interruptions have greatly affected the efficiency of property management and monitoring effects.
[0028] In view of the problems existing in the above-mentioned prior art, the present application proposes a method for dynamic planning of video streaming bandwidth. The present application globally optimizes the allocation of video streaming bandwidth to solve the problems of stuttering and interruption caused by traditional WebRTC under multi-concurrency and high bandwidth requirements. Starting from global optimization, the present application proposes a dynamic planning algorithm for video streaming bandwidth, which achieves the best playback quality under various constraints by performing global dynamic planning on variables such as the total real-time bandwidth of the intranet, the total real-time bandwidth of the extranet, the real-time bandwidth of each channel, the minimum required video quality, the encoding and decoding computing power of the edge gateway, the hardware encoding parameters of the intranet camera, and the number of playback request channels. The global dynamic planning and adjustment of the streaming algorithm can effectively solve the problems of traditional WebRTC point-to-point independence, and the streaming is stuck, interrupted or cannot be played only based on the video encoding format and dynamic bit rate optimization algorithm, thereby maximizing the system operation efficiency.
[0029] The overall implementation process of the video streaming bandwidth dynamic planning algorithm provided by the embodiment of the present application is explained below in conjunction with the accompanying drawings. Figure 1 Schematic diagram of the overall implementation process of the video streaming bandwidth dynamic planning algorithm provided in the embodiment of the present application. Figure 1 As shown in the figure, the whole process optimizes system performance by dynamically adjusting the push quality and bandwidth allocation of the video stream. The video push bandwidth dynamic planning algorithm can specifically include the following contents:
[0030] 1. Initial Setup:
[0031] When the system starts, all n-channel videos are set to the lowest video quality by default. The purpose of this initial setting is to ensure that the system can still maintain the continuity of video streaming with the lowest resource requirements when the bandwidth is insufficient or the network environment is poor.
[0032] 2. Preliminary judgment of bandwidth allocation algorithm:
[0033] The system uses bandwidth allocation algorithms to allocate bandwidth for the current multi-channel video streams based on the existing network environment. At this time, it will determine whether the bandwidth allocation can fully meet the push requirements of all video streams.
[0034] If the bandwidth allocation cannot fully meet the current demand, the system will maintain the existing push status, that is, maintain the lowest quality video push to avoid interruption or freeze of the video stream.
[0035] If the bandwidth allocation is fully satisfied, the next step is to determine the boundary conditions.
[0036] 3. Determination of boundary conditions:
[0037] On the premise that bandwidth allocation is met, the system will check whether it meets the preset boundary conditions. These boundary conditions include:
[0038] Is the total bandwidth of the intranet and extranet sufficient to support the current video push?
[0039] Whether the minimum bandwidth of each video stream is guaranteed;
[0040] Are the computing resources of the edge gateway sufficient to support the current video stream decoding and encoding requirements?
[0041] If the boundary conditions are not met, the system will maintain the current optimal push state and will not increase bandwidth allocation.
[0042] If the boundary conditions are met, the system will proceed to the next step and increase the bandwidth step.
[0043] 4. Adjustment of bandwidth step:
[0044] When the boundary conditions are met, the system decides to increase the bandwidth allocation step to improve the quality of the video stream.
[0045] After increasing the bandwidth, the system uses the bandwidth allocation algorithm to reallocate the video streams again. At this time, it is necessary to determine whether the new bandwidth allocation can fully meet the push requirements of all video streams.
[0046] If the bandwidth allocation cannot be fully met, the system will reduce the bandwidth step to reduce the total allocated bandwidth and re-judge the bandwidth allocation.
[0047] 5. Cycle judgment and adjustment:
[0048] The adjustment of bandwidth step is a dynamic cycle. If the current bandwidth allocation still cannot fully meet the demand after reducing the step, the system will continue to reduce the step until a suitable bandwidth allocation level is found.
[0049] If the bandwidth allocation is fully satisfied, the system will continue to determine whether the boundary conditions are met, and if the conditions are met, continue to increase the bandwidth step to gradually optimize the quality of the video stream.
[0050] 6. Termination conditions:
[0051] This process will continue to cycle until an optimal bandwidth allocation strategy is found within a certain step range, which can balance bandwidth resources and video stream quality, ensuring that the system bandwidth utilization is maximized without sacrificing video stream quality.
[0052] The bandwidth dynamic planning algorithm introduces a bandwidth allocation algorithm and a step adjustment mechanism, combined with strict judgment of boundary conditions, to ensure that the system can dynamically adjust the video streaming quality in a complex network environment, avoid video freezes or interruptions, and maximize the use of bandwidth resources to achieve high-quality video push.
[0053] The contents of the technical solution of the present application are described in detail below with reference to the accompanying drawings and specific embodiments.
[0054] Figure 2 FIG. 1 is a flow chart of a method for dynamically planning bandwidth for video streaming provided in an embodiment of the present application. Figure 2 As shown, the method for dynamically planning the video streaming bandwidth may specifically include:
[0055] S201, setting the initial push quality of multiple video streams to the lowest video quality, and performing bandwidth allocation according to a bandwidth allocation algorithm based on the real-time total bandwidth of the intranet, the real-time total bandwidth of the extranet, and the real-time bandwidth requirement of each video;
[0056] S202, determining whether the current bandwidth can be fully allocated, and if it is determined that the current bandwidth cannot be fully allocated, maintaining the current video push state;
[0057] S203, when it is determined that the bandwidth allocation is completed, the preset boundary conditions are determined, wherein the boundary conditions include the intranet bandwidth, the extranet bandwidth, the minimum bandwidth requirement of each video stream, and the computing resources of the edge gateway;
[0058] S204, when it is determined that the boundary condition is not met, the current video push state is maintained; when it is determined that the boundary condition is met, the step value of the bandwidth allocation is increased, and the bandwidth allocation is re-performed;
[0059] S205, when the bandwidth allocation fails or does not meet the boundary conditions, the step value of the bandwidth allocation is reduced, and the bandwidth allocation is re-performed until the bandwidth allocation and the boundary conditions meet the preset requirements.
[0060] In some embodiments, bandwidth allocation is performed according to a bandwidth allocation algorithm based on the real-time total bandwidth of the intranet, the real-time total bandwidth of the extranet, and the real-time bandwidth requirement of each video channel, including:
[0061] Based on the computing resources of the edge gateway, the output bandwidth of the video stream is dynamically allocated by adjusting the codec quality of the video. The backpack algorithm is used for optimization modeling. Under the specified computing resource constraints, the bandwidth allocated to each video stream is determined to maximize the total bandwidth of the video push stream. The codec quality of each video stream is associated with the required bandwidth and computing resources, and bandwidth is allocated once for each video stream.
[0062] Specifically, the embodiment of the present application optimizes the bandwidth allocation by adjusting the encoding and decoding quality of the video and adopting the backpack algorithm to ensure the optimal push bandwidth of the video stream under the computing resource constraints of the edge gateway.
[0063] The system first allocates bandwidth based on the real-time total bandwidth of the intranet and the real-time total bandwidth of the extranet, combined with the real-time bandwidth requirements of each video stream. This process needs to consider the computing resources of the edge gateway and the minimum encoding and decoding bandwidth requirements of each video stream to ensure that the push requirements of all video streams can be met under limited resources.
[0064] Furthermore, the edge gateway controls the output bandwidth of each video by adjusting the video encoding and decoding quality. In this embodiment, the video encoding quality is set between 1 and 10, where the larger the number, the higher the video encoding quality and the larger the required bandwidth; as the encoding quality improves, the computing power requirement of the edge gateway also increases accordingly.
[0065] For example, when the encoding quality of the video stream is set to 5, the push bandwidth of the video stream is w(i), and the computing resources allocated to it by the edge gateway are V(i). As the video encoding quality improves, the push bandwidth w(i) and the computing resources V(i) consumed by it will increase synchronously.
[0066] Furthermore, in order to maximize the total bandwidth utilization of the system, the system uses the knapsack algorithm to optimize the bandwidth allocation of each video stream. Specifically, the system models the problem as a classic knapsack problem:
[0067] Assume that the total computing power of the edge gateway is V, there are n video streams that need to be pushed, the bandwidth requirement of each video stream is w(i), and the required computing resources are V(i);
[0068] The goal of the knapsack algorithm is to select several video streams and maximize the total bandwidth of all allocated video streams without exceeding the total computing power V of the edge gateway.
[0069] In this embodiment, the process of solving the knapsack problem includes the following steps:
[0070] State definition: Set a state variable f(j) to represent the maximum video push bandwidth that can be obtained under the condition that the computing resources do not exceed j.
[0071] State transfer: For each video stream, there are two options:
[0072] The video stream is not selected for streaming, the bandwidth does not increase, and the state remains at f(j);
[0073] The video stream is selected for streaming, the bandwidth increases, and the status is updated to f(jV(i))+w(i).
[0074] State transfer equation: The state variables are updated by the following formula:
[0075] f(j)=max{f(j),f(jv(i)+w(i))}
[0076] Wherein, V(i) represents the computing resources consumed by the video stream, and w(i) represents the bandwidth requirement of the video stream.
[0077] Iterative solution: The system enumerates the computing resources j from large to small, ensuring that each video stream is considered only once to avoid repeated calculations.
[0078] In this embodiment, bandwidth can only be allocated once for each video stream. Through the optimization modeling of the backpack algorithm, the system finally determines the push bandwidth allocated to each video stream based on the computing resource limitations of the edge gateway to ensure that the total bandwidth of the video push stream is maximized. The bandwidth allocation of each video channel corresponds to its corresponding encoding quality and computing resource requirements, ensuring the reasonable allocation of resources and efficient push of video streams.
[0079] Through the method of this embodiment, the system can realize dynamic bandwidth allocation for multiple video streams under the condition of limited computing resources, ensuring that the total push bandwidth is maximized while meeting the video quality requirements. This algorithm effectively solves the problem of unreasonable bandwidth allocation in the traditional WebRTC architecture, especially in the case of multiple concurrent requests, and can significantly improve the stability of the system and the efficiency of pushing streams.
[0080] In some embodiments, a knapsack algorithm is used for optimization modeling to determine the bandwidth allocated to each video stream under specified computing resource constraints to maximize the total bandwidth of video streaming, including:
[0081] A state variable is defined, wherein the state variable is used to represent a maximum bandwidth allocation value obtained when the computing resources do not exceed the total amount of computing resources;
[0082] For any video stream, set the computing resources and corresponding streaming bandwidth of the video stream, and perform state transition according to the preset situation:
[0083] Iterate and update using the state transition equation, and enumerate the total amount of computing resources from large to small;
[0084] After the enumeration is completed, the maximum value of the state variable is determined, wherein the maximum value of the state variable is used to represent the maximum video streaming bandwidth value that can be allocated under given computing resource constraints.
[0085] Specifically, the embodiment of the present application uses a knapsack algorithm for optimization modeling, which is used to determine the bandwidth allocation of each video stream under the specified computing resource constraints to maximize the total bandwidth of the video push stream. The knapsack algorithm reasonably allocates bandwidth to each video stream by defining state variables and state transition equations, ensuring the optimization of bandwidth utilization under limited computing resources.
[0086] First, define the state variable f(j), which represents the maximum bandwidth allocation value that can be obtained when the computing resources do not exceed a certain total amount. In other words, f(j) represents the maximum streaming bandwidth that the system can allocate for the video stream under the computing resource constraints of the edge gateway.
[0087] Furthermore, for any i-th video stream, the required computing resources are set as computing resources V(i), and the streaming bandwidth is set as bandwidth w(i). The computing resources of each video stream are associated with its corresponding streaming bandwidth. The higher the video quality, the greater the bandwidth and computing resources required.
[0088] The computing resource V(i) represents the processing power required to allocate the video stream, such as the computing power required for encoding and decoding; the bandwidth w(i) represents the bandwidth required for streaming the video stream at the set quality.
[0089] In order to optimize bandwidth allocation, the system iteratively updates the state transition equation of the preset knapsack problem. There are two options for allocating each video stream:
[0090] The video stream is not selected for streaming. At this time, the maximum bandwidth allocation value remains at f(j) in the current state.
[0091] Select this video stream for streaming, and the maximum bandwidth allocation value is updated to f(jv(i))+w(i).
[0092] The specific state transfer equation is as follows:
[0093] f(j)=max{f(j),f(jv(i)+w(i))}
[0094] This equation indicates that at each step of the calculation, the system needs to decide whether to keep the current state or increase the streaming bandwidth of a certain video stream to ensure that the current total bandwidth allocation is maximized.
[0095] Furthermore, to avoid repeated calculations, the system updates the status by enumerating the total amount of computing resources from large to small. In each enumeration process, each video stream is considered only once, ensuring that the allocation of the previous video stream does not affect the bandwidth optimization of the current video stream.
[0096] For example, assuming that the system has a total of n video streams and a total computing resource of V, the system will start from V and gradually reduce the computing resource value j, making bandwidth allocation decisions for each video stream each time, and finally updating the state variable f(j).
[0097] When the enumeration process is completed, the system will determine the maximum value of the state variable f (total computing resources) from the calculation results. This maximum value represents the maximum video streaming bandwidth that the system can allocate under the given computing resource constraints. The system will allocate push bandwidth for each video stream accordingly to ensure the optimal use of bandwidth resources.
[0098] Through the optimized allocation of the backpack algorithm, the system can achieve efficient bandwidth allocation for each video stream when the computing resources of the edge gateway are limited. The algorithm can ensure that the total bandwidth of the video push reaches the maximum value within the total bandwidth and computing resource limits. Especially in the case of concurrent requests for multiple video streams, this optimization solution can significantly improve the stability and quality of video push, and effectively avoid problems such as video stream freezes and interruptions.
[0099] For example, in a specific example, assume that the total computing resources of an edge gateway are 100 units, and the system needs to push 5 video streams. The computing resource requirements and bandwidth requirements for each video stream are as follows:
[0100] Video stream 1: The computing resource requirement is 20 units, and the streaming bandwidth is 10 Mbps.
[0101] The second video stream: The computing resource requirement is 30 units, and the streaming bandwidth is 15 Mbps.
[0102] The third video stream: The computing resource requirement is 40 units, and the streaming bandwidth is 20 Mbps.
[0103] The fourth video stream: The computing resource requirement is 10 units, and the streaming bandwidth is 5 Mbps.
[0104] The fifth video stream requires 50 computing resources and a streaming bandwidth of 25 Mbps.
[0105] Through the knapsack algorithm, the system can find an optimal bandwidth allocation plan to maximize the video streaming bandwidth when the total computing resources do not exceed 100 units.
[0106] In some embodiments, the state transition is performed according to a preset situation, including:
[0107] When bandwidth is not allocated for the video stream, the state variable is set to the maximum bandwidth allocation value; when bandwidth is allocated for the video stream, the maximum bandwidth allocation value is calculated based on the total amount of computing resources, computing resources and streaming bandwidth.
[0108] Specifically, the system optimizes the bandwidth allocation of video streaming by adopting the state transfer equation. The application of the backpack algorithm ensures that the total bandwidth of video streaming is maximized under limited computing resources. Specifically, according to the actual needs of the video stream, the system performs state transfer based on the preset situation and dynamically adjusts the bandwidth allocation.
[0109] First, define the state variable f (total amount of computing resources) to represent the maximum bandwidth allocation value that can be obtained when the current computing resources do not exceed a certain total amount. This state variable is used to track the best bandwidth allocation effect that the system can achieve under different resource constraints.
[0110] In this embodiment, the system determines the bandwidth allocation for each video stream through the state transition equation according to the preset situation. For each video stream, there are two state transition options:
[0111] 1) No bandwidth allocation:
[0112] If the system decides not to allocate bandwidth for the current i-th video stream, the current state variable f(j) remains unchanged. The maximum bandwidth allocation value at this time is the original state value, that is, the bandwidth allocation result is not changed due to the existence of the video stream.
[0113] 2) Allocate bandwidth:
[0114] If the system decides to allocate bandwidth for the i-th video stream, it needs to update the state variable based on the current total amount of computing resources minus the amount of computing resources required for the video stream. The maximum bandwidth allocation value is updated to f(jv(i))+w(i). This update reflects the remaining resources and bandwidth optimization results after being allocated to the video stream.
[0115] The specific state transfer equation is: f(j)=max{f(j),f(jv(i)+w(i))}, that is, f(total computing resources)=max{f(total computing resources),f(total computing resources-computing resources(i))+bandwidth(i)}.
[0116] The meaning of this equation is that the system will select the maximum value between the two options of not allocating bandwidth and allocating bandwidth at each state update, thereby ensuring the optimization effect of the total bandwidth allocation of the system.
[0117] For example, in one example, assume that the total computing resources of the current system are 100 units, the computing resource requirement of the i-th video stream is 30 units, and the streaming bandwidth is 15Mbps. The system has the following two options based on the state transition equation:
[0118] Do not allocate bandwidth for the video stream: At this time, the state variable of the system remains at f(100), that is, the maximum bandwidth allocation value calculated previously does not change.
[0119] Allocate bandwidth for the video stream: The system calculates the updated state to be f(100-30)+15Mbps, that is, with 70 units of computing resources remaining, allocate 15Mbps of streaming bandwidth to the video stream, and update the system's maximum bandwidth allocation value.
[0120] The system iterates and updates the state variable f (total amount of computing resources) by enumerating the value of each total amount of computing resources from large to small. In each iteration, the system determines whether to allocate bandwidth for a certain video stream based on the currently available computing resources and bandwidth requirements, and updates the state value accordingly.
[0121] For example, when the total computing resources are 100, the system first calculates the distribution of all video streams, and then decreases the value of the total amount of computing resources, for example, 100->99->98, and sequentially determines and updates the state variables f(99), f(98), etc., until all possible values of computing resources are traversed.
[0122] Furthermore, after all state transfers and iterative updates are completed, the system will eventually determine a maximum bandwidth allocation value, which represents the maximum video streaming bandwidth that can be achieved under the current computing resource constraints. This maximum value is used to guide the final bandwidth allocation strategy to achieve optimal resource utilization.
[0123] This embodiment realizes dynamic bandwidth allocation optimization through the state transition equation of the knapsack algorithm, combined with the computing resource requirements and bandwidth requirements of each video stream. Through a reasonable state transition mechanism, the system can ensure the maximum allocation of total bandwidth under limited resources, significantly improving the efficiency and quality of video stream push.
[0124] Through the method of the above embodiment, the system can dynamically choose whether to allocate bandwidth to each video stream based on the currently available computing resources and the actual needs of the video stream, and maximize the total bandwidth allocation value through the state transition equation. This algorithm effectively solves the problem of uneven resource allocation in multi-channel video streaming and improves the overall performance of streaming.
[0125] In some embodiments, boundary conditions include:
[0126] The sum of the total bandwidth of each video stream pulled from the intranet is less than or equal to the real-time total bandwidth of the intranet; the sum of the total bandwidth of each video stream pushed from the external network is less than or equal to the real-time total bandwidth of the external network; the sum of the minimum encoding and decoding bandwidth of each video stream is less than or equal to the real-time total bandwidth of the external network; the actual pushing bandwidth of each video stream is greater than or equal to the minimum encoding and decoding bandwidth of the video stream; the sum of the decoding computing resource consumption of each video stream is less than or equal to the total computing resources of the edge gateway.
[0127] Specifically, suppose that the intranet bandwidth is sampled at equal intervals at time t, and is the average estimate of the total real-time bandwidth of the intranet from time t to time t+1; suppose the bandwidth of the external network is sampled at equal intervals at time t, and suppose is the average estimate of the total real-time bandwidth of the external network from time t to time t+1; suppose the camera internal network samples at equal intervals at time t, and suppose is the average estimate of the bandwidth of the nth stream from time t to time t+1. Suppose the camera external network samples at equal intervals at time t. Suppose is the average estimate of the n-th channel streaming bandwidth from time t to t+1; let the minimum bandwidth required by the n-th camera at resolution r be Min mbps (n,r); Assume that the total computing power of the edge gateway is T, and the computing power consumed by the nth camera is T(n).
[0128] Furthermore, the model optimization has boundary conditions, which are shown in the following formula:
[0129]
[0130] Mbps xam_out (n,t)≥Min mbps (n,r)
[0131]
[0132] In the above boundary condition formula, it is necessary to ensure that the sum of the total bandwidth of each channel of intranet streaming is less than the total bandwidth of the intranet, the sum of the total bandwidth of each channel of extranet streaming is less than the total bandwidth of the extranet, the sum of the minimum quality bandwidth of each video encoding and decoding is less than the total bandwidth of the extranet, the minimum quality bandwidth of each video encoding and decoding is greater than or equal to the extranet bandwidth, and the sum of the decoding computing power of each video channel is less than the total encoding and decoding computing power of the edge gateway.
[0133] In some embodiments, the method further comprises:
[0134] Negative feedback control based on the PID control algorithm is adopted to dynamically adjust the encoding quality of each video according to the real-time bandwidth feedback signal during the video streaming process. The PID control algorithm is used to automatically adjust the encoding quality by adjusting the proportional coefficient, integral time constant and differential time constant, so as to adaptively optimize the video streaming bandwidth.
[0135] Specifically, the embodiment of the present application proposes a negative feedback control method based on the PID control algorithm, which is used to dynamically adjust the encoding quality of each video stream according to the real-time bandwidth feedback signal during the video streaming process, thereby optimizing the allocation of streaming bandwidth. Through this method, the system can automatically adjust the encoding level during the video streaming process to ensure adaptive optimization of video quality in different network environments.
[0136] During the video streaming process, the system continuously monitors the current bandwidth usage and obtains real-time bandwidth feedback signals. This feedback signal is used to reflect the current network bandwidth availability and is used as the input of the PID control algorithm to dynamically adjust the video encoding quality according to the actual bandwidth fluctuations.
[0137] In order to achieve dynamic optimization of video streaming quality, this embodiment uses a PID control algorithm to automatically adjust the encoding quality of each video stream. The PID control algorithm ensures the stability and optimization of video streaming bandwidth by adjusting the following three core parameters:
[0138] Proportional coefficient (K p ): reflects the instant response of the current bandwidth error to the encoding quality. The larger the proportional coefficient, the more sensitive the system is to bandwidth changes;
[0139] Integration time constant (T i ): used to eliminate the accumulated errors over a long period of time and ensure the long-term stability of the video streaming bandwidth;
[0140] Differential time constant (τ): used to predict the bandwidth change trend, adjust the encoding quality in advance, and avoid excessive bandwidth fluctuations.
[0141] Furthermore, based on real-time bandwidth feedback, the system first calculates the bandwidth error e(t), which is the difference between the current bandwidth and the target bandwidth. The PID control algorithm outputs a control signal u(t) according to the following formula to dynamically adjust the encoding quality of each video channel:
[0142]
[0143] Among them, u(t) represents the control output signal, which is used to adjust the video encoding quality; e(t) represents the bandwidth error, which represents the difference between the current bandwidth usage and the target bandwidth; K p is the proportionality coefficient, T i is the integral time constant and τ is the differential time constant.
[0144] Furthermore, the system automatically adjusts the encoding level of each video channel according to the value of u(t) to ensure that the push bandwidth of the video stream is optimized under the current network environment. Specifically:
[0145] When bandwidth is sufficient, the PID control signal will drive the system to improve the video encoding quality, making the pushed video stream have higher definition and better user experience;
[0146] When the bandwidth is insufficient, the PID control signal will prompt the system to reduce the video encoding quality, reduce the streaming bandwidth, and avoid freezes or interruptions.
[0147] This dynamic adjustment process is a continuous negative feedback control loop, which ensures that the system can respond to changes in network bandwidth in real time and achieve adaptive optimization.
[0148] Furthermore, in order to ensure that the system can run efficiently under different network conditions, the PID control algorithm in this embodiment determines the PID parameter configuration suitable for video streaming through simulation and testing, including the specific values of the proportional coefficient, integral time constant and differential time constant.
[0149] For example, the system sets the proportional coefficient to K through step response analysis. p =2.31, the integral time constant is T i =0.87, and the differential time constant is τ =0.61. This parameter setting ensures that the system can quickly and stably adjust the video encoding quality in response to changes in network bandwidth, avoiding over-adjustment or delayed response.
[0150] Through the PID control algorithm in this embodiment, the system can achieve adaptive bandwidth optimization during video streaming. In an actual network environment, the system can dynamically adjust the video encoding quality based on real-time feedback from the bandwidth to ensure the best video quality when the bandwidth is sufficient and maintain stable video streaming when the bandwidth is limited.
[0151] This method significantly improves the robustness and flexibility of the video streaming system, solves the problem of traditional methods being unresponsive or insufficiently adjusted when facing network bandwidth fluctuations, and is suitable for high-quality video streaming needs in a variety of complex network environments.
[0152] In this embodiment, the system can automatically adjust the video encoding level and realize adaptive optimization of the video streaming bandwidth by using the PID control algorithm for negative feedback control. Through the real-time bandwidth feedback signal, the system dynamically adjusts the encoding quality of the video stream to ensure the efficiency and stability of video push under different network conditions.
[0153] In some embodiments, negative feedback control based on a PID control algorithm is used to dynamically adjust the encoding quality of each video according to the real-time bandwidth feedback signal during the video streaming process, including:
[0154] Collect the real-time bandwidth feedback signal during video streaming and calculate the error signal between the current bandwidth and the target bandwidth;
[0155] According to the error signal, the PID control algorithm is used to calculate the adjustment signal. According to the adjustment signal, the encoding quality of each video channel is automatically adjusted to adjust the encoding bandwidth of the video streaming.
[0156] The step response method is used to calculate and set the proportional coefficient, integral time constant and differential time constant, and the video encoding quality is adjusted according to the real-time bandwidth feedback.
[0157] Specifically, the system achieves dynamic adjustment of encoding quality during video streaming through negative feedback control based on the PID control algorithm. This method calculates the error based on the real-time bandwidth feedback signal, and generates an adjustment signal through the PID control algorithm, thereby automatically adjusting the encoding quality of each video stream to ensure adaptive optimization of streaming bandwidth.
[0158] During the video streaming process, the system first collects the real-time bandwidth feedback signal, which is used to reflect the current network bandwidth usage. The system detects the difference between the current bandwidth and the preset target bandwidth to obtain the bandwidth error signal. The error signal e(t) is the core input of the PID control algorithm, indicating the deviation between the current bandwidth and the ideal state.
[0159] The error signal e(t) is calculated by the following formula:
[0160] e(t) = target bandwidth - current real-time bandwidth
[0161] The target bandwidth is the ideal bandwidth value preset by the system according to the video stream quality requirements, and the current real-time bandwidth is the network bandwidth value obtained through real-time acquisition.
[0162] Furthermore, based on the error signal e(t), the system uses the PID control algorithm to calculate the adjustment signal u(t) to adjust the encoding quality of each video. Through PID control, the system can dynamically adjust the encoding level of each video stream according to the size and change trend of the current error signal, thereby optimizing the allocation of streaming bandwidth.
[0163] Furthermore, according to the adjustment signal u(t), the system will automatically adjust the encoding quality of each video stream to dynamically adjust the encoding bandwidth of the video push stream. The specific process is as follows:
[0164] When the real-time bandwidth feedback signal shows that the current bandwidth is sufficient, the system improves the encoding quality of the video stream through u(t) and increases the bandwidth of the push stream, thereby improving the clarity and quality of the video;
[0165] When the real-time bandwidth feedback signal shows that the current bandwidth is insufficient, the system will reduce the encoding quality of the video stream and reduce the streaming bandwidth to ensure that the video stream remains stable in the event of network fluctuations and avoid freezes or interruptions.
[0166] This dynamic adjustment process continues throughout the entire video streaming process, ensuring that the system can respond to bandwidth changes in real time and maximize the optimization of video streaming push effects.
[0167] In order to achieve the best control effect, this embodiment calculates and sets the parameters of the PID control algorithm through the step response method, including the proportional coefficient, integral time constant and differential time constant. Based on the simulation and experimental results, the system finally determines the PID parameters suitable for video streaming:
[0168] Proportional coefficient (K p )=2.31
[0169] Integration time constant (T i )=0.87
[0170] Differential time constant (τ) = 0.61
[0171] The settings of these parameters enable the system to quickly respond to bandwidth changes under different network conditions, and stably adjust the video encoding quality to avoid the impact of bandwidth fluctuations on the video stream.
[0172] The negative feedback control system in this embodiment continuously feeds back the real-time encoding bandwidth to the input of the PID control, forming a closed-loop control process. Through continuous feedback and adjustment, the system can dynamically adjust the encoding level of each video stream to ensure the best encoding quality self-adjustment within the specified bandwidth range.
[0173] Through simulation and actual application tests, it is shown that the PID control algorithm in this system can effectively improve the stability of video streaming and bandwidth utilization efficiency. In the case of large network fluctuations, the system can dynamically adjust the encoding quality to reduce the jamming phenomenon and ensure the stable playback of the video stream. At the same time, when the network bandwidth is sufficient, the system will automatically improve the video encoding quality to provide a higher-definition video experience.
[0174] Through the method of the present embodiment described above, the negative feedback control system based on the PID control algorithm can effectively dynamically adjust the encoding quality of each video according to the real-time bandwidth feedback, ensuring the adaptive optimization of the video streaming bandwidth. The system adjusts the encoding level of the video stream according to the real-time changes in the bandwidth, ensuring the stability and quality of the video stream under different network conditions.
[0175] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.
[0176] Figure 3 Schematic diagram of the structure of the video streaming bandwidth dynamic planning device provided in the embodiment of the present application. Figure 3As shown, the video streaming bandwidth dynamic planning device includes:
[0177] The first allocation module 301 is configured to set the initial push quality of the multiple video streams to the lowest video quality, and perform bandwidth allocation based on the real-time total bandwidth of the intranet, the real-time total bandwidth of the extranet, and the real-time bandwidth demand of each video according to the bandwidth allocation algorithm;
[0178] The first judgment module 302 is configured to judge whether the current bandwidth can be fully allocated, and when it is judged that it cannot be fully allocated, maintain the current video push state;
[0179] The second judgment module 303 is configured to judge the preset boundary conditions when it is judged that the bandwidth allocation is completed, wherein the boundary conditions include the intranet bandwidth, the extranet bandwidth, the minimum bandwidth requirement of each video stream and the computing resources of the edge gateway;
[0180] The second allocation module 304 is configured to maintain the current video push state when it is determined that the boundary condition is not met, and increase the step value of bandwidth allocation and re-allocate bandwidth when it is determined that the boundary condition is met;
[0181] The third allocation module 305 is configured to reduce the step value of bandwidth allocation and re-allocate bandwidth when bandwidth allocation fails or does not meet the boundary conditions, until the bandwidth allocation and the boundary conditions meet the preset requirements.
[0182] In some embodiments, Figure 3 The first allocation module 301 dynamically allocates the output bandwidth of the video stream by adjusting the codec quality of the video based on the computing resources of the edge gateway, and uses the backpack algorithm for optimization modeling. Under the specified computing resource constraints, the bandwidth allocated to each video stream is determined to maximize the total bandwidth of the video push stream, wherein the codec quality of each video stream is associated with the required bandwidth and computing resources, and bandwidth is allocated once for each video stream.
[0183] In some embodiments, Figure 3 The first allocation module 301 defines a state variable, wherein the state variable is used to represent the maximum bandwidth allocation value obtained when the computing resources do not exceed the total amount of computing resources; for any video stream, the computing resources of the video stream and the corresponding streaming bandwidth are set, and the state transfer is performed according to the preset situation: the state transfer equation is used for iterative update, and the value of the total amount of computing resources is enumerated from large to small; after the enumeration is completed, the maximum value of the state variable is determined, wherein the maximum value of the state variable is used to represent the maximum video streaming bandwidth value that can be allocated under the given computing resource constraints.
[0184] In some embodiments, Figure 3The first allocation module 301 sets the state variable to the maximum bandwidth allocation value when no bandwidth is allocated for the video stream; when bandwidth is allocated for the video stream, the maximum bandwidth allocation value is calculated according to the total amount of computing resources, computing resources and streaming bandwidth.
[0185] In some embodiments, Figure 3 The boundary conditions in the second judgment module 303 include that the sum of the total bandwidth of each video stream pulled from the intranet is less than or equal to the real-time total bandwidth of the intranet; the sum of the total bandwidth of each video stream pushed from the external network is less than or equal to the real-time total bandwidth of the external network; the sum of the minimum encoding and decoding bandwidth of each video stream is less than or equal to the real-time total bandwidth of the external network; the actual pushing bandwidth of each video stream is greater than or equal to the minimum encoding and decoding bandwidth of the video stream; the sum of the decoding computing resource consumption of each video stream is less than or equal to the total computing resources of the edge gateway.
[0186] In some embodiments, Figure 3 The dynamic adjustment 306 adopts negative feedback control based on the PID control algorithm, and dynamically adjusts the encoding quality of each video according to the real-time bandwidth feedback signal during the video streaming process. The PID control algorithm is used to automatically adjust the encoding quality by adjusting the proportional coefficient, integral time constant and differential time constant, so as to adaptively optimize the video streaming bandwidth.
[0187] In some embodiments, Figure 3 The dynamic adjustment 306 collects the real-time bandwidth feedback signal during the video streaming process, and calculates the error signal between the current bandwidth and the target bandwidth; according to the error signal, the adjustment signal is calculated using the PID control algorithm, and the encoding quality of each video is automatically adjusted according to the adjustment signal, so as to adjust the encoding bandwidth of the video streaming; the proportional coefficient, the integral time constant and the differential time constant are calculated and set using the step response method, and the video encoding quality is adjusted according to the real-time bandwidth feedback.
[0188] Figure 4 Schematic diagram of the structure of the electronic device 4 provided in the embodiment of the present application. Figure 4 As shown, the electronic device 4 of this embodiment includes: a processor 401, a memory 402, and a computer program 403 stored in the memory 402 and executable on the processor 401. When the processor 401 executes the computer program 403, the steps in the above-mentioned method embodiments are implemented. Alternatively, when the processor 401 executes the computer program 403, the functions of the modules / units in the above-mentioned device embodiments are implemented.
[0189] Exemplarily, the computer program 403 may be divided into one or more modules / units, which are stored in the memory 402 and executed by the processor 401 to complete the present application. The one or more modules / units may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program 403 in the electronic device 4.
[0190] The electronic device 4 may be a desktop computer, a notebook, a PDA, a cloud server, or other electronic device. The electronic device 4 may include, but is not limited to, a processor 401 and a memory 402. Those skilled in the art will appreciate that Figure 4 It is only an example of the electronic device 4 and does not constitute a limitation of the electronic device 4. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the electronic device may also include input and output devices, network access devices, buses, etc.
[0191] The processor 401 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.
[0192] The memory 402 may be an internal storage unit of the electronic device 4, for example, a hard disk or memory of the electronic device 4. The memory 402 may also be an external storage device of the electronic device 4, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 4. Further, the memory 402 may also include both an internal storage unit and an external storage device of the electronic device 4. The memory 402 is used to store computer programs and other programs and data required by the electronic device. The memory 402 may also be used to temporarily store data that has been output or is to be output.
[0193] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0194] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0195] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments applied for herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0196] In the embodiments provided in the present application, it should be understood that the disclosed devices / computer equipment and methods can be implemented in other ways. For example, the device / computer equipment embodiments described above are only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation. Multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0197] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0198] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0199] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. The computer program may include computer program code, which may be in source code form, object code form, executable file or some intermediate form. Computer-readable media may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc.
[0200] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A method for dynamically planning bandwidth for video streaming, characterized in that: include: The initial push quality of multiple video streams is set to the lowest video quality, and bandwidth is allocated based on the real-time total bandwidth of the intranet, the real-time total bandwidth of the extranet, and the real-time bandwidth requirements of each video channel according to the bandwidth allocation algorithm; Determine whether the current bandwidth can be fully allocated. If it cannot be fully allocated, maintain the current video push status. When it is determined that the bandwidth allocation is completed, the preset boundary conditions are determined, wherein the boundary conditions include the intranet bandwidth, the extranet bandwidth, the minimum bandwidth requirement of each video stream, and the computing resources of the edge gateway; When it is determined that the boundary conditions are not met, the current video push state is maintained; when it is determined that the boundary conditions are met, the step value of bandwidth allocation is increased and bandwidth allocation is performed again; When bandwidth allocation fails or does not meet the boundary conditions, the step value of bandwidth allocation is reduced and bandwidth allocation is performed again until the bandwidth allocation and boundary conditions meet the preset requirements.
2. The method according to claim 1, characterized in that The bandwidth allocation algorithm is used to allocate bandwidth based on the real-time total bandwidth of the intranet, the real-time total bandwidth of the extranet, and the real-time bandwidth demand of each video channel, including: Based on the computing resources of the edge gateway, the output bandwidth of the video stream is dynamically allocated by adjusting the codec quality of the video. The backpack algorithm is used for optimization modeling. Under the specified computing resource constraints, the bandwidth allocated to each video stream is determined to maximize the total bandwidth of the video push stream. The codec quality of each video stream is associated with the required bandwidth and computing resources, and bandwidth is allocated once for each video stream.
3. The method according to claim 2, characterized in that The knapsack algorithm is used for optimization modeling to determine the bandwidth allocated to each video stream under the specified computing resource constraints to maximize the total bandwidth of the video streaming, including: Define a state variable, wherein the state variable is used to represent a maximum bandwidth allocation value obtained when the computing resources do not exceed the total amount of computing resources; For any video stream, set the computing resources and corresponding streaming bandwidth of the video stream, and perform state transition according to the preset situation: Iteratively updating using a state transfer equation and enumerating the value of the total amount of computing resources from large to small; After the enumeration is completed, the maximum value of the state variable is determined, wherein the maximum value of the state variable is used to represent the maximum video streaming bandwidth value that can be allocated under given computing resource constraints.
4. The method according to claim 3, characterized in that The state transfer according to the preset situation includes: When bandwidth is not allocated for the video stream, the state variable is set to the maximum bandwidth allocation value; when bandwidth is allocated for the video stream, the maximum bandwidth allocation value is calculated based on the total amount of computing resources, the computing resources and the streaming bandwidth.
5. The method according to claim 1, characterized in that The boundary conditions include: The sum of the total bandwidth of each video stream pulled from the intranet is less than or equal to the real-time total bandwidth of the intranet; the sum of the total bandwidth of each video stream pushed from the external network is less than or equal to the real-time total bandwidth of the external network; the sum of the minimum encoding and decoding bandwidth of each video stream is less than or equal to the real-time total bandwidth of the external network; the actual pushing bandwidth of each video stream is greater than or equal to the minimum encoding and decoding bandwidth of the video stream; the sum of the decoding computing resource consumption of each video stream is less than or equal to the total computing resources of the edge gateway.
6. The method according to claim 1, characterized in that The method further comprises: Negative feedback control based on the PID control algorithm is adopted to dynamically adjust the encoding quality of each video according to the real-time bandwidth feedback signal during the video streaming process. The PID control algorithm is used to automatically adjust the encoding quality by adjusting the proportional coefficient, integral time constant and differential time constant, so as to adaptively optimize the video streaming bandwidth.
7. The method according to claim 6, characterized in that The negative feedback control based on the PID control algorithm is adopted to dynamically adjust the encoding quality of each video according to the real-time bandwidth feedback signal during the video streaming process, including: Collect the real-time bandwidth feedback signal during video streaming and calculate the error signal between the current bandwidth and the target bandwidth; According to the error signal, an adjustment signal is calculated using a PID control algorithm, and according to the adjustment signal, the encoding quality of each video channel is automatically adjusted so as to adjust the encoding bandwidth of the video streaming; The step response method is used to calculate and set the proportional coefficient, integral time constant and differential time constant, and the video encoding quality is adjusted according to the real-time bandwidth feedback.
8. A video streaming bandwidth dynamic planning device, characterized in that: include: The first allocation module is configured to set the initial push quality of the multiple video streams to the lowest video quality, and perform bandwidth allocation based on the real-time total bandwidth of the intranet, the real-time total bandwidth of the extranet, and the real-time bandwidth demand of each video according to the bandwidth allocation algorithm; The first judgment module is configured to judge whether the current bandwidth can be fully allocated, and when it is judged that it cannot be fully allocated, maintain the current video push state; The second judgment module is configured to judge the preset boundary conditions when it is judged that the bandwidth allocation is completed, wherein the boundary conditions include the intranet bandwidth, the extranet bandwidth, the minimum bandwidth requirement of each video stream and the computing resources of the edge gateway; The second allocation module is configured to maintain the current video push state when it is determined that the boundary condition is not met, and increase the step value of bandwidth allocation and re-allocate the bandwidth when it is determined that the boundary condition is met; The third allocation module is configured to reduce the step value of bandwidth allocation and re-allocate bandwidth when bandwidth allocation fails or does not meet the boundary conditions, until the bandwidth allocation and the boundary conditions meet the preset requirements.
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, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.