Code stream control method, network camera, electronic device and storage medium
By adjusting the encoding parameters and the number of picture frames of the network camera, the problem of fuzzy key information when monitoring video files reduces the code stream is solved, and image quality improvement and storage space optimization are achieved.
Patent Information
- Application Number
- CN202211337157.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-28
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2042-10-28
AI Technical Summary
In the process of reducing the monitoring video file code stream, the prior art may lead to blurring of key information and affecting the display effect.
By adjusting the encoding code rate of the network camera and the specified parameters of the picture frames in the picture group, especially increasing the quantization parameters of the keyframes and reducing the quantization parameters of non-keyframes, we ensure that the picture quality of the target to be monitored is enhanced, and at the same time adjusting the number of picture frames in the picture group to reduce the number of keyframes.
While ensuring that the key information is not blurred, the code stream is reduced, the image quality of the surveillance video is improved, especially the clarity of the target to be monitored, and the storage space is reduced.
Smart Images

Figure CN115695921B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of monitoring technology, and in particular to a code stream control method, a network camera, an electronic device, and a storage medium. Background Art
[0002] In recent years, surveillance video technology has become more stable and mature, high-definition network cameras have become more and more common, and users have higher and higher requirements for surveillance video. They hope to reduce storage costs while ensuring the acquisition of key surveillance video information.
[0003] Currently, the size of surveillance video files is usually reduced by adjusting encoding parameters to reduce the bit rate. However, this method also reduces the display quality of surveillance video files and may cause key information in the surveillance video files to be blurred. Summary of the Invention
[0004] The present application provides a code stream control method, a network camera, an electronic device and a storage medium to solve the problem that the existing technology may reduce the display effect of the monitoring video file and may cause the key information in the monitoring video file to be blurred.
[0005] In a first aspect, the present application provides a bitrate control method applied to a network camera, the method comprising: when there is a target to be monitored in the monitoring image captured by the network camera, adjusting the bitrate of the network camera encoding and the specified parameters of the picture frame in the picture group, so that the image quality of the target to be monitored in the current monitoring picture of the network camera is enhanced.
[0006] In an embodiment of the present application, by adjusting the bit rate of the network camera encoding and the specified parameters of the picture frames in the picture group, the image quality of the monitored target in the current monitoring picture of the network camera is enhanced, and the bit rate is reduced while ensuring that key information is not blurred as much as possible.
[0007] In combination with the technical solution provided in the first aspect above, in some possible implementations, the specified parameters include quantization parameters, and adjusting the specified parameters of the picture frames in the picture group includes: increasing the maximum quantization parameter value and the minimum quantization parameter value of the key frames in the picture group, wherein the maximum quantization parameter value of the key frame after the increase is greater than the minimum quantization parameter value of the key frame after the increase, and the maximum quantization parameter value of the key frame after the increase is less than or equal to the maximum value that the quantization parameter can be adjusted.
[0008] In the embodiment of the present application, the quantization step size level of non-key frames in the picture group is reduced, thereby improving the picture quality of the non-key frames, thereby ensuring the picture quality of key information as much as possible.
[0009] In combination with the technical solution provided in the first aspect above, in some possible implementations, increasing the maximum quantization parameter value and the minimum quantization parameter value of the key frame in the picture group includes: increasing the maximum quantization parameter value of the key frame by a first preset value, the sum of the maximum quantization parameter value of the key frame and the first preset value is less than or equal to the maximum value that the quantization parameter can be adjusted, and the first preset value is a positive integer; increasing the minimum quantization parameter value of the key frame by a second preset value, the sum of the minimum quantization parameter value of the key frame and the second preset value is less than the sum of the maximum quantization parameter value of the key frame and the first preset value, and the second preset value is a positive integer.
[0010] In an embodiment of the present application, the sum of the maximum quantization parameter value of the key frame and the first preset value is limited to be less than or equal to the maximum value that the quantization parameter can be adjusted, and the sum of the minimum quantization parameter value of the key frame and the second preset value is less than the sum of the maximum quantization parameter value of the key frame and the first preset value, so as to ensure that the adjusted key frame can still be used normally and prevent the problem of the key frame being unable to be decoded after the quantization parameter of the key frame is adjusted.
[0011] In combination with the technical solution provided in the first aspect above, in some possible implementations, the designated parameters include quantization parameters, and adjusting the designated parameters of the picture frames in the picture group includes: for each picture frame in the picture group except the key frames, reducing the maximum quantization parameter value and the minimum quantization parameter value of the picture frame, wherein the maximum quantization parameter value of the picture frame after the reduction is greater than the minimum quantization parameter value of the picture frame after the reduction.
[0012] In the embodiment of the present application, since the smaller the quantization parameter, the better the image quality, by reducing the maximum quantization parameter value and the minimum quantization parameter value of each frame in the picture group except the key frames, the picture quality of each frame in the picture group except the key frames can be improved, thereby ensuring the picture quality of the monitored target in the current monitoring picture of the network camera.
[0013] In combination with the technical solution provided in the first aspect above, in some possible implementations, reducing the maximum quantization parameter value and the minimum quantization parameter value of each picture frame other than the key frame in the picture group includes: reducing the maximum quantization parameter value of each picture frame other than the key frame in the picture group by a third preset value, where the third preset value is a positive integer less than or equal to the maximum quantization parameter value; and reducing the minimum quantization parameter value of the picture frame by a fourth preset value, where the fourth preset value is a positive integer less than or equal to the minimum quantization parameter value.
[0014] In the embodiment of the present application, the third preset value is limited to a positive integer less than or equal to the maximum quantization parameter value, and the fourth preset value is limited to a positive integer less than or equal to the minimum quantization parameter value, to ensure that the adjusted picture frame can still be used normally, and to prevent the problem of the picture frame being unable to be decoded or encoded after the quantization parameter of the picture frame is adjusted.
[0015] In combination with the technical solution provided in the first aspect above, in some possible implementations, when the current ambient light intensity meets a preset condition, the number of picture frames in the picture group of the network camera is adjusted.
[0016] In the embodiment of the present application, the key frames in each picture group occupy a larger storage space than other picture frames. Therefore, by adjusting the number of picture frames in the picture group, the number of key frames in the picture group containing the same picture content can be made smaller, thereby reducing the occupied memory and code stream.
[0017] In combination with the technical solution provided in the first aspect above, in some possible implementations, adjusting the number of picture frames in the picture group of the network camera includes: increasing the number of picture frames in the picture group by a specified number.
[0018] In the embodiment of the present application, by increasing the number of picture frames in a picture group, the number of key frames in a picture group corresponding to the same picture content can be made smaller, thereby reducing the occupied memory and code stream.
[0019] In combination with the technical solution provided in the first aspect above, in some possible implementations, the preset condition includes: an exposure gain of the network camera is greater than a preset threshold.
[0020] In the embodiment of the present application, the exposure gain of the network camera is used to determine whether the light intensity of the current environment meets the preset threshold, which reduces the difficulty of determining whether the light intensity of the current environment meets the preset threshold.
[0021] In a second aspect, the present application provides a network camera, comprising: a processor, which is used to adjust the bit rate of the network camera encoding and the specified parameters of the picture frames in the picture group when there is a target to be monitored in the monitoring image captured by the network camera, so that the image quality of the target to be monitored in the current monitoring picture of the network camera is enhanced.
[0022] In a third aspect, an embodiment of the present application further provides an electronic device, comprising: a memory and a processor, the memory and the processor being connected; the memory being used to store programs; and the processor being used to call the programs stored in the memory to execute a method provided in the embodiment of the first aspect above and / or in combination with any possible implementation method of the embodiment of the first aspect above.
[0023] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored. When the computer program is run by a computer, it executes the method provided in the embodiment of the first aspect above and / or any possible implementation method in combination with the embodiment of the first aspect above. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without paying any creative work.
[0025] Figure 1 A flow chart of a code stream control method according to an embodiment of the present application is shown;
[0026] Figure 2 This is a flow chart of another bitrate control method according to an embodiment of the present application;
[0027] Figure 3 This is a flow chart of another bitrate control method according to an embodiment of the present application;
[0028] Figure 4 This is a structural block diagram of an electronic device shown in an embodiment of the present application. DETAILED DESCRIPTION
[0029] The terms "first", "second", "third", etc. are only used to distinguish and describe, and do not indicate the order of arrangement, nor can they be understood as indicating or implying relative importance.
[0030] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.
[0031] It should be noted that similar numbers and letters represent similar items in the following figures, so once an item is defined in one figure, it does not need to be further defined and explained in the subsequent figures. At the same time, in the description of this application, relational terms such as "first", "second", etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or equipment including a series of elements includes not only those elements, but also includes other elements that are not clearly listed, or also includes elements inherent to such process, method, article or equipment. In the absence of more restrictions, the elements defined by the sentence "comprise a..." do not exclude the presence of other identical elements in the process, method, article or equipment including the elements.
[0032] Furthermore, the term "and / or" in this application is merely a description of the association relationship between associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0033] The technical solution of this application will be described in detail below with reference to the accompanying drawings.
[0034] See also Figure 1 , Figure 1 A flow chart of a code stream control method provided in an embodiment of the present application is provided. The code stream control method is applied to a network camera. Figure 1 Describe the steps it involves.
[0035] S100: When a target to be monitored exists in a monitoring image captured by a network camera, the encoding bit rate of the network camera and the designated parameters of the picture frames in the picture group are adjusted to enhance the image quality of the target to be monitored in the current monitoring picture of the network camera.
[0036] In order to enhance the image quality of the target to be monitored in the current monitoring screen of the network camera and ensure that key information is not blurred, it is also necessary to perform image recognition on the monitoring image captured by the network camera. When the target to be monitored is recognized in the monitoring image, the bit rate of the network camera encoding and the specified parameters of the picture frame in the picture group are adjusted.
[0037] Among them, the target to be monitored can be set according to actual needs. For example, the target to be monitored can be a person; when the network camera is used to monitor animals, the target to be monitored can be an animal; when the network camera is used to monitor moving vehicles, the target to be monitored can be a vehicle, etc. The specific selection of the target to be monitored is not restricted here.
[0038] The specific implementation method and principle of image recognition to determine whether a target to be monitored exists in the monitored image are well known to those skilled in the art and will not be described in detail here for the sake of brevity.
[0039] Adjusting the bit rate of the network camera encoding may be increasing the bit rate of the network camera encoding by a preset value, or increasing the preset magnification.
[0040] For example, when adjusting the bit rate of the network camera encoding is to increase the maximum bit rate of the network camera encoding by a preset value, and the preset value is K, and the maximum bit rate of the network camera encoding is MaxBitrate, then the adjusted bit rate of the network camera encoding is MaxBitrate+K, where K is a positive integer.
[0041] When adjusting the bit rate of the network camera encoding, the maximum bit rate of the network camera encoding is increased by a preset ratio, and the preset value is J. The maximum bit rate of the network camera encoding is MaxBitrate, then the adjusted bit rate of the network camera encoding is MaxBitrate*J.
[0042] A GOP typically includes key frames and at least one of forward-predicted frames and bidirectionally interpolated frames. Therefore, when the specified parameters include quantization parameters, there are three specific implementations for adjusting the bit rate of the network camera encoding and the specified parameters of the frames in the GOP.
[0043] Under the first implementation mode, the specific process of adjusting the specified parameters of the picture frames in the picture group is: increasing the maximum quantization parameter value and the minimum quantization parameter value of the key frames in the picture group, wherein the maximum quantization parameter value of the key frame after the increase is greater than the minimum quantization parameter value of the key frame after the increase, and the maximum quantization parameter value of the key frame after the increase is less than or equal to the maximum value that the quantization parameter can be adjusted.
[0044] Optionally, increasing the maximum quantization parameter value and the minimum quantization parameter value of the key frame in the picture group includes: increasing the maximum quantization parameter value of the key frame by a first preset value, where the sum of the maximum quantization parameter value of the key frame and the first preset value is less than or equal to the maximum value that the quantization parameter can be adjusted, and the first preset value is a positive integer; and increasing the minimum quantization parameter value of the key frame by a second preset value, where the sum of the minimum quantization parameter value of the key frame and the second preset value is less than the sum of the maximum quantization parameter value of the key frame and the first preset value, and the second preset value is a positive integer.
[0045] When the quantization parameter is the Qp parameter (the quantization level in the video coding standard protocol, the smaller the value, the better the image quality and the larger the image data volume), the MaxIQp value is used to represent the maximum quantization parameter value of the key frame, and the MinIQp value is used to represent the minimum quantization parameter value of the key frame. A represents the first preset value and B represents the second preset value. Then, increasing the maximum quantization parameter value and the minimum quantization parameter value of the key frame in the picture group can be: increasing the MaxIQp value and the MinIQp value of the key frame to obtain the MaxIQp′ value and the MinIQp′ value, wherein the MaxIQp′ value is greater than the MinIQp′ value, and the MaxIQp′ value is less than or equal to the maximum value of the Qp parameter.
[0046] That is, MaxIQp′=MaxIQp+A; MinIQp′=MinIQp+B.
[0047] The first preset value may be 6, and the second preset value may be 3, then MaxIQp′=MaxIQp+6; MinIQp′=MinIQp+3, and MaxIQp′>MinIQp′.
[0048] In the second embodiment, the specific process of adjusting the specified parameters of the picture frames in the picture group is: for each picture frame (i.e., any one of the forward prediction frames and the bidirectional interpolation frames) except the key frames in the picture group, reducing the maximum quantization parameter value and the minimum quantization parameter value of the picture frame, wherein the maximum quantization parameter value of the picture frame after the reduction is greater than the minimum quantization parameter value of the picture frame after the reduction.
[0049] Optionally, for each picture frame except the key frame in the picture group, reducing the maximum quantization parameter value and the minimum quantization parameter value of the picture frame includes: for each picture frame except the key frame in the picture group, reducing the maximum quantization parameter value of the picture frame by a third preset value, where the third preset value is a positive integer less than or equal to the maximum quantization parameter value; and reducing the minimum quantization parameter value of the picture frame by a fourth preset value, where the fourth preset value is a positive integer less than or equal to the minimum quantization parameter value.
[0050] For each picture frame other than the key frame in the picture group, when the quantization parameter is the Qp parameter, the MaxQp value is used to represent the maximum quantization parameter value of the picture frame, and the MinQp value is used to represent the minimum quantization parameter value of the picture frame. C represents the third preset value, and D represents the fourth preset value. Then, reducing the maximum quantization parameter value and the minimum quantization parameter value of the picture frame in the picture group can be: reducing the MaxQp value and the MinQp value of the picture frame to obtain the MaxQp′ value and the MinQp′ value, wherein the MaxQp′ value of the picture frame is greater than the MinQp′ value.
[0051] That is, MaxQp′=MaxQp-C; MinQp′=MinQp-D.
[0052] The third preset value may be 6, and the fourth preset value may be 1, then MaxQp′=MaxQp−6; MinQp′=MinQp−1, where MaxQp′>MinQp′>0.
[0053] In a third embodiment, the specific process of adjusting the specified parameters of the picture frames in the picture group is: increasing the maximum quantization parameter value and the minimum quantization parameter value of the key frames in the picture group, and reducing the maximum quantization parameter value and the minimum quantization parameter value of each picture frame except the key frames in the picture group.
[0054] Among them, the specific implementation method and process of increasing the maximum quantization parameter value and the minimum quantization parameter value of the key frame in the picture group are consistent with the first implementation method mentioned above. For each frame of the picture group except the key frame, the specific implementation method and process of reducing the maximum quantization parameter value and the minimum quantization parameter value of the picture frame are consistent with the second implementation method mentioned above. For the sake of brief description, they are not repeated here.
[0055] Compared with existing encoding parameters, the above encoding parameters are used to obtain the code stream of the monitoring image. In other words, the obtained image including the monitored target is clearer, and its corresponding APSNR (Average Peak Signal to Noise Ratio) is 25. The image using normal bit rate control parameters is not very clear, and its corresponding APSNR is 19. The average peak signal-to-noise ratio refers to the average value of the peak signal-to-noise ratios of the Y and UV components. The larger the average peak signal-to-noise ratio, the closer the monitoring image is to the original image, that is, the better the image quality. YUV is the image data format before encoding, where Y is the grayscale component and UV is the color component.
[0056] In one embodiment, the aforementioned bitrate control method further includes adjusting the number of frames in a picture group of the network camera when the current ambient light intensity satisfies a preset condition. Because key frames in each picture group occupy more storage space than other frames, adjusting the number of frames in a picture group can reduce the number of key frames in a picture group containing the same content, thereby reducing memory usage and bitrate.
[0057] A group of pictures (GOP) refers to the image frames that comprise a group of images encoded in a video coding protocol. Video coding protocols categorize frames into three types: I-frames, P-frames, and B-frames. I-frames are intra-coded frames, P-frames are forward-predicted frames, and B-frames are bidirectionally interpolated frames. In other words, an I-frame is a keyframe and represents a complete image. P-frames and B-frames record changes relative to an I-frame: a P-frame represents the difference from the previous frame, while a B-frame represents the difference from the previous frame to the next. Without I-frames, P-frames and B-frames cannot be decoded.
[0058] In one embodiment, the number of frames in a picture group of a network camera can be adjusted by increasing the number of frames in the picture group by a specified amount. By increasing the number of frames in the picture group, the number of key frames in the picture group corresponding to the same picture content can be reduced, thereby reducing memory usage and bitrate.
[0059] The specified number may be a positive integer. In this case, the sum of the number of picture frames in the picture group and the specified number is the number of picture frames in the increased picture group. For example, if the number of picture frames in the picture group is N and the specified number is A, the number of picture frames in the increased picture group is N+A, where N and A are positive integers.
[0060] Alternatively, the specified number may be a multiplication factor, in which case the product of the number of picture frames in the picture group and the specified number is the increased number of picture frames in the picture group. For example, if the number of picture frames in the picture group is N and the specified number is B times the number, then the increased number of picture frames in the picture group is N*B, where N is a positive integer and B is a real number greater than 1.
[0061] Optionally, the number of picture frames in the picture group may be doubled.
[0062] In one embodiment, before adjusting the number of picture frames in the picture group of the network camera, it is also necessary to determine whether the current ambient light intensity meets the preset condition. There are two embodiments for determining whether the current ambient light intensity meets the preset condition.
[0063] In a first embodiment, a light sensor can be provided to detect the light intensity of the current environment. The network camera receives data representing the light intensity from the light sensor and determines whether the light intensity of the current environment is less than a preset light intensity threshold. If the light intensity of the current environment is less than the preset light intensity threshold, the current environment light intensity is considered to meet the preset condition. If the light intensity of the current environment is greater than or equal to the preset light intensity threshold, the current environment light intensity is considered to not meet the preset condition.
[0064] Under the second implementation mode, in order to ensure the usability of the captured images, the exposure gain of the network camera will change with the changes in the intensity of the external environment light. That is, the weaker the light intensity of the external environment, the stronger the exposure gain of the network camera, so that the images captured by the network camera can be used even in low-light environments such as at night.
[0065] Based on this, the aforementioned preset condition can be that the network camera's exposure gain is greater than a preset threshold. Exposure gain reflects the ambient light intensity. That is, when the network camera's exposure gain is greater than the preset threshold, the current ambient light intensity is considered to meet the preset condition. This simplifies the difficulty of determining whether the current ambient light intensity meets the preset threshold. Exposure gain is the ISO (light sensitivity) value; a higher ISO value indicates a lower current illumination.
[0066] Optionally, the exposure gain may be obtained based on a short-frame analog gain, a short-frame digital gain, and an ISP short-frame digital gain of a sensor of the network camera. The sensor is a core component of the camera and is used to convert an optical signal into an electrical signal.
[0067] For example, exposure gain = sensor short-frame analog gain * sensor short-frame digital gain * ISP (Image Signal Processing) short-frame digital gain. Each gain can have a 10-bit precision, and the total exposure gain range can be expressed in hexadecimal as [0x64, 0xffffffff]. The specific value of each exposure gain can be expressed in hexadecimal.
[0068] The preset threshold can be set according to actual needs and is not limited here.
[0069] Taking a network camera shooting images for a day as an example, the network camera using the bit rate control method provided by this solution can reduce the bit rate by 10% compared with the network camera using the existing bit rate control method.
[0070] To further understand the above stream control method, please refer to Figure 2 It should be noted that Figure 2 The principle shown is only one of many embodiments of the code stream control method of this application. Therefore, it cannot be Figure 2 The manner shown is to be understood as limiting the present application.
[0071] like Figure 2 As shown, the system first determines whether the current ambient light intensity meets the preset conditions. Then, it doubles the number of frames in the network camera's image group. Next, it performs image recognition on the surveillance images captured by the network camera. If a target is present in the surveillance image, the network camera's maximum encoding bit rate is doubled. The maximum quantization parameter of the key frames in the image group is increased by 6, and the minimum quantization parameter is increased by 3. The maximum quantization parameter of all frames in the image group, excluding the key frames, is reduced by 6, and the minimum quantization parameter is reduced by 1.
[0072] Specifically, Gop represents the number of frames in the group of pictures, and the initial GOP is twice the frame rate Fps, MaxBitrate represents the maximum bit rate, maxIQp represents the maximum quantization parameter of the key frame, MinIQp represents the minimum quantization parameter of the key frame, MaxQp represents the maximum quantization parameter of the other frames in the group of pictures except the key frame, and MinQp represents the minimum quantization parameter of the other frames in the group of pictures except the key frame. Then:
[0073] Gop'=Gop*2=Fps*4;MaxBitrate'=MaxBitrate*2;MaxIQp'=MaxIQp+6;MinIQp'=MinIQp+3;MaxQp'=MaxQp-6;MinQp'=MinQp-1. Wherein, Gop' is the number of frames in the doubled GOP, MaxBitrate' is the maximum bitrate after doubling, MaxIQp' is the maximum quantization parameter of the key frames after increasing, MinIQp' is the minimum quantization parameter of the key frames after increasing, MaxQp' is the maximum quantization parameter of the frames other than the key frames in the increased GOP, and MinQp' is the minimum quantization parameter of the frames other than the key frames in the increased GOP.
[0074] in, Figure 2 The specific implementation of each step of the code stream control method has been clearly described above and will not be repeated here for the sake of brevity.
[0075] In one implementation mode, after the maximum bit rate of the network camera encoding and the quantization parameters of the picture frames in the picture group are adjusted, image recognition is continued on the surveillance image taken by the network camera. When the monitored target no longer exists in the surveillance image, the maximum bit rate of the network camera encoding and the quantization parameters of the picture frames in the picture group are adjusted to initial values. The initial values here are the values before the maximum bit rate of the network camera encoding and the quantization parameters of the picture frames in the picture group were adjusted.
[0076] For example, Gop represents the initial value of the number of picture frames in the picture group, and the initial GOP is twice the frame rate Fps, MaxBitrate represents the initial value of the maximum bit rate, maxIQp represents the initial value of the maximum quantization parameter of the key frame, MinIQp represents the initial value of the minimum quantization parameter of the key frame, MaxQp represents the initial value of the maximum quantization parameter of the other picture frames in the picture group except the key frame, MinQp represents the initial value of the minimum quantization parameter of the other picture frames in the picture group except the key frame, Gop' is the number of picture frames in the picture group after doubling, MaxBitrate' is the maximum bit rate after doubling, MaxIQp' is the maximum quantization parameter of the key frame after increasing, MinIQp' is the minimum quantization parameter of the key frame after increasing, MaxQp' is the maximum quantization parameter of the other picture frames in the picture group except the key frame after increasing, and MinQp' is the minimum quantization parameter of the other picture frames in the picture group except the key frame after increasing. When the monitored target no longer exists in the monitored image, the maximum bit rate of the network camera encoding and the quantization parameters of the picture frames in the picture group are adjusted to the initial values, including: adjusting Gop' back to Gop; adjusting MaxBitrate' back to MaxBitrate; adjusting maxIQp' back to maxIQp; adjusting MinIQp' back to MinIQp; adjusting MaxQp' back to MaxQp; adjusting MinQp' back to MinQp. For ease of understanding, please refer to Figure 3 .
[0077] An embodiment of the present application provides a network camera, which includes a processor.
[0078] The processor is used to adjust the number of picture frames in the picture group of the network camera when the current ambient light intensity meets the preset condition.
[0079] The processor is further configured to adjust the encoding bit rate of the network camera and the designated parameters of the picture frames in the picture group, so that the image quality of the target to be monitored in the current monitoring picture of the network camera is enhanced.
[0080] The processor is specifically configured to increase the number of picture frames in the picture group by a specified number.
[0081] The processor is specifically used to increase the maximum quantization parameter value and the minimum quantization parameter value of the key frame in the picture group, wherein the maximum quantization parameter value of the key frame after the increase is greater than the minimum quantization parameter value of the key frame after the increase, and the maximum quantization parameter value of the key frame after the increase is less than or equal to the maximum value that can be adjusted by the quantization parameter.
[0082] The processor is specifically used to increase the maximum quantization parameter value of the key frame by a first preset value, the sum of the maximum quantization parameter value of the key frame and the first preset value is less than or equal to the maximum value that the quantization parameter can be adjusted, and the first preset value is a positive integer; and increase the minimum quantization parameter value of the key frame by a second preset value, the sum of the minimum quantization parameter value of the key frame and the second preset value is less than the sum of the maximum quantization parameter value of the key frame and the first preset value, and the second preset value is a positive integer.
[0083] The processor is specifically configured to reduce the maximum quantization parameter value and the minimum quantization parameter value of each picture frame except the key frame in the picture group, wherein the maximum quantization parameter value of the picture frame after reduction is greater than the minimum quantization parameter value of the picture frame after reduction.
[0084] The processor is specifically configured to, for each picture frame in the picture group except the key frame, reduce the maximum quantization parameter value of the picture frame by a third preset value, where the third preset value is a positive integer less than or equal to the maximum quantization parameter value; and reduce the minimum quantization parameter value of the picture frame by a fourth preset value, where the fourth preset value is a positive integer less than or equal to the minimum quantization parameter value.
[0085] In one implementation manner, the preset condition includes: an exposure gain of the network camera is greater than a preset threshold.
[0086] The network camera provided in the embodiment of the present application has the same implementation principle and technical effects as those in the aforementioned embodiment of the bit stream control method. For the sake of brief description, for matters not mentioned in the device embodiment, reference can be made to the corresponding content in the aforementioned embodiment of the bit stream control method.
[0087] Among them, the network camera can also include a camera module and a communication module. Both the camera module and the communication module are connected to the processor. The camera module is used to collect monitoring images, and the communication module is used to connect to a third-party electronic device. The monitoring images collected by the camera module are sent to the third-party electronic device.
[0088] The communication module is further used to receive an instruction from a third-party electronic device for adjusting the working parameters of the network camera, so that the processor adjusts the corresponding working parameters according to the instruction.
[0089] See also Figure 4 , which is an electronic device 200 provided in an embodiment of the present application. The electronic device 200 includes: a transceiver 210, a memory 220, a communication bus 230, and a processor 240.
[0090] The transceiver 210, the memory 220, and the processor 240 are electrically connected to each other directly or indirectly to achieve data transmission or interaction. For example, these components can be electrically connected to each other via one or more communication buses 230 or signal lines. The transceiver 210 is used to send and receive data. The memory 220 is used to store computer programs. The processor 240 is used to execute the executable module stored in the memory 220. At this time, the processor 240 is used to adjust the number of picture frames in the picture group of the network camera when the current ambient light intensity meets the preset conditions; adjust the bit rate of the network camera encoding and the specified parameters of the picture frames in the picture group, so that the image quality of the monitored target in the current monitoring picture of the network camera is enhanced.
[0091] Among them, the memory 220 can be, but is not limited to, random access memory (RAM), read only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), etc.
[0092] The processor 240 may be an integrated circuit chip with signal processing capabilities. The above-mentioned processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The various methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor may be a microprocessor or the processor 240 may also be any conventional processor, etc.
[0093] The electronic device 200 mentioned above includes but is not limited to a web camera and an electronic device with a web camera function.
[0094] The present application also provides a non-volatile computer-readable storage medium (hereinafter referred to as storage medium), which stores a computer program. When the computer program is executed by a computer, such as the electronic device 200 described above, the computer-readable storage medium executes the above-described bitrate control method. The computer-readable storage medium includes various media capable of storing program code, such as a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0095] The above description is merely a preferred embodiment of the present application and is not intended to limit the present application. Various modifications and variations are possible for those skilled in the art. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present application shall be included within the scope of protection of the present application.
Claims
1. A code stream control method, characterized in that: Applied to a network camera, the method includes: When a target to be monitored exists in the surveillance image captured by the network camera, adjusting the encoding bit rate of the network camera and the specified parameters of the picture frames in the picture group so that the image quality of the target to be monitored in the current surveillance picture of the network camera is enhanced; The specified parameters include quantization parameters, and adjusting the specified parameters of the picture frames in the picture group includes: Increasing a maximum quantization parameter value and a minimum quantization parameter value of a key frame in the picture group, wherein the maximum quantization parameter value of the key frame after the increase is greater than the minimum quantization parameter value of the key frame after the increase, and the maximum quantization parameter value of the key frame after the increase is less than or equal to the maximum value that the quantization parameter can be adjusted; And, for each picture frame except the key frame in the picture group, the maximum quantization parameter value and the minimum quantization parameter value of the picture frame are reduced, wherein the maximum quantization parameter value of the picture frame after reduction is greater than the minimum quantization parameter value of the picture frame after reduction.
2. The method according to claim 1, characterized in that The increasing the maximum quantization parameter value and the minimum quantization parameter value of the key frames in the picture group includes: Increasing the maximum quantization parameter value of the key frame by a first preset value, wherein the sum of the maximum quantization parameter value of the key frame and the first preset value is less than or equal to the maximum value that the quantization parameter can be adjusted, and the first preset value is a positive integer; The minimum quantization parameter value of the key frame is increased by a second preset value, the sum of the minimum quantization parameter value of the key frame and the second preset value is less than the sum of the maximum quantization parameter value of the key frame and the first preset value, and the second preset value is a positive integer.
3. The method according to claim 1, characterized in that The reducing the maximum quantization parameter value and the minimum quantization parameter value of each picture frame except the key frame in the picture group includes: For each picture frame in the picture group except the key frame, reducing the maximum quantization parameter value of the picture frame by a third preset value, where the third preset value is a positive integer less than or equal to the maximum quantization parameter value; The minimum quantization parameter value of the picture frame is reduced by a fourth preset value, where the fourth preset value is a positive integer less than or equal to the minimum quantization parameter value.
4. The method according to claim 1, wherein The method further comprises: When the current ambient light intensity meets a preset condition, the number of picture frames in the picture group of the network camera is adjusted.
5. The method according to claim 4, characterized in that The adjusting the number of picture frames in the picture group of the network camera includes: Increase the number of picture frames in the picture group by a specified amount.
6. The method according to claim 4, characterized in that The preset conditions include: The exposure gain of the network camera is greater than a preset threshold.
7. A network camera, characterized in that: include: a processor configured to adjust, when a target to be monitored exists in the surveillance image captured by the network camera, a bit rate of the network camera encoding and specified parameters of the picture frames in the picture group, so as to enhance the image quality of the target to be monitored in the current surveillance picture of the network camera; The processor is specifically configured to increase a maximum quantization parameter value and a minimum quantization parameter value of a key frame in the picture group, wherein the maximum quantization parameter value of the key frame after the increase is greater than the minimum quantization parameter value of the key frame after the increase, and the maximum quantization parameter value of the key frame after the increase is less than or equal to the maximum value that the quantization parameter can be adjusted; and, for each picture frame in the picture group except the key frame, reduce the maximum quantization parameter value and the minimum quantization parameter value of the picture frame, wherein the maximum quantization parameter value of the picture frame after the decrease is greater than the minimum quantization parameter value of the picture frame after the decrease.
8. An electronic device, characterized in that: include: a memory and a processor, the memory and the processor being connected; The memory is used to store programs; The processor is configured to call a program stored in the memory to execute the method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that A computer program is stored thereon, and when the computer program is run by a computer, the method according to any one of claims 1 to 6 is executed.
Citation Information
Patent Citations
Method and device for enhancing monitoring video compression ratio
CN101742294A
Video storage method and device, camera and readable storage medium
CN111885332A
Image processing method and device, computer readable storage medium and terminal
CN113259594A