CN114979726A - 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
CN114979726A
CN114979726A CN202210768344.1A CN202210768344A CN114979726A CN 114979726 A CN114979726 A CN 114979726A CN 202210768344 A CN202210768344 A CN 202210768344A CN 114979726 A CN114979726 A CN 114979726A
Authority
CN
China
Prior art keywords
code rate
parameter
adjusted
camera equipment
preset
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.)
Granted
Application number
CN202210768344.1A
Other languages
Chinese (zh)
Other versions
CN114979726B (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

Images

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)
  • General Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Studio Devices (AREA)

Abstract

The invention relates to the technical field of video storage, and provides a code rate adjusting method, a code rate adjusting device, a server and a storage medium. The server is in communication connection with the plurality of camera devices, and is provided with a storage space and a cache space comprising a plurality of cache blocks, wherein the cache space is used for caching the video data received by the server and sent by each camera device, and the storage space is used for transferring the cached video data in the cache space when no idle cache block exists in the cache space; acquiring occupation parameters representing the use condition of the cache space periodically according to a preset adjustment period; determining the camera equipment to be adjusted and code rate parameters according to the occupation parameters and the current code rate of each camera equipment; and then 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. The code rate is dynamically adjusted by periodically acquiring the use condition of the cache space, so that the stability of the video is ensured, and the abnormal video storage 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 code rate adjusting device, a server and a storage medium.
Background
Along with the development of economy, people pay more and more attention to safety. The implementation of monitoring platforms such as skynet and safe cities in all parts of the country promotes the rapid development of the security industry. Video storage is the core of security industry, and because the actual application environment is complicated, many factors can cause video storage abnormity. The code rate of the camera is very critical to video storage, and therefore how to adjust the code rate of the camera is a concern.
Disclosure of Invention
In view of the above, the present invention provides a method, an apparatus, a server and a storage medium for adjusting a bitrate.
In order to achieve the above object, the embodiments of the present invention adopt the following technical solutions:
in a first aspect, the present invention provides a code rate adjustment method, which is applied to a server, where the server is in communication connection with a plurality of camera devices, the server has a storage space and a cache space including a plurality of cache blocks, the cache space is used to cache video data sent by each camera device and received by the server, and the storage space is used to transfer the cached video data in the cache space when there is no free cache block in the cache space, where the method includes:
acquiring occupation parameters representing the use condition of the cache space periodically according to a preset adjustment period;
determining the camera equipment to be adjusted and 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 camera equipment to be adjusted so that the camera equipment to be adjusted adjusts the code rate according to the code rate parameter.
In an optional embodiment, the server prestores a plurality of code rate intervals and frame rate parameters corresponding to each code rate interval;
after the step of determining the camera devices to be adjusted and the code rate parameters according to the occupancy parameters and the current code rate of each camera device, the method further includes:
determining a target code rate interval to which the code rate parameter belongs;
acquiring frame rate parameters corresponding to the target code rate interval to obtain target frame rate parameters;
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.
In an optional embodiment, the occupancy 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 and a code rate lower limit;
the step of determining the camera equipment to be adjusted and the code rate parameter according to the occupation parameter and the current code rate of each camera equipment comprises the following steps:
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 code rate upper limit value as the camera equipment 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 camera equipment with the current code rate larger than the code rate lower limit value as the 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.
In an optional embodiment, the server further prestores 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 camera equipment to be adjusted comprises the following steps:
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 volume received in the current adjustment period, and the average input bandwidth represents an average video data volume transferred to the storage space in the current adjustment period;
when the occupation parameter is smaller than the observation threshold, calculating an improved code rate value according to the preset improvement proportion and the current code rate of the camera equipment to be adjusted, and taking the smaller of the improved code rate value and the upper limit value of the code rate as the code rate parameter;
when the occupancy parameter is greater than or equal to the observation threshold, calculating a 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 an improved code rate value according to the preset improvement proportion and the current code rate of the camera equipment to be adjusted, and taking the smaller of the improved code rate value and the upper limit value of the code rate as the code rate parameter.
In an optional embodiment, the server further prestores a mandatory threshold, a preset lower limit reduction ratio, a preset upper limit reduction ratio, and a preset coefficient; the mandatory threshold is greater than the adjusted threshold;
the step of determining the code rate parameter according to the occupied parameter, the code rate lower limit value and the current code rate of the camera equipment to be adjusted comprises the following steps:
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 volume received in the current adjustment period, and the average input bandwidth represents an average video data volume transferred to the storage space in the current adjustment period;
when the occupied parameter is larger than or equal to the mandatory threshold, determining a target reduction proportion according to the average input bandwidth, the average output bandwidth, the preset reduction lower limit proportion and the preset reduction upper limit proportion, and determining the code rate parameter according to the target reduction proportion, 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 mandatory 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 larger than or equal to the product, determining a target reduction ratio according to the average input bandwidth, the average output bandwidth, the preset reduction lower limit ratio and the preset reduction upper limit 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 camera equipment to be adjusted.
In an optional embodiment, the step of determining a target reduction ratio according to the average input bandwidth, the average output bandwidth, the preset reduction lower limit ratio, and the preset reduction upper 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 ratio to be reduced;
if the ratio to be reduced belongs to the range between the preset lower reduction limit ratio and the preset upper reduction limit ratio, taking the ratio to be reduced as the target reduction ratio;
if the ratio to be reduced is smaller than the preset lower limit reduction ratio, taking the preset lower limit reduction ratio as the target reduction ratio;
and if the undetermined reduction proportion is larger than the preset reduction upper limit proportion, taking the preset reduction upper limit proportion as the target reduction proportion.
In an optional embodiment, 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 image capturing apparatus includes:
calculating a reduced code rate value according to the target reduction proportion and the current code rate of the camera equipment to be adjusted;
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 less 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, where the server is in communication connection with a plurality of image capturing devices, the server has a storage space and a cache space including a plurality of cache blocks, the cache space is used to cache video data sent by each image capturing device received by the server, and the storage space is used to transfer the cached video data in the cache space when there is no free cache block in the cache space, where the apparatus includes:
the acquisition module is used for periodically acquiring the occupation parameters representing the use condition of the cache space according to a preset adjustment period;
the determining module is used for determining the camera equipment to be adjusted and the code rate parameter according to the occupation parameter and the current code rate of each camera equipment;
and the adjusting module is used for sending the code rate parameter to the camera equipment to be adjusted so as to enable the camera equipment to be adjusted to adjust 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, wherein the memory stores a computer program, and the processor implements the method of any one of the foregoing 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 the method of any of the preceding embodiments.
The code rate adjusting method, the code rate adjusting device, the server and the storage medium provided by the embodiment of the invention have the advantages that 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 no idle cache block exists in the cache space; acquiring occupation parameters representing the use condition of the cache space periodically according to a preset adjustment period; determining the camera equipment to be adjusted and code rate parameters according to the occupation parameters and the current code rate of each camera equipment; and then 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. The code rate is dynamically adjusted by periodically acquiring the use condition of the cache space, and the code rate and the use rate of the cache space are balanced, so that the stability of the video is ensured, and the abnormal storage of the video is effectively avoided.
In order to make the aforementioned and other objects, features and advantages of the present invention 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 needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
FIG. 1 is a schematic diagram of a scenario provided by an embodiment of the present invention;
FIG. 2 is a schematic diagram of another scenario provided by an embodiment of the present invention;
FIG. 3 is a block diagram of a server provided by an embodiment of the invention;
fig. 4 is a flowchart illustrating a method for adjusting a code rate according to an embodiment of the present invention;
fig. 5 is a schematic flow chart illustrating a method for adjusting a code rate according to an embodiment of the present invention;
fig. 6 is a schematic flow chart illustrating a method for adjusting a code rate according to an embodiment of the present invention;
fig. 7 is a functional block diagram of a bitrate adjustment apparatus according to an embodiment of the present invention.
Icon: 101-an image pickup apparatus; 103-a server; 105-a storage cluster; 110-a bus; 120-a processor; 130-a memory; 170 — a communication interface; 300-code rate adjusting means; 310-an acquisition module; 330-a determination module; 350-adjusting module.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. The components of 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 present 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 derived by a person skilled in the art from the embodiments of the present invention without making any creative effort, shall fall within the protection scope of the present invention.
It is noted that relational terms such as "first" and "second," and the like, may be 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. Also, 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 an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
Along with the development of economy, people pay more and more attention to safety. The implementation of monitoring platforms such as skynet and safe cities in all parts of the country promotes the rapid development of the security industry. Video storage is the core of security industry, and the stability of video storage is an important index for measuring a set of products or a system. Due to the fact that actual production and application environments are complex, video storage abnormity can be caused by factors such as network fluctuation, storage disk slow disc, single storage IO high-delay fluctuation, average IO delay increase caused by storage cluster reconstruction and the like.
There are several 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 judging the network condition according to the data transmission condition of the sending end and the receiving end to further adjust the code rate. However, these methods cannot avoid buffer overflow, video frame loss, video jam, interruption, and the like. Further, an embodiment of the present invention provides a method for adjusting a code rate to solve the above problem.
Fig. 1 is a schematic view of a scene according to an embodiment of the present invention. Including a plurality of image pickup apparatuses 101 and a server 103. The image pickup apparatus 101 and the server 103 may be connected by a standard ONVIF protocol. The server 103 may be an independent server or a server cluster composed of a plurality of servers.
The server 103 has a cache space and a storage space. The cache space is used for caching the 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 is used up.
Optionally, another scene schematic diagram is provided in the embodiment of the present invention, please refer to fig. 2. Including a plurality of image capture devices 101, servers 103, and storage clusters 105. The image pickup apparatus 101 and the server 103 may be connected by a standard ONVIF protocol, and the server 103 and the storage cluster 105 may be connected by an NFS protocol. The storage cluster 105 may be a three-node NAS cluster. The server 103 has a cache space. Storage cluster 105 is used to provide storage space.
Fig. 3 is a schematic block diagram of a server according to an embodiment of the present invention. The server includes a bus 110, a processor 120, a memory 130, and a communication interface 170.
Bus 110 may be circuitry that interconnects the above-described elements and passes communications (e.g., control messages) between the above-described elements.
The processor 120 may receive commands from the above-described other elements (e.g., the memory 130, the communication interface 170, etc.) through the bus 110, may interpret the received commands, and may perform calculations or data processing according to the interpreted commands.
The processor 120 may be an integrated circuit chip having signal processing capabilities. The Processor 120 may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components.
Memory 130 may store commands or data received from processor 120 or other elements (e.g., communication interface 170, etc.) or generated by processor 120 or other elements.
The Memory 130 may be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Read-Only Memory (EPROM), and an electrically Erasable Read-Only Memory (EEPROM).
Communication interface 170 may be used for communicating 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 a server may 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 is to be understood that the structure shown in fig. 3 may also be used to implement the above-described image pickup apparatus and storage terminal.
It can be understood that the server is installed with a video access platform, and the video access platform is used for executing the code rate adjustment method provided by the embodiment of the invention.
The following describes a code rate adjustment method according to an embodiment of the present invention with reference to the scenario shown in fig. 1. Referring to fig. 4, fig. 4 is a flowchart illustrating a method for adjusting a code rate according to an embodiment of the present invention.
Step S202, regularly 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 plurality of cache blocks have the same size.
The camera equipment sends video data to the server, and the server caches the received video data to a cache block of a cache space; when the buffer space is used up, that is, no free buffer block exists, the buffered video data in the buffer space is transferred to the storage space to release the buffer block.
Due to the fact that the buffer space is limited, the use condition of the buffer space is related to the code rate of the camera shooting equipment. 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 are used up quickly, and data overflow may occur, that is, video frames are lost due to no idle buffer blocks, thereby causing video interruption.
Therefore, in this embodiment, the usage of the buffer space may be periodically obtained according to a preset adjustment period, and this usage may be represented by an occupancy parameter, and the code rate is dynamically adjusted according to the occupancy parameter, so as to keep the balance between the code rate and the usage rate of the buffer space.
It can be understood that the code rate is adjusted by periodically obtaining the occupancy parameter, so that the jitter caused by frequently adjusting the code rate can be avoided.
Step S204, determining the camera equipment to be adjusted and code rate parameters according to the occupation parameters and the current code rate of each camera equipment;
in this embodiment, the server is in communication connection with the plurality of camera devices, and can acquire the current code rate of each camera device, determine, in combination with the occupancy parameter, the camera device whose code rate needs to be adjusted, that is, obtain the camera device to be adjusted, and determine a new code rate of the camera device to be adjusted, that is, a code rate parameter.
Step S206, 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;
in this embodiment, based on the obtained code rate parameter and the camera device to be adjusted, the server sends the code rate parameter to the camera device to be adjusted; and then the camera equipment to be adjusted receives and adjusts the code rate parameter, namely, the camera equipment is coded according to the code rate parameter.
Based on the above steps, the server is in communication connection with the plurality of camera devices, the server has a storage space and a cache space including a plurality of cache blocks, the cache space is used for caching the 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 no idle cache block exists in the cache space; acquiring occupation parameters representing the use condition of the cache space periodically according to a preset adjustment period; determining the camera equipment to be adjusted and code rate parameters according to the occupation parameters and the current code rate of each camera equipment; and then 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. The code rate is dynamically adjusted by regularly acquiring the use condition of the cache space, and the code rate and the use rate of the cache space are balanced, so that the stability of the video is ensured, and the abnormal video storage is effectively avoided.
Optionally, to further ensure the stability of the video, for the step S206, the 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 to obtain target frame rate parameters;
and step S206-5, 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.
It can be understood that the stability of a video is related to the frame rate of the video in addition to the bitrate of the video coding. If the bit rate is not matched with the frame rate, the video picture is affected. Therefore, in this embodiment, a plurality of rate intervals and a frame rate parameter corresponding to each rate interval are configured in advance.
Determining the code rate interval to which the code rate parameter belongs from all code rate intervals according to the code rate parameter to obtain a target code rate interval; then obtaining frame rate parameters corresponding to the target code rate interval to obtain target frame rate parameters, wherein the target frame rate parameters can be understood as frame rates matched with the code rate parameters; 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 received target frame rate parameter.
As can be seen, a plurality of code rate intervals and frame rate parameters corresponding to each code rate interval are configured in advance; and determining a target code rate interval according to the code rate parameters, acquiring frame rate parameters corresponding to the target code rate interval to obtain target frame rate parameters, and sending the code rate parameters and the target frame rate parameters to the camera equipment to be adjusted so that the camera equipment to be adjusted can 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.
Optionally, the occupancy 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, a possible implementation manner 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 less than or equal to the adjusting threshold, the camera equipment with the current code rate less than the code rate upper limit value is taken as the camera equipment 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, is 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 occupied parameter is less than or equal to the adjustment threshold value, the fact that more idle cache blocks exist in the current cache space is indicated, the code rate can be improved, the camera shooting equipment with the current code rate being less than the upper limit value of the code rate is used as the camera shooting equipment to be adjusted, and the new code rate, namely the code rate parameter of the camera shooting equipment to be adjusted is determined according to the current code rate, the upper limit value of the code rate and the occupied parameter of the camera shooting equipment to be adjusted.
It can be understood that, when the occupancy parameter is lower than the adjustment threshold, the usage rate of the buffer space is lower at this time, and the code rate of the camera device can be appropriately increased to improve the efficiency of video encoding.
Step S204B-1, when the occupied parameter is larger than the adjusting threshold, the camera shooting equipment with the current code rate larger than the code rate lower limit value is taken as the camera shooting equipment to be adjusted;
and step S204B-3, determining code rate parameters according to the occupation parameters, the code rate lower limit value and the current code rate of the camera equipment to be adjusted.
In this embodiment, when the occupied parameter is greater than the adjustment threshold, which indicates that there are fewer idle cache blocks or no idle cache blocks in the current cache space, and the code rate needs to be reduced at this time, the camera device whose current code rate is greater than the lower limit of the code rate is used as the camera device to be adjusted, and a new code rate, that is, a code rate parameter, of the camera device to be adjusted is determined according to the current code rate, the lower limit of the code rate, and the occupied parameter of the camera device to be adjusted.
It can be understood that, when the occupied parameter is higher than the adjustment threshold, the usage rate of the buffer space is higher, and if the code rate is not adjusted, data overflow may be caused, and the code rate of the camera 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 cache space is evaluated by adjusting the threshold value, and the adjustment trend of the current code rate is determined to be increased or decreased based on the comparison result of the utilization rate of the current cache space and the occupied parameters, so that the code rate is dynamically adjusted, the video data are cached by keeping the proper number of idle cache blocks, and the stability of the video is ensured.
Optionally, for step S204A-3, the embodiment of the present invention provides a possible implementation manner.
Step S204A-3-1, obtaining the average input bandwidth and the average output bandwidth of the current adjustment period;
wherein the average input bandwidth represents an average amount of video data received in a current adjustment period, and the average input bandwidth represents an average amount of video data transferred to the storage space in the current adjustment period.
It is understood that the buffer space is used for buffering the video data received by the server, which can be regarded as an input of the 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 obtains the average input bandwidth and the average output bandwidth of the current adjustment period, and the average input bandwidth and the average output bandwidth are used as reference 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 input bandwidth values and output bandwidth values corresponding to the plurality of statistical periods. For example, if an adjustment period is set to 180 seconds and a statistical period is set to 10 seconds, there are 18 statistical periods in an adjustment period, and the input bandwidth value of each statistical period in the 18 statistical periods may be obtained and the average value may be calculated to obtain the average input bandwidth, and the output bandwidth value of each statistical period may be obtained and the average value may be calculated to obtain the average output bandwidth.
Step S204A-3-2a, when the occupied parameter is smaller than the observation threshold, calculating an improved code rate value according to a preset improvement proportion and the current code rate of the camera equipment to be adjusted, and taking the smaller of the improved code rate value and the code rate upper limit value as a code rate parameter;
in this embodiment, in order to adjust the code rate more reasonably, an observation threshold is further set to subdivide the usage of the buffer space, and the observation threshold is smaller than the adjustment threshold.
When the occupied parameter is smaller than the observation threshold value, the fact that a plurality of idle cache blocks exist in the current cache space is indicated, and the code rate value after the lifting 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 represented 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 the embodiment of the present invention is not limited.
And then comparing the promoted code rate value with the code rate upper limit value, and taking the smaller of the two as a code rate parameter. For example, the code rate upper limit is denoted by BRmax. If BRcur (1+ Pup) < BRmax, then BRcur (1+ Pup) is used as the code rate parameter; if BRcur (1+ Pup) is not less than BRmax, then BRmax is used as the code rate parameter. Namely, the bitrate parameter is min { BRmax, BRcur (1+ Pup) }.
Step S204A-3-2b-1, when the occupancy parameter is greater 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 less than or equal to the product, calculating the code rate value after the lifting according to the preset lifting proportion and the current code rate of the camera equipment to be adjusted, and taking the smaller of the code rate value after the lifting 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 needs to further determine whether the code rate can be increased based on the average output bandwidth and the average input bandwidth. I.e. calculating the product of the average output bandwidth and a preset coefficient and comparing the product with the size of the average input bandwidth.
For example, the predetermined coefficient is represented by s, e.g., s may be 1.05; the average input bandwidth is denoted by IB; the average output bandwidth is denoted OB. And calculating the product OB & lts & gt of the average output bandwidth OB and a preset coefficient s, and comparing the product OB & lts & gt 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, the difference between the input rate and the output rate of the data in the current cache space is within the set range. It can be understood that, according to the average input bandwidth IB and the average output bandwidth OB, there are many idle cache blocks in the cache space, and then, according to the preset boosting ratio Pup and the current code rate BRcur of the image pickup apparatus to be adjusted, the boosted code rate value BRcur (1+ Pup) is calculated, and the smaller of the boosted code rate value BRcur (1+ Pup) and the upper limit value BRmax is used as the code rate parameter.
If IB > OB × s indicates that the difference between the input rate and the output rate of the data in the current cache space is not within the set range, the current adjustment period is not adjusted, and how to adjust the data is determined based on the parameter values obtained in the next adjustment period.
It can be seen that, by adopting the observation threshold smaller than the adjustment threshold, the situation that the code rate needs to be increased is further subdivided, 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 adjustment strategy of the code rate is more reasonable and comprehensive, and the stability of the video is further ensured.
Optionally, for step S204B-3, the embodiment of the present invention provides a possible implementation manner.
Step S204B-3-1, obtaining the average input bandwidth and the average output bandwidth of the current adjustment period;
wherein the average input bandwidth represents an average amount of video data received in a current adjustment period, and the average input bandwidth represents an average amount of video data transferred to the storage space in the current adjustment period.
It is understood that the step S204B-3-1 is the same as the step S204A-3-1 in implementation and effect, and for brevity, refer to the description of the step S204A-3-1.
Step S204B-3-2a, when the occupied parameter is greater than or equal to the mandatory threshold, determining a target reduction ratio according to the average input bandwidth, the average output bandwidth, the preset reduction lower limit ratio and the preset reduction upper limit 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;
in this embodiment, in order to adjust the code rate more reasonably, a forced threshold is further set to subdivide the usage of the buffer space, and the forced threshold is greater than the adjustment threshold.
When the occupied parameter is greater than or equal to the mandatory threshold, the number of idle cache blocks in the current cache space is indicated, and the code rate needs to be quickly reduced, a target reduction ratio can be determined according to the average input bandwidth, the average output bandwidth, the preset reduction lower limit ratio and the preset reduction upper limit ratio, and a code rate parameter is determined according to the target reduction ratio, the code rate lower limit value and the current code rate of the camera equipment to be adjusted.
Step S204B-3-2b-1, when the occupancy parameter is smaller than the mandatory 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 reduction lower limit ratio and a preset reduction upper limit 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.
In this embodiment, when the occupancy parameter is smaller than the mandatory threshold and larger than the adjustment threshold, it needs to further determine whether to decrease the code rate based on the average output bandwidth and the average input bandwidth. I.e. calculating the product OB s of the average output bandwidth OB and a predetermined coefficient s, and comparing the product OB s with the average input bandwidth IB.
If IB is larger than or equal to OB x s, the difference between the input rate and the output rate of the data in the current cache space is not in the set range. It can be understood that, according to the average input bandwidth and the average output bandwidth, fewer idle cache blocks exist in the cache space, a target reduction ratio is determined according to the average input bandwidth, the average output bandwidth, a preset reduction lower limit ratio and a preset reduction upper limit ratio, and a code rate parameter is determined according to the target reduction ratio, a code rate lower limit value and a current code rate of the camera device to be adjusted.
If IB is less than OB x s and the difference between the input rate and the output rate of the data in the current cache space is within the set range, the current adjustment period is not adjusted, observation is continued, and how to adjust the data can be determined based on the parameter values obtained in the next adjustment period.
It can be seen that the situation that the code rate needs to be reduced is further subdivided by adopting the mandatory threshold value larger than the regulation threshold value, and the code rate is dynamically regulated by combining the average input bandwidth and the average output bandwidth of the current regulation period. By considering various factors, the adjustment strategy of the code rate is more reasonable and comprehensive, and the stability of the video is further ensured.
Optionally, the embodiment of the present invention provides a possible implementation manner for determining the target reduction ratio in the above step S204B-3-2a and step S204B-3-2 b-2.
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 the ratio to be reduced;
as in the above example, the average input bandwidth is denoted by IB; when the average output bandwidth is represented by OB, the ratio Pd to be reduced is (IB-OB)/IB.
Step S204B-3-2-2, if the proportion to be reduced belongs to the range between the preset lower limit proportion and the preset upper limit proportion, the proportion to be reduced is taken as the target reduction proportion;
step S204B-3-2-3, if the ratio to be reduced is smaller than the preset lower limit reduction ratio, taking the preset lower limit reduction ratio as the target reduction ratio;
and step S204B-3-2-4, if the ratio to be reduced is larger than the preset reduction upper limit ratio, taking the preset reduction upper limit ratio as the target reduction ratio.
In this embodiment, a range interval 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 limit reduction ratio is represented by Pdmin, such as Pdmin may be 5%, and the preset upper limit reduction ratio is represented by Pdmax, such as Pdmax may be 30%. It should be understood that the preset reduction lower limit proportion and the preset reduction upper limit proportion may be set according to practical applications, and the embodiment of the present invention is not limited.
If Pd belongs to [ Pdmin, Pdmax ], taking Pd as a target reduction proportion; if Pd is less than Pdmin, taking Pdmin as a target reduction ratio; if Pd > Pdmax, then Pdmax is taken as the target reduction ratio.
Optionally, the embodiment of the present invention provides a possible implementation manner for determining the bitrate parameter according to the target reduction ratio in the above step S204B-3-2a and step S204B-3-2 b-2.
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 represented by BRcur; the reduced code rate value is BRcur (1-Pdown).
Step S204B-3-2-6, comparing the reduced code rate value with the 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, the reduced code rate value is used as a code rate parameter;
step S204B-3-2-8, if the reduced code rate value is less than or equal to the code rate lower limit value, the code rate lower limit value is used as the code rate parameter.
In this embodiment, the reduced bitrate value and the lower limit of the bitrate are compared, and the larger of the two is used as a bitrate parameter. For example, the lower limit of the code rate is denoted by BRmin. If BRcur (1-Pdawn) > BRmin, taking BRcur (1-Pdawn) as a code rate parameter; if BRcur (1-Pdawn) is less than or equal to BRmin, then BRmin is used as the code rate parameter. Namely, the code rate parameter is max { BRmin, BRcur (1-Pdawn) }.
To facilitate understanding, the embodiments of the present invention provide an example. For example, the cache space is 400MByte, which includes 200 cache blocks, each of which is 2M; the preset adjusting period is 180 seconds, and the preset counting period is 10 seconds; the code rate lower limit value BRmin is 1Mbit/s, and the code rate upper limit value BRmax is 4 Mbit/s; the observation threshold is 70%, the adjustment threshold is 80%, and the mandatory threshold is 90%; the preset lifting proportion Pup is 10%, the preset lower limit reduction proportion Pdmin is 5%, and the preset upper limit reduction proportion Pdmax is 30%; the predetermined coefficient s is 1.05.
And acquiring the use condition of the cache space every 180 seconds, namely calculating the percentage of the number of used cache blocks to the total number of all cache blocks to obtain an occupation parameter P.
When the occupied 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 the camera equipment to be adjusted; and then, calculating a code rate value after lifting, namely BRcur (1+ 10%), according to the current code rate BRcur and a preset lifting proportion of 10%, and selecting the smaller one from the lifted code rate value and the 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 sending the code rate parameter BR and the target frame rate parameter FR 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 BR and FR.
When the occupied parameter P is equal to 75%, acquiring an average input bandwidth IB and an average output bandwidth OB in the current adjustment period; and if IB is less than or equal to OB multiplied by 1.05, improving the code rate according to the condition that P is equal to 60 percent.
When the occupied 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 the camera equipment to be adjusted; acquiring an average input bandwidth IB and an average output bandwidth OB in the current adjustment period; if IB is larger than or equal to OB × s, calculating the ratio Pd to be reduced to be (IB-OB)/IB, and determining the target reduction ratio Pwown according to Pd, Pdmin and Pdmax.
Then according to the current code rate BRcur and the target reduction ratio Pdrain, calculating a reduced code rate value, namely BRcur (1-Pdrain), and selecting the larger one from the reduced code rate value and the lower limit value of the code rate as a code rate parameter, namely BR (max { BRmin, BRcur (1-Pdrain) };
then acquiring a target frame rate parameter FR corresponding to a target code rate interval to which the code rate parameter BR belongs; and then sending the code rate parameter BR and the target frame rate parameter FR 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 BR and FR.
When the occupied 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 the camera equipment to be adjusted; and the code rate is reduced as described above for the case where P equals 85%.
In order to perform the corresponding steps in the above embodiments and various possible manners, an implementation manner of the code rate adjustment apparatus is given below. Referring to fig. 7, fig. 7 is a functional block diagram of a code rate adjustment apparatus 300 according to an embodiment of the present invention. It should be noted that the basic principle and the resulting technical effects of the bitrate adjusting apparatus 300 provided in the present embodiment are the same as those of the above embodiments, and for the sake of brief description, reference may be made to the corresponding contents in the above embodiments for parts that are not mentioned in the present embodiment. The bitrate adjusting apparatus 300 comprises:
an obtaining module 310, configured to periodically obtain an occupation parameter indicating a usage condition of a cache space according to a preset adjustment period;
the determining module 330 is configured to determine, according to the occupancy parameters and the current code rate of each camera device, a camera device to be adjusted and a code rate parameter;
and the adjusting module 350 is configured to send the code rate parameter to the to-be-adjusted camera device, so that the to-be-adjusted camera device adjusts the code rate according to the code rate parameter.
Optionally, the adjusting module 350 is further configured to: determining a target code rate interval to which the code rate parameter belongs; acquiring frame rate parameters corresponding to the target code rate interval to obtain target frame rate parameters; 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 is further configured to: when the occupation parameter is less than or equal to the adjustment threshold, taking the camera equipment with the current code rate less than the upper limit value of the code rate as the camera equipment to be adjusted; determining a code rate parameter according to the occupied parameter, the code rate upper limit value and the current code rate of the camera equipment to be adjusted;
when the occupied parameter is larger than the adjusting threshold value, 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 determining a code rate parameter according to the occupied parameter, the code rate lower limit value and the current code rate of the camera equipment to be adjusted.
Optionally, the determining module 330 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 volume received in the current adjustment period, and the average input bandwidth represents an average video data volume transferred to a storage space in the current adjustment period;
when the occupied parameter is smaller than the observation threshold, calculating an improved code rate value according to a preset improvement proportion and the current code rate of the camera equipment to be adjusted, and taking the smaller of the improved code rate value and the code rate upper limit value as a code rate parameter;
when the occupation parameter is larger than or equal to the observation 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 smaller than or equal to the product, calculating an improved code rate value according to a preset improvement proportion and the current code rate of the camera equipment to be adjusted, and taking the smaller of the improved code rate value and the code rate upper limit value as a code rate parameter.
Optionally, the determining module 330 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 volume received in the current adjustment period, and the average input bandwidth represents an average video data volume transferred to a storage space in the current adjustment period;
when the occupied parameter is larger than or equal to the mandatory threshold, determining a target reduction proportion according to the average input bandwidth, the average output bandwidth, the preset reduction lower limit proportion and the preset reduction upper limit proportion, and determining a code rate parameter according to the target reduction proportion, the code rate lower limit value and the current code rate of the camera equipment to be adjusted;
when the occupied parameter is smaller than the mandatory 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 larger than or equal to the product, determining a target reduction proportion according to the average input bandwidth, the average output bandwidth, a preset reduction lower limit proportion and a preset reduction upper limit proportion, and determining a code rate parameter according to the target reduction proportion, the code rate lower limit value and the current code rate of the camera equipment to be adjusted.
Optionally, the determining module 330 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 ratio to be reduced;
if the ratio to be reduced belongs to the range between the preset lower reduction limit ratio and the preset upper reduction limit ratio, taking the ratio to be reduced as a target reduction ratio;
if the undetermined reduction proportion is smaller than the preset reduction lower limit proportion, taking the preset reduction lower limit proportion as a target reduction proportion;
and if the undetermined reduction proportion is larger than the preset reduction upper limit proportion, taking the preset reduction upper limit proportion as the target reduction proportion.
Optionally, the determining module 330 is further configured to: calculating a reduced code rate value according to the target reduction proportion 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, the reduced code rate value is used as a code rate parameter;
and if the reduced code rate value is less 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 present invention further provides a server, which includes a processor 120 and a memory 130, where the memory 130 stores a computer program, and when the processor executes the computer program, the code rate adjustment method disclosed in the above embodiment is implemented.
The embodiment of the present invention further provides a storage medium, on which a computer program is stored, and when the computer program is executed by the processor 120, the computer program implements the code rate adjustment method disclosed in the embodiment of the present invention.
In summary, the code rate adjustment method, apparatus, server and storage medium provided in the embodiments of the present invention. The server is in communication connection with the plurality of camera devices, and is provided with a storage space and a cache space comprising a plurality of cache blocks, wherein the cache space is used for caching the video data received by the server and sent by each camera device, and the storage space is used for transferring the cached video data in the cache space when no idle cache block exists in the cache space; acquiring occupation parameters representing the use condition of the cache space periodically according to a preset adjustment period; determining the camera equipment to be adjusted and code rate parameters according to the occupation parameters and the current code rate of each camera equipment; and then 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. The code rate is dynamically adjusted by periodically acquiring the use condition of the cache space, and the code rate and the use rate of the cache space are balanced, so that the stability of the video is ensured, and the abnormal storage of the video is effectively avoided.
In the embodiments provided by 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 and, for example, the flowchart and block diagrams in the figures 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, the functional modules in the embodiments of the present invention may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to 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), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The present invention has been described in terms of the preferred embodiment, and it is not intended to be limited to the embodiment. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A code rate adjustment method, applied to a server, where the server is in communication connection with multiple image capturing devices, the server has a storage space and a cache space including multiple cache blocks, the cache space is used to cache video data sent by each image capturing device and received by the server, and the storage space is used to transfer the cached video data in the cache space when there is no free cache block in the cache space, where the method includes:
acquiring occupation parameters representing the use condition of the cache space periodically according to a preset adjustment period;
determining the camera equipment to be adjusted and 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 camera equipment to be adjusted so that the camera equipment to be adjusted adjusts the code rate according to 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 of the code rate intervals;
after the step of determining the camera equipment to be adjusted and the code rate parameter according to the occupancy parameter and the current code rate of each camera equipment, the method further comprises:
determining a target code rate interval to which the code rate parameter belongs;
acquiring frame rate parameters corresponding to the target code rate interval to obtain target frame rate parameters;
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.
3. The method of claim 1, wherein the occupancy parameter is a percentage of a number of used cache blocks to a total number of all cache blocks, and the server pre-stores an adjustment threshold, a code rate upper limit, and a code rate lower limit;
the step of determining the camera equipment to be adjusted and the code rate parameter according to the occupation parameter and the current code rate of each camera equipment comprises the following steps:
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 code rate upper limit value as the camera equipment 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 camera equipment with the current code rate larger than the code rate lower limit value as the 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.
4. The method of claim 3, wherein the server further pre-stores an observation threshold, a preset boost 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 camera equipment to be adjusted comprises the following steps:
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 volume received in the current adjustment period, and the average input bandwidth represents an average video data volume transferred to the storage space in the current adjustment period;
when the occupation parameter is smaller than the observation threshold, calculating an improved code rate value according to the preset improvement proportion and the current code rate of the camera equipment to be adjusted, and taking the smaller of the improved code rate value and the upper limit value of the code rate as the code rate parameter;
when the occupancy parameter is greater than or equal to the observation threshold, calculating a 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 an improved code rate value according to the preset improvement proportion and the current code rate of the camera equipment to be adjusted, and taking the smaller of the improved code rate value and the upper limit value of the code rate as the code rate parameter.
5. The method according to claim 3, wherein the server is further pre-stored with a mandatory threshold, a preset lower reduction limit proportion, a preset upper reduction limit proportion and a preset coefficient; the mandatory threshold is greater than the adjusted threshold;
the step of determining the code rate parameter according to the occupied parameter, the code rate lower limit value and the current code rate of the camera equipment to be adjusted comprises the following steps:
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 volume received in the current adjustment period, and the average input bandwidth represents an average video data volume transferred to the storage space in the current adjustment period;
when the occupied parameter is larger than or equal to the mandatory threshold, determining a target reduction proportion according to the average input bandwidth, the average output bandwidth, the preset reduction lower limit proportion and the preset reduction upper limit proportion, and determining the code rate parameter according to the target reduction proportion, 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 mandatory 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 larger than or equal to the product, determining a target reduction ratio according to the average input bandwidth, the average output bandwidth, the preset reduction lower limit ratio and the preset reduction upper limit 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 camera equipment to be adjusted.
6. The method of claim 5, wherein the step of determining a target reduction ratio based on the average input bandwidth, the average output bandwidth, the preset reduction lower limit ratio and the preset reduction upper 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 ratio to be reduced;
if the ratio to be reduced belongs to the range between the preset lower reduction limit ratio and the preset upper reduction limit ratio, taking the ratio to be reduced as the target reduction ratio;
if the ratio to be reduced is smaller than the preset lower limit reduction ratio, taking the preset lower limit reduction ratio as the target reduction ratio;
and if the undetermined reduction proportion is larger than the preset reduction upper limit proportion, taking the preset reduction upper limit proportion as the target reduction proportion.
7. The method according to claim 5, 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 capturing apparatus to be adjusted includes:
calculating a reduced code rate value according to the target reduction proportion and the current code rate of the camera equipment to be adjusted;
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 less than or equal to the code rate lower limit value, taking the code rate lower limit value as the code rate parameter.
8. The code rate adjusting device is applied to a server, the server is in communication connection with a plurality of camera devices, the server has a storage space and a cache space including 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 unloading the cached video data in the cache space when no idle cache block exists in the cache space, and the device includes:
the acquisition module is used for periodically acquiring the occupation parameters representing the use condition of the cache space according to a preset adjustment period;
the determining module is used for determining the camera equipment to be adjusted and the code rate parameter according to the occupation parameter and the current code rate of each camera equipment;
and the adjusting module is used for sending the code rate parameter to the camera equipment to be adjusted so as to enable the camera equipment to be adjusted to adjust the code rate according to the code rate parameter.
9. A server, characterized in that it comprises a processor and a memory, said memory storing a computer program which, when executed by said processor, implements the method of any one of claims 1 to 7.
10. A storage medium, characterized in that the storage medium has stored thereon a computer program which, when executed by a processor, implements the method of any one of claims 1 to 7.
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 true CN114979726A (en) 2022-08-30
CN114979726B 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)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024108950A1 (en) * 2022-11-22 2024-05-30 天地伟业技术有限公司 Bitstream control method and apparatus, and electronic device

