CN114979726B - Code rate adjusting method, device, server and storage medium - Google Patents

Code rate adjusting method, device, server and storage medium Download PDF

Info

Publication number
CN114979726B
CN114979726B CN202210768344.1A CN202210768344A CN114979726B CN 114979726 B CN114979726 B CN 114979726B CN 202210768344 A CN202210768344 A CN 202210768344A CN 114979726 B CN114979726 B CN 114979726B
Authority
CN
China
Prior art keywords
code rate
parameter
adjusted
preset
current
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210768344.1A
Other languages
Chinese (zh)
Other versions
CN114979726A (en
Inventor
董丹华
易曌平
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chongqing Unisinsight Technology Co Ltd
Original Assignee
Chongqing Unisinsight Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chongqing Unisinsight Technology Co Ltd filed Critical Chongqing Unisinsight Technology Co Ltd
Priority to CN202210768344.1A priority Critical patent/CN114979726B/en
Publication of CN114979726A publication Critical patent/CN114979726A/en
Application granted granted Critical
Publication of CN114979726B publication Critical patent/CN114979726B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/25Management operations performed by the server for facilitating the content distribution or administrating data related to end-users or client devices, e.g. end-user or client device authentication, learning user preferences for recommending movies
    • H04N21/266Channel or content management, e.g. generation and management of keys and entitlement messages in a conditional access system, merging a VOD unicast channel into a multicast channel
    • H04N21/2662Controlling the complexity of the video stream, e.g. by scaling the resolution or bitrate of the video stream based on the client capabilities
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/234Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs
    • H04N21/2343Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs involving reformatting operations of video signals for distribution or compliance with end-user requests or end-user device requirements
    • H04N21/234381Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs involving reformatting operations of video signals for distribution or compliance with end-user requests or end-user device requirements by altering the temporal resolution, e.g. decreasing the frame rate by frame skipping
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/24Monitoring of processes or resources, e.g. monitoring of server load, available bandwidth, upstream requests
    • H04N21/2405Monitoring of the internal components or processes of the server, e.g. server load
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/66Remote control of cameras or camera parts, e.g. by remote control devices

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Studio Devices (AREA)

Abstract

The invention relates to the technical field of video storage, and provides a code rate adjusting method, a device, a server and a storage medium. The server is in communication connection with the plurality of camera devices, the server is provided with a storage space and a cache space comprising a plurality of cache blocks, the cache space is used for caching video data sent by each camera device and received by the server, and the storage space is used for transferring the cached video data in the cache space when the cache space has no free cache block; periodically acquiring occupation parameters representing the use condition of the cache space according to a preset adjustment period; determining the camera equipment to be adjusted and the code rate parameters according to the occupation parameters and the current code rate of each camera equipment; and then sending the code rate parameter to the camera equipment to be adjusted so that the camera equipment to be adjusted adjusts the code rate according to the code rate parameter. The code rate is dynamically adjusted by periodically acquiring the use condition of the buffer memory space, so that the stability of the video is ensured, and the video storage abnormality is effectively avoided.

Description

Code rate adjusting method, device, server and storage medium
Technical Field
The invention relates to the technical field of video storage, in particular to a code rate adjusting method, a device, a server and a storage medium.
Background
With the development of economy, people pay more and more attention to safety. The implementation of monitoring platforms such as the skynet, the safe city and the like in various places of the country promotes the rapid development of the security industry. Video storage is the core of the security industry, and due to the fact that the actual application environment is complex, many factors can possibly cause video storage abnormality. The code rate of the camera is critical to video storage, and how to adjust the code rate of the camera is a concern.
Disclosure of Invention
In view of the above, the present invention aims to provide a code rate adjustment method, a device, a server and a storage medium.
In order to achieve the above object, the technical scheme adopted by the embodiment of the invention is as follows:
in a first aspect, the present invention provides a code rate adjustment method applied to a server, where the server is communicatively connected to a plurality of image capturing devices, the server has a storage space and a buffer space including a plurality of buffer blocks, the buffer space is used for buffering video data sent by each image capturing device received by the server, and the storage space is used for, when the buffer space has no free buffer block, restoring the buffered video data in the buffer space, the method includes:
Periodically acquiring occupation parameters representing the use condition of the cache space according to a preset adjustment period;
determining the camera equipment to be adjusted and the code rate parameters according to the occupation parameters and the current code rate of each camera equipment;
and sending the code rate parameter to the to-be-adjusted camera equipment so that the to-be-adjusted camera equipment adjusts the code rate according to the code rate parameter.
In an optional implementation manner, the server pre-stores a plurality of code rate intervals and frame rate parameters corresponding to each code rate interval;
after the step of determining the image capturing apparatus and the code rate parameters to be adjusted according to the occupancy parameter and the current code rate of each image capturing apparatus, the method further includes:
determining a target code rate interval to which the code rate parameter belongs;
obtaining a frame rate parameter corresponding to the target code rate interval to obtain a target frame rate parameter;
and sending the code rate parameter and the target frame rate parameter to the to-be-adjusted camera equipment so that the to-be-adjusted camera equipment adjusts the code rate according to the code rate parameter and adjusts the frame rate according to the target frame rate parameter.
In an optional implementation manner, the occupation parameter is a percentage of the number of used cache blocks to the total number of all cache blocks, and the server pre-stores an adjustment threshold, a code rate upper limit value and a code rate lower limit value;
The step of determining the parameters of the image capturing device and the code rate to be adjusted according to the occupation parameters and the current code rate of each image capturing device comprises the following steps:
when the occupation parameter is smaller than or equal to the adjustment threshold, taking the image pickup device with the current code rate smaller than the code rate upper limit value as the image pickup device to be adjusted;
determining the code rate parameter according to the occupation parameter, the code rate upper limit value and the current code rate of the camera equipment to be adjusted;
when the occupation parameter is larger than the adjustment threshold, taking the image pickup device with the current code rate larger than the code rate lower limit value as the image pickup device to be adjusted;
and determining the code rate parameter according to the occupation parameter, the code rate lower limit value and the current code rate of the camera equipment to be adjusted.
In an alternative embodiment, the server also pre-stores an observation threshold, a preset lifting ratio and a preset coefficient; the observation threshold is less than the adjustment threshold;
the step of determining the code rate parameter according to the occupation parameter, the code rate upper limit value and the current code rate of the to-be-adjusted camera equipment comprises the following steps:
obtaining an average input bandwidth and an average output bandwidth of a current adjustment period, wherein the average input bandwidth represents an average video data amount received in the current adjustment period, and the average input bandwidth represents an average video data amount transferred to the storage space in the current adjustment period;
When the occupation parameter is smaller than the observation threshold, calculating a lifted code rate value according to the preset lifting proportion and the current code rate of the to-be-adjusted camera equipment, and taking the smaller one of the lifted code rate value and the code rate upper limit value as the code rate parameter;
when the occupation parameter is larger than or equal to the observation threshold value, calculating the product of the average output bandwidth and a preset coefficient, and comparing the product with the average input bandwidth;
if the average input bandwidth is smaller than or equal to the product, calculating a lifted code rate value according to the preset lifting proportion and the current code rate of the to-be-adjusted camera equipment, and taking the smaller one of the lifted code rate value and the code rate upper limit value as the code rate parameter.
In an alternative embodiment, the server also pre-stores a forced threshold, a preset lower limit reduction ratio, a preset upper limit reduction ratio and a preset coefficient; the forced threshold is greater than the adjusted threshold;
the step of determining the code rate parameter according to the occupation parameter, the code rate lower limit value and the current code rate of the to-be-adjusted camera equipment comprises the following steps:
Obtaining an average input bandwidth and an average output bandwidth of a current adjustment period, wherein the average input bandwidth represents an average video data amount received in the current adjustment period, and the average input bandwidth represents an average video data amount transferred to the storage space in the current adjustment period;
when the occupation parameter is larger than or equal to the forced threshold, determining a target reduction ratio according to the average input bandwidth, the average output bandwidth, the preset lower limit reduction ratio and the preset upper limit reduction ratio, and determining the code rate parameter according to the target reduction ratio, the code rate lower limit value and the current code rate of the to-be-adjusted image pickup device;
when the occupation parameter is smaller than the forced threshold, calculating the product of the average output bandwidth and a preset coefficient, and comparing the product with the average input bandwidth;
if the average input bandwidth is greater than or equal to the product, determining a target reduction ratio according to the average input bandwidth, the average output bandwidth, the preset lower limit reduction ratio and the preset upper limit reduction ratio, and determining the code rate parameter according to the target reduction ratio, the code rate lower limit value and the current code rate of the to-be-adjusted image pickup device.
In an alternative embodiment, the step of determining the target reduction ratio according to the average input bandwidth, the average output bandwidth, the preset lower reduction limit ratio and the preset upper reduction limit ratio includes:
subtracting the average input bandwidth from the average output bandwidth to obtain a difference value, and calculating the ratio of the difference value to the average input bandwidth to obtain a pending reduction ratio;
if the undetermined reduction ratio belongs to a range between the preset reduction lower limit ratio and the preset reduction upper limit ratio, taking the undetermined reduction ratio as the target reduction ratio;
if the undetermined reduction ratio is smaller than the preset reduction lower limit ratio, taking the preset reduction lower limit ratio as the target reduction ratio;
and if the undetermined reduction ratio is larger than the preset reduction upper limit ratio, taking the preset reduction upper limit ratio as the target reduction ratio.
In an optional implementation manner, the step of determining the code rate parameter according to the target reduction ratio, the code rate lower limit value and the current code rate of the to-be-adjusted camera device includes:
calculating a reduced code rate value according to the target reduction ratio and the current code rate of the to-be-adjusted camera equipment;
Comparing the reduced code rate value with the code rate lower limit value;
if the reduced code rate value is larger than the code rate lower limit value, taking the reduced code rate value as the code rate parameter;
and if the reduced code rate value is smaller than or equal to the code rate lower limit value, taking the code rate lower limit value as the code rate parameter.
In a second aspect, the present invention provides a code rate adjustment apparatus applied to a server, the server being communicatively connected to a plurality of image capturing devices, the server having a storage space and a buffer space including a plurality of buffer blocks, the buffer space being used for buffering video data transmitted by each of the image capturing devices received by the server, the storage space being used for, when the buffer space has no free buffer block, restoring the buffered video data in the buffer space, the apparatus comprising:
the acquisition module is used for periodically acquiring occupation parameters representing the use condition of the cache space according to a preset adjustment period;
the determining module is used for determining the image pickup equipment to be adjusted and the code rate parameters according to the occupation parameters and the current code rate of each image pickup equipment;
and the adjusting module is used for sending the code rate parameter to the to-be-adjusted camera equipment so that the to-be-adjusted camera equipment adjusts the code rate according to the code rate parameter.
In a third aspect, the present invention provides a server comprising a processor and a memory, the memory storing a computer program, the processor implementing the method of any of the preceding embodiments when executing the computer program.
In a fourth aspect, the present invention provides a storage medium having stored thereon a computer program which, when executed by a processor, implements a method according to any of the preceding embodiments.
The embodiment of the invention provides a code rate adjusting method, a device, a server and a storage medium, wherein the server is in communication connection with a plurality of camera devices, the server is provided with a storage space and a cache space comprising a plurality of cache blocks, the cache space is used for caching video data sent by each camera device and received by the server, and the storage space is used for transferring the cached video data in the cache space when the cache space has no free cache block; periodically acquiring occupation parameters representing the use condition of the cache space according to a preset adjustment period; determining the camera equipment to be adjusted and the code rate parameters according to the occupation parameters and the current code rate of each camera equipment; and then sending the code rate parameter to the camera equipment to be adjusted so that the camera equipment to be adjusted adjusts the code rate according to the code rate parameter. The code rate is dynamically adjusted by periodically acquiring the use condition of the buffer memory space, and the code rate and the use rate of the buffer memory space are balanced, so that the stability of the video is ensured, and the video storage abnormality is effectively avoided.
In order to make the above objects, features and advantages of the present invention more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the embodiments will be briefly described below, it being understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 shows a schematic view of a scenario provided by an embodiment of the present invention;
FIG. 2 illustrates another scenario set forth in an embodiment of the present invention;
FIG. 3 shows a schematic block diagram of a server provided by an embodiment of the present invention;
fig. 4 is a schematic flow chart of a code rate adjustment method according to an embodiment of the present invention;
fig. 5 is a schematic flow chart of a code rate adjustment method according to an embodiment of the present invention;
fig. 6 is a schematic flow chart of a code rate adjustment method according to an embodiment of the present invention;
fig. 7 is a functional block diagram of a code rate adjusting device according to an embodiment of the present invention.
Icon: a 101-image pickup apparatus; 103-a server; 105-storage clusters; 110-bus; a 120-processor; 130-memory; 170-a communication interface; 300-code rate adjusting device; 310-an acquisition module; 330-a determination module; 350-an adjustment module.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. The components of the embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the invention, as presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be made by a person skilled in the art without making any inventive effort, are intended to be within the scope of the present invention.
It is noted that relational terms such as "first" and "second", and the like, are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
With the development of economy, people pay more and more attention to safety. The implementation of monitoring platforms such as the skynet, the safe city and the like in various places of the country promotes the rapid development of the security industry. Video storage is the core of the security industry, and the stability of video storage is an important index for measuring a set of products or a system. Because of the complex practical production and application environments, factors such as network fluctuation, slow disk storage, single IO high-delay fluctuation storage, average IO delay increase caused by storage cluster reconstruction and the like can possibly cause video storage abnormality.
There are various solutions in the related art. For example, the code rate is adjusted by judging whether the current code rate belongs to a preset code rate interval; or the code rate is adjusted by judging the network condition according to the data transmission condition of the sending end and the receiving end. However, these methods cannot avoid the problems of buffer overflow, video frame loss, video clip, interruption, etc. Furthermore, the embodiment of the invention provides a code rate adjusting method to solve the problems.
Fig. 1 is a schematic view of a scenario provided in an embodiment of the present invention. Including a plurality of image pickup apparatuses 101 and a server 103. The image capturing apparatus 101 and the server 103 may be connected by a standard ONVIF protocol. The server 103 may be a stand-alone server or may be a server cluster formed by a plurality of servers.
The server 103 has a cache space and a storage space. The buffer space is used for buffering video data sent by each camera equipment and received by the server, and the storage space is used for transferring the buffered video data in the buffer space when the buffer space is used completely.
Optionally, another schematic view of a scenario is provided in the embodiment of the present invention, please refer to fig. 2. Including a plurality of image capturing apparatuses 101, a server 103, and a storage cluster 105. The image capturing apparatus 101 and the server 103 may be connected via a standard ONVIF protocol, and the server 103 and the storage cluster 105 may be connected via an NFS protocol. Storage cluster 105 may be a three node NAS cluster. The server 103 has a buffer space. Storage cluster 105 is used to provide storage space.
Fig. 3 is a block diagram of a server according to an embodiment of the invention. The server includes a bus 110, a processor 120, a memory 130, and a communication interface 170.
Bus 110 may be a circuit that interconnects the elements and communicates, such as control messages, between the elements.
The processor 120 may receive commands from the other elements described above (e.g., the memory 130, the communication interface 170, etc.) via the bus 110, may interpret the received commands, and may perform calculations or data processing based on the interpreted commands.
The processor 120 may be an integrated circuit chip with signal processing capabilities. The processor 120 may be a general-purpose processor including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; but may also be a Digital Signal Processor (DSP), application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components.
Memory 130 may store commands or data received from processor 120 or other elements (e.g., communication interface 170, etc.) or commands or data generated by processor 120 or other elements.
The Memory 130 may be, but is not limited to, random access Memory (Random Access Memory, RAM), read Only Memory (ROM), programmable Read Only Memory (Programmable Read-Only Memory, PROM), erasable Read Only Memory (Erasable Programmable Read-Only Memory, EPROM), electrically erasable Read Only Memory (Electric Erasable Programmable Read-Only Memory, EEPROM).
The communication interface 170 may be used for communication of signaling or data with other node devices.
It will be appreciated that the architecture shown in fig. 3 is merely a schematic diagram of a server, and that the server may also include more or fewer components than shown in fig. 3, or have a different configuration than shown in fig. 3. The components shown in fig. 3 may be implemented in hardware, software, or a combination thereof. It will be appreciated that the configuration shown in fig. 3 may also be used to implement the image capturing apparatus and the storage terminal described above.
It can be understood that a video access platform is installed in the server, and the code rate adjustment method provided by the embodiment of the invention is executed through the video access platform.
The code rate adjustment method provided by the embodiment of the present invention will be described below with reference to the scenario shown in fig. 1. Referring to fig. 4, fig. 4 is a flowchart illustrating a code rate adjustment method according to an embodiment of the present invention.
Step S202, periodically acquiring occupation parameters representing the use condition of the cache space according to a preset adjustment period;
in this embodiment, the server has a cache space and a storage space, and the cache space includes a plurality of cache blocks, and the sizes of the plurality of cache blocks are the same.
The camera equipment sends video data to a server, and the server caches the received video data to a cache block in a cache space; when the buffer space is used up, i.e. no free buffer block exists, the video data buffered in the buffer space is transferred to the storage space to release the buffer block.
Since the buffer space is limited, and the use condition of the buffer space is related to the code rate of the image pickup apparatus. When the code rate is too small, more idle cache blocks exist in the cache space; when the code rate is too large, the buffer blocks in the buffer space can be used up more quickly, so that data overflow can occur, namely, the video frames are lost due to the fact that no idle buffer blocks exist, and video interruption is caused.
Therefore, in this embodiment, the usage situation of the buffer space may be obtained periodically according to a preset adjustment period, and the usage situation may be represented by an occupancy parameter, and the code rate may be dynamically adjusted according to the occupancy parameter, so that the code rate and the usage rate of the buffer space are balanced.
It can be understood that the code rate is adjusted by periodically acquiring the occupation parameter, so that frequent code rate adjustment to generate jitter can be avoided.
Step S204, determining the image pickup equipment to be adjusted and the code rate parameters according to the occupation parameters and the current code rate of each image pickup equipment;
in this embodiment, the server is in communication connection with a plurality of image capturing devices, and may acquire a current code rate of each image capturing device, determine, in combination with the occupation parameter, an image capturing device that needs to adjust the code rate, that is, obtain an image capturing device to be adjusted, and determine a new code rate, that is, a code rate parameter, of the image capturing device to be adjusted.
Step S206, sending the code rate parameters to the camera equipment to be adjusted so that the camera equipment to be adjusted adjusts the code rate according to the code rate parameters;
in the embodiment, based on the obtained code rate parameter and the image pickup device to be adjusted, the server sends the code rate parameter to the image pickup device to be adjusted; and then the camera equipment to be adjusted receives the code rate parameter and adjusts the code rate parameter, namely, codes according to the code rate parameter.
Based on the steps, the server is in communication connection with a plurality of image pickup devices, the server is provided with a storage space and a cache space comprising a plurality of cache blocks, the cache space is used for caching video data sent by each image pickup device received by the server, and the storage space is used for transferring the cached video data in the cache space when the cache space has no free cache block; periodically acquiring occupation parameters representing the use condition of the cache space according to a preset adjustment period; determining the camera equipment to be adjusted and the code rate parameters according to the occupation parameters and the current code rate of each camera equipment; and then sending the code rate parameter to the camera equipment to be adjusted so that the camera equipment to be adjusted adjusts the code rate according to the code rate parameter. The code rate is dynamically adjusted by periodically acquiring the use condition of the buffer memory space, and the code rate and the use rate of the buffer memory space are balanced, so that the stability of the video is ensured, and the video storage abnormality is effectively avoided.
Optionally, to further ensure stability of the video, for the step S206 described above, an embodiment of the present invention provides a possible implementation manner. Referring to fig. 5, step S206 includes the following steps:
step S206-1, determining a target code rate interval to which the code rate parameter belongs;
Step S206-3, obtaining frame rate parameters corresponding to the target code rate interval, and obtaining target frame rate parameters;
and S206-5, transmitting the code rate parameter and the target frame rate parameter to the camera equipment to be adjusted so that the camera equipment to be adjusted adjusts the code rate according to the code rate parameter and adjusts the frame rate according to the target frame rate parameter.
It will be appreciated that the stability of video is related to the frame rate of the video in addition to the code rate at which the video is encoded. If the code rate is not matched with the frame rate, the video picture is affected. Therefore, in the present embodiment, a plurality of code rate sections and frame rate parameters corresponding to each code rate section are preconfigured.
Determining the code rate interval to which the code rate parameter belongs from all code rate intervals according to the code rate parameter, and obtaining a target code rate interval; then obtaining a frame rate parameter corresponding to the target code rate interval to obtain a target frame rate parameter, wherein the target frame rate parameter can be understood as a frame rate matched with the code rate parameter; and then sending the code rate parameter and the target frame rate parameter to the camera equipment to be adjusted, and respectively adjusting the code rate and the frame rate by the camera equipment to be adjusted according to the received code rate parameter and the target frame rate parameter.
It can be seen that a plurality of code rate intervals and frame rate parameters corresponding to each code rate interval are pre-configured; and determining a target code rate interval according to the code rate parameter, acquiring a frame rate parameter corresponding to the target code rate interval to obtain a target frame rate parameter, and transmitting the code rate parameter and the target frame rate parameter to the to-be-adjusted camera equipment so as to enable the to-be-adjusted camera equipment to adjust the code rate and the frame rate. The frame rate is synchronously adjusted while the code rate is adjusted, so that the frame rate is kept to be matched with the code rate, the influence on the picture effect caused by only adjusting the code rate is avoided, and the stability of the video is ensured.
Alternatively, the occupation parameter may be a percentage of the number of used cache blocks to the total number of all cache blocks, and further for the step S204 described above, a possible implementation is provided in the embodiment of the present invention. Referring to fig. 6, step S204 includes the following steps:
step S204A-1, when the occupation parameter is smaller than or equal to the adjustment threshold, taking the image pickup device with the current code rate smaller than the upper limit value of the code rate as the image pickup device to be adjusted;
step S204A-3, determining code rate parameters according to the occupation parameters, the code rate upper limit value and the current code rate of the camera equipment to be adjusted;
in this embodiment, a fluctuation interval of the code rate, that is, a code rate upper limit value and a code rate lower limit value, are preset, and a threshold value for evaluating the use condition of the buffer space, such as an adjustment threshold value, is also set. The adjustment threshold is used to determine an adjustment trend of the code rate, such as increasing the code rate or decreasing the code rate.
When the occupation parameter is smaller than or equal to the adjustment threshold value, the fact that more idle cache blocks exist in the current cache space is indicated, at the moment, the code rate can be improved, the camera equipment with the current code rate smaller than the upper limit value of the code rate is used as camera equipment to be adjusted, and the new code rate of the camera equipment to be adjusted, namely the code rate parameter, is determined according to the current code rate, the upper limit value of the code rate and the occupation parameter of the camera equipment to be adjusted.
It can be understood that when the occupation parameter is lower than the adjustment threshold, the usage rate of the buffer space is lower at this time, so that the code rate of the image capturing device can be properly improved, so as to improve the efficiency of video encoding.
Step S204B-1, when the occupation parameter is larger than the adjustment threshold, taking the camera equipment with the current code rate larger than the lower limit value of the code rate as the camera equipment to be adjusted;
and step S204B-3, determining a code rate parameter according to the occupation parameter, the code rate lower limit value and the current code rate of the camera equipment to be adjusted.
In this embodiment, when the occupation parameter is greater than the adjustment threshold, it indicates that there are fewer idle buffer blocks or no idle buffer blocks in the current buffer space, and when the code rate needs to be reduced, the image capturing device with the current code rate greater than the lower limit value of the code rate is used as the image capturing device to be adjusted, and according to the current code rate, the lower limit value of the code rate and the occupation parameter of the image capturing device to be adjusted, the new code rate, that is, the code rate parameter of the image capturing device to be adjusted is determined.
It can be understood that when the occupation parameter is higher than the adjustment threshold, the usage rate of the buffer space is higher at this time, and if the code rate is not adjusted, the data overflow may be caused, and the code rate of the image capturing device needs to be reduced to ensure that there is an idle buffer block to buffer the video data, so as to avoid losing the video frame.
Therefore, the utilization rate of the current buffer space is evaluated by adjusting the threshold value, and the adjustment trend of the current code rate is determined to be improved or reduced based on the comparison result of the current buffer space and the occupation parameter, so that the dynamic code rate adjustment is realized, the video data is buffered by keeping the existence of a proper number of idle buffer blocks, and the stability of the video is ensured.
Optionally, for step S204A-3, one possible implementation is provided by an embodiment of the present invention.
Step S204A-3-1, obtaining an average input bandwidth and an average output bandwidth of a current adjustment period;
wherein the average input bandwidth represents the average amount of video data received during the current adjustment period, and the average input bandwidth represents the average amount of video data transferred to the storage space during the current adjustment period.
It will be appreciated that the buffer space is used to buffer video data received by the server, which may be considered as input of data in the buffer space; when the buffer space has no free buffer, the buffered video data in the buffer space is transferred to the storage space, which can be regarded as the output of the data in the buffer space.
Therefore, in this embodiment, each adjustment period may obtain the average input bandwidth and the average output bandwidth of the current adjustment period, and use the average input bandwidth and the average output bandwidth as the reference basis for adjusting the code rate, so as to achieve more accurate adjustment of the code rate.
A plurality of statistical periods may be set in one adjustment period, and an average input bandwidth and an average output bandwidth of the adjustment period may be calculated based on the input bandwidth values and the output bandwidth values corresponding to the plurality of statistical periods. For example, setting an adjustment period to 180 seconds and a statistics period to 10 seconds, there are 18 statistics periods in one adjustment period, and the input bandwidth value of each statistics period in the 18 statistics periods can be obtained and the average value is calculated to obtain an average input bandwidth, and the output bandwidth value of each statistics period is obtained and the average value is calculated to obtain an average output bandwidth.
Step S204A-3-2a, when the occupation parameter is smaller than the observation threshold, calculating an elevated code rate value according to a preset elevation proportion and the current code rate of the camera equipment to be adjusted, and taking the smaller of the elevated code rate value and the code rate upper limit value as the code rate parameter;
in this embodiment, in order to more reasonably adjust the code rate, an observation threshold is further provided to subdivide the usage of the buffer space, where the observation threshold is smaller than the adjustment threshold.
When the occupation parameter is smaller than the observation threshold value, which means that a lot of idle cache blocks exist in the current cache space, the lifted code rate value can be calculated according to the preset lifting proportion and the current code rate of the camera equipment to be adjusted;
For example, the preset boost ratio is expressed by Pup, e.g., pup may be 10%; the current code rate of the camera equipment to be adjusted is expressed by BRcur; the boosted code rate value is BRcur (1+pup). It should be understood that the preset lifting ratio may be set according to practical applications, and embodiments of the present invention are not limited.
And then comparing the raised code rate value with the code rate upper limit value, and taking the smaller of the two values as the code rate parameter. For example, the code rate upper limit value is denoted by BRmax. If BRcur (1+Pup) < BRmax, taking BRcur (1+Pup) as code rate parameter; and if BRcur is (1+Pup) not less than BRmax, taking BRmax as a code rate parameter. I.e. the code rate parameter is min BRmax BRcur (1+pup).
Step S204A-3-2b-1, when the occupation parameter is larger than or equal to the observation threshold, calculating the product of the average output bandwidth and the preset coefficient, and comparing the product with the average input bandwidth;
step S204A-3-2b-2, if the average input bandwidth is smaller than or equal to the product, calculating the lifted code rate value according to the preset lifting proportion and the current code rate of the camera equipment to be adjusted, and taking the smaller of the lifted code rate value and the code rate upper limit value as the code rate parameter.
In this embodiment, when the occupancy parameter is greater than or equal to the observation threshold and less than the adjustment threshold, it is necessary to further determine whether the code rate can be raised based on the average output bandwidth and the average input bandwidth. I.e. the product of the average output bandwidth and a preset coefficient is calculated and compared with the average input bandwidth.
For example, the preset coefficient is represented by s, for example s may be 1.05; the average input bandwidth is denoted by IB; the average output bandwidth is denoted OB. Calculating the product of the average output bandwidth OB and the preset coefficient s, namely OB×s, and comparing the product OB×s with the average input bandwidth IB. It should be understood that the preset coefficient may be set according to practical applications, and the embodiment of the present invention is not limited.
If IB is less than or equal to OB s, it indicates that the difference between the input rate and the output rate of the data in the current buffer space is within the set range. It may be understood that, according to the average input bandwidth IB and the average output bandwidth OB, more idle buffer blocks exist in the buffer space, the lifted code rate value BRcur (1+pup) may be calculated according to the preset lifting proportion Pup and the current code rate BRcur of the image capturing device to be adjusted, and the smaller one of the lifted code rate value BRcur (1+pup) and the code rate upper limit BRmax may be used as the code rate parameter.
If IB > OB s, it indicates that the difference between the input rate and the output rate of the data in the current buffer space is not within the set range, the current adjustment period is not adjusted, and the observation is continued, and how to adjust can be determined again based on each parameter value obtained in the next adjustment period.
It can be seen that the condition of the code rate to be improved is further subdivided by adopting an observation threshold value smaller than the adjustment threshold value, and the code rate is dynamically adjusted by combining the average input bandwidth and the average output bandwidth of the current adjustment period. By considering various factors, the code rate adjustment strategy is more reasonable and comprehensive, and the stability of the video is further ensured.
Optionally, for step S204B-3, one possible implementation is provided by an embodiment of the present invention.
Step S204B-3-1, obtaining an average input bandwidth and an average output bandwidth of a current adjustment period;
wherein the average input bandwidth represents the average amount of video data received during the current adjustment period, and the average input bandwidth represents the average amount of video data transferred to the storage space during the current adjustment period.
It is understood that the implementation and effect of step S204B-3-1 is the same as that of step S204A-3-1, and for brevity, reference is made to the description of step S204A-3-1.
Step S204B-3-2a, when the occupation parameter is greater than or equal to the forced threshold, determining a target reduction ratio according to the average input bandwidth, the average output bandwidth, the preset lower limit reduction ratio and the preset upper limit reduction ratio, and determining a code rate parameter according to the target reduction ratio, the code rate lower limit value and the current code rate of the image pickup device to be adjusted;
In this embodiment, in order to more reasonably adjust the code rate, a mandatory threshold is further provided to subdivide the use condition of the buffer space, where the mandatory threshold is greater than the adjustment threshold.
When the occupation parameter is greater than or equal to the forced threshold, which means that there are few idle cache blocks in the current cache space and the code rate needs to be reduced rapidly, the target reduction ratio can be determined according to the average input bandwidth, the average output bandwidth, the preset lower limit reduction ratio and the preset upper limit reduction ratio, and the code rate parameter is determined according to the target reduction ratio, the code rate lower limit value and the current code rate of the image capturing device to be adjusted.
Step S204B-3-2B-1, when the occupation parameter is smaller than the forced threshold, calculating the product of the average output bandwidth and the preset coefficient, and comparing the product with the average input bandwidth;
step S204B-3-2B-2, if the average input bandwidth is greater than or equal to the product, determining a target reduction ratio according to the average input bandwidth, the average output bandwidth, a preset lower limit reduction ratio and a preset upper limit reduction ratio, and determining a code rate parameter according to the target reduction ratio, a code rate lower limit value and a current code rate of the image pickup device to be adjusted.
In this embodiment, when the occupancy parameter is smaller than the mandatory threshold and larger than the adjustment threshold, it is necessary to further determine whether the code rate needs to be reduced based on the average output bandwidth and the average input bandwidth. That is, a product of the average output bandwidth OB and the preset coefficient s, that is ob×s, is calculated, and the product ob×s is compared with the average input bandwidth IB.
If IB is greater than or equal to OB, it means that the difference between the input rate and the output rate of the data in the current buffer space is not within the set range. It can be understood that, according to the average input bandwidth and the average output bandwidth, there are fewer idle buffer blocks in the buffer space, the target reduction ratio is determined according to the average input bandwidth, the average output bandwidth, the preset lower limit reduction ratio and the preset upper limit reduction ratio, and the code rate parameter is determined according to the target reduction ratio, the code rate lower limit value and the current code rate of the image capturing device to be adjusted.
If IB < OB s, it indicates that the difference between the input rate and the output rate of the data in the current buffer space is within the set range, the current adjustment period is not adjusted, and the observation is continued, and how to adjust can be determined again based on each parameter value obtained in the next adjustment period.
It can be seen that the condition of the code rate to be reduced is further subdivided by adopting a forced threshold value larger than the adjustment threshold value, and the code rate is dynamically adjusted by combining the average input bandwidth and the average output bandwidth of the current adjustment period. By considering various factors, the code rate adjustment strategy is more reasonable and comprehensive, and the stability of the video is further ensured.
Alternatively, one possible implementation is provided by the embodiments of the present invention for the determined target reduction ratio in steps S204B-3-2a and S204B-3-2B-2 described above.
Step S204B-3-2-1, subtracting the average input bandwidth from the average output bandwidth to obtain a difference value, and calculating the ratio of the difference value to the average input bandwidth to obtain a pending reduction ratio;
as in the example above, the average input bandwidth is denoted by IB; the average output bandwidth is denoted OB, the undetermined reduction ratio pd= (IB-OB)/IB.
Step S204B-3-2-2, if the undetermined reduction ratio belongs to a preset lower limit reduction ratio and a preset upper limit reduction ratio, taking the undetermined reduction ratio as a target reduction ratio;
step S204B-3-2-3, if the undetermined reduction ratio is smaller than the preset reduction lower limit ratio, taking the preset reduction lower limit ratio as a target reduction ratio;
step S204B-3-2-4, if the undetermined reduction ratio is greater than the preset reduction upper limit ratio, the preset reduction upper limit ratio is taken as the target reduction ratio.
In this embodiment, a range section for reducing the code rate, that is, a preset lower limit reduction ratio and a preset upper limit reduction ratio, is preset.
For example, the preset lower reduction limit ratio is represented by Pdmin, for example, pdmin may be 5%, and the preset upper reduction limit ratio is represented by Pdmax, for example, pdmax may be 30%. It should be understood that the preset lower limit proportion and the preset upper limit proportion may be set according to practical applications, and the embodiment of the present invention is not limited.
If Pd is epsilon [ Pdmin, pdmax ], taking Pd as a target reduction proportion; if Pd is less than Pdmin, taking the Pdmin as a target reduction ratio; if Pd > Pdmax, pdmax is taken as the target reduction ratio.
Optionally, for determining the code rate parameter according to the target reduction ratio in the above steps S204B-3-2a and S204B-3-2B-2, an embodiment of the present invention provides a possible implementation.
Step S204B-3-2-5, calculating a reduced code rate value according to the target reduction ratio and the current code rate of the camera equipment to be adjusted;
for example, the target reduction ratio is represented by Pdown; the current code rate of the camera equipment to be adjusted is expressed by BRcur; the reduced code rate value is BRcur (1-Pdown).
Step S204B-3-2-6, comparing the reduced code rate value with a code rate lower limit value;
step S204B-3-2-7, if the reduced code rate value is larger than the code rate lower limit value, taking the reduced code rate value as a code rate parameter;
and step S204B-3-2-8, if the reduced code rate value is smaller than or equal to the code rate lower limit value, taking the code rate lower limit value as a code rate parameter.
In this embodiment, the reduced code rate value and the code rate lower limit value are compared, and the larger of them is used as the code rate parameter. For example, the code rate lower limit value is denoted by BRmin. If BRcur (1-Pdown) > BRmin, taking BRcur (1-Pdown) as code rate parameters; and if BRcur is less than or equal to 1-Pdown, taking BRmin as a code rate parameter. I.e. the code rate parameter is max BRmin BRcur (1-Pdown).
For ease of understanding, an example is provided by embodiments of the present invention. For example, the cache space is 400 MBytes, which includes 200 cache blocks, each of which is 2M; the preset adjustment period is 180 seconds, and the preset statistical period is 10 seconds; the lower limit value BRmin of the code rate is 1Mbit/s, and the upper limit value BRmax of the code rate is 4Mbit/s; the observation threshold is 70%, the adjustment threshold is 80%, and the forced threshold is 90%; the preset lifting proportion Pup is 10%, the preset lower limit proportion Pdmin is 5%, and the preset upper limit proportion Pdmax is 30%; the preset coefficient s is 1.05.
And obtaining the use condition of the buffer space every 180 seconds, namely calculating the percentage of the number of used buffer blocks and the total number of all buffer blocks to obtain an occupation parameter P.
When the occupation parameter P is equal to 60%, taking the camera equipment with the current code rate smaller than the upper limit value of the code rate as camera equipment to be adjusted; and then calculating a raised code rate value, namely BRcur (1+10%), according to the current code rate BRcur and a preset raising proportion of 10%, and selecting the smaller code rate value from the raised code rate value and a code rate upper limit value as a code rate parameter, namely BR=min { BRmax, BRcur 1.1}.
Then obtaining a target frame rate parameter FR corresponding to a target code rate interval to which the code rate parameter BR belongs; and then the code rate parameter BR and the target frame rate parameter FR are sent to the camera equipment to be adjusted, and the camera equipment to be adjusted adjusts the code rate and the frame rate respectively according to the received BR and FR.
When the occupation parameter P is equal to 75%, acquiring an average input bandwidth IB and an average output bandwidth OB in the current adjustment period; if IB is less than or equal to OB and 1.05, the code rate is improved according to the condition that P is equal to 60 percent.
When the occupation parameter P is equal to 85%, taking the camera equipment with the current code rate larger than the lower limit value of the code rate as camera equipment to be adjusted; obtaining average input bandwidth IB and average output bandwidth OB in a current adjustment period; if IB is greater than or equal to OB s, calculating a pending reduction ratio pd= (IB-OB)/IB, and determining a target reduction ratio Pdown according to Pd, pdmin and Pdmax.
Then calculating a reduced code rate value (BRcur) which is 1-Pdown according to the current code rate BRcur and a target reduction proportion Pdown, and selecting a larger code rate value from the reduced code rate value and a code rate lower limit value as a code rate parameter (BR=max { BRmin, BRcur (1-Pdown));
then obtaining a target frame rate parameter FR corresponding to a target code rate interval to which the code rate parameter BR belongs; and then the code rate parameter BR and the target frame rate parameter FR are sent to the camera equipment to be adjusted, and the camera equipment to be adjusted adjusts the code rate and the frame rate respectively according to the received BR and FR.
When the occupation parameter P is equal to 95%, taking the camera equipment with the current code rate larger than the lower limit value of the code rate as camera equipment to be adjusted; and the code rate is reduced according to the case that P is equal to 85% as described above.
In order to perform the corresponding steps in the above embodiments and in each possible manner, an implementation of the code rate adjustment device is given below. Referring to fig. 7, fig. 7 is a functional block diagram of a code rate adjusting device 300 according to an embodiment of the invention. It should be noted that, the basic principle and the technical effects of the code rate adjusting device 300 provided in this embodiment are the same as those of the foregoing embodiments, and for brevity, reference may be made to the corresponding contents of the foregoing embodiments. The code rate adjustment device 300 includes:
an obtaining module 310, configured to obtain, periodically, according to a preset adjustment period, an occupancy parameter that indicates a usage situation of a cache space;
a determining module 330, configured to determine an image capturing device to be adjusted and a code rate parameter according to the occupancy parameter and a current code rate of each image capturing device;
and the adjusting module 350 is configured to send the code rate parameter to the image capturing device to be adjusted, so that the image capturing device to be adjusted adjusts the code rate according to the code rate parameter.
Optionally, the adjustment module 350 module is further configured to: determining a target code rate interval to which the code rate parameter belongs; obtaining a frame rate parameter corresponding to a target code rate interval to obtain a target frame rate parameter; and sending the code rate parameter and the target frame rate parameter to the camera equipment to be adjusted so that the camera equipment to be adjusted adjusts the code rate according to the code rate parameter and adjusts the frame rate according to the target frame rate parameter.
Optionally, the determining module 330 module is further configured to: when the occupation parameter is smaller than or equal to the adjustment threshold, taking the camera equipment with the current code rate smaller than the upper limit value of the code rate as the camera equipment to be adjusted; determining a code rate parameter according to the occupation parameter, the code rate upper limit value and the current code rate of the camera equipment to be adjusted;
when the occupation parameter is larger than the adjustment threshold, taking the camera equipment with the current code rate larger than the lower limit value of the code rate as camera equipment to be adjusted; and determining the code rate parameter according to the occupation parameter, the code rate lower limit value and the current code rate of the camera equipment to be adjusted.
Optionally, the determining module 330 module is further configured to: acquiring an average input bandwidth and an average output bandwidth of a current adjustment period, wherein the average input bandwidth represents an average video data amount received in the current adjustment period, and the average input bandwidth represents an average video data amount transferred to a storage space in the current adjustment period;
when the occupied parameter is smaller than the observation threshold, calculating an elevated code rate value according to a preset elevation proportion and the current code rate of the camera equipment to be adjusted, and taking the smaller of the elevated code rate value and the code rate upper limit value as the code rate parameter;
when the occupation parameter is larger than or equal to the observation threshold value, calculating the product of the average output bandwidth and a preset coefficient, and comparing the product with the average input bandwidth; if the average input bandwidth is smaller than or equal to the product, calculating the lifted code rate value according to the preset lifting proportion and the current code rate of the camera equipment to be adjusted, and taking the smaller one of the lifted code rate value and the code rate upper limit value as the code rate parameter.
Optionally, the determining module 330 module is further configured to: acquiring an average input bandwidth and an average output bandwidth of a current adjustment period, wherein the average input bandwidth represents an average video data amount received in the current adjustment period, and the average input bandwidth represents an average video data amount transferred to a storage space in the current adjustment period;
when the occupation parameter is larger than or equal to the forced threshold, determining a target reduction ratio according to the average input bandwidth, the average output bandwidth, the preset lower limit reduction ratio and the preset upper limit reduction ratio, and determining a code rate parameter according to the target reduction ratio, the code rate lower limit value and the current code rate of the camera equipment to be adjusted;
when the occupation parameter is smaller than the forced threshold, calculating the product of the average output bandwidth and a preset coefficient, and comparing the product with the average input bandwidth; if the average input bandwidth is greater than or equal to the product, determining a target reduction ratio according to the average input bandwidth, the average output bandwidth, a preset lower limit reduction ratio and a preset upper limit reduction ratio, and determining a code rate parameter according to the target reduction ratio, a code rate lower limit value and a current code rate of the image pickup equipment to be adjusted.
Optionally, the determining module 330 module is further configured to: subtracting the average input bandwidth from the average output bandwidth to obtain a difference value, and calculating the ratio of the difference value to the average input bandwidth to obtain a pending reduction ratio;
If the undetermined reduction ratio belongs to a range between the preset lower limit reduction ratio and the preset upper limit reduction ratio, taking the undetermined reduction ratio as a target reduction ratio;
if the undetermined reduction ratio is smaller than the preset reduction lower limit ratio, taking the preset reduction lower limit ratio as a target reduction ratio;
and if the undetermined reduction ratio is larger than the preset reduction upper limit ratio, taking the preset reduction upper limit ratio as a target reduction ratio.
Optionally, the determining module 330 module is further configured to: calculating a reduced code rate value according to the target reduction ratio and the current code rate of the camera equipment to be adjusted; comparing the reduced code rate value with a code rate lower limit value;
if the reduced code rate value is larger than the code rate lower limit value, taking the reduced code rate value as a code rate parameter;
and if the reduced code rate value is smaller than or equal to the code rate lower limit value, taking the code rate lower limit value as a code rate parameter.
The embodiment of the invention also provides a server, which comprises a processor 120 and a memory 130, wherein the memory 130 stores a computer program, and the code rate adjusting method disclosed in the above embodiment is realized when the processor executes the computer program.
The embodiment of the present invention also provides a storage medium having a computer program stored thereon, which when executed by the processor 120 implements the code rate adjustment method disclosed in the embodiment of the present invention.
In summary, the code rate adjusting method, the device, the server and the storage medium provided by the embodiment of the invention. The server is in communication connection with the plurality of camera devices, the server is provided with a storage space and a cache space comprising a plurality of cache blocks, the cache space is used for caching video data sent by each camera device and received by the server, and the storage space is used for transferring the cached video data in the cache space when the cache space has no free cache block; periodically acquiring occupation parameters representing the use condition of the cache space according to a preset adjustment period; determining the camera equipment to be adjusted and the code rate parameters according to the occupation parameters and the current code rate of each camera equipment; and then sending the code rate parameter to the camera equipment to be adjusted so that the camera equipment to be adjusted adjusts the code rate according to the code rate parameter. The code rate is dynamically adjusted by periodically acquiring the use condition of the buffer memory space, and the code rate and the use rate of the buffer memory space are balanced, so that the stability of the video is ensured, and the video storage abnormality is effectively avoided.
In the several embodiments provided in the present invention, it should be understood that the disclosed apparatus and method may be implemented in other manners. The apparatus embodiments described above are merely illustrative, for example, of the flowcharts and block diagrams in the figures that illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, functional modules in the embodiments of the present invention may be integrated together to form a single part, or each module may exist alone, or two or more modules may be integrated to form a single part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored on a computer readable storage medium. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method of the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The above is only a preferred embodiment of the present invention, and is not intended to limit the present invention, but various modifications and variations can be made to the present invention by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (8)

1. A code rate adjustment method, applied to a server, where the server is communicatively connected to a plurality of image capturing devices, the server has a storage space and a buffer space including a plurality of buffer blocks, the buffer space is used for buffering video data sent by each image capturing device received by the server, and the storage space is used for restoring the buffered video data in the buffer space when the buffer space has no free buffer block, the method includes:
periodically acquiring occupation parameters representing the use condition of the cache space according to a preset adjustment period;
determining the camera equipment to be adjusted and the code rate parameters according to the occupation parameters and the current code rate of each camera equipment;
sending the code rate parameter to the to-be-adjusted camera equipment so that the to-be-adjusted camera equipment adjusts the code rate according to the code rate parameter;
the occupation parameter is the percentage of the number of used cache blocks and the total number of all cache blocks, and the server pre-stores an adjustment threshold value, a code rate upper limit value and a code rate lower limit value;
the step of determining the parameters of the image capturing device and the code rate to be adjusted according to the occupation parameters and the current code rate of each image capturing device comprises the following steps:
When the occupation parameter is smaller than or equal to the adjustment threshold, taking the image pickup device with the current code rate smaller than the code rate upper limit value as the image pickup device to be adjusted;
determining the code rate parameter according to the occupation parameter, the code rate upper limit value and the current code rate of the camera equipment to be adjusted;
when the occupation parameter is larger than the adjustment threshold, taking the image pickup device with the current code rate larger than the code rate lower limit value as the image pickup device to be adjusted;
determining the code rate parameter according to the occupation parameter, the code rate lower limit value and the current code rate of the camera equipment to be adjusted;
the server is also pre-stored with an observation threshold value, a preset lifting proportion and a preset coefficient; the observation threshold is less than the adjustment threshold;
the step of determining the code rate parameter according to the occupation parameter, the code rate upper limit value and the current code rate of the to-be-adjusted camera equipment comprises the following steps:
obtaining an average input bandwidth and an average output bandwidth of a current adjustment period, wherein the average input bandwidth represents an average video data amount received in the current adjustment period, and the average input bandwidth represents an average video data amount transferred to the storage space in the current adjustment period;
When the occupation parameter is smaller than the observation threshold, calculating a lifted code rate value according to the preset lifting proportion and the current code rate of the to-be-adjusted camera equipment, and taking the smaller one of the lifted code rate value and the code rate upper limit value as the code rate parameter;
when the occupation parameter is larger than or equal to the observation threshold value, calculating the product of the average output bandwidth and a preset coefficient, and comparing the product with the average input bandwidth;
if the average input bandwidth is smaller than or equal to the product, calculating a lifted code rate value according to the preset lifting proportion and the current code rate of the to-be-adjusted camera equipment, and taking the smaller one of the lifted code rate value and the code rate upper limit value as the code rate parameter.
2. The method according to claim 1, wherein the server pre-stores a plurality of code rate intervals and frame rate parameters corresponding to each code rate interval;
after the step of determining the image capturing apparatus and the code rate parameters to be adjusted according to the occupancy parameter and the current code rate of each image capturing apparatus, the method further includes:
determining a target code rate interval to which the code rate parameter belongs;
Obtaining a frame rate parameter corresponding to the target code rate interval to obtain a target frame rate parameter;
and sending the code rate parameter and the target frame rate parameter to the to-be-adjusted camera equipment so that the to-be-adjusted camera equipment adjusts the code rate according to the code rate parameter and adjusts the frame rate according to the target frame rate parameter.
3. The method according to claim 1, wherein the server further pre-stores a forced threshold, a preset lower limit reduction ratio, a preset upper limit reduction ratio, and a preset coefficient; the forced threshold is greater than the adjusted threshold;
the step of determining the code rate parameter according to the occupation parameter, the code rate lower limit value and the current code rate of the to-be-adjusted camera equipment comprises the following steps:
obtaining an average input bandwidth and an average output bandwidth of a current adjustment period, wherein the average input bandwidth represents an average video data amount received in the current adjustment period, and the average input bandwidth represents an average video data amount transferred to the storage space in the current adjustment period;
when the occupation parameter is larger than or equal to the forced threshold, determining a target reduction ratio according to the average input bandwidth, the average output bandwidth, the preset lower limit reduction ratio and the preset upper limit reduction ratio, and determining the code rate parameter according to the target reduction ratio, the code rate lower limit value and the current code rate of the to-be-adjusted image pickup device;
When the occupation parameter is smaller than the forced threshold, calculating the product of the average output bandwidth and a preset coefficient, and comparing the product with the average input bandwidth;
if the average input bandwidth is greater than or equal to the product, determining a target reduction ratio according to the average input bandwidth, the average output bandwidth, the preset lower limit reduction ratio and the preset upper limit reduction ratio, and determining the code rate parameter according to the target reduction ratio, the code rate lower limit value and the current code rate of the to-be-adjusted image pickup device.
4. A method according to claim 3, wherein the step of determining a target reduction ratio based on the average input bandwidth, average output bandwidth, the preset lower reduction limit ratio and preset upper reduction limit ratio comprises:
subtracting the average input bandwidth from the average output bandwidth to obtain a difference value, and calculating the ratio of the difference value to the average input bandwidth to obtain a pending reduction ratio;
if the undetermined reduction ratio belongs to a range between the preset reduction lower limit ratio and the preset reduction upper limit ratio, taking the undetermined reduction ratio as the target reduction ratio;
If the undetermined reduction ratio is smaller than the preset reduction lower limit ratio, taking the preset reduction lower limit ratio as the target reduction ratio;
and if the undetermined reduction ratio is larger than the preset reduction upper limit ratio, taking the preset reduction upper limit ratio as the target reduction ratio.
5. The method according to claim 3, wherein the step of determining the code rate parameter according to the target reduction ratio, the code rate lower limit value, and the current code rate of the image pickup apparatus to be adjusted includes:
calculating a reduced code rate value according to the target reduction ratio and the current code rate of the to-be-adjusted camera equipment;
comparing the reduced code rate value with the code rate lower limit value;
if the reduced code rate value is larger than the code rate lower limit value, taking the reduced code rate value as the code rate parameter;
and if the reduced code rate value is smaller than or equal to the code rate lower limit value, taking the code rate lower limit value as the code rate parameter.
6. A code rate adjustment device, applied to a server, the server being communicatively connected to a plurality of image capturing apparatuses, the server having a storage space and a buffer space including a plurality of buffer blocks, the buffer space being used for buffering video data transmitted by each of the image capturing apparatuses received by the server, the storage space being used for, when the buffer space has no free buffer block, restoring the buffered video data in the buffer space, the device comprising:
The acquisition module is used for periodically acquiring occupation parameters representing the use condition of the cache space according to a preset adjustment period;
the determining module is used for determining the image pickup equipment to be adjusted and the code rate parameters according to the occupation parameters and the current code rate of each image pickup equipment;
the adjusting module is used for sending the code rate parameter to the to-be-adjusted camera equipment so that the to-be-adjusted camera equipment adjusts the code rate according to the code rate parameter;
the occupation parameter is the percentage of the number of used cache blocks and the total number of all cache blocks, and the server pre-stores an adjustment threshold value, a code rate upper limit value and a code rate lower limit value; the determining module is further configured to: when the occupation parameter is smaller than or equal to the adjustment threshold, taking the image pickup device with the current code rate smaller than the code rate upper limit value as the image pickup device to be adjusted; determining the code rate parameter according to the occupation parameter, the code rate upper limit value and the current code rate of the camera equipment to be adjusted; when the occupation parameter is larger than the adjustment threshold, taking the image pickup device with the current code rate larger than the code rate lower limit value as the image pickup device to be adjusted; determining the code rate parameter according to the occupation parameter, the code rate lower limit value and the current code rate of the camera equipment to be adjusted;
The server is also pre-stored with an observation threshold value, a preset lifting proportion and a preset coefficient; the observation threshold is less than the adjustment threshold; the determining module is further configured to: obtaining an average input bandwidth and an average output bandwidth of a current adjustment period, wherein the average input bandwidth represents an average video data amount received in the current adjustment period, and the average input bandwidth represents an average video data amount transferred to the storage space in the current adjustment period; when the occupation parameter is smaller than the observation threshold, calculating a lifted code rate value according to the preset lifting proportion and the current code rate of the to-be-adjusted camera equipment, and taking the smaller one of the lifted code rate value and the code rate upper limit value as the code rate parameter; when the occupation parameter is larger than or equal to the observation threshold value, calculating the product of the average output bandwidth and a preset coefficient, and comparing the product with the average input bandwidth; if the average input bandwidth is smaller than or equal to the product, calculating a lifted code rate value according to the preset lifting proportion and the current code rate of the to-be-adjusted camera equipment, and taking the smaller one of the lifted code rate value and the code rate upper limit value as the code rate parameter.
7. A server comprising a processor and a memory, the memory storing a computer program, the processor implementing the method of any one of claims 1 to 5 when executing the computer program.
8. A storage medium having stored thereon a computer program which, when executed by a processor, implements the method of any of claims 1 to 5.
CN202210768344.1A 2022-06-30 2022-06-30 Code rate adjusting method, device, server and storage medium Active CN114979726B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210768344.1A CN114979726B (en) 2022-06-30 2022-06-30 Code rate adjusting method, device, server and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210768344.1A CN114979726B (en) 2022-06-30 2022-06-30 Code rate adjusting method, device, server and storage medium

Publications (2)

Publication Number Publication Date
CN114979726A CN114979726A (en) 2022-08-30
CN114979726B true CN114979726B (en) 2023-09-26

Family

ID=82967630

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210768344.1A Active CN114979726B (en) 2022-06-30 2022-06-30 Code rate adjusting method, device, server and storage medium

Country Status (1)

Country Link
CN (1) CN114979726B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101771492A (en) * 2008-12-29 2010-07-07 华为技术有限公司 Method and device for adjusting streaming media bit rate
CN105025249A (en) * 2014-04-22 2015-11-04 中国移动通信集团江苏有限公司 Video monitoring data transmission control method, apparatus and video monitoring system
CN106162229A (en) * 2015-04-10 2016-11-23 北京大学 Improve smooth code check adaptive approach and the device of fairness
CN107333169A (en) * 2017-06-30 2017-11-07 郑州云海信息技术有限公司 A kind of client-cache method of adjustment and device
WO2018000567A1 (en) * 2016-06-30 2018-01-04 宇龙计算机通信科技(深圳)有限公司 Frame rate adjustment method and device
CN109040855A (en) * 2018-09-03 2018-12-18 重庆邮电大学 A kind of wireless DASH streaming media bit rate smooth adaptive transmission method
CN110769296A (en) * 2019-10-30 2020-02-07 杭州叙简科技股份有限公司 Video code rate self-adaptive adjusting mode based on local cache during transmission
CN112637631A (en) * 2020-12-17 2021-04-09 清华大学 Code rate determining method and device, electronic equipment and storage medium
WO2022111111A1 (en) * 2020-11-26 2022-06-02 Oppo广东移动通信有限公司 Audio transmission method and apparatus, smart device, and computer-readable storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120195356A1 (en) * 2011-01-31 2012-08-02 Apple Inc. Resource usage control for real time video encoding
JP2017157903A (en) * 2016-02-29 2017-09-07 富士ゼロックス株式会社 Information processor

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101771492A (en) * 2008-12-29 2010-07-07 华为技术有限公司 Method and device for adjusting streaming media bit rate
CN105025249A (en) * 2014-04-22 2015-11-04 中国移动通信集团江苏有限公司 Video monitoring data transmission control method, apparatus and video monitoring system
CN106162229A (en) * 2015-04-10 2016-11-23 北京大学 Improve smooth code check adaptive approach and the device of fairness
WO2018000567A1 (en) * 2016-06-30 2018-01-04 宇龙计算机通信科技(深圳)有限公司 Frame rate adjustment method and device
CN107333169A (en) * 2017-06-30 2017-11-07 郑州云海信息技术有限公司 A kind of client-cache method of adjustment and device
CN109040855A (en) * 2018-09-03 2018-12-18 重庆邮电大学 A kind of wireless DASH streaming media bit rate smooth adaptive transmission method
CN110769296A (en) * 2019-10-30 2020-02-07 杭州叙简科技股份有限公司 Video code rate self-adaptive adjusting mode based on local cache during transmission
WO2022111111A1 (en) * 2020-11-26 2022-06-02 Oppo广东移动通信有限公司 Audio transmission method and apparatus, smart device, and computer-readable storage medium
CN112637631A (en) * 2020-12-17 2021-04-09 清华大学 Code rate determining method and device, electronic equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
罗际炜;瞿涛;邓徳祥.嵌入式多通道无线视频传输的码率自适应算法.计算机应用.(04), *

Also Published As

Publication number Publication date
CN114979726A (en) 2022-08-30

Similar Documents

Publication Publication Date Title
CN109600610B (en) Data encoding method, terminal and computer readable storage medium
WO2012154808A2 (en) Providing adaptive media optimization
EP3014854B1 (en) Method for adapting the downloading behavior of a client terminal configured to receive multimedia content, and corresponding terminal.
CN111263153B (en) Video encoding method, device, equipment and storage medium
CN111107017A (en) Method, equipment and storage medium for processing switch message congestion
CN110690988A (en) Bandwidth control method, bandwidth control platform, server and storage medium
US20160234118A1 (en) Method, System and Device for Managing Congestion in Network Services
CN111093094A (en) Video transcoding method, device and system, electronic equipment and readable storage medium
CN114466194A (en) Video coding adjusting method and device, storage medium and electronic equipment
WO2023174254A1 (en) Video posting method and apparatus, and device and storage medium
CN111768790B (en) Method and device for transmitting voice data
CN110324681B (en) Slicing method, device, storage medium and transmission system of multimedia data
CN114979726B (en) Code rate adjusting method, device, server and storage medium
CN109769125B (en) Dynamic adjustment method for streaming media code rate, media server and transcoding server
US20130007206A1 (en) Transmission apparatus, control method for transmission apparatus, and storage medium
CN114189705A (en) Live broadcast card pause processing method and system
CN112565016B (en) Positioning method, system and device for abnormal time delay, electronic equipment and storage medium
CN108429705B (en) Link bandwidth allocation method and device
CN115767149A (en) Video data transmission method and device
CN112737971B (en) Data processing method, device, storage medium and network equipment
JP6999633B2 (en) Adaptive storage across multiple cameras in a video recording system
CN114866763A (en) Video quality evaluation method and device, terminal equipment and storage medium
CN112533029A (en) Video time-sharing transmission method, camera device, system and storage medium
CN113207011A (en) Pre-loading method for short video processing
KR102101507B1 (en) Method and Apparatus for Lossless Network Video Transmission

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant