CN112738444A - Video code rate control method and device, computer equipment and storage medium - Google Patents
Video code rate control method and device, computer equipment and storage medium Download PDFInfo
- Publication number
- CN112738444A CN112738444A CN202011506368.7A CN202011506368A CN112738444A CN 112738444 A CN112738444 A CN 112738444A CN 202011506368 A CN202011506368 A CN 202011506368A CN 112738444 A CN112738444 A CN 112738444A
- Authority
- CN
- China
- Prior art keywords
- real
- code rate
- threshold
- time code
- video
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 43
- 230000002829 reductive effect Effects 0.000 claims description 22
- 238000004590 computer program Methods 0.000 claims description 13
- 238000012545 processing Methods 0.000 claims description 11
- 230000003247 decreasing effect Effects 0.000 claims description 4
- 230000009467 reduction Effects 0.000 abstract description 6
- 230000000694 effects Effects 0.000 abstract description 2
- 238000010586 diagram Methods 0.000 description 12
- 238000004891 communication Methods 0.000 description 8
- 230000006870 function Effects 0.000 description 5
- 238000013461 design Methods 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 3
- 230000002159 abnormal effect Effects 0.000 description 2
- 230000000670 limiting effect Effects 0.000 description 2
- 230000008569 process Effects 0.000 description 2
- 239000007787 solid Substances 0.000 description 2
- 230000005856 abnormality Effects 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 230000006835 compression Effects 0.000 description 1
- 238000007906 compression Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000007613 environmental effect Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012806 monitoring device Methods 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000036961 partial effect Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 230000001360 synchronised effect Effects 0.000 description 1
- 238000009423 ventilation Methods 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N5/00—Details of television systems
- H04N5/76—Television signal recording
- H04N5/907—Television signal recording using static stores, e.g. storage tubes or semiconductor memories
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/134—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
- H04N19/146—Data rate or code amount at the encoder output
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Signal Processing For Digital Recording And Reproducing (AREA)
- Television Signal Processing For Recording (AREA)
Abstract
The application relates to a video code rate control method, a device, computer equipment and a storage medium, wherein the video code rate control method comprises the following steps: the real-time code rate of a video channel and the storage bandwidth of a storage device are obtained; acquiring a first threshold according to the storage bandwidth; comparing the real-time code rate to the first threshold; and if the real-time code rate is larger than the first threshold, reducing the real-time code rate until the real-time code rate is smaller than or equal to the first threshold. Through the method and the device, the problem that the video is lost due to reduction of the storage bandwidth of the hard disk is solved, and the effect of preventing the video from being lost is achieved.
Description
Technical Field
The present application relates to the field of storage technologies, and in particular, to a video bitrate control method, apparatus, computer device, and storage medium.
Background
The hard disk video recorder comprises a digital hard disk video recorder DVR and a network hard disk video recorder NVR, is different from the traditional analog video recorder, and is a digital video recorder which converts audio and video signals into digital signals and stores the digital signals in a hard disk after compression. The storage code rate of the existing video recorder is fixed, for example, when a 1-path 2MB/S video recorder is full of video cameras, the total code rate is 16 MB/S. The storage bandwidth of the hard disk is also relatively fixed, for example, 130MB/S, and the storage bandwidth of the hard disk meets the requirement of the full-channel video rate.
For a common video recorder, the storage code rate of a single-path video is fixed, and the sum of the storage code rates of all paths of videos is also fixed. In general, the ambient temperature satisfies the design specification, and no abnormality occurs. However, in practical use, problems such as unsmooth ventilation of a storage position of the hard disk video recorder, stacking of a plurality of video recorders, abnormal fan of a case and the like often occur, so that the working temperature of the hard disk is too high, and finally the working temperature of the hard disk exceeds a threshold value of the working temperature of the hard disk to cause the speed reduction of the hard disk, namely the storage bandwidth of the hard disk caused by too high temperature is reduced. After the hard disk is decelerated, if one set of effective processing is not available, the problem of video loss is inevitably caused, and serious consequences are caused.
At present, no effective solution is provided for the problem of video loss caused by reduction of the storage bandwidth of a hard disk in the related art.
Disclosure of Invention
The embodiment of the application provides a video code rate control method, a video code rate control device, computer equipment and a storage medium, and aims to at least solve the problem of video loss caused by reduction of storage bandwidth of a hard disk in the related art.
In a first aspect, an embodiment of the present application provides a video rate control method, including:
acquiring the real-time code rate of a video channel and the storage bandwidth of storage equipment;
acquiring a first threshold according to the storage bandwidth;
comparing the real-time code rate to the first threshold;
and if the real-time code rate is larger than the first threshold, reducing the real-time code rate until the real-time code rate is smaller than or equal to the first threshold.
In one embodiment, the obtaining the real-time bitrate of the video channel includes: and acquiring the access number of the video channels and the code rate of each video channel, and calculating the total code rate of the plurality of video channels as the real-time code rate.
In one embodiment, the obtaining the first threshold according to the storage bandwidth further includes: acquiring a first threshold and a second threshold according to the storage bandwidth, wherein the first threshold is larger than the second threshold; acquiring a preset range according to the first threshold and the second threshold; the upper limit of the preset range is less than or equal to the first threshold value, and the lower limit of the preset range is greater than or equal to the second threshold value; judging whether the real-time code rate is in a preset range, and if the real-time code rate is in the preset range, keeping the real-time code rate unchanged; and if the real-time code rate is not in a preset range, comparing the real-time code rate with the first threshold value.
In one embodiment, if the real-time bitrate is greater than the first threshold, reducing the real-time bitrate until the real-time bitrate is less than or equal to the first threshold further includes: and if the real-time code rate is not in the preset range and is smaller than the first threshold, the real-time code rate is increased until the real-time code rate is larger than or equal to the second threshold.
In one embodiment, if the real-time bitrate is not within a preset range and is less than the first threshold, the increasing the real-time bitrate until the real-time bitrate is greater than or equal to the second threshold further includes: when the real-time code rate is increased, the code rate of each video channel is smaller than or equal to the default code rate of the corresponding video channel, and the default code rate is a preset code rate meeting the storage requirement of the storage bandwidth.
In one embodiment, the reducing the real-time bitrate if the real-time bitrate is greater than the first threshold until the real-time bitrate is less than or equal to the first threshold includes: and if the real-time code rate is larger than the first threshold, sequentially reducing the code rate of each video channel according to the priority of the video channel until the real-time code rate is smaller than or equal to the first threshold.
In one embodiment, the reducing the real-time bitrate if the real-time bitrate is greater than or equal to the first threshold until the real-time bitrate is less than or equal to the first threshold includes: if the real-time code rate is larger than the first threshold, the real-time code rate is reduced step by step according to a preset code rate grade until the real-time code rate is smaller than or equal to the first threshold.
In one embodiment, if the real-time bitrate is greater than the first threshold, reducing the real-time bitrate until the real-time bitrate is less than or equal to the first threshold further includes: and if the real-time code rate is smaller than the first threshold, increasing the real-time code rate until the real-time code rate is larger than or equal to the second threshold.
In a second aspect, an embodiment of the present application provides a video rate control apparatus, including:
an acquisition module: the method comprises the steps of obtaining a real-time code rate of a video channel and a storage bandwidth of a storage device;
a processing module: the device is used for acquiring a first threshold according to the storage bandwidth;
a comparison module: for comparing the real-time code rate with the first threshold;
a control module: and if the real-time code rate is greater than the first threshold, reducing the real-time code rate until the real-time code rate is less than or equal to the first threshold.
In a third aspect, an embodiment of the present application provides a computer device, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the computer program, the processor implements the video bitrate control method according to the first aspect.
In a fourth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, where the computer program is executed by a processor to implement the video bitrate control method according to the first aspect.
Compared with the related art, the video code rate control method provided by the embodiment of the application obtains the real-time code rate of the video channel and the storage bandwidth of the storage device; acquiring a first threshold according to the storage bandwidth; comparing the real-time code rate to the first threshold; if the real-time code rate is larger than the first threshold, reducing the real-time code rate until the real-time code rate is smaller than or equal to the first threshold, solving the problem of video loss caused by reduction of the storage bandwidth of the hard disk, and realizing the effect of ensuring that the video is not lost.
The details of one or more embodiments of the application are set forth in the accompanying drawings and the description below to provide a more thorough understanding of the application.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
fig. 1 is a schematic view of a hard disk recorder according to the related art;
FIG. 2 is a flow chart of a video rate control method according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a digital hard disk recorder according to the preferred embodiment of the present application;
FIG. 4 is a flow chart of a video rate control method according to the preferred embodiment of the present application;
FIG. 5 is a schematic diagram of a network video recorder according to the preferred embodiment of the present application;
FIG. 6 is a block diagram of a video rate control apparatus according to an embodiment of the present application;
fig. 7 is a hardware configuration diagram of a computer device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be described and illustrated below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments provided in the present application without any inventive step are within the scope of protection of the present application.
It is obvious that the drawings in the following description are only examples or embodiments of the present application, and that it is also possible for a person skilled in the art to apply the present application to other similar contexts on the basis of these drawings without inventive effort. Moreover, it should be appreciated that in the development of any such actual implementation, as in any engineering or design project, numerous implementation-specific decisions must be made to achieve the developers' specific goals, such as compliance with system-related and business-related constraints, which may vary from one implementation to another.
Reference in the specification to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the specification. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of ordinary skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments without conflict.
Unless defined otherwise, technical or scientific terms referred to herein shall have the ordinary meaning as understood by those of ordinary skill in the art to which this application belongs. Reference to "a," "an," "the," and similar words throughout this application are not to be construed as limiting in number, and may refer to the singular or the plural. The present application is directed to the use of the terms "including," "comprising," "having," and any variations thereof, which are intended to cover non-exclusive inclusions; for example, a process, method, system, article, or apparatus that comprises a list of steps or modules (elements) is not limited to the listed steps or elements, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus. Reference to "connected," "coupled," and the like in this application is not intended to be limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The term "plurality" as referred to herein means two or more. "and/or" describes an association relationship of associated objects, meaning that three relationships may exist, for example, "A and/or B" may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. Reference herein to the terms "first," "second," "third," and the like, are merely to distinguish similar objects and do not denote a particular ordering for the objects.
Digital Video Recorders (DVRs) adopt hard disk recording, so they are often called hard disk recorders (hdd's) and also called DVRs (DVR's), compared with traditional analog Video recorders. DVRs employ digital recording technology and are far superior to analog monitoring devices in image processing, image storage, retrieval, backup, and network delivery, remote control, etc. A Network Video Recorder (NVR) is a store-and-forward part of a Network Video monitoring system, and its core function is the store and forward of Video streams. Compared with the DVR, the NVR has single function, does not have analog-to-digital conversion and coding functions, cannot work independently, and usually cooperates with a video encoder DVS or a network camera IPC to complete video recording, storage and forwarding functions. Fig. 1 is a schematic diagram of a work flow of a hard disk video recorder according to the related art, and as shown in fig. 1, the hard disk video recorder includes a power supply module, an audio and video encoding module (only a digital hard disk video recorder includes the module), a control module, a storage module, and a display output module. When the hard disk video recorder works, image information collected by the camera is sent to the control module through encoding processing of the audio and video encoding module, the control module controls the image information after encoding processing to be stored in the storage module such as a hard disk, and the processed image information is sent to the display through the display output module to be displayed. However, sometimes the speed of the hard disk in the storage module may be reduced during operation, and the speed of the image information collected by the camera is higher than the speed of the image information written into the hard disk, which inevitably causes the situation of losing the video, and the loss of the video may cause serious consequences.
The embodiment also provides a video rate control method. Fig. 2 is a flowchart of a video rate control method according to an embodiment of the present application, and as shown in fig. 2, the flowchart includes the following steps:
step S201, acquiring a real-time bitrate of a video channel and a storage bandwidth of a storage device.
Specifically, the storage code rate of the video channel of the video recorder is obtained in real time, the storage device refers to a hard disk commonly used by a computer at present, and the hard disk can be a serial hard disk solid state disk, which is not limited in the present invention. In general, the storage bandwidth of the hard disk is far larger than the storage code rate of the video recorder.
In one embodiment, the obtaining the real-time bitrate of the video channel includes: and acquiring the access number of the video channels and the code rate of each video channel, and calculating the total code rate of the plurality of video channels as the real-time code rate. Specifically, for a video recorder with multiple video channels, the number of the video channels of the video recorder and the code rate of each video channel are obtained, the code rates of the video channels can be the same or different, the code rates of the video channels are overlapped, and the total code rate of each video channel is used as a real-time code rate. For example, for an 8-channel video recorder, the storage rate of each video channel is 2MB/S, when the video recorder is full of cameras, the access number of the video channels is 8, the code rate of each video channel is 2MB/S, the total code rate of the 8 video channels is 16MB/S, and 16MB/S is taken as the real-time code rate.
Step S202, a first threshold value is obtained according to the storage bandwidth.
Specifically, a first threshold may be set according to the storage bandwidth of the hard disk, for example, several percentage points of the storage bandwidth are used as the first threshold, for example: and setting 80% of the storage bandwidth as a first threshold, wherein when the storage bandwidth is 200M/S, the first threshold is 160M/S.
In one embodiment, the obtaining the first threshold according to the storage bandwidth further includes: acquiring a first threshold and a second threshold according to the storage bandwidth, wherein the first threshold is larger than the second threshold; acquiring a preset range according to the first threshold and the second threshold; the upper limit of the preset range is less than or equal to the first threshold and the lower limit is greater than or equal to the second threshold. Specifically, several percents of the storage bandwidth are used as the first threshold and the second threshold, for example: and setting 80% of the storage bandwidth as a first threshold value and 60% of the storage bandwidth as a second threshold value, wherein when the storage bandwidth is 200M/S, the first threshold value is 160M/S, and the second threshold value is 120M/S. The preset range is 160M/S-120M/S.
Step S203, comparing the real-time code rate with the first threshold.
Specifically, the obtained real-time code rate of the video recorder is compared with a first threshold of the hard disk storage bandwidth.
In one embodiment, the comparing the real-time code rate with the first threshold further comprises: judging whether the real-time code rate is in a preset range, and if the real-time code rate is in the preset range, keeping the real-time code rate unchanged; and if the real-time code rate is not in a preset range, comparing the real-time code rate with the first threshold value. Specifically, the method comprises the following steps: taking the total code rate of each video channel as a real-time code rate, and judging whether the real-time code rate is in a preset range, namely judging whether the real-time code rate is greater than or equal to a second threshold and less than or equal to a first threshold; if the real-time code rate is in the preset range, the storage bandwidth just meets the requirement of the storage code rate, and the normal storage of the image information can be realized without adjusting the code rate value of each channel. And if the real-time code rate is not in the preset range, comparing the real-time code rate with the first threshold, and if the real-time code rate is greater than the first threshold, reducing the real-time code rate until the real-time code rate is less than or equal to the first threshold. For example: if the video recorder is an 8-channel video recorder, the storage code rate of each channel is 4M/S, under the condition that the video camera is fully connected, the real-time code rate is 32MB/S, the storage bandwidth is 50M/S, the first threshold is 80% of the storage bandwidth, and the first threshold is 40 MB/S; the second threshold is 60% of the storage bandwidth, and the second threshold is 30 MB/S; if the real-time bitrate 32MB/S is greater than or equal to the second threshold 30MB/S and less than or equal to the first threshold 40MB/S, the real-time bitrate does not need to be adjusted. When the storage bandwidth of the hard disk is reduced to 30MB/S due to temperature rise, the first threshold is 80% of the current storage bandwidth, the first threshold is 24MB/S, and the second threshold is 60% of the storage bandwidth, the second threshold is 18 MB/S; and comparing the real-time code rate 32MB/S with the current first threshold value 24MB/S if the real-time code rate is not within the preset range of 18 MB/S-24 MB/S, and reducing the real-time code rate until the real-time code rate is less than or equal to the current first threshold value 24MB/S because the real-time code rate 32MB/S is greater than the current first threshold value 24 MB/S.
In one embodiment, if the real-time bitrate is greater than the first threshold, reducing the real-time bitrate until the real-time bitrate is less than or equal to the first threshold further includes: and if the real-time code rate is not in the preset range and is smaller than the first threshold, the real-time code rate is increased until the real-time code rate is larger than or equal to the second threshold. Specifically, when the real-time code rate is not within the preset range and is smaller than the first threshold, it is indicated that the real-time code rate is smaller than the second threshold at this time, that is, the storage bandwidth is already far greater than the storage requirement of the real-time code rate of the video, and in order to obtain a video image with good definition, the real-time code rate needs to be increased. When the real-time code rate is increased, the storage code rate can be increased according to the priority of each path of video channel, and the storage code rates of all the video channels can also be increased step by step according to a preset increasing grade until the real-time code rate is larger than or equal to a second threshold value.
In one embodiment, if the real-time bitrate is not within a preset range and is less than the first threshold, the increasing the real-time bitrate until the real-time bitrate is greater than or equal to the second threshold further includes: when the real-time code rate is increased, the code rate of each video channel is smaller than or equal to the default code rate of the corresponding video channel, and the default code rate is a preset code rate meeting the storage requirement of the storage bandwidth. Specifically, a default bitrate of each video channel is preset. When the environmental temperature meets the design specification and the storage device is normally used, the default code rate is the optimal code rate value meeting the storage bandwidth of the storage device. When the real-time code rate value is small and the real-time code rate needs to be improved, the storage code rate of each video channel should not exceed the default code rate. If the storage bitrate of each video channel exceeds the default bitrate, the total bitrate of the multiple video channels may be caused, that is, the real-time bitrate is higher than the first threshold of the storage bandwidth, and therefore, in this embodiment, the default bitrate of each video channel should be smaller than or equal to the default bitrate.
Step S204, if the real-time code rate is larger than the first threshold, reducing the real-time code rate until the real-time code rate is smaller than or equal to the first threshold. Specifically, if the acquired real-time code rate of the video recorder is greater than a first threshold of the hard disk storage bandwidth, the control command is generated to control the encoding module to reduce the storage code rate of the current video channel, so that the storage code rate is always lower than the storage bandwidth, and the image information acquired by the camera is completely stored in the storage device.
In one embodiment, the reducing the real-time bitrate if the real-time bitrate is greater than the first threshold until the real-time bitrate is less than or equal to the first threshold includes: and if the real-time code rate is larger than the first threshold, sequentially reducing the code rate of each video channel according to the priority of the video channel until the real-time code rate is smaller than or equal to the first threshold. Specifically, in practical applications, the storage code rates of the video channels of the video recorder may be different due to the requirement on the definition of the recorded video. Therefore, the priority can be set for the decreasing sequence of each video channel, and when the real-time code rate is larger than the current first threshold, the code rate of each video channel is decreased once according to the priority of each video channel. For example: the video recorder is 4 video recorders, and the priority of each video channel when the code rate is reduced is the first path, the second path, the third path and the fourth path. And the storage code rate of each path is 4MB/S, the total code rate of the video recorder is 16MB/S as a real-time code rate, if the real-time code rate is greater than a first threshold value of 14MB/S, the code rate of the first path of video channel is preferentially reduced, and the adjusted code rates of each path of video channel are 2MB/S of the first path, 4MB/S of the second path, 4MB/S of the third path and 4MB/S of the fourth path. Another example is: the video recorder is 4 video recorders, and the priority of each video channel when the code rate is reduced is the first path, the second path, the third path and the fourth path. The storage code rate of each path is 4MB/S, the total code rate of the video recorder is 16MB/S as the real-time code rate, if the real-time code rate is greater than the first threshold value of 12MB/S, the code rate of the first path of video channel is preferentially reduced, and then the code rate of the second path of video channel is reduced; the adjusted code rate of each path of video channel is 2MB/S of the first path, 2MB/S of the second path, 4MB/S of the third path and 4MB/S of the fourth path.
In one embodiment, the reducing the real-time bitrate if the real-time bitrate is greater than or equal to the first threshold until the real-time bitrate is less than or equal to the first threshold includes: if the real-time code rate is larger than the first threshold, the real-time code rate is reduced step by step according to a preset code rate grade until the real-time code rate is smaller than or equal to the first threshold. Specifically, when the real-time code rate is reduced, the level of reducing the code rate each time can be set, and the code rate is reduced step by step. For example, when the code rate is reduced for the first time, the storage code rates of all the video channels are all reduced by 2MB/S, and when the code rate is reduced for the second time, all the video channels are reduced by 1 MB/S; the bit rate of each level reduction can be set by a user in a customized manner, which is not limited by the invention.
Through the steps, the problem of insufficient storage bandwidth is judged by acquiring the real-time code rate of the video channel and the storage bandwidth of the storage device and combining the relation between the actual storage bandwidth of the current hard disk and the total code rate; when the storage bandwidth is reduced to a value which does not meet the requirement of the total video code rate, automatically adjusting the video recorder or the coding rate of the front-end camera according to the priority of the video channel or the preset adjustment level to reduce the storage code rate, and ensuring that the video is not lost by sacrificing part of the image quality; when the actual storage bandwidth of the hard disk is recovered to be normal, the video code rate control method can also control the video recorder or the front-end camera to recover the code rate so as to meet the actual image quality requirement.
The embodiments of the present application are described and illustrated below by means of preferred embodiments.
In one embodiment, fig. 3 is a schematic structural diagram of a digital hard disk recorder according to a preferred embodiment of the present application. As shown in fig. 3, assume that 8 analog cameras with consistent resolution are connected to the digital hard disk recorder DVR, each path of video input corresponds to a virtual encoding module inside the DVR, and the video signals are compressed by the encoding module and then stored in the hard disk. The code rate of the video signal after being compressed by the encoding module is settable, for example, the default code rate is 2MB/S, and the code rate can be manually configured into 4MB/S, 1MB/S and the like, and the difference is that the definition of the picture is slightly poor when the code rate is small and the playback is carried out.
The storage bandwidth of the hard disk at normal temperature is relatively fixed, such as 130 MB/S. When the temperature of the hard disk is too high and exceeds the threshold value, the hard disk will increase the read operation after each write operation to ensure successful write, and the increased read operation causes the storage bandwidth of the hard disk to be reduced, such as to 10MB/S or even lower.
The total code rate of 8 paths of video signals after being compressed is 8 × 2 MB/S-16 MB/S at normal temperature, which is less than the storage bandwidth 130MB/S of the hard disk, and the video information can be normally stored. However, when the temperature of the hard disk is higher than the threshold value, the storage bandwidth of the hard disk is supposed to be reduced to 10MB/S, and at this time, the storage bandwidth cannot meet the requirement of simultaneous storage of all video information, and a video loss phenomenon inevitably exists.
In order to avoid video loss, the problem of insufficient storage bandwidth needs to be judged by combining the relation between the actual storage bandwidth of the current hard disk and the total video code rate, and when the judgment is abnormal, the code rate is automatically reduced or partial channels are closed according to the priority of the channels. Fig. 4 is a flowchart of a video bitrate control method according to a preferred embodiment of the present application, and as shown in fig. 4, after a system is started and a hard disk recorder starts to work, a user can set default bitrates of each channel of video channels as R1 and R2 … Rn. The method comprises the steps of obtaining the number of video channels accessed by the hard disk video recorder, obtaining real-time code rate values r1 and r2 … rn, calculating the total code rate r (r1+ r2+ … + rn), and obtaining the current actual storage bandwidth B. Determine whether the total code rate r is less than or equal to X% of the storage bandwidth B and greater than or equal to Y% of the storage bandwidth B (i.e., r/B ≦ X%)? If yes, the storage bandwidth just meets the requirement of the total video code rate, the code rate of each video channel does not need to be adjusted, and the code rate of each video channel is kept unchanged; if the ratio of the total code rate r to the storage bandwidth is not between Y% and X% of the storage bandwidth B, then determine whether the total code rate r is greater than X% (i.e., r/B > X%) of the storage bandwidth B? If yes, the storage bandwidth does not meet the requirement of the total video code rate, the code rate of each channel needs to be reduced, and the total code rate r is adjusted step by step until the total code rate r is less than or equal to X% of the actual storage bandwidth B; if the ratio of the total code rate r to the storage bandwidth is not between Y% and X% of the storage bandwidth B, and the total code rate r is smaller than X% of the storage bandwidth B (namely r/B < X%), it is indicated that the storage bandwidth is far greater than the requirement of the total code rate of the video, the code rates of the channels need to be increased, at this time, the adjustment is performed step by step until the total code rate r is greater than Y% of the current actual storage bandwidth B, and the code rates r1 and r2 … Rn of the single channel cannot be greater than the default value Rn.
In one embodiment, fig. 5 is a schematic diagram of a network hard disk recorder according to a preferred embodiment of the present application, as shown in fig. 5, 8 IP cameras with consistent resolution are connected to an NVR, a video encoding module is arranged at an IP camera end, and when a code rate needs to be controlled, a control module generates a control command and sends the control command to the encoding module at the IP camera end to adjust a video storage code rate.
It should be noted that the steps illustrated in the above-described flow diagrams or in the flow diagrams of the figures may be performed in a computer system, such as a set of computer-executable instructions, and that, although a logical order is illustrated in the flow diagrams, in some cases, the steps illustrated or described may be performed in an order different than here.
This embodiment further provides a video rate control device, which is used to implement the foregoing embodiments and preferred embodiments, and the description of the device is omitted here. As used hereinafter, the terms "module," "unit," "subunit," and the like may implement a combination of software and/or hardware for a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
Fig. 6 is a block diagram of a video rate control apparatus according to an embodiment of the present application, and as shown in fig. 6, the apparatus includes:
the acquisition module 10: the method is used for acquiring the real-time code rate of the video channel and the storage bandwidth of the storage device.
The processing module 20: the method is used for acquiring a first threshold value according to the storage bandwidth.
The comparison module 30: for comparing the real-time code rate with the first threshold.
The control module 40: and if the real-time code rate is greater than the first threshold, reducing the real-time code rate until the real-time code rate is less than or equal to the first threshold.
The acquisition module 10 is further configured to acquire the access number of the video channels and the code rate of each video channel, and calculate a total code rate of the plurality of video channels as a real-time code rate.
The processing module 20 is further configured to obtain a first threshold and a second threshold according to the storage bandwidth, where the first threshold is greater than the second threshold; acquiring a preset range according to the first threshold and the second threshold; the upper limit of the preset range is less than or equal to the first threshold value, and the lower limit of the preset range is greater than or equal to the second threshold value; judging whether the real-time code rate is in a preset range, and if the real-time code rate is in the preset range, keeping the real-time code rate unchanged; and if the real-time code rate is not in a preset range, comparing the real-time code rate with the first threshold value.
The comparing module 30 is further configured to, if the real-time code rate is not within the preset range and is smaller than the first threshold, increase the real-time code rate until the real-time code rate is greater than or equal to the second threshold.
The comparing module 30 is further configured to, when the real-time bitrate is increased, determine that the bitrate of each video channel is smaller than or equal to a default bitrate of a corresponding video channel, where the default bitrate is a preset bitrate that meets the storage requirement of the storage bandwidth.
The control module 40 is further configured to, if the real-time code rate is greater than the first threshold, sequentially reduce the code rate of each video channel according to the priority of the video channel until the real-time code rate is less than or equal to the first threshold.
The control module 40 is further configured to, if the real-time code rate is greater than the first threshold, gradually decrease the real-time code rate according to a preset code rate level until the real-time code rate is less than or equal to the first threshold.
The above modules may be functional modules or program modules, and may be implemented by software or hardware. For a module implemented by hardware, the modules may be located in the same processor; or the modules can be respectively positioned in different processors in any combination.
In addition, the video rate control method described in the embodiment of the present application with reference to fig. 1 may be implemented by a computer device. Fig. 7 is a hardware structure diagram of a computer device according to an embodiment of the present application.
The computer device may comprise a processor 71 and a memory 72 in which computer program instructions are stored.
Specifically, the processor 71 may include a Central Processing Unit (CPU), or A Specific Integrated Circuit (ASIC), or may be configured to implement one or more Integrated circuits of the embodiments of the present Application.
The memory 72 may be used to store or cache various data files that need to be processed and/or used for communication, as well as possible computer program instructions executed by the processor 71.
The processor 71 reads and executes the computer program instructions stored in the memory 72 to implement any one of the video rate control methods in the above embodiments.
In some of these embodiments, the computer device may also include a communication interface 73 and a bus 70. As shown in fig. 7, the processor 71, the memory 72, and the communication interface 73 are connected via the bus 70 to complete mutual communication.
The communication interface 73 is used for realizing communication among modules, devices, units and/or equipment in the embodiment of the present application. The communication port 73 may also be implemented with other components such as: the data communication is carried out among external equipment, image/data acquisition equipment, a database, external storage, an image/data processing workstation and the like.
The bus 70 comprises hardware, software, or both that couple the components of the computer device to one another. Bus 70 includes, but is not limited to, at least one of the following: data Bus (Data Bus), Address Bus (Address Bus), Control Bus (Control Bus), Expansion Bus (Expansion Bus), and Local Bus (Local Bus). By way of example, and not limitation, Bus 70 may include an Accelerated Graphics Port (AGP) or other Graphics Bus, an Enhanced Industry Standard Architecture (EISA) Bus, a Front-Side Bus (FSB), a Hyper Transport (HT) Interconnect, an ISA (ISA) Bus, an InfiniBand (InfiniBand) Interconnect, a Low Pin Count (LPC) Bus, a memory Bus, a microchannel Architecture (MCA) Bus, a PCI (Peripheral Component Interconnect) Bus, a PCI-Express (PCI-X) Bus, a Serial Advanced Technology Attachment (SATA) Bus, a Video Electronics Bus (audio Electronics Association), abbreviated VLB) bus or other suitable bus or a combination of two or more of these. Bus 70 may include one or more buses, where appropriate. Although specific buses are described and shown in the embodiments of the application, any suitable buses or interconnects are contemplated by the application.
The computer device may execute the video rate control method in the embodiment of the present application based on the obtained computer program instruction, thereby implementing the video rate control method described in conjunction with fig. 1.
In addition, in combination with the video rate control method in the foregoing embodiment, the embodiment of the present application may provide a computer-readable storage medium to implement the method. The computer readable storage medium having stored thereon computer program instructions; the computer program instructions, when executed by a processor, implement any of the video rate control methods in the above embodiments.
The technical features of the embodiments described above may be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the embodiments described above are not described, but should be considered as being within the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.
Claims (10)
1. A method for controlling video bitrate, comprising:
acquiring the real-time code rate of a video channel and the storage bandwidth of storage equipment;
acquiring a first threshold according to the storage bandwidth;
comparing the real-time code rate to the first threshold;
and if the real-time code rate is larger than the first threshold, reducing the real-time code rate until the real-time code rate is smaller than or equal to the first threshold.
2. The method of claim 1, wherein the obtaining the real-time bitrate of the video channel comprises:
and acquiring the access number of the video channels and the code rate of each video channel, and calculating the total code rate of the plurality of video channels as the real-time code rate.
3. The video rate control method of claim 2, wherein the obtaining the first threshold according to the storage bandwidth further comprises:
acquiring a first threshold and a second threshold according to the storage bandwidth, wherein the first threshold is larger than the second threshold;
acquiring a preset range according to the first threshold and the second threshold; the upper limit of the preset range is less than or equal to the first threshold value, and the lower limit of the preset range is greater than or equal to the second threshold value;
judging whether the real-time code rate is in a preset range, and if the real-time code rate is in the preset range, keeping the real-time code rate unchanged;
and if the real-time code rate is not in a preset range, comparing the real-time code rate with the first threshold value.
4. The method of claim 3, wherein if the real-time bitrate is greater than the first threshold, decreasing the real-time bitrate until the real-time bitrate is less than or equal to the first threshold further comprises:
and if the real-time code rate is not in the preset range and is smaller than the first threshold, the real-time code rate is increased until the real-time code rate is larger than or equal to the second threshold.
5. The method of claim 4, wherein if the real-time bitrate is not within a preset range and is less than the first threshold, the increasing the real-time bitrate until the real-time bitrate is greater than or equal to the second threshold further comprises:
when the real-time code rate is increased, the code rate of each video channel is smaller than or equal to the default code rate of the corresponding video channel, and the default code rate is a preset code rate meeting the storage requirement of the storage bandwidth.
6. The method of claim 1, wherein if the real-time bitrate is greater than the first threshold, decreasing the real-time bitrate until the real-time bitrate is less than or equal to the first threshold comprises:
and if the real-time code rate is larger than the first threshold, sequentially reducing the code rate of each video channel according to the priority of the video channel until the real-time code rate is smaller than or equal to the first threshold.
7. The method of claim 1, wherein the reducing the real-time bitrate until the real-time bitrate is less than or equal to the first threshold if the real-time bitrate is greater than or equal to the first threshold comprises:
if the real-time code rate is larger than the first threshold, the real-time code rate is reduced step by step according to a preset code rate grade until the real-time code rate is smaller than or equal to the first threshold.
8. An apparatus for controlling video bitrate, comprising:
an acquisition module: the method comprises the steps of obtaining a real-time code rate of a video channel and a storage bandwidth of a storage device;
a processing module: the device is used for acquiring a first threshold according to the storage bandwidth;
a comparison module: for comparing the real-time code rate with the first threshold;
a control module: and if the real-time code rate is greater than the first threshold, reducing the real-time code rate until the real-time code rate is less than or equal to the first threshold.
9. A computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the video rate control method of any of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, implements the video rate control method according to any of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011506368.7A CN112738444A (en) | 2020-12-18 | 2020-12-18 | Video code rate control method and device, computer equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011506368.7A CN112738444A (en) | 2020-12-18 | 2020-12-18 | Video code rate control method and device, computer equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112738444A true CN112738444A (en) | 2021-04-30 |
Family
ID=75603136
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011506368.7A Pending CN112738444A (en) | 2020-12-18 | 2020-12-18 | Video code rate control method and device, computer equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112738444A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113645402A (en) * | 2021-07-27 | 2021-11-12 | 深圳市阿达视高新技术有限公司 | Bit rate control method and system for image pickup apparatus, storage medium, and image pickup apparatus |
Citations (6)
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 |
CN101977185A (en) * | 2010-10-14 | 2011-02-16 | 杭州海康威视数字技术股份有限公司 | Digital video recorder in video monitoring system and network connection control method thereof |
CN102264003A (en) * | 2010-05-27 | 2011-11-30 | 华为软件技术有限公司 | Realization method for lowering code rate as well as relevant equipment and system |
CN106463164A (en) * | 2014-07-29 | 2017-02-22 | 深圳市大疆创新科技有限公司 | System and method for dynamically adjusting recording bitrate to accommodate writing speed of storage device |
US10349059B1 (en) * | 2018-07-17 | 2019-07-09 | Wowza Media Systems, LLC | Adjusting encoding frame size based on available network bandwidth |
CN110062003A (en) * | 2019-04-30 | 2019-07-26 | 北京金山云网络技术有限公司 | Video data transmitting method, device, electronic equipment and storage medium |
-
2020
- 2020-12-18 CN CN202011506368.7A patent/CN112738444A/en active Pending
Patent Citations (6)
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 |
CN102264003A (en) * | 2010-05-27 | 2011-11-30 | 华为软件技术有限公司 | Realization method for lowering code rate as well as relevant equipment and system |
CN101977185A (en) * | 2010-10-14 | 2011-02-16 | 杭州海康威视数字技术股份有限公司 | Digital video recorder in video monitoring system and network connection control method thereof |
CN106463164A (en) * | 2014-07-29 | 2017-02-22 | 深圳市大疆创新科技有限公司 | System and method for dynamically adjusting recording bitrate to accommodate writing speed of storage device |
US10349059B1 (en) * | 2018-07-17 | 2019-07-09 | Wowza Media Systems, LLC | Adjusting encoding frame size based on available network bandwidth |
CN110062003A (en) * | 2019-04-30 | 2019-07-26 | 北京金山云网络技术有限公司 | Video data transmitting method, device, electronic equipment and storage medium |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113645402A (en) * | 2021-07-27 | 2021-11-12 | 深圳市阿达视高新技术有限公司 | Bit rate control method and system for image pickup apparatus, storage medium, and image pickup apparatus |
CN113645402B (en) * | 2021-07-27 | 2022-05-17 | 深圳市阿达视高新技术有限公司 | Bit rate control method and system for image pickup apparatus, storage medium, and image pickup apparatus |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20070255890A1 (en) | Flash memory apparatus and access method to flash memory | |
US9055204B2 (en) | Image capture device with network capability and computer program | |
US8233790B2 (en) | Data recording apparatus and digital camera | |
US20150281573A1 (en) | Imaging apparatus and control method thereof | |
CN110198475B (en) | Video processing method, device, equipment, server and readable storage medium | |
JP5235541B2 (en) | Recording apparatus and method | |
CN110521208B (en) | System and method for intelligent data/frame compression in a system-on-chip | |
US9456173B2 (en) | Recording apparatus and recording method | |
US9036982B2 (en) | Recording apparatus | |
CN112738444A (en) | Video code rate control method and device, computer equipment and storage medium | |
US8423704B2 (en) | Dynamic optimization of memory use in a digital recording device | |
CN104408109A (en) | Alarm video recording method and device | |
US9277197B2 (en) | Recording apparatus, recording method, and recording system | |
CN112104840B (en) | Video acquisition method and mobile baseband workstation | |
JP5473623B2 (en) | Data recording apparatus and control method thereof | |
US8526796B2 (en) | Network video recorder and method for recording video data in the network video recorder | |
US20050175036A1 (en) | IP image transmission apparatus | |
US11334142B2 (en) | Recording apparatus, image capturing apparatus, control method, and storage medium | |
US8761573B2 (en) | Recording device, imaging and recording device, recording method, and program | |
CN104394453A (en) | Video prerecording method and device | |
US9025935B2 (en) | Recording apparatus, recording method, and recording system | |
JP5693277B2 (en) | Recording apparatus and recording method | |
KR102369798B1 (en) | Data management method and data management system | |
MX2008001567A (en) | Content data storage device and its control method. | |
US7999853B2 (en) | Moving image reproducing apparatus and processing method therefor |
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20210430 |
|
RJ01 | Rejection of invention patent application after publication |