Video coding parameter adjusting method, data processing method, electronic equipment and medium
By adjusting the video encoding parameters in the camera device, and predicting the code rate and bandwidth according to the picture change amount and network status, the problem of high network bandwidth requirements for black light cameras in low-illumination environments is solved, and the smooth diagram output of wireless transmission is achieved, avoiding the installation difficulties of wired transmission.
Patent Information
- Application Number
- CN202411704052.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-26
- Publication Date
- 2025-02-25
AI Technical Summary
The high bit rate of black light cameras in low illumination environments leads to high requirements for network bandwidth stability, but the stability of wireless networks is poor, resulting in stuttering in the output and unable to meet the bit rate requirements. Wired transmission has problems such as cumbersome wiring and limited installation.
By using the video encoding parameter adjustment method in the camera device, the change amount of the current picture and the previous unit time is determined, the code rate and network bandwidth in the next unit time are predicted, and the video encoding parameters are adjusted according to the comparison results, so that the code rate and bandwidth are matched to avoid lag.
It realizes smooth graphics of the camera equipment under wireless network conditions, avoids the problems of cumbersome wiring and limited installation of wired transmission, and ensures the stable transmission of video data.
Smart Images

Figure CN119520809A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of camera technology, and in particular to a video encoding parameter adjustment method, a data processing method, an electronic device and a storage medium. Background Art
[0002] With the rapid development of camera equipment technology, blacklight cameras have emerged to meet users' color camera needs in low-light environments. Blacklight cameras can output color images in low-light environments (such as outdoor environments at night, dark areas, etc.). The bit rate and image quality of traditional cameras will drop a lot in low-light environments, but the bit rate of blacklight cameras will be higher in low-light environments, which makes blacklight cameras have high requirements for the stability of network bandwidth; and the network status of wireless networks is usually affected by many factors (such as distance, obstacles, wireless signals of routers, etc.), and the stability is poor. If blacklight cameras are used with wireless transmission, the bandwidth of the wireless network often cannot meet the bit rate of the blacklight camera, causing the image output to be stuck and affecting the user's normal viewing of the shooting picture; therefore, current blacklight cameras all use wired transmission to ensure smooth image output of blacklight cameras. However, blacklight cameras with wired transmission require wiring during installation, which has the problems of cumbersome wiring and limited installation. Summary of the invention
[0003] The main purpose of the present invention is to provide a video encoding parameter adjustment method and a data processing method, aiming to enable a camera device (such as a black light camera) to use wireless transmission to smoothly output images, avoiding the problems of cumbersome wiring and limited installation caused by using wired transmission.
[0004] To achieve the above object, the video encoding parameter adjustment method proposed in the present invention is applied to a camera device, comprising:
[0005] During the data encoding process, determining the amount of change of the current picture compared to the picture in the previous unit time;
[0006] Predicting a first bit rate in the next unit time according to the change amount and the current video encoding parameter;
[0007] Acquire network status parameters of the current wireless network, and predict a first bandwidth that can be maximally supported by the network status within a next unit time according to the network status parameters;
[0008] The first bit rate is compared with the first bandwidth, and the video encoding parameters are adjusted according to the comparison result so that the bit rate of the encoded data obtained in the next unit time matches the first bandwidth.
[0009] In some embodiments, determining the change amount of the current picture compared to the picture in the previous unit time includes:
[0010] Compare the current picture with the previous frame or any frame in the previous unit time to determine the change amount; wherein the change amount is the proportion of changed pixels or the number of changed pixels;
[0011] And / or, predicting a first bit rate in a next unit time according to the change amount and the current video encoding parameter includes:
[0012] Predicting a first change amount of the picture in the next unit time compared to the current picture according to the change amount;
[0013] The first bit rate is determined according to the first change amount and a current video encoding parameter.
[0014] In some embodiments, adjusting the video encoding parameters according to the comparison result includes:
[0015] When the difference between the first bit rate and the first bandwidth exceeds a preset range, adjusting the frame rate and / or image quality and / or resolution in the video encoding parameters; and / or,
[0016] When the difference between the first bit rate and the first bandwidth is within the preset range, the video encoding parameter is kept unchanged.
[0017] In some embodiments, when the difference between the first bit rate and the first bandwidth exceeds a preset range, adjusting the frame rate and / or image quality and / or resolution in the video encoding parameters includes:
[0018] When the first bit rate is higher than the first bandwidth by a first preset amount, reducing the frame rate and / or image quality and / or resolution in the video encoding parameters;
[0019] And / or, when the first bit rate is lower than the first bandwidth by a second preset amount, the frame rate and / or image quality and / or resolution in the video encoding parameters are increased.
[0020] In some embodiments, reducing the frame rate and / or image quality and / or resolution in the video encoding parameters includes:
[0021] Reducing the frame rate and / or image quality and / or resolution in a preset manner until the difference between the second bit rate corresponding to the adjusted video encoding parameter and the first bandwidth is within the preset range;
[0022] And / or, the increasing the frame rate and / or image quality and / or resolution in the video encoding parameters includes:
[0023] Increasing the frame rate and / or image quality and / or resolution in a preset manner until the difference between the second bit rate corresponding to the adjusted video encoding parameter and the first bandwidth is within a preset range;
[0024] The second bit rate is determined according to a change in the adjusted video encoding parameters compared to the video encoding parameters corresponding to the first bit rate, combined with the size of the first bit rate.
[0025] In some embodiments, reducing the frame rate and / or image quality and / or resolution in a preset manner includes:
[0026] Alternately reducing the image quality and the frame rate;
[0027] When the image quality and the frame rate are both reduced to a preset minimum level, gradually reducing the resolution level;
[0028] Alternatively, the reducing the frame rate and / or image quality and / or resolution in a preset manner may include:
[0029] gradually lowering the level of image quality;
[0030] When the image quality level is reduced to a preset minimum level, gradually reducing the frame rate level;
[0031] When the frame rate drops to a preset minimum level, the resolution level is gradually reduced;
[0032] and / or,
[0033] The step of increasing the frame rate and / or image quality and / or resolution in a preset manner includes:
[0034] gradually increasing the resolution level;
[0035] When the resolution is increased to a preset highest level, the image quality and the frame rate are alternately increased;
[0036] Alternatively, the step of increasing the frame rate and / or image quality and / or resolution in a preset manner may include:
[0037] gradually increasing the resolution level;
[0038] When the resolution is increased to a preset highest level, gradually increasing the frame rate level;
[0039] When the frame rate level is increased to a preset highest level, gradually increasing the image quality level;
[0040] Alternatively, the step of increasing the frame rate and / or image quality and / or resolution in a preset manner may include:
[0041] When the first bit rate or the second bit rate is lower than the first bandwidth by a third preset amount, increasing the resolution;
[0042] When the first bit rate or the second bit rate is lower than the first bandwidth by a fourth preset amount and does not reach the third preset amount, increasing the image quality level or the frame rate level;
[0043] Wherein, the fourth preset amount is greater than the second preset amount.
[0044] In some embodiments, the video encoding parameter adjustment method further includes:
[0045] When the frame rate, image quality and resolution in the video encoding parameters are all reduced to the preset lowest level, if the second bit rate is still higher than the first bandwidth by the first preset amount, a bandwidth increase request is sent to a bandwidth allocation device;
[0046] And / or, the first bit rate is predicted using a Kalman filter algorithm;
[0047] And / or, the first bandwidth is predicted using a Kalman filter algorithm.
[0048] The present invention also provides a data processing method, which is applied to a camera device, comprising:
[0049] Receive video data collected by the sensor, encode the video data according to current video encoding parameters, and wirelessly transmit the encoded data obtained by the data encoding;
[0050] Determine the change in the current image compared to the image in the previous unit of time;
[0051] Predicting a first bit rate in the next unit time according to the change amount and the current video encoding parameter;
[0052] Acquire network status parameters of the current wireless network, and predict a first bandwidth that can be maximally supported by the network status within a next unit time according to the network status parameters;
[0053] The first bit rate is compared with the first bandwidth, and the video encoding parameters are adjusted according to the comparison result so that the bit rate of the encoded data obtained in the next unit time matches the first bandwidth.
[0054] The present invention also proposes an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the steps of the above-mentioned video encoding parameter adjustment method or the steps of the above-mentioned data processing method are implemented.
[0055] The present invention also proposes a storage medium, on which a computer program is stored. When the computer program is executed by a care device, the steps of the above-mentioned video encoding parameter adjustment method or the steps of the above-mentioned data processing method are implemented.
[0056] The technical solution of the video encoding parameter adjustment method of the present invention adopts a method of predicting a first bit rate in the next unit time (i.e., the bit rate of the encoded data in the next unit time) based on the change amount between the current picture and the picture in the next unit time and the current video encoding parameters, and predicting the maximum bandwidth supported by the network state in the next unit time (i.e., the first bandwidth) based on the network state parameters of the current wireless network; then the first bit rate is compared with the first bandwidth, and the video encoding parameters are adjusted according to the comparison result, so that the bit rate of the encoded data obtained in the next unit time matches the first bandwidth, that is, the bandwidth of the wireless network in the next unit time can meet the wireless transmission of the encoded data obtained by encoding the data using the adjusted video encoding parameters. The scheme of the present invention predicts the network bandwidth and the bit rate of the encoded data in the next unit time in advance, and compares the predicted network bandwidth with the bit rate to confirm in advance whether the network bandwidth in the next unit time meets the bit rate of the encoded data, and adjusts the video encoding parameters in advance according to the confirmation result, that is, adjusts the bit rate of the encoded data obtained by data encoding in the next unit time, so that the network bandwidth in the next unit time can meet the bit rate of the encoded data in the next unit time; in this way, even if the network status of the wireless network of the camera device fluctuates frequently, it can ensure that the encoded data of the camera device at any time can be smoothly transmitted wirelessly through the wireless module, thereby ensuring the smoothness of the camera device's image output, that is, the scheme of the present invention enables the camera device to use wireless transmission to smoothly output images without using wired transmission, effectively avoiding the problems of cumbersome wiring and limited installation caused by wired transmission. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without paying creative work.
[0058] Figure 1 A schematic diagram of a flow chart of a first embodiment of a method for adjusting video encoding parameters according to the present invention;
[0059] Figure 2 A schematic diagram of a flow chart of a second embodiment of a method for adjusting video encoding parameters according to the present invention;
[0060] Figure 3A schematic diagram of a flow chart of a third embodiment of a method for adjusting video encoding parameters according to the present invention;
[0061] Figure 4 A schematic diagram of a flow chart of a fourth embodiment of a method for adjusting video encoding parameters according to the present invention;
[0062] Figure 5 A schematic diagram of a flow chart of a fifth embodiment of a method for adjusting video encoding parameters according to the present invention;
[0063] Figure 6 A schematic diagram of a flow chart of a sixth embodiment of a method for adjusting video encoding parameters according to the present invention;
[0064] Figure 7 A schematic diagram of a flow chart of a seventh embodiment of a method for adjusting video encoding parameters according to the present invention;
[0065] Figure 8 1 is a flow chart of an eighth embodiment of a method for adjusting video encoding parameters according to the present invention;
[0066] Fig. 9 A schematic diagram of a flow chart of an embodiment of a data processing method of the present invention;
[0067] Fig.10 It is a schematic diagram of the structure of an electronic device in a hardware operating environment involved in an embodiment of the present invention. DETAILED DESCRIPTION
[0068] The technical solutions in the embodiments of the present invention will be described clearly and completely in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0069] It should be noted that all directional indications in the embodiments of the present invention (such as up, down, left, right, front, back, etc.) are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.
[0070] In addition, the descriptions of "first", "second", etc. in the present invention are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, "and / or" in the full text includes three solutions. Taking A and / or B as an example, it includes technical solution A, technical solution B, and technical solution that satisfies both A and B. In addition, the technical solutions between the various embodiments can be combined with each other, but it must be based on the ability of ordinary technicians in this field to implement. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by the present invention.
[0071] The present invention proposes a video encoding parameter adjustment method, which is applied to a camera device; the camera device may be, for example, a black light camera, a full color camera, a starlight camera, or a super starlight camera, etc. The implementation terminal of the video encoding parameter adjustment method of the present invention may be an electronic device, which may be a controller of the camera device, or a computing device such as a desktop computer, a notebook, a palm computer, and a server.
[0072] like Figure 1 As shown, Figure 1 It is a flowchart of the first embodiment of the video encoding parameter adjustment method of the present invention.
[0073] In this embodiment, the video encoding parameter adjustment method includes:
[0074] Step S10, during the data encoding process, determining the amount of change of the current picture compared to the picture in the previous unit time;
[0075] When the camera device is working, it collects video data (continuous dynamic image data) through the sensor and encodes the collected video data. In the process of encoding the video data, the electronic device determines the change of the current picture compared with the picture in the previous unit time, that is, compares the current picture with the picture in the previous unit time, and determines the amount of changed pixel parts; the change can refer to the proportion of changed pixels, that is, the proportion of the number of changed pixels to the total number of pixels in the current picture, or the number of changed pixels, etc. Among them, the unit time can be, for example, 1 second, 0.5 second, 0.2 second, 0.1 second, etc. The change can be determined by the electronic device based on the analysis and comparison of the current picture and the picture in the previous unit time by the image chip, or it can be obtained by other comparison methods or algorithms.
[0076] Step S20, predicting a first bit rate in the next unit time according to the change amount and the current video encoding parameters;
[0077] The size of the change in the image screen is related to the amount of details that need to be retained by the encoding, that is, the amount of redundant information that can be compressed and removed by the encoding; therefore, after the electronic device determines the change in the current screen and the screen in the previous unit time, it predicts the first bit rate in the next unit time according to the change and the current video encoding parameters, that is, the bit rate of the encoded data obtained by data encoding in the next unit time. Among them, the electronic device can be based on the change in the current screen and the screen in the previous unit time, and according to the preset algorithm, the change of the screen in the next unit time is estimated and determined compared with the current screen, so as to calculate the first bit rate in the next unit time according to the determined change and the bit rate in the current video encoding parameters; the electronic device can also input the change in the current screen and the screen in the previous unit time into a pre-trained prediction model to directly predict the first bit rate in the next unit time, or predict the change in the screen in the next unit time compared with the current screen, and then calculate the first bit rate in the next unit time in combination with the bit rate in the current video encoding parameters.
[0078] Step S30, obtaining network status parameters of the current wireless network, and predicting a first bandwidth that can be maximally supported by the network status within the next unit time according to the network status parameters;
[0079] The electronic device obtains the network status parameters of the current wireless network (such as a wifi network) from the wireless module of the camera device; the network status parameters can be that the wireless module will feedback an MCS (Modulation and Coding Scheme) value based on the wireless parameters (for example, including transmitter power, error vector size, receiver sensitivity, channel and band, data transmission rate and connection quality index), and the MCS value feedbacks the quality of the network status. The larger the MCS value, the better the network status of the current wireless network; the network status parameters can also be the wireless parameters of the wireless module, and the wireless parameters include transmitter power, error vector size, receiver sensitivity, channel and band, data transmission rate and connection quality index. After obtaining the network status parameters, the electronic device predicts the maximum bandwidth (i.e., the first bandwidth) supported by the network status in the next unit time according to the network status parameters. Among them, the electronic device can predict the network status in the next unit time according to the network status parameters using a preset algorithm, and then determine the first bandwidth in the next gear time; the electronic device can also input the network status parameters into a pre-trained network prediction model, and directly output the prediction result through the network prediction model, i.e., the first bandwidth in the next unit time. It should be noted that there is no sequence restriction for step S30 and step S10 or step S20. Step S30 may be executed simultaneously with step S10 or step S20, or may be executed before or after step S20.
[0080] Step S40, comparing the first bit rate with the first bandwidth, and adjusting the video encoding parameters according to the comparison result, so that the bit rate of the encoded data obtained in the next unit time matches the first bandwidth.
[0081] After predicting the first bit rate and the first bandwidth in the next unit time, the electronic device compares the first bit rate with the first bandwidth to determine the size relationship between the first bit rate and the first bandwidth, that is, to determine whether the maximum bandwidth (that is, the first bandwidth) supported by the network state of the wireless network in the next unit time can meet the bit rate (that is, the first bit rate) of the encoded data obtained by encoding in the next unit time; after the electronic device determines the comparison result of the first bit rate and the first bandwidth, it adjusts the video encoding parameters according to the comparison result, so that the bit rate of the encoded data obtained by data encoding in the next unit time (that is, using the adjusted video encoding parameters to encode the data) can match the first bandwidth, that is, can match the maximum bandwidth supported by the network state in the next unit time, that is, in the next unit time, the bandwidth of the wireless network can meet the wireless transmission (that is, sending) of the encoded data obtained by using the adjusted video encoding parameters to encode the data.
[0082] The technical solution of the video encoding parameter adjustment method of this embodiment adopts a method of predicting a first bit rate in the next unit time (i.e., the bit rate of the encoded data in the next unit time) based on the change amount between the current picture and the picture in the next unit time and the current video encoding parameters, and predicting the maximum bandwidth supported by the network state in the next unit time (i.e., the first bandwidth) based on the network state parameters of the current wireless network; then comparing the first bit rate with the first bandwidth, and adjusting the video encoding parameters based on the comparison result, so that the bit rate of the encoded data obtained in the next unit time matches the first bandwidth, that is, the bandwidth of the wireless network in the next unit time can meet the wireless transmission of the encoded data obtained by encoding the data using the adjusted video encoding parameters. The present embodiment scheme predicts in advance the network bandwidth and the bit rate of the encoded data in the next unit time, and compares the predicted network bandwidth with the bit rate, so as to confirm in advance whether the network bandwidth in the next unit time satisfies the bit rate of the encoded data, and adjusts the video encoding parameters in advance according to the confirmation result, that is, adjusts the bit rate of the encoded data obtained by data encoding in the next unit time, so that the network bandwidth in the next unit time can meet the bit rate of the encoded data in the next unit time; in this way, even if the network status of the wireless network of the camera device fluctuates frequently, it can ensure that the encoded data of the camera device at any time can be smoothly transmitted wirelessly through the wireless module, thereby ensuring the smoothness of the camera device's image output, that is, the present embodiment scheme enables the camera device to use wireless transmission to smoothly output images without using wired transmission, effectively avoiding the problems of cumbersome wiring and limited installation caused by wired transmission.
[0083] In some embodiments, when the camera device is started, the initial video encoding parameters can be determined according to the current network status parameters. For example, a mapping table of network status parameters and initial video encoding parameters is pre-set in the electronic device. When the camera device is started, the electronic device obtains the current network status parameters and determines the corresponding initial video encoding parameters by searching the mapping table according to the current network status parameters. In some embodiments, fixed initial video encoding parameters can also be pre-set in the electronic device. When the camera device is started, the electronic device directly uses the pre-set initial video encoding parameters as the video encoding parameters at startup.
[0084] In some embodiments, in the above step S10, the step of determining the amount of change of the current picture compared to the picture in the previous unit time includes: comparing the current picture with the previous frame or any frame in the previous unit time to determine the amount of change; comparing the current picture with the most recently encoded frame (i.e., the previous frame) to determine the amount of change between the two, and the change of adjacent frames can reflect the change of the content in the picture captured by the camera or the change of the movement of the camera. In some embodiments, in the above step S10, the step of determining the amount of change of the current picture compared to the picture in the previous unit time may also include: comparing the current picture with any frame in the previous unit time to determine the amount of change; since the unit time is very short, the difference between the frames in the unit time is very small, therefore, the amount of change determined by comparing the current picture with any frame in the previous unit time is substantially the same as the amount of change determined by comparing the current picture with the previous frame. In addition, in some other embodiments, the step of determining the amount of change in the current picture compared to the picture in the previous unit time may also include: comparing the current picture with each frame of the picture in the previous unit time, and taking the average of the obtained changes to determine the amount of change.
[0085] like Figure 2 As shown, Figure 2 It is a flowchart diagram of a second embodiment of a method for adjusting video encoding parameters of the present invention.
[0086] This embodiment is based on the technical solution of the first embodiment. In this embodiment, step S20 includes:
[0087] Step S21, predicting a first change amount of the picture in the next unit time compared with the current picture according to the change amount;
[0088] After determining the amount of change in the current picture compared to the picture in the previous unit time, the electronic device can predict the first amount of change in the picture in the next unit time compared to the current picture based on the change through an algorithm (for example, the Kalman algorithm) or a model. The first amount of change is the number or proportion of pixels that have changed in the picture in the next unit time compared to the current picture.
[0089] Step S22: determining a first bit rate according to the first variation and the current video encoding parameter.
[0090] After the first variation is predicted, the first bit rate, i.e., the bit rate of the encoded data in the next unit time, can be determined based on the first variation combined with the current video encoding parameters. For example, the initial bit rate is first estimated by the image quality, resolution, and frame rate in the current video encoding parameters, and the first variation is predicted by an algorithm or model. According to the encoding characteristics, when the image quality and resolution in the video encoding parameters are used as constants and the variation of the image is used as a variable, the bit rate is proportional to the variation of the image. By applying the formula, M represents the first bit rate, X is the initial bit rate, and N is the first variation, then M=X+X*N can be obtained.
[0091] This embodiment adopts a scheme that predicts a first change amount of the picture in the next unit time compared to the current picture based on the change amount of the current picture compared to the picture in the previous unit time, and determines the bit rate (i.e., the first bit rate) of the encoded data in the next unit time (the encoded data obtained by encoding the data with the current video encoding parameters) based on the first change amount combined with the current video encoding parameters. The overall implementation scheme is relatively simple and the implementation cost is low.
[0092] Of course, in other embodiments, a pre-trained bit rate prediction model may be provided in the electronic device, and the change amount of the current picture compared to the picture in the previous unit time is directly input into the bit rate prediction model, and the bit rate prediction model outputs the predicted first bit rate.
[0093] like Figure 3 As shown, Figure 3 It is a flowchart of the third embodiment of the video encoding parameter adjustment method of the present invention.
[0094] This embodiment is based on the technical solution of the first embodiment or the second embodiment. In this embodiment, in the above step S40, the step of adjusting the video encoding parameters according to the comparison result includes:
[0095] Step S41, when the difference between the first bit rate and the first bandwidth exceeds a preset range, adjusting the frame rate and / or image quality and / or resolution in the video encoding parameters;
[0096] Since the first bit rate and the first bandwidth are both predicted values, there will be a certain error with the actual value, therefore, a reference range (i.e., the preset range) is pre-set in the electronic device, and the reference range improves the influence of the preset error of the first bit rate and the first bandwidth on the comparison result. When the electronic device compares the first bit rate with the first bandwidth and finds that the difference between the first bit rate and the first bandwidth exceeds the preset range, it means that the first bit rate does not match the first bandwidth (such as the first bit rate is too much greater than the first bandwidth, or the first bit rate is too much less than the first bandwidth), at this time, the electronic device adjusts the frame rate and / or image quality and / or resolution in the video encoding parameters so that the bit rate of the encoded data in the next unit time (i.e., the encoded data obtained by encoding the video data in the next unit time using the adjusted encoding parameters) matches the first bandwidth.
[0097] And / or, step S42, when the difference between the first bit rate and the first bandwidth is within a preset range, the video encoding parameters are kept unchanged.
[0098] When the electronic device compares the first bit rate with the first bandwidth and finds that the difference between the first bit rate and the first bandwidth is within the preset range, it means that the first bit rate matches the first bandwidth (that is, the difference between the first bit rate and the first bandwidth is very small), that is, the network bandwidth in the next unit time satisfies the wireless transmission of the encoded data of the first bit rate. At this time, there is no need to adjust the video encoding parameters, and the electronic device keeps the video encoding parameters unchanged.
[0099] The technical solution of this embodiment is to adjust the frame rate and / or image quality and / or resolution in the video encoding parameters when the difference between the first bit rate and the first bandwidth exceeds a preset range, so that the video data in the next unit time is encoded by the adjusted video encoding parameters, and the bit rate of the obtained encoded data is lowered or increased compared with the first bit rate, so that it matches the first bandwidth, ensuring that the camera device can achieve the best effect of smooth image output in the next unit time; and when the difference between the first bit rate and the first bandwidth is within the preset range, it means that the first bit rate matches the first bandwidth. At this time, the video encoding parameters are kept unchanged, so that the camera device can continue to output images stably and smoothly in the next unit time.
[0100] like Figure 4 As shown, Figure 4 4 is a flow chart of a fourth embodiment of a method for adjusting video encoding parameters according to the present invention.
[0101] This embodiment is based on the technical solution of the third embodiment. In this embodiment, step S41 includes:
[0102] Step S411, when the first bit rate is higher than the first bandwidth by a first preset amount, reducing the frame rate and / or image quality and / or resolution in the video encoding parameters;
[0103] The first preset amount is a boundary value of the preset range, which may be a preset percentage (such as 5%, 8%, etc.) or a preset fixed value (such as 100, 150, etc.). When the first bit rate is higher than the first bandwidth by the first preset amount, it means that the first bit rate is too much greater than the first bandwidth. At this time, the electronic device reduces the frame rate and / or image quality and / or resolution in the video encoding parameters, so that the bit rate of the encoded data obtained by encoding the video data in the next unit time using the adjusted video encoding parameters is reduced, thereby reducing the difference with the first bandwidth until it matches the first bandwidth, thereby ensuring that the camera device achieves the best effect of smooth image output in the next unit time.
[0104] And / or, step S412, when the first bit rate is lower than the first bandwidth by a second preset amount, the frame rate and / or image quality and / or resolution in the video encoding parameters are increased.
[0105] Among them, the second preset amount is another boundary value of the preset range, which can be a preset percentage (such as 10%, 15%, etc.) or a preset fixed value (such as 300, 400, etc.). When the first bit rate is lower than the first bandwidth to reach the second preset amount, it means that the first bit rate is too much less than the first bandwidth, that is, the camera device can ensure smooth image output in the next unit time. At this time, the electronic device increases the frame rate and / or image quality and / or resolution in the video encoding parameters, so that the bit rate of the encoded data obtained by encoding the video data in the next unit time using the adjusted video encoding parameters is increased until it matches the first bandwidth. In this way, while ensuring that the camera device can smoothly output images in the next unit time, the image output effect (clarity, image effect, etc.) is improved, and smooth image output with better effect is achieved.
[0106] In some embodiments, in step S411, the step of reducing the frame rate and / or image quality and / or resolution in the video encoding parameters includes: reducing the frame rate and / or image quality and / or resolution in a preset manner until the difference between the second bit rate corresponding to the adjusted video encoding parameters and the first bandwidth is within a preset range. And / or, in step S412, increasing the frame rate and / or image quality and / or resolution in the video encoding parameters includes: increasing the frame rate and / or image quality and / or resolution in a preset manner until the difference between the second bit rate corresponding to the adjusted video encoding parameters and the first bandwidth is within a preset range;
[0107] The electronic device is provided with a preset method for reducing the frame rate and / or image quality and / or resolution. When the electronic device determines that the first bit rate is higher than the first bandwidth by a first preset amount, the frame rate and / or image quality and / or resolution are reduced in accordance with the preset method until the difference between the second bit rate corresponding to the adjusted video encoding parameter and the first bandwidth is within a preset range; when the electronic device determines that the first bit rate is lower than the first bandwidth by a second preset amount, the frame rate and / or image quality and / or resolution are increased in accordance with the preset method until the difference between the second bit rate corresponding to the adjusted video encoding parameter and the first bandwidth is within a preset range. The second bit rate is the bit rate of the encoded data obtained by encoding the video data of the camera device in the next unit time using the adjusted video encoding parameter. According to the encoding characteristics, the bit rate of the encoded data is positively correlated with any one of the frame rate, image quality, and resolution. Therefore, when other parameters are the same, the larger the frame rate or the higher the image quality or the higher the resolution, the larger the bit rate of the corresponding encoded data; therefore, the second bit rate can be determined based on the change in the adjusted video encoding parameters compared to the video encoding parameters corresponding to the first bit rate, combined with the size of the first bit rate.
[0108] After the electronic device adjusts (lowers or increases) the frame rate and / or image quality and / or resolution each time in a preset manner, the electronic device compares the second bit rate with the first bandwidth. If the difference between the second bit rate and the first bandwidth is within a preset range, the adjustment is terminated. If the difference between the second bit rate and the first bandwidth exceeds the preset range, the frame rate and / or image quality and / or resolution continues to be adjusted in a preset manner until the difference between the second bit rate and the first bandwidth is adjusted to be within the preset range.
[0109] like Figure 5 As shown, Figure 5 4 is a flow chart of a fifth embodiment of a method for adjusting video encoding parameters according to the present invention.
[0110] In this embodiment, the step of reducing the frame rate and / or image quality and / or resolution in a preset manner includes:
[0111] Step S401, alternately reducing the image quality and frame rate;
[0112] Among them, the image quality level may include, for example, excellent+, excellent, excellent-, good+, good, good- in order from high to low; the frame rate level may include, for example, 15, 14, 13, 12, 11 in order from high to low. In this embodiment, the electronic device first reduces the image quality and frame rate levels in the video encoding parameters by alternating reduction; for example, reducing the image quality level by one level and reducing the frame rate level by one level are performed alternately; for another example, reducing the image quality by two levels and reducing the frame rate by one level are performed alternately, or reducing the frame rate by two levels and reducing the image quality by one level are performed alternately, etc. When one of the image quality or the frame rate is reduced to the preset lowest level, the level of the other is gradually reduced. For example, when the image quality is reduced to the lowest level (i.e., good-), but the frame rate is still at 13, the electronic device will gradually reduce the frame rate level.
[0113] Step S402, when both the image quality and the frame rate are reduced to a preset minimum level, gradually reduce the resolution level;
[0114] Among them, the resolution levels may include, for example, high-end (such as ultra-high definition), mid-range (such as high definition), and low-end (such as ordinary) in order from high to low. When both the image quality and the frame rate are reduced to the preset lowest level (such as the image quality is reduced to good- and the frame rate is reduced to 11), if the difference between the second bit rate corresponding to the adjusted video encoding parameter and the first bandwidth still exceeds the preset range, the electronic device will no longer continue to reduce the image quality and frame rate to prevent the camera device from producing serious distortion and freezes in the output image, but will gradually reduce the resolution level in the video encoding parameter, that is, continue to reduce the bit rate of the encoded data obtained by data encoding of the video data in the next unit time of the camera device by reducing the clarity.
[0115] The technical solution of this embodiment is a preset method for reducing the frame rate and / or image quality and / or resolution in the video encoding parameters, which is to preferentially reduce the image quality and frame rate levels in the video encoding parameters, and after the image quality and frame rate are reduced to the preset lowest level, gradually reduce the resolution level in the video encoding parameters; in this way, it is ensured that the output picture of the camera device can maintain a high clarity and the picture is clearer.
[0116] In some embodiments, reducing the frame rate and / or image quality and / or resolution in a preset manner may also include: first gradually reducing the image quality level; when the image quality level is reduced to a preset minimum level, then gradually reducing the frame rate level; and finally, when the frame rate is reduced to a preset minimum level, gradually reducing the resolution level; that is, gradually reducing the image quality level first, then gradually reducing the frame rate level, and finally gradually reducing the resolution level. Alternatively, in some embodiments, reducing the frame rate and / or image quality and / or resolution in a preset manner may also include: first gradually reducing the frame rate level; when the frame rate level is reduced to a preset minimum level, then gradually reducing the image quality level; and finally, when the image quality is reduced to a preset minimum level, gradually reducing the resolution level.
[0117] like Figure 6 As shown, Figure 6 It is a flowchart of a sixth embodiment of the video encoding parameter adjustment method of the present invention.
[0118] In this embodiment, the step of increasing the frame rate and / or image quality and / or resolution in a preset manner includes:
[0119] Step S403, gradually increasing the high resolution level;
[0120] The resolution levels may include, for example, high-end (such as ultra-high definition), mid-end (such as high definition), and low-end (such as ordinary) in order from high to low. In this embodiment, the electronic device first gradually increases the resolution level in the video encoding parameters to increase the bit rate of the encoded data obtained by encoding the video data in the next unit time of the camera device.
[0121] Step S404, when the resolution is increased to a preset highest level, the image quality and frame rate levels are alternately increased;
[0122] Among them, the image quality gears may include, for example, excellent+, excellent, excellent-, good+, good, good- in order from high to low; the frame rate gears may include, for example, 15, 14, 13, 12, 11 in order from high to low. In this embodiment, the electronic device first gradually increases the high resolution gear, and when the resolution is increased to the preset highest gear (such as the resolution is increased to high), if the difference between the second bit rate corresponding to the adjusted video encoding parameter and the first bandwidth still exceeds the preset range, the electronic device continues to increase the image quality and frame rate gears to continue to increase the bit rate of the encoded data obtained by data encoding of the video data in the next unit time of the camera device. Specifically, in this embodiment, the electronic device uses an alternating increase method to increase the image quality and frame rate gears; for example, the image quality gear is increased by one gear and the frame rate gear is increased by one gear alternately; for another example, the image quality is increased by two gears and the frame rate is increased by one gear alternately, or the frame rate is increased by two gears and the image quality is increased by one gear alternately, etc. When one of the image quality or the frame rate is increased to the preset highest level, the level of the other one will be gradually increased. For example, when the image quality is increased to the highest level (i.e., Excellent+), but the frame rate is still at 13, the electronic device will gradually increase the frame rate level.
[0123] The technical solution of this embodiment is a preset method for increasing the frame rate and / or image quality and / or resolution in the video encoding parameters, which is to preferentially increase the resolution level in the video encoding parameters, and after the resolution is increased to a preset highest level, alternately increase the image quality and frame rate levels in the video encoding parameters; in this way, it is ensured that the output picture of the camera device can effectively maintain a high clarity, and the picture is clearer.
[0124] In some embodiments, the step of increasing the frame rate and / or image quality and / or resolution in a preset manner may also include: first gradually increasing the high resolution; when the resolution is increased to a preset highest level, gradually increasing the frame rate; finally, when the frame rate is increased to a preset highest level, gradually increasing the image quality; that is, first gradually increasing the high resolution, then gradually increasing the frame rate, and finally gradually increasing the image quality.
[0125] like Figure 7 As shown, Figure 7 4 is a flow chart of a seventh embodiment of a method for adjusting video encoding parameters according to the present invention.
[0126] In this embodiment, the step of increasing the frame rate and / or image quality and / or resolution in a preset manner includes:
[0127] Step S405, when the first bit rate or the second bit rate is lower than the first bandwidth by a third preset amount, raising the high resolution gear;
[0128] Step S406: when the first bit rate or the second bit rate is lower than the first bandwidth by a fourth preset amount but lower than the third preset amount, the image quality level or the frame rate level is increased.
[0129] In this embodiment, the third preset amount and the fourth preset amount are two preset reference thresholds, which can be preset percentages, wherein the fourth preset amount is greater than the second preset amount, and the third preset amount is greater than the fourth preset amount; for example, the third preset amount is 100% or 90%, and the fourth preset amount is 50% or 40%. Since the bit rate of the encoded data obtained by data encoding the video data in the next unit time of the camera device is improved by a relatively high level for each increase in the resolution in the video encoding parameters, and the bit rate of the encoded data obtained by data encoding the video data in the next unit time of the camera device is improved by a relatively low level for each increase in the image quality or frame rate in the video encoding parameters; therefore, when the first bit rate or the second bit rate is lower than the first bandwidth and reaches the third preset amount, it means that the first bit rate or the second bit rate is much lower than the first bandwidth. At this time, the electronic device quickly improves the bit rate of the encoded data obtained by data encoding the video data in the next unit time of the camera device by increasing the high resolution level, so that the adjusted video encoding parameters The difference between the corresponding second bit rate and the first bandwidth decreases more quickly; and when the first bit rate or the second bit rate is lower than the first bandwidth by reaching the fourth preset amount and has not reached the third preset amount, it means that the first bit rate or the second bit rate is lower than the first bandwidth by a small amount. If the high resolution gear is directly increased, it is possible that the bit rate of the encoded data obtained by data encoding the video data in the next unit time of the camera device may exceed the first bandwidth, and the adjustment effect cannot be achieved. Therefore, at this time, the electronic device adopts a method of increasing the image quality gear or the frame rate gear to more appropriately increase the bit rate of the encoded data obtained by data encoding the video data in the next unit time of the camera device, so that the second bit rate corresponding to the adjusted video encoding parameters is closer to the first bandwidth.
[0130] The technical solution of this embodiment selects and adjusts corresponding parameters in the video encoding parameters by determining the amount by which the first bandwidth exceeds the first bit rate or the second bit rate, so that the bit rate of the encoded data obtained by data encoding the video data in the next unit time of the camera device can be adjusted more quickly to match the first bandwidth.
[0131] like Figure 8 As shown, Figure 8 4 is a flow chart of an eighth embodiment of a method for adjusting video encoding parameters according to the present invention.
[0132] In this embodiment, the video encoding parameter adjustment method further includes:
[0133] Step S50, when the frame rate, image quality and resolution in the video encoding parameters are all reduced to the preset lowest level, if the second bit rate is still higher than the first bandwidth by a first preset amount, a bandwidth increase request is sent to the bandwidth allocation device;
[0134] When it is predicted that the bandwidth of the wireless network in the next unit time is very small, even if the frame rate, image quality and resolution in the video encoding parameters are reduced to the preset lowest level, the second bit rate is still higher than the first bandwidth by a preset amount. At this time, since the second bit rate can no longer be reduced by reducing the frame rate, image quality and resolution in the video encoding parameters, the electronic device sends a bandwidth increase request to the bandwidth allocation device (such as a router). Since the bandwidth allocation device usually provides a network for multiple devices, each device occupies a fixed bandwidth of the bandwidth allocation device. For example, the total bandwidth of the router is 40M / S, which is evenly allocated to 8 devices (including camera equipment) for use, and each device is allocated 5M / S of bandwidth. In this embodiment, a bandwidth increase request is sent to the bandwidth allocation device. After receiving the bandwidth increase request, the bandwidth allocation device can temporarily allocate the idle bandwidth of other devices to the camera device for use according to the bandwidth usage status of other devices. For example, the idle 3M / S bandwidth of other devices is increased to the camera device for use, so that the actual bandwidth of the camera device is increased to 8M / S. The corresponding first bandwidth predicted for the network status in the next unit time can be proportionally increased by 60%. In this way, the first bandwidth can temporarily meet the bit rate of the encoded data obtained by data encoding of the video data of the camera device in the next unit time.
[0135] It should be noted that, in the case where there are no contradictions or conflicts among the above-mentioned embodiments of the method for adjusting video encoding parameters of the present invention, the above-mentioned embodiments can be arbitrarily combined or combined to form a new embodiment.
[0136] In some embodiments, in step S30, in the step of predicting the first bandwidth that the network state can support in the next unit time according to the network state parameter, a Kalman filter algorithm can be used to predict the first bandwidth. The detailed steps of the Kalman filter algorithm are as follows:
[0137] Use the Kalman filter algorithm to preset the trend of variable X, where X is the network state parameter MCS, which is a variable; A is a coefficient constant, which is also a performance constant related to module power;
[0138] Defining the system model, the Kalman filter algorithm requires a system model to describe the evolution of the variable X over time.
[0139] For a simple linear system, it can be expressed as: X k+1 =AX k +ω k
[0140] Among them, X k+1 is the state at time k+1; ω k is the process noise, which is usually assumed to be Gaussian distributed.
[0141] Initialize the Kalman filter:
[0142] Select initial state estimate Select initial state estimate X^ 0 and the initial covariance matrix P 0 The initial state estimate can be based on prior knowledge or the first observed value, and the initial covariance matrix represents a measure of the uncertainty of the initial estimate.
[0143] Prediction steps:
[0144] 1. State prediction: Use the state transition model to predict the next state.
[0145] X^ k+1 |k=AX^ k ∣k
[0146] 2. Update the state covariance matrix: prediction error covariance.
[0147] P k+1 |k=AP k ∣kA T +Q, where Q is the covariance matrix of the process noise;
[0148] Update steps:
[0149] 1. Get a new measurement value Z k+1 .
[0150] 2. Calculate the Kalman gain K: K k+1 =P k+1∣k H T (HP k+1∣k H T +R) -1 Where H is the matrix of the observation model and R is the covariance matrix of the measurement noise.
[0151] 3. Update state estimate: X^ k+1∣k+1 =X^ k+1∣k +K k+1 (Z k+1 -HX^ k+1∣k )
[0152] 4. Update the covariance matrix: P k+1∣k+1 =(IK k+1 H)P k+1∣k
[0153] Iterative process: Repeat the prediction and update steps, updating the state estimate each time new measurement data is obtained.
[0154] Parameter adjustment: Adjust the process noise covariance Q and measurement noise covariance R according to system characteristics and measurement data to optimize filtering performance.
[0155] Of course, in some other embodiments, the first bandwidth may also be predicted by other similar filtering algorithms or other algorithms, or may be predicted by a trained preset model.
[0156] In some embodiments, the first bit rate in step S20 or the first change in step S21 may also be predicted using a Kalman filter algorithm. The specific algorithm is similar to the above-mentioned Kalman filter algorithm for predicting the first bandwidth and will not be described in detail.
[0157] The following lists the test data of the camera system using the technical solution of the present invention, which is tested in a Wi-Fi network and in a low-light environment:
[0158] Among them, the camera system includes devices: iPhone 11 (iOS17.5.1), camera AX620U (5MP (2560*1440) / SMP (640*360)), network conditions: Wi-Fi network, light intensity is 0.lux~0.5lux.
[0159] Distance: 0~2M, Network bandwidth (referring to the total bandwidth of 8 devices, the bandwidth of each device is 1 / 8 of the total bandwidth, the same applies to the following): 40M / S, Camera bit rate: (5044~5330)kb / s, Frame rate: 15, Resolution 5MP, Image output smoothness: Excellent, Image quality: Excellent+;
[0160] Distance: 3-5M, Network bandwidth: 38M / S, Camera bit rate: (4944-5130) kb / s, Frame rate: 15, Resolution 5MP, Image output smoothness: Excellent, Image quality: Excellent+;
[0161] Distance: 5~10M, network bandwidth 35M / S Camera bit rate: (4907~5080)kb / s Frame rate: 15 Resolution 5MP Output smoothness: Excellent, Image quality: Excellent+;
[0162] Distance: 10-15M, Network bandwidth: 34M / S, Camera bit rate: (4533-4908) kb / s, Frame rate: 15, Resolution 5MP, Image output smoothness: Excellent, Image quality: Excellent+;
[0163] Distance: 15-20M, Network bandwidth: 33M / S, Camera bit rate: (4325-4805)kb / s, Frame rate: 15, Resolution 5MP, Image smoothness: Excellent, Image quality: Excellent+;
[0164] Distance: 20-25M, Network bandwidth: 31M / S, Camera bit rate: (4257-4658) kb / s, Frame rate: 14, Resolution 5MP, Image smoothness: Excellent, Image quality: Excellent-;
[0165] Distance: 25-30M, Network bandwidth: 28M / S, Camera bit rate: (3944-4156) kb / s, Frame rate: 14 Resolution 5MP, Image output smoothness: Excellent, Image quality: Excellent-;
[0166] Distance: 30-35M, Network bandwidth: 23M / S, Camera bit rate: (3744-3945) kb / s, Frame rate: 14, Resolution 5MP, Image smoothness: Excellent, Image quality: Excellent-;
[0167] Distance: 30-35M, Network bandwidth: 23M / S, Camera bit rate: (3744-3945) kb / s, Frame rate: 14, Resolution 5MP, Image smoothness: Excellent, Image quality: Excellent-;
[0168] Distance: 35-40M, Network bandwidth: 21M / S, Camera bit rate: (3542-3623) kb / s, Frame rate: 13, Resolution 5MP, Image smoothness: Excellent, Image quality: Excellent-;
[0169] Distance: 40-45M, Network bandwidth: 17M / S, Camera bit rate: (3352-3418) kb / s, Frame rate: 13, Resolution 5MP, Image smoothness: Excellent, Image quality: Excellent -
[0170] Distance: 45-50M, Network bandwidth: 15M / S, Camera bit rate: (3024-3478) kb / s, Frame rate: 12, Resolution 5MP, Image smoothness: Excellent, Image quality: Excellent-;
[0171] Distance: 55-60M, Network bandwidth: 11M / S, Camera bit rate: (2501-2837) kb / s, Frame rate: 11, Resolution 5MP, Image output smoothness: Excellent, Image quality: Good;
[0172] Distance: 60-65M, network bandwidth 10M / S, camera bit rate: (2324-2314) kb / s, frame rate: 11, resolution 5MP, image output smoothness: excellent, image quality: good;
[0173] Distance: 65-70M, Network bandwidth: 5M / S, Camera bit rate: (1341-1544) kb / s, Frame rate: 15, Resolution SMP, Image output smoothness: Excellent, Image quality: Good-;
[0174] Distance: 70-75M, Network bandwidth: 5M / S, Camera bit rate: (1159-1273) kb / s, Frame rate: 15, Resolution SMP, Image output smoothness: Excellent, Image quality: Good-;
[0175] Distance: 75-80M, Network bandwidth: 5M / S, Camera bit rate: (1004-1123) kb / s, Frame rate: 14, Resolution SMP, Image smoothness: Excellent, Image quality: Good-;
[0176] Distance: 80-85M, Network bandwidth: 5M / S, Camera bit rate: (985-1023) kb / s, Frame rate: 14, Resolution SMP, Image output smoothness: Excellent, Image quality: Good-;
[0177] Distance: 85-90M, Network bandwidth: 5M / S, Camera bit rate: (659-1028) kb / s, Frame rate: 14, Resolution SMP, Image output smoothness: Excellent, Image quality: Good-;
[0178] Distance: 90~100M, network bandwidth: 5M / S, camera bit rate: (532~761)kb / s, frame rate: 13, resolution SMP, image output smoothness: excellent, image quality: good-.
[0179] The present invention also provides a data processing method, which is applied to a camera device. The implementation terminal of the data processing method of the present invention can be an electronic device, which can be a controller of the camera device, or a computing device such as a desktop computer, a notebook, a palm computer, and a server.
[0180] like Fig. 9 As shown, Fig. 9 It is a flow chart of an embodiment of a data processing method of the present invention.
[0181] In this embodiment, the data processing method includes:
[0182] Step S60, receiving the video data collected by the sensor, encoding the video data according to the current video encoding parameters, and wirelessly transmitting the encoded data;
[0183] When the camera device is working, the sensor of the camera device collects video data, the electronic device receives the video data collected by the sensor, and encodes the video data according to the current video encoding parameters, and sends the encoded data obtained by the data encoding through the wireless module;
[0184] Step S10, during the data encoding process, determining the amount of change of the current picture compared to the picture in the previous unit time;
[0185] Step S20, predicting a first bit rate in the next unit time according to the change amount and the current video encoding parameters;
[0186] Step S30, obtaining network status parameters of the current wireless network, and predicting a first bandwidth that can be maximally supported by the network status within the next unit time according to the network status parameters;
[0187] Step S40, comparing the first bit rate with the first bandwidth, and adjusting the video encoding parameters according to the comparison result, so that the bit rate of the encoded data obtained in the next unit time matches the first bandwidth.
[0188] In some embodiments, the data processing method may further include the steps of the video encoding parameter adjustment method of any of the above embodiments. Of course, in some embodiments, the data processing method may further include collecting audio signals, encoding the audio signals, and wirelessly transmitting the encoded audio encoding data.
[0189] The technical solution of the data processing method of this embodiment includes all the steps of the video encoding parameter adjustment method, and therefore has at least all the beneficial effects brought by the technical solution of the aforementioned video encoding parameter adjustment method embodiment, which will not be described one by one here.
[0190] The present invention also provides an electronic device, referring to Fig.10 , Fig.10 It is a schematic diagram of the structure of an electronic device in a hardware operating environment involved in an embodiment of the present invention.
[0191] The electronic device of the embodiment of the present invention can be a computing device such as a desktop computer, a notebook, a palm computer, and a server. Fig.10 As shown, the electronic device may include: a processor 1001 (e.g., a CPU), a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit, such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0192] Those skilled in the art will understand that Fig.10 The electronic device structure shown in the figure does not constitute a limitation of the electronic device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0193] like Fig.10 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a computer program (eg, a beauty instrument control program).
[0194] exist Fig.10 In the electronic device shown, the network interface 1004 is mainly used to connect to the background server and communicate data with the background server; the user interface 1003 is mainly used to connect to the client (user end) and communicate data with the client; and the processor 1001 can be used to call the computer program stored in the memory 1005. When the computer program is called and executed by the processor 1001, the steps of the above-mentioned video encoding parameter adjustment method are implemented, or the steps of the above-mentioned data processing method are implemented.
[0195] Based on the computer program proposed in the aforementioned embodiment, the present invention further proposes a storage medium, which stores a computer program. When the computer program is executed by a controller, the steps of the aforementioned video encoding parameter adjustment method or the steps of the aforementioned data processing method are implemented.
[0196] Since the electronic device and storage medium of the present invention can implement the steps of the above-mentioned video encoding parameter adjustment method or data processing method, they at least have all the beneficial effects brought by the technical solutions of the above-mentioned video encoding parameter adjustment method or data processing method embodiments, which are not described one by one here.
[0197] In the several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or modules, which can be electrical, mechanical or other forms.
[0198] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0199] In addition, each functional module in each embodiment of the present invention may be integrated into one processing module, or each module may exist physically separately, or two or more modules may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of software functional modules.
[0200] If the integrated module is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0201] The above description is only a partial or preferred embodiment of the present invention. Neither the text nor the drawings can limit the scope of protection of the present invention. All equivalent structural changes made by using the contents of the present invention specification and drawings under the application concept of the present invention, or directly / indirectly applied in other related technical fields are included in the patent protection scope of the present invention.
Claims
1. A video encoding parameter adjustment method, applied to a camera device, characterized in that: include: During the data encoding process, determining the amount of change of the current picture compared to the picture in the previous unit time; Predicting a first bit rate in the next unit time according to the change amount and the current video encoding parameter; Acquire network status parameters of the current wireless network, and predict a first bandwidth that can be maximally supported by the network status within a next unit time according to the network status parameters; The first bit rate is compared with the first bandwidth, and the video encoding parameters are adjusted according to the comparison result so that the bit rate of the encoded data obtained in the next unit time matches the first bandwidth.
2. The video encoding parameter adjustment method according to claim 1, characterized in that: The determining of the change amount of the current picture compared with the picture in the previous unit time includes: Compare the current picture with the previous frame or any frame in the previous unit time to determine the change amount; wherein the change amount is the proportion of changed pixels or the number of changed pixels; And / or, predicting a first bit rate in a next unit time according to the change amount and the current video encoding parameter includes: Predicting a first change amount of the picture in the next unit time compared to the current picture according to the change amount; The first bit rate is determined according to the first change amount and a current video encoding parameter.
3. The video encoding parameter adjustment method according to claim 1, characterized in that: The step of adjusting the video encoding parameters according to the comparison result includes: When the difference between the first bit rate and the first bandwidth exceeds a preset range, adjusting the frame rate and / or image quality and / or resolution in the video encoding parameters; and / or, When the difference between the first bit rate and the first bandwidth is within a preset range, the video encoding parameters are kept unchanged.
4. The video encoding parameter adjustment method according to claim 3, characterized in that: When the difference between the first bit rate and the first bandwidth exceeds a preset range, adjusting the frame rate and / or image quality and / or resolution in the video encoding parameters includes: When the first bit rate is higher than the first bandwidth by a first preset amount, reducing the frame rate and / or image quality and / or resolution in the video encoding parameters; And / or, when the first bit rate is lower than the first bandwidth by a second preset amount, the frame rate and / or image quality and / or resolution in the video encoding parameters are increased.
5. The video encoding parameter adjustment method according to claim 4, characterized in that: The reducing the frame rate and / or image quality and / or resolution in the video encoding parameters comprises: Reducing the frame rate and / or image quality and / or resolution in a preset manner until the difference between the second bit rate corresponding to the adjusted video encoding parameter and the first bandwidth is within the preset range; And / or, the increasing the frame rate and / or image quality and / or resolution in the video encoding parameters includes: Increasing the frame rate and / or image quality and / or resolution in a preset manner until the difference between the second bit rate corresponding to the adjusted video encoding parameter and the first bandwidth is within a preset range; The second bit rate is determined according to a change in the adjusted video encoding parameters compared to the video encoding parameters corresponding to the first bit rate, combined with the size of the first bit rate.
6. The video encoding parameter adjustment method according to claim 5, characterized in that: The reducing the frame rate and / or image quality and / or resolution in a preset manner includes: Alternately reducing the image quality and the frame rate; When the image quality and the frame rate are both reduced to a preset minimum level, gradually reducing the resolution level; Alternatively, the reducing the frame rate and / or image quality and / or resolution in a preset manner may include: gradually lowering the level of image quality; When the image quality level is reduced to a preset minimum level, gradually reducing the frame rate level; When the frame rate drops to a preset minimum level, the resolution level is gradually reduced; and / or, The step of increasing the frame rate and / or image quality and / or resolution in a preset manner includes: gradually increasing the resolution level; When the resolution is increased to a preset highest level, the image quality and the frame rate are alternately increased; Alternatively, the step of increasing the frame rate and / or image quality and / or resolution in a preset manner may include: gradually increasing the resolution level; When the resolution is increased to a preset highest level, gradually increasing the frame rate level; When the frame rate level is increased to a preset highest level, gradually increasing the image quality level; Alternatively, the step of increasing the frame rate and / or image quality and / or resolution in a preset manner may include: When the first bit rate or the second bit rate is lower than the first bandwidth by a third preset amount, increasing the resolution; When the first bit rate or the second bit rate is lower than the first bandwidth by a fourth preset amount and does not reach the third preset amount, increasing the image quality level or the frame rate level; Wherein, the fourth preset amount is greater than the second preset amount.
7. The video encoding parameter adjustment method according to claim 5, characterized in that: Also includes: When the frame rate, image quality and resolution in the video encoding parameters are all reduced to the preset lowest level, if the second bit rate is still higher than the first bandwidth by the first preset amount, a bandwidth increase request is sent to a bandwidth allocation device; And / or, the first bit rate is predicted using a Kalman filter algorithm; And / or, the first bandwidth is predicted using a Kalman filter algorithm.
8. A data processing method, applied to a camera device, characterized in that: include: Receive video data collected by the sensor, encode the video data according to current video encoding parameters, and wirelessly transmit the encoded data obtained by the data encoding; And the steps of the video encoding parameter adjustment method as described in any one of claims 1 to 7.
9. An electronic device, characterized in that: The electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the steps of the video encoding parameter adjustment method described in any one of claims 1 to 7 are implemented, or the steps of the data processing method described in claim 8 are implemented.
10. A storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by the care device, the steps of the video encoding parameter adjustment method described in any one of claims 1 to 7 are implemented, or the steps of the data processing method described in claim 8 are implemented.