Citations (11)

* 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
US20120195356A1 (en) * 2011-01-31 2012-08-02 Apple Inc. Resource usage control for real time video encoding
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
US20170251274A1 (en) * 2016-02-29 2017-08-31 Fuji Xerox Co., Ltd. Information processing apparatus and information processing method
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

Patent Citations (11)

* 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
US20120195356A1 (en) * 2011-01-31 2012-08-02 Apple Inc. Resource usage control for real time video encoding
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
US20170251274A1 (en) * 2016-02-29 2017-08-31 Fuji Xerox Co., Ltd. Information processing apparatus and information processing method
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
罗际炜;瞿涛;邓?祥;: "嵌入式多通道无线视频传输的码率自适应算法", no. 04 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024108950A1 (en) * 2022-11-22 2024-05-30 天地伟业技术有限公司 Bitstream control method and apparatus, and electronic device

Also Published As

Publication number Publication date
CN114979726B (en) 2023-09-26

Similar Documents

Publication Publication Date Title
CN111836079B (en) Video code stream transmission method and device
US10735740B2 (en) Bit rate control method and device
US8458328B2 (en) Method and system for data packet queue recovery
WO2012154808A2 (en) Providing adaptive media optimization
CN109600610B (en) Data encoding method, terminal and computer readable storage medium
US20200128246A1 (en) Dynamic codec adaptation
EP2888846A2 (en) Device and method for adaptive rate multimedia communications on a wireless network
WO2019033877A1 (en) Video frame coding method, terminal, and storage medium
CN108924205B (en) Data transmission method and device, electronic equipment and gatekeeper adapter
CN111263153B (en) Video encoding method, device, equipment and storage medium
CN110996103A (en) Method for adjusting video coding rate according to network condition
CN112019384A (en) Bandwidth prediction method, device, equipment and storage medium
CN114979726B (en) Code rate adjusting method, device, server and 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
WO2023029994A1 (en) Video call processing method and apparatus, device and storage medium
CN112019873A (en) Video code rate adjusting method and device and electronic equipment
CN101521813B (en) Method and device for processing media stream
CN111741248A (en) Data transmission method, device, terminal equipment and storage medium
CN115378832B (en) Congestion detection method and device, stream media transmission system, electronic equipment and medium
CN116546276A (en) Link bandwidth estimation method, device, equipment, storage medium and program product
CN115842928B (en) Video code rate switching method, device, computer equipment and storage medium
JP6999633B2 (en) Adaptive storage across multiple cameras in a video recording system
WO2017050121A1 (en) Overload control method and apparatus for accounting request
CN113014940A (en) Live broadcast optimization method and device

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