Method for adjusting code rate based on bandwidth, priority and no-operation time
Technical Field
The invention belongs to the technical field of visual intelligent online monitoring, and particularly relates to a method for adjusting code rate based on bandwidth, priority and no-operation time.
Background
The video monitoring system is widely applied to the field of power transmission and transformation online monitoring, and bandwidth resource limitation exists in the practical application of video monitoring. Because the total bandwidth required by the task exceeds the capacity of actual bandwidth resources, the network is congested and blocked, and packet loss is caused, and the situations of video blocking, mosaic and the like often occur. The current device has the ability of QoS (Quality of Service) based automatic adjustment of the code rate according to the bandwidth resource, but the method is based on the network bandwidth situation. The existing device has the capability of automatically adjusting the code rate according to the bandwidth resources, but the factors such as the importance of operation, the invalid occupation of the bandwidth and the like cannot be considered from the level of the whole system, and the bandwidth resources are uniformly distributed and managed without difference according to the factors. Therefore, the bandwidth capability of the video operation is also considered from the system level, and the bandwidth and the code rate of the video are uniformly adjusted and reasonably distributed in combination with the factors such as the priority, the non-operation time and the like.
However, in practical application, different video access requirements need to be considered and treated differently on a system level, and the method is directed to the actual requirements of the security risk management and control platform of the company in liaoning province on bandwidth allocation and video smoothness, and combines the following requirements: for the situations of emergency command and real-time scene viewing by leaders, the situation that the video code rate of the video line corresponding to the scene is automatically reduced and viewed due to the limitation of bandwidth resources is not suitable, and high-definition video browsing is required to be ensured in the application situations.
Disclosure of Invention
Aiming at the defects in the prior art, the invention provides a method for adjusting the code rate based on bandwidth, priority and no operation time by combining the actual requirements of a security risk management and control platform on bandwidth allocation and utilization and smooth video. The invention aims to realize the purposes of effectively saving bandwidth resources, avoiding the phenomenon of video pause to the maximum extent and guaranteeing the operation of high-priority videos.
In order to realize the purpose of the invention, the invention is realized by adopting the following technical scheme:
a method for adjusting code rate based on bandwidth, priority and no-operation time comprises the following steps:
step 1, recording the current code rates of video circuits corresponding to all current account numbers when a video is started every time; the recording of the current code rates of the video lines corresponding to all the current account numbers at each video starting comprises the following steps: recording the current video line code rate each time the video is connected, and storing the current video line code rate of the operation video and the current operation account in a correlation manner; each time the code rate is modified, the associated memory needs to be updated;
recording the current code rates of the video lines corresponding to all current account numbers at each video starting time specifically comprises the following steps: recording the current code rates of all current online video circuits, and adding and calculating the total used bandwidth resources of the current online video circuits;
the calculation mode of the total bandwidth is to accumulate the bandwidth occupied by all the online video circuits and calculate the used total bandwidth;
step 2, judging the priority of the current operation before the current operation is carried out; the priority is preset according to the account number and is not adjusted and changed; if the change needs to be applied to the super manager through the application approval process;
step 3, allocating bandwidth resources according to the priority; the priorities respectively comprise a default priority and a high priority;
the bandwidth resource allocation according to the priority is that before the bandwidth resource is allocated, the currently used bandwidth resource is judged at first, and if the used total bandwidth resource does not exceed the total bandwidth allocated by the line, the current task is started; if the used bandwidth resources exceed the total bandwidth of the line, the bandwidth resources are adjusted until the bandwidth resources can meet the requirements of the current task;
the non-operation time is calculated from the last action time of operating the ball distribution and control equipment by the cradle head until the current time, the code rate reduction operation is performed step by step from a low priority to a higher priority, and the video circuit with the longest non-operation time is selected for operation;
the adjustment of the bandwidth resources is realized by a combined video code rate adjustment strategy process, and the combined video code rate adjustment strategy comprises the following steps:
step a: traversing the low priority task list; finding a task occupying default initial bandwidth resources at present, and selecting a conforming task to perform code rate reduction processing by combining the task without operation time, so that the processed code rate is lower than the default code rate;
step b: after the strategy is executed, continuously and repeatedly judging whether the current bandwidth resource meets the bandwidth requirement, and if so, starting a new task; if not, re-executing the combined code rate strategy until the bandwidth resources can meet the requirements of the current task;
step c: and after the steps are finished, starting the current task.
Further, the adjusting the bandwidth resource includes the following steps:
step (1) processing according to the non-operation time of each line, and performing code rate reduction processing on the non-operation line from the line with the lowest priority;
step (2) if the strategy in step (1) still can not meet the bandwidth requirement, closing the low-priority and longest non-operation time line, wherein the closing operation is performed step by step from the low priority to the higher priority and is selected from the video channel with the longest non-operation time;
and (3) after the high-priority operation is finished, restoring the code rate of the line which is reduced or closed previously to the default code rate.
Further, the allocating bandwidth resources according to the account number permission priority specifically includes: presetting a code rate for the current video circuit according to the priority, traversing the online video circuit at the same time, judging whether the circuit has the condition of no operation for a long time one by one, and if the circuit has no operation for a long time, reducing the code rate or closing the low-priority video circuit according to the priority; after the above operations are carried out, enough bandwidth resources are reserved for the current high-priority video line to use; setting operation highest priority, only giving a specific examination and approval account for use, and giving a video line with low priority to reduce code rate or close processing according to the priority if bandwidth resources are not met when the line corresponding to the highest priority is used; and distributing the highest code rate to the highest priority, and distributing other priority tasks according to the preset value.
The invention has the following advantages and beneficial technical effects:
the method is used in the field of intelligent video monitoring, and has the characteristics of simple structure and easy realization. The invention considers the bandwidth resource allocation from the system level and ensures the requirement of the task of high priority operation on high definition resolution. The invention considers the occupation of bandwidth resources by long-time no-operation lines from the system level, and optimizes and allocates the resources through a combination strategy.
Based on the current common video application, the unified video monitoring platform aims to provide guarantee for services such as safety supervision and inspection. This requires integrity and correctness of the video information. According to the needs, a method for reducing the code rate until quitting based on the operation priority and considering the long-time no-operation is provided, so that the bandwidth resource is saved and effectively utilized, and support is provided for realizing video monitoring management and improving the lean level of production management.
The invention takes the bandwidth resource allocation of the system into full consideration from the overall level of the video monitoring system, allocates different priorities to different video demands, and sets a high-priority account, wherein the priority is only used for a specific account, which is suitable for the situations of leadership and accountability emergency command or urgent browsing, and when the highest-priority line is used, if the bandwidth resource is not satisfied, the video line with low priority can be given according to the priority to reduce the code rate until the video line is closed. In addition, the invention considers the conditions of no operation and bandwidth resource occupation for a long time and reduces the code rate to ensure the bandwidth resource allocation. The defect that tasks requiring high resolution cannot clearly view the field situation due to the fact that the equipment code rate is automatically adjusted according to the bandwidth resources in the prior art is overcome. The method has good popularization and can be applied to various scenes of power transmission and transformation video online monitoring. Has important significance for ensuring the safe and reliable operation of equipment, and also has wide market prospect and application value.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings of the embodiments of the present invention will be briefly described below. Wherein the drawings are only for purposes of illustrating some embodiments of the invention and are not to be construed as limiting the invention to all embodiments thereof.
FIG. 1 is a flow chart of video bitrate adjustment in the present invention;
fig. 2 is a flow chart of a combination strategy for adjusting video bitrate in the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The invention relates to a method for adjusting code rate based on bandwidth, priority and no-operation time, in particular to a method for adjusting code rate based on bandwidth resources, operation priority, line no-operation time and other parameters, which carries out reasonable bandwidth allocation and code rate adjustment on all online tasks, and considers that the operation has different importance degrees and different priorities are required to be given in the whole system level. Assigning higher priority is important for certain video operations that require the ability to guarantee high definition resolution. In addition, the invention mainly divides the operation into different priorities, ensures that the high priority can preferentially ensure the bandwidth utilization, and simultaneously considers the situation that in practical application, the operation is finished for a long time and the bandwidth resource is still occupied, and the situation is monitored or operated without people on site to a great extent, and the reduction of the code rate can be considered until the operation is closed.
As shown in fig. 1, fig. 1 is a flow chart of the automatic video bitrate adjustment of the present invention. The invention relates to a method for adjusting code rate based on parameters such as bandwidth, priority, no-operation time and the like, which comprises the following steps:
step 1, recording the current code rates of video circuits corresponding to all current account numbers at each video starting.
Recording the current video line code rate each time a video is connected, and storing the current line video code rate and the current operation account number into a database storage table in a correlation manner; each time the code rate is modified, the association memory table needs to be updated.
And 2, judging the priority of the current operation before the current operation is carried out.
The priority is preset according to the account number, adjustment and change are not required to be given under the general condition, and if the change is required, the application is applied to a super manager through an application approval process.
And 3, allocating the bandwidth resources according to the priority.
Before allocating bandwidth resources, firstly judging the currently used bandwidth resources, and if the used total bandwidth resources do not exceed the total bandwidth allocated by a line, allowing to start a video; if the used total bandwidth resources exceed the total bandwidth allocated by the line, the bandwidth resources are adjusted according to the following steps until the bandwidth resources can meet the requirements of the current task, and the method specifically comprises the following steps:
step (1) firstly, processing is carried out according to the non-operation time of each line, and the code rate reduction processing is carried out on the non-operation line from the line with the lowest priority.
The non-operation time is calculated until the current time from the last action time of operating the ball arrangement and control equipment through a holder and the like, the code rate reduction operation is performed step by step from a low priority to a higher priority, and the video line with the longest non-operation time is selected for operation.
And (2) if the bandwidth requirement cannot be met through the strategy in the step (1), closing the low-priority and longest non-operation time line, wherein the closing operation is performed step by step from the low priority to the higher priority and is selected from the video channel with the longest non-operation time.
And (3) after the high-priority operation is finished, restoring the code rate of the line which is reduced or closed previously to the default code rate.
Example 1:
the invention relates to a method for adjusting code rate based on bandwidth, priority and no-operation time, which comprises the following steps: recording the current code rates of all current online video circuits, and adding and calculating the total used bandwidth resources of the current online video circuits; presetting a code rate for the current video circuit according to the priority, traversing the online video circuit simultaneously, judging whether the circuit has the condition of no operation for a long time one by one, and if the circuit has no operation for a long time, reducing the code rate or closing the low-priority video circuit according to the priority. After the above operations are performed, enough bandwidth resources are left for the current high-priority video line to use. In addition, the highest priority of operation is set, the priority is only used for a specific examination and approval account, such as leadership and accountability for emergency command or urgent browsing, and when the highest priority corresponds to the line usage, if the bandwidth resource is not satisfied, the video line with low priority can be given according to the priority to reduce the code rate or close the processing.
In the system corresponding to the invention, the priority level is two levels: default priority and high priority. A default priority and permission table needs to be established. The table content includes different operation authority account numbers and corresponding priorities, and the different priorities correspond to the same default initial code rate initially. And the default priority is the priority corresponding to the common authority account.
Before starting a task, the bandwidth resources currently available should be calculated first: and recording the current code rate, and calculating and updating the current occupied bandwidth resource.
The calculation mode of the total bandwidth is to accumulate the bandwidths occupied by all the online video lines and calculate the used total bandwidth.
Calculating the difference between the total allocated bandwidth of the line and the occupied bandwidth resource to obtain available bandwidth, judging whether the available bandwidth meets the bandwidth requirement of the current task operation, and if the available bandwidth meets the bandwidth requirement, starting the current task; and if the bandwidth requirement is not met, reducing the bit rate of the existing low-priority task according to a video bit rate regulation combination strategy, and storing the bit rate of the task and the account number in a corresponding table in an associated manner, wherein the table comprises information such as the current account number, a preset bit rate, the current bit rate, the last operation time and the like. As shown in fig. 2, fig. 2 is a flow chart of a combination strategy for adjusting video bitrate in the present invention.
Wherein the combined code rate strategy step comprises the steps of:
step a: the low priority task list is traversed.
And finding the task occupying the default initial bandwidth resource, and selecting the conforming task to perform code rate reduction treatment by combining the task without operation time, so that the treated code rate is lower than the default code rate.
Step b: after the strategy is executed, continuously and repeatedly judging whether the current bandwidth resource meets the bandwidth requirement, and if so, starting a new task; and if not, re-executing the combined code rate strategy until the bandwidth resources can meet the requirements of the current task.
Step c: and after the steps are finished, starting the current task.
Those of ordinary skill in the art will understand that: the discussion of any embodiment above is meant to be exemplary only, and is not intended to intimate that the scope of the disclosure, including the claims, is limited to these examples; within the idea of the invention, also features in the above embodiments or in different embodiments may be combined, steps may be implemented in any order, and there are many other variations of the different aspects of the invention as described above, which are not provided in detail for the sake of brevity.
The embodiments of the invention are intended to embrace all such alternatives, modifications and variances that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, substitutions, improvements and the like that may be made without departing from the spirit and principles of the invention are intended to be included within the scope of the invention.