Code rate adjustment method and apparatus, and electronic device and storage medium
By dynamically adjusting the code rate and matching the video data transmission rate according to the network environment of the receiving device, the video lag and delay problems caused by network damage in the monitoring video service are solved, and the video fluency is automatically adjusted and the integrity of live data is achieved.
Patent Information
- Application Number
- PCT/CN2024/092593
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-12-15
- Filing Date
- 2024-05-11
- Publication Date
- 2025-06-19
AI Technical Summary
In wide-area network interaction, network damage such as delay, packet loss and bandwidth limitations lead to a decline in data transmission capacity, especially in surveillance video services, which will lead to lag or delay in live videos, and it is difficult for the existing technology to effectively solve these problems.
In the case of a dynamic screen, the transmission data rate of the receiving end device is obtained, and the dynamic average generation data rate is determined based on the data amount of the I-frame and P-frame of the dynamic screen. If the data rate is less than or equal to the preset multiple, the target code rate is determined based on the cache time, and the code rate is adjusted to match the network environment of the receiving end device.
It realizes automatic adjustment of video fluency, ensures the integrity of live data, avoids video lag and delay problems, and improves the smoothness of video playback of the receiver device.
Smart Images

Figure CN2024092593_19062025_PF_FP_ABST
Abstract
Description
Bit rate adjustment method, device, electronic device and storage medium
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims priority to Chinese patent application No. 2023117384883, filed on December 15, 2023, entitled “Rate Adjustment Method,” which is incorporated herein by reference in its entirety. Technical Field
[0003] The present application relates to the field of video technology, and in particular to a bit rate adjustment method, device, electronic device, and storage medium. Background Art
[0004] Wide area network (WAN) interactions can experience various network impairments, such as latency, packet loss, and bandwidth limitations. These impairments can reduce data transmission capacity. In surveillance video services, insufficient data transmission capacity can cause live video to freeze or experience increased latency.
[0005] When the video freezes or the delay increases, the user usually manually changes the video clarity, such as switching from ultra-high definition to high definition, or from high definition to standard definition, using a lower level of image quality to try to restore smooth video playback.
[0006] Summary of the Invention
[0007] To address the existing problems, the present application provides a bit rate adjustment method, device, electronic device, and storage medium.
[0008] This application provides a bit rate adjustment method, including:
[0009] In the case of a dynamic picture, obtaining a first sending data rate sent by the receiving end device; the first sending data rate is determined by the receiving end device based on the amount of data received for the current dynamic picture I frame and a first receiving duration corresponding to the current dynamic picture I frame;
[0010] Determining a dynamic average data rate based on the data volume of the dynamic picture I frame and the data volume of a first preset number of dynamic picture P frames after the current dynamic picture I frame;
[0011] In a case where the dynamic average data rate is less than or equal to a second preset number of times the first sending data rate, a first target bit rate is determined based on a first cache duration; the first cache duration is a difference between a first current moment and a moment when the first current cache data is written to the cache area; the first current cache data is live data remaining when first live data generated based on the current bit rate is sent to the receiving device based on the first sending data rate; the first target bit rate is used to generate new live data.
[0012] The present application also provides a bit rate adjustment device, comprising:
[0013] A first acquiring unit is configured to acquire, in the case of a dynamic picture, a first sending data rate sent by a receiving end device; the first sending data rate is determined by the receiving end device based on an amount of data of a current dynamic picture I frame received and a first receiving time length corresponding to the current dynamic picture I frame;
[0014] a first determining unit configured to determine a dynamic average generated data rate based on a data volume of a dynamic picture I frame and a data volume of a first preset number of dynamic picture P frames following the current dynamic picture I frame;
[0015] The second determination unit is configured to determine a first target bit rate based on a first cache duration when the dynamic average data rate is less than or equal to a second preset number of times the first sending data rate; the first cache duration is the difference between the first current moment and the moment when the first current cache data is written to the cache area; the first current cache data is the live data remaining when the first live data generated based on the current bit rate is sent to the receiving device based on the first sending data rate; the first target bit rate is used to generate new live data.
[0016] The present application also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, any of the above-described bit rate adjustment methods is implemented.
[0017] The present application also provides a computer-readable storage medium having a computer program stored thereon, which implements any of the above-described bit rate adjustment methods when executed by a processor.
[0018] The present application also provides a computer program product, including a computer program, which implements any of the above-mentioned bit rate adjustment methods when executed by a processor.
[0019] The bit rate adjustment method, device, electronic device and storage medium provided in the present application determine, when the video picture is a dynamic picture, a dynamic average data rate based on the data volume of a first preset number of dynamic picture P frames and the data volume of the dynamic picture I frame after the current dynamic picture I frame; when the dynamic average data rate is less than or equal to a second preset number of times the first sending data rate, a first target bit rate is determined based on the first cache duration, and new live data is generated using the re-determined first target bit rate, so that the generation rate of the new live data matches the current network environment of the receiving device. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The following will introduce the drawings required for the description of the embodiments. The drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0021] FIG1 is a flow chart of a method for adjusting the bit rate according to an embodiment of the present invention;
[0022] FIG2 is a second flow chart of the bit rate adjustment method provided in an embodiment of the present application;
[0023] FIG3 is a third flow chart of the bit rate adjustment method provided in an embodiment of the present application;
[0024] FIG4 is a schematic diagram of the overall flow of a method for adjusting the bit rate of a dynamic picture provided by an embodiment of the present application;
[0025] FIG5 is a schematic diagram of the overall flow of a method for adjusting the bit rate of a static image provided by an embodiment of the present application;
[0026] FIG6 is a schematic structural diagram of a bit rate adjustment device provided in an embodiment of the present application;
[0027] FIG7 is a schematic diagram of the physical structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0028] The technical solutions in this application will be described below in conjunction with the drawings in this application. The described embodiments are only part of the embodiments of this application, not all of the embodiments.
[0029] The following describes the bit rate adjustment method of the present application in conjunction with Figures 1 to 5. The execution subject of the bit rate adjustment method can be an electronic device such as a camera device that monitors a live environment, or a bit rate adjustment device provided in the electronic device. The bit rate adjustment device can be implemented by software, hardware, or a combination of both.
[0030] FIG1 is a flow chart of a method for adjusting the bit rate according to an embodiment of the present invention. As shown in FIG1 , the method for adjusting the bit rate includes the following steps:
[0031] Step 101: In the case of a dynamic picture, obtain a first sending data rate sent by the receiving device; the first sending data rate is determined by the receiving device based on the amount of data received of the current dynamic picture I frame and the first receiving time length corresponding to the current dynamic picture I frame.
[0032] Among them, the dynamic picture refers to a picture containing dynamic elements, and the dynamic picture is composed of multiple frames of static pictures. The current dynamic picture I frame refers to the complete dynamic picture I frame currently received by the receiving device. The data volume of the current dynamic picture I frame refers to the number of bytes occupied by the encoding of the current dynamic picture I frame. The first receiving duration is the time required for the receiving device to start receiving the current dynamic picture I frame and to complete receiving the current dynamic picture I frame.
[0033] For example, for dynamic images, the receiving end device divides the data volume of the complete current dynamic image I frame received by the first receiving time length to calculate the first sending data rate. The first sending data rate is used to characterize the sending capability of the current link, and the first sending data rate is fed back to the camera device so that the camera device obtains the first sending data rate. For example, the data volume of the complete current dynamic image I frame is expressed as Data DynamicI Indicates that the first receiving duration is Δt 1接收I帧 Indicates that the first sending data rate
[0034] Step 102: Determine a dynamic average data rate based on the data volume of the dynamic picture I frame and the data volume of a first preset number of dynamic picture P frames after the current dynamic picture I frame.
[0035] For example, the dynamic picture is represented by the current dynamic picture I frame and the first X dynamic picture P frames after the current dynamic picture I frame, where X is a first preset number, and the subsequent data accumulation is predicted. For example, the average data volume of the first X dynamic picture P frames is used to represent the dynamic picture P frame data volume Data DynamicP , then Data DynamicP =(Data DynamicP1 +…+Data DynamicPX ) / X, where Data DynamicP1 Indicates the first dynamic picture P frame among X dynamic picture P frames, Data DynamicPX Indicates the Xth dynamic picture P frame among X dynamic picture P frames. The dynamic picture I frame data volume can be the number of bytes occupied by the first dynamic picture I frame encoding. The dynamic picture I frame data volume can be expressed as Data DynamicIThe dynamic average generates the data rate Here, GOP represents the I-frame interval, and Frame represents the frame rate.
[0036] Step 103: When the dynamic average data rate is less than or equal to a second preset number of times the first sending data rate, determine a first target bit rate based on a first cache period; the first cache period is the difference between a first current moment and a moment when the first current cache data is written to the cache area; the first current cache data is the live data remaining when the first live data generated based on the current bit rate is sent to the receiving device based on the first sending data rate; the first target bit rate is used to generate new live data.
[0037] For example, the dynamic average data rate V is obtained. Dynamic and the first transmission data rate V Send1 When , assuming that the second preset number is N, N∈(1,+∞), V Dynamic With N*V Send1 For comparison, in V Dynamic ≤N*V Send1 When the current data accumulation speed is still within the short-term allowable range, there is no need to adjust the current bit rate. However, due to the uncertainty of how long the dynamic picture will last, it is necessary to continue to observe for a longer time. During the observation period, the duration of the dynamic picture and V Dynamic They are all change factors, but these change factors will be reflected in the cache duration of the cached data in the cache area, so the cache duration is used to detect the accumulation of cached data in the cache area.
[0038] After the camera device generates the first live data based on the current bit rate, it needs to send the first live data to the receiving device based on the first sending data rate. In the process of sending the first live data, when the sending of part of the live data does not receive a successful reception response returned by the receiving device, it is considered that the part of the live data has not been successfully received by the receiving device. At this time, it is necessary to cache the part of the live data in the cache area. When the part of the live data is the first current cache data, the difference between the first current moment and the moment when the first current cache data is written to the cache area is determined as the first cache duration, and then the current bit rate is adjusted based on the size of the first cache duration to obtain the first target bit rate, and the first target bit rate is used to generate new live data.
[0039] The bit rate adjustment method provided by the present application determines, when the video picture is a dynamic picture, a dynamic average data rate based on the data volume of a first preset number of dynamic picture P frames and the data volume of the dynamic picture I frame after the current dynamic picture I frame; when the dynamic average data rate is less than or equal to a second preset number of times the first sending data rate, a first target bit rate is determined based on the first cache duration, and new live data is generated using the re-determined first target bit rate, so that the generation rate of the new live data matches the current network environment of the receiving device. In this way, the receiving device can play the new live data in real time when it receives the new live data, thereby improving the smoothness of the receiving device in playing the new live data and realizing automatic adjustment of the video smoothness; in addition, since the generation rate of the new live data matches the current network environment of the receiving device, it is possible to avoid loss of live data during transmission and ensure the integrity of the live data.
[0040] In one embodiment, step 103 above determines the first target bit rate based on the first buffer duration, which can be achieved by:
[0041] When a first preset condition is met, increasing the current bit rate to obtain the first target bit rate;
[0042] The first preset condition includes any one of the following:
[0043] Condition 11: After the first live data of the first preset duration is generated, the first cache duration is less than a first delay threshold.
[0044] Condition 12: After generating the first live data of the first preset duration, the first cache duration is less than the first delay threshold, and the difference between the current moment and the last moment of reducing the bit rate is greater than the first preset threshold, and the first preset threshold is used to characterize the duration of suppressing gear oscillation switching.
[0045] Condition 13: After the first live data of the first preset duration is generated, the first cache duration is greater than or equal to the first delay threshold, and after continuing to generate the second live data of the second preset duration, the second cache duration is less than the second delay threshold; the first delay threshold is less than the second delay threshold, the second cache duration is the difference between the second current moment and the moment when the second current cache data is written to the cache area, the second current cache data is the live data remaining when the third live data is sent to the receiving device based on the first sending data rate, and the third live data includes the second live data and the first current cache data.
[0046] Condition 14: After generating the first live data of a first preset duration, the first cache duration is greater than or equal to the first delay threshold; after continuing to generate the second live data of a second preset duration, the second cache duration is less than the second delay threshold, and the difference between the current moment and the last moment of reducing the bit rate is greater than the first preset threshold.
[0047] For example, for condition 11, when the dynamic average data rate is less than or equal to the first transmission data rate of the second preset number of times, the first live data of the first preset duration T1 is generated. Assuming T1 is 1s, that is, the first live data of 1s is generated. When the first live data is sent to the receiving end device, only 950ms of the first live data are sent. The first cache duration corresponding to the first current cache data is 50ms, and the first delay threshold t 低延时 Used to characterize the length of time a low-latency network allows for caching. Assuming the first delay threshold t 低延时 If the first buffering time is 100ms, the first buffering time of 50ms is less than the first delay threshold of 100ms, which means that the amount of buffered data is small and the current bit rate can be increased. For example, the bit rate can be increased by one gear, that is, the gear can be increased based on the current bit rate to obtain the first target bit rate.
[0048] For example, for condition 12, on the basis of condition 11, that is, after the first live data of the first preset time length is generated, when the first cache time length is less than the first delay threshold, in order to avoid the oscillation switching of the bit rate gear, it is necessary to compare the difference between the current time and the time when the bit rate was last reduced with the first preset threshold t 抑制 For comparison, the first preset threshold t 抑制 It is used to characterize the duration of the gear oscillation suppression switching, when the difference between the current moment and the moment of the last bit rate reduction is greater than the first preset threshold t 抑制 When , it means that it has been a long time since the downshift, then the bit rate can be increased by one gear, that is, the gear can be increased based on the current bit rate to obtain the first target bit rate; the difference between the current moment and the moment when the bit rate was last reduced is less than or equal to the first preset threshold t 抑制 When , it means that the downshift time is not long. At this time, it is not allowed to upshift based on the current bit rate to avoid gear oscillation switching.
[0049] For example, for condition 13, after generating the first live data of the first preset duration, when the first cache duration is greater than or equal to the first delay threshold, it is necessary to continue observing, that is, it is necessary to continue generating the second live data of the second preset duration T2. Assuming T2 is 2s, that is, 2s of second live data are generated. When sending the third live data (the second live data 2s and the first current cache data 50ms previously cached) to the receiving end device, if only 1900ms of the third live data 2050ms is sent, the second cache duration corresponding to the second current cache data is 150ms, and the second delay threshold t 高延时 It is used to characterize the duration of caching allowed by high-latency networks. Assuming the second delay threshold t 高延时 If the second buffering time is 200ms, the second buffering time of 150ms is less than the second delay threshold of 200ms, which means that the amount of buffered data is small and the current bit rate can be increased. For example, the bit rate can be increased by one gear, that is, the gear can be increased based on the current bit rate to obtain the first target bit rate.
[0050] It should be noted that, in actual application, multiple different first delay thresholds and second delay thresholds can be set based on network requirements so that the gear adjustment of the bit stream is more in line with the current network environment. This application does not limit this.
[0051] For example, for condition 14, on the basis of condition 13, that is, after generating the first live data of the first preset time length, the first cache time length is greater than or equal to the first delay threshold, and after continuing to generate the second live data of the second preset time length, the second cache time length is less than the second delay threshold, in order to avoid the oscillation switching of the bit rate gear, it is necessary to compare the difference between the current time and the time when the bit rate was last reduced with the first preset threshold t 抑制 Comparison is made, and the difference between the current moment and the moment when the bit rate was last reduced is greater than the first preset threshold t 抑制 When , it means that it has been a long time since the downshift, then the bit rate can be increased by one gear, that is, the gear can be increased based on the current bit rate to obtain the first target bit rate; the difference between the current moment and the moment when the bit rate was last reduced is less than or equal to the first preset threshold t 抑制 When , it means that the downshift time is not long. At this time, it is not allowed to upshift based on the current bit rate to avoid gear oscillation switching.
[0052] In this embodiment, when the first preset condition is met, it means that the current network condition is good, and the current bit rate can be quickly increased. New live data is generated based on the first target bit rate obtained after the bit rate is increased, so that the generation rate of the new live data matches the current network environment of the receiving device. In this way, the receiving device can play the new live data in real time when it receives it, thereby improving the fluency of the receiving device in playing the new live data and realizing automatic adjustment of the video fluency; in addition, under dynamic pictures, multiple thresholds such as the first preset threshold, the first delay threshold, and the second delay threshold are set in the gear-up stage, which can be compatible with both low-latency network environments and high-latency network environments; and under dynamic pictures, only time is used to measure the accumulation of cached data, which is closer to the user's judgment of picture delay and can be compatible with fixed-bitrate video and variable-bitrate video.
[0053] In one embodiment, step 103 above determines the first target bit rate based on the first buffer duration, which can also be achieved by:
[0054] After generating the first live data of a first preset duration, if the first cache duration is greater than or equal to the first delay threshold, and after continuing to generate the second live data of a second preset duration, if the second cache duration is greater than or equal to the second delay threshold, the current bit rate is reduced to obtain the first target bit rate; the first delay threshold is less than the second delay threshold, the second cache duration is the difference between the second current moment and the moment when the second current cache data is written into the cache area, the second current cache data is the live data remaining when the third live data is sent to the receiving device based on the first sending data rate, and the third live data includes the second live data and the first current cache data.
[0055] For example, after generating the first live data of the first preset duration, when the first cache duration is greater than or equal to the first delay threshold, it is necessary to continue observing, that is, it is necessary to continue generating the second live data of the second preset duration T2. After continuing to generate the second live data of the second preset duration T2, assuming that T2 is 2s, that is, 2s of second live data are generated, when sending the third live data (the second live data 2s and the first current cache data 50ms previously cached) to the receiving end device, if only 1800ms of the third live data 2050ms is sent, then the second cache duration corresponding to the second current cache data is 250ms, and the second delay threshold t 高延时 It is used to characterize the duration of caching allowed by high-latency networks. Assuming the second delay threshold t 高延时If the second buffering time is 200ms, the second buffering time of 250ms is greater than the second delay threshold of 200ms, which means that the amount of cached data is large and the current bit rate can be reduced. For example, the bit rate can be reduced by one gear, that is, the gear can be downgraded based on the current bit rate to obtain the first target bit rate.
[0056] In this embodiment, after generating the first live data of the first preset time length, if the first cache time length is greater than or equal to the first delay threshold, and after continuing to generate the second live data of the second preset time length, if the second cache time length is greater than or equal to the second delay threshold, it indicates that the current network condition is poor, and the current bit rate can be quickly reduced. New live data is generated based on the first target bit rate obtained after reducing the bit rate, so that the generation rate of the new live data matches the current network environment of the receiving device. In this way, the receiving device can play the new live data in real time when it receives it, thereby improving the fluency of the receiving device in playing the new live data and realizing automatic adjustment of the video fluency.
[0057] In one embodiment, after reducing the current bit rate to obtain the first target bit rate, the bit rate adjustment method further includes the following steps:
[0058] When a second preset condition is met, the first target bit rate is reduced to obtain a second target bit rate.
[0059] The second preset condition includes any one of the following:
[0060] Condition 21: The third cache duration is greater than or equal to a second preset threshold; the second preset threshold is used to characterize the duration of severe network congestion, the third cache duration is the difference between the third current moment and the moment when the third current cache data is written to the cache area, and the third current cache data is the live data remaining when the second current cache data is sent to the receiving device based on the first sending data rate.
[0061] Condition 22: the third cache duration is less than the second preset threshold, the third cache duration is greater than or equal to the second delay threshold, and after continuing to generate the fourth live data of the third preset duration, the consumption speed of the remaining cached data in the cache area is less than the preset speed; the remaining cached data is the live data remaining when the fourth live data and the historical cached live data in the cache area are sent to the receiving device; the second target bit rate is used to generate new live data.
[0062] Among them, the preset speed can be V 下降 To indicate the preset speed V 下降 is an adjustable parameter, V 下降 The larger it is, the more sensitive the downshift will be.
[0063] For example, for condition 21, when the current bit rate is reduced to obtain the first target bit rate, the data cached in the buffer area is the second current buffer data. When the second current buffer data in the buffer area is sent to the receiving end device, only part of the live data in the second current buffer data is sent. For example, the second buffer duration corresponding to the second current buffer data is 3500ms, and only 100ms of live data in the second current buffer data is sent. Then, the third buffer duration corresponding to the third current buffer data is 3400ms, and the second delay threshold t 严重阻塞 Used to characterize the duration of severe network congestion, assuming that the second delay threshold t 严重阻 塞 For example, if the third cache duration of 3400ms is greater than the second delay threshold of 3000ms, it means that the cache data is seriously accumulated in the cache area, and the current network environment suddenly becomes very bad. Then, the logic of downgrading one gear at a time is not suitable for the current picture or network changes. At this time, the first target bit rate can be reduced. For example, the first target bit rate can be reduced to the lowest gear bit rate to obtain the second target bit rate.
[0064] For example, for condition 22, for example, the second cache duration corresponding to the second current cache data is 3500ms, 2500ms of live data in the second current cache data is sent, and the third cache duration corresponding to the third current cache data is 1000ms. Assuming that the second delay threshold t 严重阻塞 is 3000ms, then the third cache duration 1000ms is less than the second delay threshold 3000ms. At this time, the third cache duration is equal to the second delay threshold t 高延时 Compare, when the third cache duration is greater than or equal to the second delay threshold t 高延时 When the buffered data in the buffer area is accumulated, it is necessary to continue to observe and determine whether the buffered data in the buffer area can be consumed in time under the current bit rate. That is, continue to generate the fourth live data of the third preset time length, obtain the remaining buffered data in the buffer area once within each I frame interval period, and determine the corresponding consumption speed of the buffer area based on the remaining buffered data obtained multiple times. When the consumption speed is less than the preset speed, it means that the data in the buffer area cannot be consumed in time. At this time, reduce the first target bit rate. For example, reduce the bit rate by one gear, that is, downgrade the gear based on the first target bit rate to obtain the second target bit rate. When the consumption speed is greater than or equal to the preset speed, it means that the data in the buffer area can be consumed in time. At this time, do not adjust the first target bit rate.
[0065] In this embodiment, after downgrading, the downward trend of the cached data accumulated in the cache area continues to be judged. If the preset downward trend is not met, it means that the cached data is still accumulating or is consumed very slowly, and it is necessary to lower the gear again. That is, if the second preset condition is met, it means that the current network condition is poor. The bit rate can be reduced again on the basis of the first target bit rate, and new live data is generated based on the obtained second target bit rate, so that the generation rate of the new live data matches the current network environment of the receiving device. In this way, the receiving device can play the new live data in real time when it receives it, thereby improving the fluency of the receiving device in playing the new live data and realizing automatic adjustment of the video fluency.
[0066] In one embodiment, FIG2 is a second flow chart of the bit rate adjustment method provided in an embodiment of the present application. As shown in FIG2 , the bit rate adjustment method further includes the following steps:
[0067] Step 104: When the dynamic average data rate is greater than the first transmission data rate by a second preset number of times, reduce the current bit rate to obtain a third target bit rate; the third target bit rate is used to generate new live data.
[0068] For example, when the dynamic average data rate is greater than the first transmission data rate of the second preset number times, that is, V Dynamic >N*V Send1 When , it means that the current data accumulation speed is fast and the current network environment is poor. The current bit rate can be reduced. For example, the bit rate can be reduced by one gear, that is, the gear can be downgraded on the basis of the current bit rate to obtain the third target bit rate. N is a constant. The smaller the value of N, the higher the sensitivity of the downgrade.
[0069] In this embodiment, when the dynamic average data rate is greater than the first transmission data rate by a second preset number of times, the current bit rate is quickly reduced, and new live data is generated based on the obtained third target bit rate, so that the generation rate of the new live data matches the current network environment of the receiving device. In this way, the receiving device can play the new live data in real time when it receives it, thereby improving the fluency of the receiving device in playing the new live data and realizing automatic adjustment of the video fluency.
[0070] In one embodiment, FIG3 is a third flow chart of the bit rate adjustment method provided in an embodiment of the present application. As shown in FIG3 , the bit rate adjustment method further includes the following steps:
[0071] Step 301: In the case of a static picture, obtain a second sending data rate sent by the receiving device; the second sending data rate is determined by the receiving device based on the amount of data received of the current static picture I frame and the second receiving time length corresponding to the current static picture I frame.
[0072] Among them, a static picture refers to an image without dynamic elements, the current static picture I frame refers to the complete static picture I frame currently received by the receiving device, the data volume of the current static picture I frame refers to the number of bytes occupied by the encoding of the current static picture I frame, and the second receiving duration is the time required for the receiving device to start receiving the current static picture I frame and complete receiving the current static picture I frame.
[0073] For example, for a static image, the receiving end device divides the data volume of the complete current static image I frame received by the second receiving time length to calculate the second sending data rate, which is used to characterize the sending capability of the current link, and feeds the second sending data rate back to the camera device so that the camera device obtains the second sending data rate. StaticI Indicates that the first receiving duration is Δt 2接收I帧 Indicates that the second transmission data rate
[0074] Step 302: Determine the static average generated data rate based on the static picture I frame data volume and the static picture P frame data volume.
[0075] For example, the data volume of each static picture I frame and each static picture P frame remains stable, so the subsequent packet transmission situation can be predicted through the previous sampling. The data volume of the static picture I frame can be the data volume of the first static picture I frame or the average data volume of the previous static picture I frames. The data volume of the static picture I frame can be expressed as Data StaticI The data volume of the static picture P frame can be the data volume of the first static picture P frame or the average data volume of the first few static picture P frames. The data volume of the static picture P frame can be expressed as Data StaticP To express it, the static average produces a data rate
[0076] Step 303: Determine a fourth target bit rate based on the second sending data rate and the static average generated data rate; the fourth target bit rate is used to generate new live data.
[0077] For example, the static average data rate V is obtained. Static and the second transmission data rate V Send2 The data rate V is generated by the static average Static and the second transmission data rate V Send2By comparison, it can be determined whether the current bit rate needs to be adjusted. When it is determined that the current bit rate needs to be adjusted, the fourth target bit rate is obtained by upshifting or downshifting the current bit rate; when it is determined that the current bit rate does not need to be adjusted, the fourth target bit rate is the current bit rate.
[0078] In this embodiment, for static images, a fourth target bit rate is automatically determined based on the second sending data rate and the static average generated data rate, and new live data is generated based on the obtained fourth target bit rate, so that the generation rate of the new live data matches the current network environment of the receiving device. In this way, the receiving device can play the new live data in real time when it receives it, thereby improving the fluency of the receiving device in playing the new live data and realizing automatic adjustment of the video fluency.
[0079] In one embodiment, the above step 107 determines the fourth target bit rate based on the second transmission data rate and the static average generated data rate, which can be achieved by:
[0080] When the static average generated data rate is greater than the second sending data rate, the current code rate is reduced to obtain the fourth target code rate.
[0081] For example, the static average generates a data rate V Static Greater than the second transmission data rate V Sen , that is, V Satic >V Send2 When , it means that data will continue to accumulate at the current bit rate, the current network environment is poor, and it is necessary to downgrade in time, that is, reduce the current bit rate. For example, the bit rate can be reduced by one gear, that is, downgrade based on the current bit rate to obtain the fourth target bit rate.
[0082] In this embodiment, when the static average data rate is greater than the second transmission data rate, it means that data will continue to accumulate at the current bit rate, and the current bit rate needs to be reduced in time to achieve a rapid reduction in the current bit rate to adapt to the poor current network environment.
[0083] In one embodiment, the above step 107 determines the fourth target bit rate based on the second transmission data rate and the static average generated data rate, which can also be implemented in the following manner:
[0084] When the static average data generation rate is less than or equal to the second sending data rate, and the static picture I frame generation data rate is greater than the second sending data rate, the target cache duration is determined based on the static picture I frame generation data rate, the static picture P frame generation data rate and the second sending data rate; the target cache duration is sent to the receiving device; the target cache duration is used to indicate that the receiving device caches live data within the target cache duration.
[0085] For example, the static average generates a data rate V Static Less than or equal to the second transmission data rate V Send2 , that is, V Satic ≤V Send2 Calculate the data rate of static image I frame And generate a data rate V for the static picture I frame StaticI With the second transmission data rate V Send2 For comparison, in V StaticI >V Send2 When the target buffering time is 0, it means that the overall data generated matches the link's transmission capacity, but the receiving device may experience a pause during the transmission of the static image I frame. Therefore, the receiving device can be allowed to cache data for a period of time to ensure the overall smoothness of the live broadcast. And the calculated target cache duration t 客户端缓存 Sent to the receiving device, the receiving device caches the received target time t 客户端缓存 Cache live data for a certain period of time.
[0086] In this embodiment, when the static average data rate is less than or equal to the second sending data rate, and the static picture I frame data rate is greater than the second sending data rate, the receiving device is controlled to cache data of the target cache duration to ensure the overall smoothness of the live broadcast. At the same time, each gear bit rate has a corresponding clarity, thereby also ensuring the clarity of the live broadcast.
[0087] In one embodiment, the above step 107 determines the fourth target bit rate based on the second transmission data rate and the static average generated data rate, which can also be implemented in the following manner:
[0088] When the third preset condition is met, the current bit rate is increased to obtain the fourth target bit rate.
[0089] The third preset condition includes any one of the following:
[0090] Condition 31: The data rate at which the static image I frame is generated is less than or equal to the second sending data rate.
[0091] Condition 32: The data rate of generating the static picture I frame is less than or equal to the second sending data rate, and the difference between the current moment and the moment of the last bit rate reduction is greater than the first preset threshold.
[0092] For example, for condition 31, the data rate V is generated in the static picture I frame. static1 Less than or equal to the second transmission data rate V Send2 , that is, V Static1≤V Send2 When , it means that the current code rate is lower than the transmission capacity of the link, and the current code rate can be increased. For example, the code rate can be increased by one gear, that is, the gear is increased based on the current code rate to obtain the fourth target code rate.
[0093] In this embodiment, when the third preset condition is met, it indicates that the current network condition is good, and the current bit rate can be increased. New live data is generated based on the fourth target bit rate obtained after the bit rate is increased, so that the generation rate of the new live data matches the current network environment of the receiving device. In this way, the receiving device can play the new live data in real time when it receives it, thereby improving the fluency of the receiving device in playing the new live data and realizing automatic adjustment of the video fluency.
[0094] In one embodiment, when starting the flow, the difference between the current flow start time and the last flow stop time and the historical record validity time t 历史记录有效期 Compare, if the difference between the current start time and the last stop time is less than the valid time of the historical record t 历史记录有效期 When , it means that the start-up interval is short. At this time, the bit rate corresponding to the last shut-off time can be determined as the current bit rate. When the difference between the current start-up time and the last shut-off time is greater than or equal to the historical record validity period t 历史记录有效期 , it means that the interval between stream start-ups is long. In this case, the lowest bit rate is determined as the current bit rate.
[0095] In this embodiment, when the difference between the current start time and the last shut-off time is less than the validity period of the historical record, the bitrate corresponding to the last shut-off time is determined as the current bitrate. This avoids starting from the lowest bitrate each time the stream is started. This eliminates the need for preliminary detection of the appropriate bitrate in a short period of time, thereby reducing the computational complexity of bitrate adjustment.
[0096] Figure 4 is a schematic diagram of the overall flow of the bit rate adjustment method for dynamic pictures provided in an embodiment of the present application, and Figure 5 is a schematic diagram of the overall flow of the bit rate adjustment method for static pictures provided in an embodiment of the present application. As shown in Figures 4 and 5, after the start of streaming, it is determined whether the difference between the current streaming start time and the last streaming stop time is less than the valid duration of the historical record. When the difference between the current streaming start time and the last streaming stop time is less than the valid duration of the historical record, the bit rate corresponding to the last streaming stop time is determined as the current bit rate corresponding to the current streaming start. When the difference between the current streaming start time and the last streaming stop time is greater than or equal to the valid duration of the historical record, the lowest bit rate is determined as the current bit rate corresponding to the current streaming start.
[0097] After starting the stream, determine whether the picture is a static picture. In the case of a dynamic picture, calculate the first sending data rate, the data volume of the dynamic picture I frame, and the data volume of the first preset number of dynamic picture P frames after the current dynamic picture I frame. Based on the data volume of the dynamic picture I frame and the data volume of the first preset number of dynamic picture P frames after the current dynamic picture I frame, determine the dynamic average data rate. When the dynamic average data rate is less than or equal to the first sending data rate times the second preset number, after the first live data of the first preset length is generated, the first cache length is less than the first delay threshold, and the difference between the current moment and the moment of the last bit rate reduction is greater than the first preset threshold, increase the current bit rate.
[0098] After generating first live data of a first preset length, the first cache length is greater than or equal to the first delay threshold; after continuing to generate second live data of a second preset length, the second cache length is less than the second delay threshold, and the difference between the current moment and the moment when the bit rate was last reduced is greater than the first preset threshold, the current bit rate is increased.
[0099] After the second live data of the second preset duration is continuously generated, when the second cache duration is greater than or equal to the second delay threshold, the current bit rate is reduced.
[0100] Exemplarily, after reducing the current bit rate, when the third buffer duration is greater than or equal to the second preset threshold, the bit rate is further reduced to the lowest bit rate.
[0101] When the third cache duration is less than the second preset threshold, the third cache duration is greater than or equal to the second delay threshold, and the fourth live data of the third preset duration continues to be generated, and the consumption speed of the remaining cache data in the cache area is less than the preset speed, the bit rate continues to be reduced.
[0102] When the dynamic average generates a data rate greater than the first transmission data rate by a second preset number of times, the current code rate is reduced.
[0103] In the case of a static picture, the second sending data rate, the static picture I frame data volume and the static picture P frame data volume are calculated, and based on the static picture I frame data volume and the static picture P frame data volume, the static average generated data rate is determined. When the static average generated data rate is greater than the second sending data rate, the current bit rate is reduced; when the static average generated data rate is less than or equal to the second sending data rate, and the static picture I frame generated data rate is greater than the second sending data rate, the target cache duration is sent to the receiving device; when the static picture I frame generated data rate is less than or equal to the second sending data rate, and the difference between the current moment and the moment of last bit rate reduction is greater than the first preset threshold, the current bit rate is increased.
[0104] After the current bit rate adjustment is completed, the process returns to the step of determining whether the image is a static image and continues to perform the adaptive adjustment of the next periodic bit rate.
[0105] The rate adjustment device provided in the present application is described below. The rate adjustment device described below and the rate adjustment method described above can be referenced to each other.
[0106] FIG6 is a schematic diagram of the structure of a bit rate adjustment device provided in an embodiment of the present application. As shown in FIG6 , the bit rate adjustment device 600 includes a first acquisition unit 601, a first determination unit 602, and a second determination unit 603; wherein:
[0107] A first acquiring unit 601 is configured to acquire, in the case of a dynamic picture, a first sending data rate sent by a receiving end device; the first sending data rate is determined by the receiving end device based on the amount of data received for a current dynamic picture I frame and a first receiving duration corresponding to the current dynamic picture I frame;
[0108] The first determining unit 602 is configured to determine a dynamic average generated data rate based on the data volume of the dynamic picture I frame and the data volume of a first preset number of dynamic picture P frames after the current dynamic picture I frame;
[0109] The second determination unit 603 is configured to determine a first target bit rate based on a first cache duration when the dynamic average data rate is less than or equal to a second preset number of times the first sending data rate; the first cache duration is the difference between the first current moment and the moment when the first current cache data is written to the cache area; the first current cache data is the live data remaining when the first live data generated based on the current bit rate is sent to the receiving device based on the first sending data rate; the first target bit rate is used to generate new live data.
[0110] The bit rate adjustment device provided in the present application determines the dynamic average data rate based on the data volume of a first preset number of dynamic picture P frames and the data volume of the dynamic picture I frame after the current dynamic picture I frame when the video picture is a dynamic picture. When the dynamic average data rate is less than or equal to a second preset number of times the first sending data rate, the device determines the first target bit rate based on the first cache duration, and uses the re-determined first target bit rate to generate new live data, so that the generation rate of the new live data matches the current network environment of the receiving device. In this way, the receiving device can play the new live data in real time when it receives it, thereby improving the fluency of the receiving device in playing the new live data and realizing automatic adjustment of the video fluency.
[0111] Based on any of the foregoing embodiments, the second determining unit 603 may be configured as follows:
[0112] When a first preset condition is met, increasing the current bit rate to obtain the first target bit rate;
[0113] The first preset condition includes any one of the following:
[0114] After the first live data of the first preset time length is generated, the first cache time length is less than a first delay threshold;
[0115] After the first live data of the first preset duration is generated, the first cache duration is less than a first delay threshold, and the difference between the current time and the time when the bit rate was last reduced is greater than a first preset threshold; the first preset threshold is used to represent the duration of suppressing gear oscillation switching;
[0116] After the first live data of a first preset duration is generated, the first cache duration is greater than or equal to the first delay threshold, and after the second live data of a second preset duration is continuously generated, the second cache duration is less than the second delay threshold; the first delay threshold is less than the second delay threshold, the second cache duration is a difference between a second current moment and a moment when the second current cache data is written into the cache area, the second current cache data is live data remaining when third live data is sent to the receiving device based on the first sending data rate, and the third live data includes the second live data and the first current cache data;
[0117] After generating the first live data of a first preset duration, the first cache duration is greater than or equal to the first delay threshold; after continuing to generate the second live data of a second preset duration, the second cache duration is less than the second delay threshold, and the difference between the current moment and the last moment of reducing the bit rate is greater than the first preset threshold.
[0118] Based on any of the foregoing embodiments, the second determining unit 603 may also be configured as follows:
[0119] After generating the first live data of a first preset duration, if the first cache duration is greater than or equal to the first delay threshold, and after continuing to generate the second live data of a second preset duration, if the second cache duration is greater than or equal to the second delay threshold, the current bit rate is reduced to obtain the first target bit rate; the first delay threshold is less than the second delay threshold, the second cache duration is the difference between the second current moment and the moment when the second current cache data is written into the cache area, the second current cache data is the live data remaining when the third live data is sent to the receiving device based on the first sending data rate, and the third live data includes the second live data and the first current cache data.
[0120] Based on any of the above embodiments, the bit rate adjustment device 600 further includes:
[0121] A first adjustment unit is configured to reduce the first target bit rate to obtain a second target bit rate when a second preset condition is met;
[0122] The second preset condition includes any one of the following:
[0123] The third cache duration is greater than or equal to a second preset threshold; the second preset threshold is used to represent the duration of severe network congestion; the third cache duration is the difference between a third current moment and a moment when the third current cache data is written to the cache area; the third current cache data is the live data remaining when the second current cache data is sent to the receiving device based on the first sending data rate;
[0124] The third cache duration is less than the second preset threshold, the third cache duration is greater than or equal to the second delay threshold, and after continuing to generate the fourth live data of the third preset duration, the consumption speed of the remaining cached data in the cache area is less than the preset speed; the remaining cached data is the live data remaining when the fourth live data and the historical cached live data in the cache area are sent to the receiving device; the second target bit rate is used to generate new live data.
[0125] Based on any of the above embodiments, the bit rate adjustment device 600 further includes:
[0126] The second adjustment unit is configured to reduce the current bit rate to obtain a third target bit rate when the dynamic average data rate is greater than the first sending data rate by a second preset number of times; the third target bit rate is used to generate new live data.
[0127] Based on any of the above embodiments, the bit rate adjustment device 600 further includes:
[0128] A second acquiring unit is configured to acquire, in the case of a static picture, a second sending data rate sent by the receiving end device; the second sending data rate is determined by the receiving end device based on the amount of data received for the current static picture I frame and a second receiving time length corresponding to the current static picture I frame;
[0129] a third determining unit configured to determine a static average generated data rate based on the static picture I frame data volume and the static picture P frame data volume;
[0130] The fourth determining unit is configured to determine a fourth target bit rate based on the second sending data rate and the static average generated data rate; the fourth target bit rate is used to generate new live data.
[0131] Based on any of the foregoing embodiments, the fourth determining unit may be configured as follows:
[0132] When the static average generated data rate is greater than the second sending data rate, the current code rate is reduced to obtain the fourth target code rate.
[0133] Based on any of the above embodiments, the bit rate adjustment device further includes:
[0134] a fifth determining unit configured to, when the static average generated data rate is less than or equal to the second sending data rate and the static picture I frame generated data rate is greater than the second sending data rate, determine a target buffer duration based on the static picture I frame generated data rate, the static picture P frame generated data rate, and the second sending data rate;
[0135] The sending unit is configured to send the target cache duration to the receiving device; the target cache duration is used to instruct the receiving device to cache live data within the target cache duration.
[0136] Based on any of the foregoing embodiments, the fourth determining unit may be configured as follows:
[0137] When a third preset condition is met, increasing the current bit rate to obtain the fourth target bit rate;
[0138] The third preset condition includes any one of the following:
[0139] The data rate of generating the static picture I frame is less than or equal to the second sending data rate;
[0140] The data rate at which the static picture I frame is generated is less than or equal to the second sending data rate, and the difference between the current moment and the moment when the bit rate was last reduced is greater than a first preset threshold.
[0141] Based on any of the above embodiments, the bit rate adjustment device further includes:
[0142] The sixth determining unit is configured to determine the bit rate corresponding to the last flow shut-off time as the current bit rate when the difference between the current flow start time and the last flow shut-off time is less than the valid time length of the historical record.
[0143] FIG7 is a schematic diagram of the physical structure of an electronic device provided in an embodiment of the present application. As shown in FIG7 , the electronic device may include: a processor 710, a communications interface 720, a memory 730, and a communication bus 740, wherein the processor 710, the communications interface 720, and the memory 730 communicate with each other via the communication bus 740. The processor 710 may call the logic instructions in the memory 730 to execute a bit rate adjustment method, which includes: in the case of a dynamic picture, obtaining a first transmission data rate sent by a receiving end device; the first transmission data rate is determined by the receiving end device based on the amount of data of the received current dynamic picture I frame and the first reception duration corresponding to the current dynamic picture I frame;
[0144] Determining a dynamic average data rate based on the data volume of the dynamic picture I frame and the data volume of a first preset number of dynamic picture P frames after the current dynamic picture I frame;
[0145] In a case where the dynamic average data rate is less than or equal to a second preset number of times the first sending data rate, a first target bit rate is determined based on a first cache duration; the first cache duration is a difference between a first current moment and a moment when the first current cache data is written to the cache area; the first current cache data is live data remaining when first live data generated based on the current bit rate is sent to the receiving device based on the first sending data rate; the first target bit rate is used to generate new live data.
[0146] In addition, the logic instructions in the above-mentioned memory 730 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a disk or an optical disk, etc., which can store program code.
[0147] On the other hand, the present application also provides a computer program product, the computer program product including a computer program, the computer program being storable on a non-transitory computer-readable storage medium, and when the computer program is executed by a processor, the computer is capable of performing the bit rate adjustment method provided by each of the above methods, the method including: in the case of a dynamic picture, obtaining a first sending data rate sent by a receiving device; the first sending data rate is determined by the receiving device based on the amount of data received of the current dynamic picture I frame and a first receiving duration corresponding to the current dynamic picture I frame;
[0148] Determining a dynamic average data rate based on the data volume of the dynamic picture I frame and the data volume of a first preset number of dynamic picture P frames after the current dynamic picture I frame;
[0149] In a case where the dynamic average data rate is less than or equal to a second preset number of times the first sending data rate, a first target bit rate is determined based on a first cache duration; the first cache duration is a difference between a first current moment and a moment when the first current cache data is written to the cache area; the first current cache data is live data remaining when first live data generated based on the current bit rate is sent to the receiving device based on the first sending data rate; the first target bit rate is used to generate new live data.
[0150] In another aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the bit rate adjustment method provided by each of the above methods, the method comprising: in the case of a dynamic picture, obtaining a first sending data rate sent by a receiving device; the first sending data rate is determined by the receiving device based on the amount of data received of a current dynamic picture I frame and a first receiving duration corresponding to the current dynamic picture I frame;
[0151] Determining a dynamic average data rate based on the data volume of the dynamic picture I frame and the data volume of a first preset number of dynamic picture P frames after the current dynamic picture I frame;
[0152] In a case where the dynamic average data rate is less than or equal to a second preset number of times the first sending data rate, a first target bit rate is determined based on a first cache duration; the first cache duration is a difference between a first current moment and a moment when the first current cache data is written to the cache area; the first current cache data is live data remaining when first live data generated based on the current bit rate is sent to the receiving device based on the first sending data rate; the first target bit rate is used to generate new live data.
[0153] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, i.e., they may be located in one location or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.
[0154] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus the necessary general hardware platform, or of course, by hardware. Based on this understanding, the essence of the above technical solution or the part that contributes to the existing technology can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the method described in each embodiment or certain parts of the embodiment.
[0155] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in each of the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of each embodiment of the present application.
Claims
1. A bit rate adjustment method, comprising: In the case of a dynamic picture, obtaining a first sending data rate sent by the receiving end device; The first sending data rate is determined by the receiving end device based on the amount of data of the current dynamic picture I frame received and the first receiving time length corresponding to the current dynamic picture I frame; Determine a dynamic average data rate based on the data volume of the dynamic picture I frame and the data volume of a first preset number of dynamic picture P frames after the current dynamic picture I frame; In a case where the dynamic average data rate is less than or equal to the first transmission data rate of a second preset number of times, determining a first target bit rate based on a first cache duration; the first cache duration is a difference between a first current moment and a moment when the first current cache data is written into the cache area; The first current buffered data is live data remaining when first live data generated based on the current bit rate is sent to the receiving end device based on the first sending data rate; The first target bit rate is used to generate new live data.
2. The bit rate adjustment method according to claim 1, wherein: The determining the first target bit rate based on the first cache duration includes: When a first preset condition is met, increasing the current bit rate to obtain the first target bit rate; The first preset condition includes any one of the following: After the first live data of the first preset time length is generated, the first cache time length is less than a first delay threshold; After the first live data of the first preset duration is generated, the first cache duration is less than the first delay threshold, and the difference between the current moment and the moment when the bit rate was last reduced is greater than the first preset threshold; the first preset threshold is used to characterize the duration of suppressing gear oscillation switching; After the first live data of the first preset time length is generated, the first cache time length is greater than or equal to the first delay threshold, and after the second live data of the second preset time length is continuously generated, the second cache time length is less than the second delay threshold; the first delay threshold is less than the second delay threshold, and the second cache time length is the time between the second current moment and the moment when the second current cache data is written into the cache area The second current cache data is the live data remaining when the third live data is sent to the receiving end device based on the first sending data rate, and the third live data includes the second live data and the first current cache data; After generating the first live data of a first preset duration, the first cache duration is greater than or equal to the first delay threshold, and after continuing to generate the second live data of a second preset duration, the second cache duration is less than the second delay threshold, and the difference between the current moment and the last moment of reducing the bit rate is greater than the first preset threshold.
3. The bit rate adjustment method according to claim 1, wherein: The determining the first target bit rate based on the first cache duration includes: After generating the first live data of a first preset time length, when the first cache time length is greater than or equal to the first delay threshold, and after continuing to generate the second live data of a second preset time length, when the second cache time length is greater than or equal to the second delay threshold, the current bit rate is reduced to obtain the first target bit rate; the first delay threshold is less than the second delay threshold, the second cache time length is the difference between the second current moment and the moment when the second current cache data is written into the cache area, the second current cache data is the live data remaining when the third live data is sent to the receiving device based on the first sending data rate, and the third live data includes the second live data and the first current cache data.
4. The bit rate adjustment method according to claim 3, wherein: After reducing the current bit rate to obtain the first target bit rate, the method further includes: When a second preset condition is met, reducing the first target bit rate to obtain a second target bit rate; The second preset condition includes any one of the following: The third cache duration is greater than or equal to the second preset threshold; the second preset threshold is used to characterize the duration of severe network congestion, the third cache duration is the difference between the third current moment and the moment when the third current cache data is written into the cache area, and the third current cache data is the live data remaining when the second current cache data is sent to the receiving end device based on the first sending data rate; The third cache duration is less than the second preset threshold, the third cache duration is greater than or equal to After the second delay threshold is reached and the fourth live data of the third preset time length continues to be generated, the consumption speed of the remaining cached data in the cache area is less than the preset speed; the remaining cached data is the live data remaining when the fourth live data and the historical cached live data in the cache area are sent to the receiving device; the second target bit rate is used to generate new live data.
5. The bit rate adjustment method according to claim 1, wherein: The method further comprises: In the case where the dynamic average data rate is greater than the first transmission data rate which is times the second preset number, the current bit rate is reduced to obtain a third target bit rate; the third target bit rate is used to generate new live data.
6. The bit rate adjustment method according to claim 1, wherein: The method further comprises: In the case of a static picture, obtaining a second sending data rate sent by the receiving end device; the second sending data rate is determined by the receiving end device based on the amount of data of the current static picture I frame received and the second receiving time length corresponding to the current static picture I frame; Determine a static average generated data rate based on a static picture I frame data volume and a static picture P frame data volume; A fourth target bit rate is determined based on the second sending data rate and the static average generated data rate; the fourth target bit rate is used to generate new live data.
7. The bit rate adjustment method according to claim 6, wherein: The determining a fourth target code rate based on the second transmitted data rate and the static average generated data rate comprises: When the static average generated data rate is greater than the second transmission data rate, the current code rate is reduced to obtain the fourth target code rate.
8. The bit rate adjustment method according to claim 6, wherein: The method further comprises: When the static average data generation rate is less than or equal to the second sending data rate, and the static picture I frame generation data rate is greater than the second sending data rate, determining the target buffer duration based on the static picture I frame generation data rate, the static picture P frame generation data rate and the second sending data rate; The target cache duration is sent to the receiving device; the target cache duration is used to instruct the receiving device to cache the live data within the target cache duration.
9. The bit rate adjustment method according to claim 6, wherein: The method further comprises: When the third preset condition is met, increasing the current bit rate to obtain the fourth target bit rate; The third preset condition includes any one of the following: The data rate of generating the static picture I frame is less than or equal to the second sending data rate; The data rate at which the static picture I frame is generated is less than or equal to the second sending data rate, and the difference between the current moment and the moment when the bit rate was last reduced is greater than a first preset threshold.
10. The bit rate adjustment method according to any one of claims 1 to 9, wherein: The method further comprises: When the difference between the current start-up time and the last stop-up time is less than the effective duration of the historical record, the bit rate corresponding to the last stop-up time is determined as the current bit rate.
11. A bit rate adjustment device, comprising: A first acquisition unit, configured to acquire a first transmission data rate sent by a receiving end device in case of a dynamic picture; The first sending data rate is determined by the receiving end device based on the amount of data of the current dynamic picture I frame received and the first receiving time length corresponding to the current dynamic picture I frame; A first determining unit is configured to determine a dynamic average generation data rate based on a data volume of a dynamic picture I frame and a data volume of a first preset number of dynamic picture P frames after the current dynamic picture I frame; A second determination unit is configured to determine a first target bit rate based on a first cache duration when the dynamic average generated data rate is less than or equal to a second preset number of times the first transmission data rate; the first cache duration is a difference between a first current moment and a moment when the first current cache data is written into the cache area; The first current buffered data is live data remaining when first live data generated based on the current bit rate is sent to the receiving end device based on the first sending data rate; The first target bit rate is used to generate new live data.
12. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the bit rate adjustment method according to any one of claims 1 to 10 when executing the program.
13. A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the bit rate adjustment method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Video transmission control method, device and equipment and storage medium
CN110381316A
Code rate control method and device for audio and video transmission, equipment and storage medium
CN112822521A
Video coding method, electronic equipment and storage medium
CN114422783A
Method and System for Controlling Transmission Rate for Data Broadcasting Service in Wireless LAN, Access Point and Record Medium Therefor
KR1020120063158A
Signal processing method and apparatus
US20010033737A1