[go: up one dir, main page]

HK1256085B - Code rate control method and apparatus, and electronic device - Google Patents

Code rate control method and apparatus, and electronic device

Info

Publication number
HK1256085B
HK1256085B HK18115147.0A HK18115147A HK1256085B HK 1256085 B HK1256085 B HK 1256085B HK 18115147 A HK18115147 A HK 18115147A HK 1256085 B HK1256085 B HK 1256085B
Authority
HK
Hong Kong
Prior art keywords
rate
coding rate
coding
target
code rate
Prior art date
Application number
HK18115147.0A
Other languages
Chinese (zh)
Other versions
HK1256085A1 (en
Inventor
李正光
陈石平
Original Assignee
阿里巴巴集团控股有限公司
Filing date
Publication date
Application filed by 阿里巴巴集团控股有限公司 filed Critical 阿里巴巴集团控股有限公司
Priority to HK18115147.0A priority Critical patent/HK1256085B/en
Publication of HK1256085A1 publication Critical patent/HK1256085A1/en
Publication of HK1256085B publication Critical patent/HK1256085B/en

Links

Description

Code rate control method and device and electronic equipment
Technical Field
The present invention relates to the field of networks, and in particular, to a code rate control method, apparatus and electronic device.
Background
In application scenes such as network live broadcast, video chat and the like, the process of pushing audio and video data to a server can be called streaming, and a mobile terminal for streaming can be called a mobile streaming end and generally comprises an acquisition module, an encoder and a network uploading module; the acquisition module acquires the most original audio and video signals through the camera and the microphone, the encoder encodes the original audio and video signals (namely, the original audio and video signals are compressed according to a certain method), and finally the original audio and video signals are uploaded to the server through the network uploading module.
Currently, the code rate control can be performed by presetting the target coding rate of the encoder (i.e. the coding rate that the encoder is expected to achieve); the encoding rate represents the data amount generated after one second of audio and video data is encoded by an encoder, and the unit is usually bit per second (bps), kilobit per second (kbps), megabit per second (mbps) and the like; for example, the coding rate is 600kbps, which means that the original audio/video signal of each second will obtain 600kb data after coding.
In general, the actual coding rate of the encoder can be consistent with the target coding rate, but there are some exceptions in some scenarios. For example, the target coding rate of the video encoder is N1, and assuming that the difference between two frames in the captured video signal is M under normal conditions, the QP value of the video encoder is Q1, and the actual coding rate is about N1. However, for the case that the captured video is still for a long period of time, since the difference between the two frames is very small (close to 0), the amount of data obtained after encoding will be small, so that the actual encoding rate N2 of the video encoder in this case will be very small, even far smaller than N1. The video encoder may increase the actual coding rate by decreasing the Quantization Parameter (QP) value to approach the target coding rate. But since the difference between the two frames is very small, even though the QP value is reduced to be much smaller than Q2 of Q1, the actual coding rate is not increased much. If the scene shot suddenly changes when the QP value is lowered, the difference between two frames becomes M again, and since the QP value is currently Q2, the actual coding rate of the video encoder suddenly increases and may far exceed N2 and N1. And the actual coding rate is too high, so that the coded data can not be uploaded in time, and the fluency of the stream pushing is influenced.
Disclosure of Invention
The application provides a code rate control method, a code rate control device and electronic equipment, which can ensure the fluency of plug flow when the environment changes.
The technical scheme is as follows.
A method of rate control, comprising:
obtaining a quantization parameter QP threshold value corresponding to a target coding rate;
when the actual coding rate is not consistent with the target coding rate, adjusting the QP value; and if the adjusted QP value is smaller than the QP threshold value, setting the QP value as the QP threshold value.
Optionally, the obtaining of the QP threshold corresponding to the target coding rate includes:
and acquiring a QP value corresponding to the target coding rate according to the pre-established corresponding relation between the QP value and the coding rate, and taking the acquired QP value as a QP threshold value corresponding to the target coding rate.
Optionally, the code rate control method further includes:
obtaining the buffer data volume, the data uploading speed and the actual coding code rate;
and when the preset conditions are met, determining the target coding rate according to the obtained buffer data volume, the data uploading speed and the actual coding rate.
Optionally, when the predetermined condition is satisfied, determining the target coding rate according to the obtained buffer data amount, the data upload speed, and the actual coding rate includes:
when the buffer data volume is larger than a preset threshold value, if the data uploading speed is smaller than the actual coding code rate, setting the target coding code rate to be a first coding code rate smaller than the data uploading speed.
Optionally, the first coding rate is 90% of the data upload speed.
Optionally, when the predetermined condition is satisfied, determining the target coding rate according to the obtained buffer data amount, the data upload speed, and the actual coding rate includes:
when the buffer data amount is larger than a preset threshold value and the data uploading speed is larger than the actual coding code rate, setting a second coding code rate smaller than the data uploading speed;
if the second coding rate is smaller than a preset coding rate, setting a target coding rate as the second coding rate;
and if the second coding rate is greater than the preset coding rate, setting the target coding rate to be a third coding rate which is less than the second coding rate.
Optionally, the second coding rate is 90% of the data uploading speed;
the third coding rate is: the data uploading speed is 90% of the average value of the larger value of the actual coding rate and the preset coding rate.
Optionally, when the predetermined condition is satisfied, determining the target coding rate according to the obtained buffer data amount, the data upload speed, and the actual coding rate includes:
when the buffer data volume is smaller than a preset threshold value and reaches a preset time length, if the target coding code rate is not smaller than the preset coding code rate, setting the target coding code rate to be a fourth coding code rate larger than the original target coding code rate; and if the target coding rate is smaller than the preset coding rate, setting the target coding rate to be a fifth coding rate which is larger than the fourth coding rate.
Optionally, the fourth coding rate is 110% of the original target coding rate; the fifth coding rate is 120% of the original target coding rate.
A method of rate control, comprising:
obtaining the buffer data volume, the data uploading speed and the actual coding code rate;
and when the preset conditions are met, determining the target coding rate according to the obtained buffer data volume, the data uploading speed and the actual coding rate.
Optionally, when the predetermined condition is satisfied, determining the target coding rate according to the obtained buffer data amount, the data upload speed, and the actual coding rate includes:
when the buffer data volume is larger than a preset threshold value, if the data uploading speed is smaller than the actual coding code rate, setting the target coding code rate to be a first coding code rate smaller than the data uploading speed.
Optionally, the first coding rate is 90% of the data upload speed.
Optionally, when the predetermined condition is satisfied, determining the target coding rate according to the obtained buffer data amount, the data upload speed, and the actual coding rate includes:
when the buffer data amount is larger than a preset threshold value and the data uploading speed is larger than the actual coding code rate, setting a second coding code rate smaller than the data uploading speed;
if the second coding rate is smaller than a preset coding rate, setting a target coding rate as the second coding rate;
and if the second coding rate is greater than the preset coding rate, setting the target coding rate to be a third coding rate which is less than the second coding rate.
Optionally, the second coding rate is 90% of the data uploading speed;
the third coding rate is: the data uploading speed is 90% of the average value of the larger value of the actual coding rate and the preset coding rate.
Optionally, when the predetermined condition is satisfied, determining the target coding rate according to the obtained buffer data amount, the data upload speed, and the actual coding rate includes:
when the buffer data volume is smaller than a preset threshold value and reaches a preset time length, if the target coding code rate is not smaller than the preset coding code rate, setting the target coding code rate to be a fourth coding code rate larger than the original target coding code rate; and if the target coding rate is smaller than the preset coding rate, setting the target coding rate to be a fifth coding rate which is larger than the fourth coding rate.
Optionally, the fourth coding rate is 110% of the original target coding rate; the fifth coding rate is 120% of the original target coding rate.
Optionally, the code rate control method further includes:
obtaining a quantization parameter QP threshold value corresponding to a target coding rate;
when the actual coding rate is not consistent with the target coding rate, adjusting the QP value; and if the adjusted QP value is smaller than the QP threshold value, setting the QP value as the QP threshold value.
Optionally, the obtaining of the QP threshold corresponding to the target coding rate includes:
and acquiring a QP value corresponding to the target coding rate according to the pre-established corresponding relation between the QP value and the coding rate, and taking the acquired QP value as a QP threshold value corresponding to the target coding rate.
A code rate control apparatus, comprising:
the acquisition module is used for acquiring a quantization parameter QP threshold value corresponding to the target coding rate;
the quantization parameter adjusting module is used for adjusting the QP value when the actual coding code rate is not consistent with the target coding code rate; and if the adjusted QP value is smaller than the QP threshold value, setting the QP value as the QP threshold value.
Optionally, the obtaining, by the obtaining module, a QP threshold corresponding to the target coding rate includes:
the obtaining module obtains a QP value corresponding to a target coding rate according to a pre-established corresponding relationship between the QP value and the coding rate, and the obtained QP value is used as a QP threshold value corresponding to the target coding rate.
Optionally, the code rate control apparatus further includes:
the monitoring module is used for acquiring the buffer data volume, the data uploading speed and the actual coding code rate;
and the coding rate adjusting module is used for determining a target coding rate according to the obtained buffer data volume, the data uploading speed and the actual coding rate when a preset condition is met.
Optionally, when the encoding rate adjustment module meets a predetermined condition, determining a target encoding rate according to the obtained buffer data amount, the data uploading speed, and the actual encoding rate includes:
and when the buffer data amount is larger than a preset threshold value, the coding rate adjusting module sets the target coding rate to be a first coding rate smaller than the data uploading speed if the data uploading speed is smaller than the actual coding rate.
Optionally, the first coding rate is 90% of the data upload speed.
Optionally, when the encoding rate adjustment module meets a predetermined condition, determining a target encoding rate according to the obtained buffer data amount, the data uploading speed, and the actual encoding rate includes:
when the buffer data amount is larger than a preset threshold value and the data uploading speed is larger than the actual coding code rate, setting a second coding code rate smaller than the data uploading speed;
if the second coding rate is smaller than a preset coding rate, setting a target coding rate as the second coding rate;
and if the second coding rate is greater than the preset coding rate, setting the target coding rate to be a third coding rate which is less than the second coding rate.
Optionally, the second coding rate is 90% of the data uploading speed;
the third coding rate is: the data uploading speed is 90% of the average value of the larger value of the actual coding rate and the preset coding rate.
Optionally, when the encoding rate adjustment module meets a predetermined condition, determining a target encoding rate according to the obtained buffer data amount, the data uploading speed, and the actual encoding rate includes:
when the buffer data volume is smaller than a preset threshold value and reaches a preset time length, if the target coding code rate is not smaller than the preset coding code rate, setting the target coding code rate to be a fourth coding code rate larger than the original target coding code rate; and if the target coding rate is smaller than the preset coding rate, setting the target coding rate to be a fifth coding rate which is larger than the fourth coding rate.
Optionally, the fourth coding rate is 110% of the original target coding rate; the fifth coding rate is 120% of the original target coding rate.
A code rate control apparatus, comprising:
the monitoring module is used for acquiring the buffer data volume, the data uploading speed and the actual coding code rate;
and the coding rate adjusting module is used for determining a target coding rate according to the obtained buffer data volume, the data uploading speed and the actual coding rate when a preset condition is met.
Optionally, when the encoding rate adjustment module meets a predetermined condition, determining a target encoding rate according to the obtained buffer data amount, the data uploading speed, and the actual encoding rate includes:
when the buffer data volume is larger than a preset threshold value, if the data uploading speed is smaller than the actual coding code rate, setting the target coding code rate to be a first coding code rate smaller than the data uploading speed.
Optionally, the first coding rate is 90% of the data upload speed.
Optionally, when the encoding rate adjustment module meets a predetermined condition, determining a target encoding rate according to the obtained buffer data amount, the data uploading speed, and the actual encoding rate includes:
when the buffer data amount is larger than a preset threshold value and the data uploading speed is larger than the actual coding code rate, setting a second coding code rate smaller than the data uploading speed;
if the second coding rate is smaller than a preset coding rate, setting a target coding rate as the second coding rate;
and if the second coding rate is greater than the preset coding rate, setting the target coding rate to be a third coding rate which is less than the second coding rate.
Optionally, the second coding rate is 90% of the data uploading speed;
the third coding rate is: the data uploading speed is 90% of the average value of the larger value of the actual coding rate and the preset coding rate.
Optionally, when the encoding rate adjustment module meets a predetermined condition, determining a target encoding rate according to the obtained buffer data amount, the data uploading speed, and the actual encoding rate includes:
when the buffer data volume is smaller than a preset threshold value and reaches a preset time length, if the target coding code rate is not smaller than the preset coding code rate, setting the target coding code rate to be a fourth coding code rate larger than the original target coding code rate; and if the target coding rate is smaller than the preset coding rate, setting the target coding rate to be a fifth coding rate which is larger than the fourth coding rate.
Optionally, the fourth coding rate is 110% of the original target coding rate; the fifth coding rate is 120% of the original target coding rate.
Optionally, the code rate control apparatus further includes:
the acquisition module is used for acquiring a quantization parameter QP threshold value corresponding to the target coding rate;
the quantization parameter adjusting module is used for adjusting the QP value when the actual coding code rate is not consistent with the target coding code rate; and if the adjusted QP value is smaller than the QP threshold value, setting the QP value as the QP threshold value.
Optionally, the obtaining, by the obtaining module, a QP threshold corresponding to the target coding rate includes:
the obtaining module obtains a QP value corresponding to a target coding rate according to a pre-established corresponding relationship between the QP value and the coding rate, and the obtained QP value is used as a QP threshold value corresponding to the target coding rate.
An electronic device for rate control, comprising:
a first memory and a first processor;
the first memory is used for storing a program for controlling the code rate; the program for rate control, when read executed by the first processor, performs the following operations:
obtaining a quantization parameter QP threshold value corresponding to a target coding rate;
when the actual coding rate is not consistent with the target coding rate, adjusting the QP value; and if the adjusted QP value is smaller than the QP threshold value, setting the QP value as the QP threshold value.
An electronic device for rate control, comprising:
a second memory and a second processor;
the second memory is used for storing a program for controlling the code rate; the program for rate control, when read executed by the second processor, performs the following operations:
obtaining the buffer data volume, the data uploading speed and the actual coding code rate;
and when the preset conditions are met, determining the target coding rate according to the obtained buffer data volume, the data uploading speed and the actual coding rate.
The application includes the following advantages:
according to at least one embodiment of the application, the QP value can be ensured not to be adjusted too small through the QP threshold value, so that the influence on the fluency of the plug flow caused by the fact that the actual coding code rate is too large when the picture is converted from static to active is avoided.
In at least one embodiment of the application, the target coding rate is adjusted according to the buffer data volume, the data uploading speed and the actual coding rate, so that the target coding rate can be correspondingly changed along with the change of the network bandwidth under the condition of network jitter, thereby realizing the dynamic control of the coding rate and ensuring the smoothness of the plug flow.
Of course, it is not necessary for any product to achieve all of the above-described advantages at the same time for the practice of the present application.
Drawings
FIG. 1 is a flowchart of a method for rate control according to a first embodiment;
FIG. 2 is a flowchart of a code rate control method according to a second embodiment;
FIG. 3 is a diagram of a code rate control apparatus according to a first embodiment;
fig. 4 is a schematic diagram of a code rate control apparatus according to a second embodiment.
Detailed Description
The technical solutions of the present application will be described in more detail below with reference to the accompanying drawings and embodiments.
It should be noted that, if not conflicted, the embodiments and the features of the embodiments can be combined with each other and are within the scope of protection of the present application. Additionally, while a logical order is shown in the flow diagrams, in some cases, the steps shown or described may be performed in an order different than here.
In one configuration, a computing device performing rate control may include one or more processors (CPUs), input/output interfaces, network interfaces, and memory (memory).
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium. The memory may include module 1, module 2, … ….
Computer-readable media include both non-transitory and non-transitory, removable and non-removable storage media that can implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include non-transitory computer readable media (transient media), such as modulated data signals and carrier waves.
An embodiment of a method for controlling a code rate, as shown in fig. 1, includes steps S110 to S120:
s110, obtaining a QP threshold value corresponding to the target coding rate;
s120, when the actual coding code rate is not consistent with the target coding code rate, adjusting the QP value; and if the adjusted QP value is smaller than the QP threshold value, setting the QP value as the QP threshold value.
In this embodiment, the inconsistency between the actual coding rate and the target coding rate may be: the actual coding rate is different from the target coding rate, or the absolute value of the difference between the actual coding rate and the target coding rate is greater than a preset threshold. When the actual coding rate is adjusted by adjusting the QP value, the higher the QP value is, the higher the compression rate is, and the smaller the actual coding rate is; the smaller the QP value, the lower the compression rate and the larger the actual encoding rate. In this embodiment, the QP threshold value can ensure that the QP value is not adjusted too small, thereby avoiding that the actual coding rate is too large to affect the fluency of the stream pushing.
Since the audio coding rate is small and basically fixed, the object of rate control is generally referred to as video coding. The target coding rate, the actual coding rate and the like in the embodiment can be specially referred to the coding rate of the video; accordingly, the encoder may refer exclusively to a video encoder; when the code rate control is required for the audio, the target coding rate and the actual coding rate may also refer to the coding rate for the audio.
In this embodiment, step S110 may be performed not only before the QP value is adjusted, but also after the QP value is adjusted.
The method of the present embodiment may be, but is not limited to, applied to moving a push stream end; steps S110 to S120 may be executed by the encoder, or may be executed by another part capable of setting parameters of the encoder in the mobile stream side.
In one implementation, the obtaining the QP threshold corresponding to the target coding rate may include:
and acquiring a QP value corresponding to the target coding rate according to the pre-established corresponding relation between the QP value and the coding rate, and taking the acquired QP value as a QP threshold value corresponding to the target coding rate.
In this implementation, the correspondence between the QP value and the coding rate can be obtained through experiments, for example, the actual coding rate corresponding to each QP value can be obtained in a normal acquisition scene (a scene in which special conditions such as long-time still of a picture do not occur), so as to obtain the correspondence between the coding rate and the QP value; the target coding rate is the coding rate expected to be achieved, and the corresponding QP value can be found in the corresponding relationship through the target coding rate, and the QP value is used as the QP threshold.
For example, if the actual coding rate is y when the QP value is x, the QP threshold value is x when the target coding rate is y.
The actual coding rate corresponding to each QP value can be obtained through results of multiple experiments, for example, the actual coding rates when the QP value is x are respectively obtained in n normal acquisition scenes, for example, the obtained actual coding rates are y1, y2, … … and yn, respectively, and the average value of y1, y2, … … and yn can be taken as the corresponding coding rate y when the QP value is x.
In this implementation, the correspondence between the QP value and the coding rate may be expressed in a form of, but not limited to, a relational curve, a table, or the like.
In other implementation manners, the corresponding relationship between the target coding rate and the QP threshold may also be determined through experiments, and when the QP threshold corresponding to the target coding rate is obtained, the QP threshold corresponding to the target coding rate may be directly queried according to the corresponding relationship.
In one implementation, the method may further include:
s130, obtaining the buffer data volume, the data uploading speed and the actual coding code rate;
and S140, when the preset conditions are met, adjusting the target coding rate according to the obtained buffer data volume, the data uploading speed and the actual coding rate.
Steps S130, S140 and S110, S120 in this implementation do not have a necessary front-to-back order; if the target coding rate is adjusted by performing the steps S130 and S140 first, the target coding rate in the steps S110 and S120 is the adjusted target coding rate; if the target coding rate is not adjusted, the target coding rate in steps S110 and S120 is the original target coding rate.
Generally, there are two criteria for determining the quality of the plug flow technique: (1) whether the uploaded video can be smoothly played (assuming that the network condition of the playing end is very good, and the video is blocked and unrelated to the playing end); (2) the video is clearer under the same network condition. Where fluency of the video is more important than sharpness.
Generally uploading the push flow through a wireless network, wherein the wireless network comprises wifi, 4G, 3G and the like; wireless networks are characterized by limited bandwidth and jitter, i.e.: the network bandwidth will be suddenly high and suddenly low. When the network bandwidth is high, the data uploading speed is high; on the contrary, when the network bandwidth is low, the data uploading speed becomes slow.
If the uploaded video is to be kept smooth, the actual coding rate is lower than the data uploading speed, wherein the data uploading speed is limited by the network bandwidth and is the maximum data volume which can be uploaded through the network in unit time, and the unit comprises bps, kbps, mbps and the like. However, on the basis of meeting the fluency, the definition needs to be ensured, and the definition of the video is directly related to the actual coding rate of the video, so that the higher the actual coding rate is, the higher the definition of the video is; the lower the actual coding rate, the lower the definition; therefore, the actual coding rate cannot be much lower than the data upload speed.
In this implementation, the buffer data size refers to the size of the data to be uploaded after being encoded in the buffer area; for example, a video buffer is provided between the video encoder and the network upload module. The encoded video data is stored in the buffer area, the network uploading module directly reads the encoded video data from the buffer area, and the change of the data volume in the buffer area can reflect the change of the network bandwidth. When the data in the buffer area increases, it indicates that the network condition becomes worse, and the data uploading speed is lower than the actual coding rate, and at this time, the actual coding rate (i.e. the data generating speed) should be reduced; on the contrary, if the data in the buffer area is reduced, the data uploading speed is higher than the actual coding rate, and then the actual coding rate can be increased. In another case, the buffered data amount is 0 for a long time, which indicates that the encoded data can be uploaded in time, that is, the data uploading speed is greater than or equal to the actual encoding code rate, and at this time, the actual encoding code rate can also be increased. Since the actual coding rate of the encoder needs to be obtained after encoding, the actual coding rate needs to be adjusted by setting the target coding rate of the encoder.
In this implementation, the predetermined condition being satisfied may be, but is not limited to, that one or more of the buffered data amount, the data uploading speed, and the actual encoding rate are matched with a predetermined condition, for example, greater than, less than, or equal to a certain value, and for example, a size relationship between the buffered data amount, the data uploading speed, and the actual encoding rate conforms to the predetermined condition. The preset condition is generally a condition that the actual coding rate is not suitable for the current network bandwidth, for example, the actual coding rate is higher than the data uploading speed which can be provided by the current network bandwidth, and for example, the actual coding rate is lower than the data uploading speed which can be provided by the current network bandwidth, and the like. In other implementation manners, the predetermined condition may also include receiving an adjustment instruction, reaching an adjustment period, and the like, and the predetermined condition may also be set by itself as needed.
In the implementation mode, the target coding rate is adjusted according to the buffer data volume, the data uploading speed and the actual coding rate, so that the target coding rate can be correspondingly changed along with the change of the network bandwidth, and the dynamic control of the code rate is realized.
In the implementation mode, the buffer data volume, the data uploading speed and the actual coding rate can be monitored in real time, and once the preset conditions are met, the target coding rate is adjusted; the buffer data volume, the data uploading speed and the actual coding rate can be obtained periodically or according to the instruction, whether the preset conditions are met or not is judged, and once the preset conditions are met, the target coding rate is adjusted.
In this implementation, when the predetermined condition is satisfied, determining the target coding rate according to the obtained buffer data amount, the data uploading speed, and the actual coding rate may include:
when the buffer data volume is larger than a preset threshold value, if the data uploading speed is smaller than the actual coding code rate, setting the target coding code rate to be a first coding code rate smaller than the data uploading speed.
Wherein the first encoding rate may be, but is not limited to, 90% of the data uploading speed. In other implementations, the first coding rate may also be the data uploading speed multiplied by n 1%; n1 can be set to, but is not limited to, about 90, such as but not limited to, any value from 85 to 95.
In this implementation, when the predetermined condition is satisfied, determining the target coding rate according to the obtained buffer data amount, the data uploading speed, and the actual coding rate may include:
when the buffer data amount is larger than a preset threshold value and the data uploading speed is larger than the actual coding code rate, setting a second coding code rate smaller than the data uploading speed;
if the second coding rate is smaller than a preset coding rate, setting a target coding rate as the second coding rate;
and if the second coding rate is greater than the preset coding rate, setting the target coding rate to be a third coding rate which is less than the second coding rate.
The preset coding rate may be an actual coding rate adopted when the definition of the video reaches a certain standard.
Wherein the second coding rate may be, but is not limited to, 90% of the data uploading speed. In other implementations, the second coding rate may also be the data uploading speed multiplied by n 2%; n2 can be set to, but is not limited to, about 90, such as but not limited to, any value from 85 to 95.
Wherein the third coding rate may be, but is not limited to: the data uploading speed is 90% of the average value of the larger value of the actual coding code rate and the preset coding code rate; namely:
90% × [ data upload speed + Max (actual coding rate, preset coding rate) ]/2.
In other implementation manners, the third encoding rate may also be an average value of the data uploading speed and a larger value of the actual encoding rate and the preset encoding rate multiplied by n 3%; n3 can be set to, but is not limited to, about 90, such as but not limited to, any value from 85 to 95. In this implementation, when the predetermined condition is satisfied, determining the target coding rate according to the obtained buffer data amount, the data uploading speed, and the actual coding rate may include:
when the buffer data volume is smaller than a preset threshold value and reaches a preset time length, if the target coding code rate is not smaller than the preset coding code rate, setting the target coding code rate to be a fourth coding code rate larger than the original target coding code rate; and if the target coding rate is smaller than the preset coding rate, setting the target coding rate to be a fifth coding rate which is larger than the fourth coding rate.
Wherein, the fourth coding rate may be, but is not limited to, 110% of the original target coding rate; in other implementations, the fourth encoding rate may also be n 4% multiplied by the data uploading speed; n4 can be set to, but is not limited to, around 110, such as, but not limited to, any value from 105 to 115.
Wherein, the fifth coding rate may be, but is not limited to, 120% of the original target coding rate; in other implementations, the fifth coding rate may also be n 5% multiplied by the data uploading speed; n5 can be set to around 120, such as but not limited to any value from 115 to 125.
The present embodiment is described below with an example, which may be applied to a scene such as live webcasting or video chat, where a user performing live webcasting or video chat completes a stream pushing process through a mobile phone, a tablet computer, a notebook computer, or other devices, for example, completes acquisition of a video signal and an audio signal through a camera and a microphone on the devices, respectively, encodes the audio and video signals through audio and video encoders in the devices, and uploads encoded data through a wireless network card in the devices.
In this example, in the device used by the user for stream pushing, the video encoder or other components capable of monitoring and adjusting parameters of the video encoder perform the method of this embodiment to perform rate control on the video encoder. In the equipment used for pushing stream by a user, a relation curve of a QP value and an encoding code rate is preserved in advance; the relation curve can be established by recording the actual coding code rate corresponding to the QP value under the normal shooting scene.
In this example, the flow of performing rate control on the video encoder includes steps 201 to 202:
201. and acquiring the buffering data volume buffering name, the video data uploading speed uploadBitrate and the actual coding code rate EncodingBitrate of the video coder in a video buffer area in real time.
202. Adjusting the target coding rate TargetBitrate of the video coder according to BufferingFrames, Uplodbtrate and EncodingBitrate; after the target coding rate is adjusted, a QP value corresponding to the targetbit is obtained according to the relation curve and is used as a QP threshold value MinQP; the QP value corresponding to the target coding rate may be obtained again when the QP is adjusted to serve as the QP threshold. If the QP is adjusted during the encoding process of the video encoder, and the adjusted QP value is smaller than MinQP, let QP be MinQP.
The manner of adjusting targetwitrate is as follows:
c1, if BufferingFrames is larger than the preset threshold BufferingThreshold and uploadBitrate is smaller than EncodingBitrate, setting TargetBitrate to 90% of uploadBitrate.
C2, if Buffering Frames is greater than Buffering threshold and Uplodbatte is greater than EncodingBitrate, it can be handled in two cases:
the TargetBitrate is set to UploadBitrate × 90%. If the TargetBITRate is smaller than the preset coding rate OptimBirate, the value of the TargetBITRate is unchanged and still is uploadBirate multiplied by 90%; if the TargetBitrate is greater than the optimberte, the TargetBitrate is (UploadBitrate + Max (EncodingBitrate))/2 × 90%.
When the TargetBitrate is equal to the optimbyte, it may be UploadBitrate × 90%, or may be TargetBitrate ═ (UploadBitrate + Max (EncodingBitrate, optimbtrate))/2 × 90%.
Wherein, OptimBitrate is EncodingBitrate when the definition of the video reaches a standard basically satisfying people.
C3, if Buffering Frames is less than Buffering threshold and can keep the predetermined time length, also divided into two cases to process:
if the current TargetBattrate is less than OptimBirate, setting the new TargetBattrate to be 120% of the original TargetBattrate; otherwise, the new targetwitrate is set to be 110% of the original targetwitrate.
When the targetwitrate is equal to optimbirate, it may be set to 120% or 110% of the original targetwitrate.
The Buffering Frames being equal to Buffering threshold can be treated as if Buffering Frames is less than Buffering threshold, or it can be treated as if Buffering Frames is greater than Buffering threshold.
In this example, TargetBitrate and MinQP are both used as parameters to be transmitted to the encoder, so as to ensure that the bitrate of the encoder does not increase dramatically when the push-stream picture suddenly changes from long-term still to motion, and in the case of network jitter, the video definition can be improved while ensuring the video smoothness.
The second embodiment is a code rate control method, as shown in fig. 2, including steps S210 to S220:
s210, obtaining a buffer data volume, a data uploading speed and an actual coding code rate;
and S220, when the preset conditions are met, determining a target coding rate according to the obtained buffer data volume, the data uploading speed and the actual coding rate.
For implementation details of this embodiment, reference may be made to specific implementation details of steps S130 and S140 in an implementation manner of the first embodiment.
In one implementation, when the predetermined condition is satisfied, determining the target coding rate according to the obtained buffer data amount, the data uploading speed, and the actual coding rate may include:
when the buffer data volume is larger than a preset threshold value, if the data uploading speed is smaller than the actual coding code rate, setting the target coding code rate to be a first coding code rate smaller than the data uploading speed.
Wherein the first encoding rate may be, but is not limited to, 90% of the data uploading speed.
In one implementation, when the predetermined condition is satisfied, determining the target coding rate according to the obtained buffer data amount, the data uploading speed, and the actual coding rate may include:
when the buffer data amount is larger than a preset threshold value and the data uploading speed is larger than the actual coding code rate, setting a second coding code rate smaller than the data uploading speed;
if the second coding rate is smaller than a preset coding rate, setting a target coding rate as the second coding rate;
and if the second coding rate is greater than the preset coding rate, setting the target coding rate to be a third coding rate which is less than the second coding rate.
Wherein the second coding rate may be, but is not limited to, 90% of the data uploading speed.
Wherein the third coding rate may be, but is not limited to: the data uploading speed is 90% of the average value of the larger value of the actual coding rate and the preset coding rate.
In one implementation, when the predetermined condition is satisfied, determining the target coding rate according to the obtained buffer data amount, the data uploading speed, and the actual coding rate may include:
when the buffer data volume is smaller than a preset threshold value and reaches a preset time length, if the target coding code rate is not smaller than the preset coding code rate, setting the target coding code rate to be a fourth coding code rate larger than the original target coding code rate; and if the target coding rate is smaller than the preset coding rate, setting the target coding rate to be a fifth coding rate which is larger than the fourth coding rate.
The fourth coding rate may be, but is not limited to, 110% of the original target coding rate.
The fifth coding rate may be, but is not limited to, 120% of the original target coding rate.
In one implementation, the code rate control method may further include:
s230, obtaining a QP threshold value corresponding to the target coding rate;
s240, when the actual coding code rate is not consistent with the target coding code rate, adjusting the QP value; and if the adjusted QP value is smaller than the QP threshold value, setting the QP value as the QP threshold value.
There is no inevitable front-back order between steps S230, S240 and steps S210, S220; if the target coding rate is adjusted through steps S210 and S220, the target coding rate in steps S230 and S240 refers to the adjusted target coding rate; if steps S230 and S240 are performed first, the target coding rate in steps S230 and S240 refers to the target coding rate that is not adjusted in step S240.
In this implementation, the obtaining of the QP threshold corresponding to the target coding rate may include:
and acquiring a QP value corresponding to the target coding rate according to the pre-established corresponding relation between the QP value and the coding rate, and taking the acquired QP value as a QP threshold value corresponding to the target coding rate.
In this implementation manner, other implementation details of steps S230 and S240 can be referred to implementation details of steps S110 and S120 in embodiment one.
A third embodiment of a code rate control apparatus, as shown in fig. 3, includes:
an obtaining module 31, configured to obtain a QP threshold corresponding to a target coding rate;
a quantization parameter adjusting module 32, configured to adjust a QP value when the actual coding rate is not consistent with the target coding rate; and if the adjusted QP value is smaller than the QP threshold value, setting the QP value as the QP threshold value.
In this embodiment, the obtaining module 31 is a part of the rate control device responsible for obtaining the QP threshold, and may be software, hardware, or a combination of the software and the hardware.
In this embodiment, the quantization parameter adjusting module 32 is a part of the rate control device responsible for adjusting the QP value, and may be software, hardware, or a combination of the software and the hardware.
In one implementation, the obtaining, by the obtaining module, a QP threshold corresponding to a target coding rate may include:
the obtaining module obtains a QP value corresponding to a target coding rate according to a pre-established corresponding relationship between the QP value and the coding rate, and the obtained QP value is used as a QP threshold value corresponding to the target coding rate.
In one implementation, the apparatus for controlling a code rate may further include:
the monitoring module is used for acquiring the buffer data volume, the data uploading speed and the actual coding code rate;
and the coding rate adjusting module is used for determining a target coding rate according to the obtained buffer data volume, the data uploading speed and the actual coding rate when a preset condition is met.
In this embodiment, the monitoring module is a part of the code rate control device responsible for acquiring corresponding information, and may be software, hardware, or a combination of the two.
In this embodiment, the code rate adjusting module is a part of the code rate control device responsible for adjusting the target code rate, and may be software, hardware, or a combination of the two.
In this implementation, the operations of the monitoring module and the coding rate adjustment module correspond to steps S130 and S140 in one implementation of the first embodiment, respectively, and other implementation details of the operations of these two modules can be referred to the above implementation of the first embodiment.
In this implementation, when the encoding rate adjustment module meets the predetermined condition, determining the target encoding rate according to the obtained buffer data amount, the data uploading speed, and the actual encoding rate may include:
and when the buffer data amount is larger than a preset threshold value, the coding rate adjusting module sets the target coding rate to be a first coding rate smaller than the data uploading speed if the data uploading speed is smaller than the actual coding rate.
Wherein the first encoding rate may be, but is not limited to, 90% of the data uploading speed.
In this implementation, when the encoding rate adjustment module meets the predetermined condition, determining the target encoding rate according to the obtained buffer data amount, the data uploading speed, and the actual encoding rate may include:
when the buffer data amount is larger than a preset threshold value and the data uploading speed is larger than the actual coding code rate, setting a second coding code rate smaller than the data uploading speed;
if the second coding rate is smaller than a preset coding rate, setting a target coding rate as the second coding rate;
and if the second coding rate is greater than the preset coding rate, setting the target coding rate to be a third coding rate which is less than the second coding rate.
Wherein the second coding rate may be, but is not limited to, 90% of the data uploading speed.
Wherein the third coding rate may be, but is not limited to: the data uploading speed is 90% of the average value of the larger value of the actual coding rate and the preset coding rate.
In this implementation, when the encoding rate adjustment module meets the predetermined condition, determining the target encoding rate according to the obtained buffer data amount, the data uploading speed, and the actual encoding rate may include:
when the buffer data volume is smaller than a preset threshold value and reaches a preset time length, if the target coding code rate is not smaller than the preset coding code rate, setting the target coding code rate to be a fourth coding code rate larger than the original target coding code rate; and if the target coding rate is smaller than the preset coding rate, setting the target coding rate to be a fifth coding rate which is larger than the fourth coding rate.
The fourth coding rate may be, but is not limited to, 110% of the original target coding rate.
The fifth coding rate may be, but is not limited to, 120% of the original target coding rate.
The operations of the obtaining module and the quantization parameter adjusting module of the rate control apparatus in this embodiment may respectively correspond to steps S110 to S120 in the first embodiment, and other implementation details of the operations of these two modules may be referred to in the first embodiment.
Fourth embodiment, a code rate control apparatus, as shown in fig. 4, includes:
the monitoring module 41 is configured to obtain a buffer data amount, a data uploading speed, and an actual encoding code rate;
and the coding rate adjusting module 42 is configured to determine a target coding rate according to the obtained buffer data amount, the data uploading speed, and the actual coding rate when a predetermined condition is satisfied.
In this embodiment, the monitoring module 41 is a part of the rate control device responsible for acquiring corresponding information, and may be software, hardware, or a combination of the two.
In this embodiment, the encoding rate adjusting module 42 is a part of the rate control device responsible for adjusting the target encoding rate, and may be software, hardware, or a combination of the two.
In one implementation, when the predetermined condition is satisfied, the determining, by the coding rate adjustment module, the target coding rate according to the obtained buffer data amount, the data uploading speed, and the actual coding rate may include:
when the buffer data volume is larger than a preset threshold value, if the data uploading speed is smaller than the actual coding code rate, setting the target coding code rate to be a first coding code rate smaller than the data uploading speed.
In this implementation, the first coding rate may be, but is not limited to, 90% of the data uploading speed.
In one implementation, when the predetermined condition is satisfied, the determining, by the coding rate adjustment module, the target coding rate according to the obtained buffer data amount, the data uploading speed, and the actual coding rate may include:
when the buffer data amount is larger than a preset threshold value and the data uploading speed is larger than the actual coding code rate, setting a second coding code rate smaller than the data uploading speed;
if the second coding rate is smaller than a preset coding rate, setting a target coding rate as the second coding rate;
and if the second coding rate is greater than the preset coding rate, setting the target coding rate to be a third coding rate which is less than the second coding rate.
In this implementation, the second coding rate may be, but is not limited to, 90% of the data uploading speed.
In this implementation, the third coding rate may be, but is not limited to: the data uploading speed is 90% of the average value of the larger value of the actual coding rate and the preset coding rate.
In one implementation, when the predetermined condition is satisfied, the determining, by the coding rate adjustment module, the target coding rate according to the obtained buffer data amount, the data uploading speed, and the actual coding rate may include:
when the buffer data volume is smaller than a preset threshold value and reaches a preset time length, if the target coding code rate is not smaller than the preset coding code rate, setting the target coding code rate to be a fourth coding code rate larger than the original target coding code rate; and if the target coding rate is smaller than the preset coding rate, setting the target coding rate to be a fifth coding rate which is larger than the fourth coding rate.
In this implementation, the fourth coding rate may be, but is not limited to, 110% of the original target coding rate.
In this implementation, the fifth coding rate may be, but is not limited to, 120% of the original target coding rate.
In one implementation, the apparatus for controlling a code rate may further include:
the acquisition module is used for acquiring a quantization parameter QP threshold value corresponding to the target coding rate;
the quantization parameter adjusting module is used for adjusting the QP value when the actual coding code rate is not consistent with the target coding code rate; and if the adjusted QP value is smaller than the QP threshold value, setting the QP value as the QP threshold value.
In this implementation manner, the obtaining module is a part of the rate control device responsible for obtaining the QP threshold, and may be software, hardware, or a combination of the software and the hardware.
In this implementation, the quantization parameter adjustment module is a part of the rate control device that is responsible for adjusting the QP value, and may be software, hardware, or a combination of the software and the hardware.
In this implementation, the operations of the obtaining module and the quantization parameter adjusting module correspond to steps S230 and S240 in one implementation of the second embodiment, respectively, and other implementation details of the operations of these two modules can be referred to the above implementation of the second embodiment.
In this implementation, the obtaining, by the obtaining module, the QP threshold corresponding to the target coding rate may include:
the obtaining module obtains a QP value corresponding to a target coding rate according to a pre-established corresponding relationship between the QP value and the coding rate, and the obtained QP value is used as a QP threshold value corresponding to the target coding rate.
The operations of the monitoring module and the coding rate adjustment module of the rate control apparatus in this embodiment correspond to steps S210 to S220 in the second embodiment, respectively, and other implementation details of the operations of these two modules can be seen in the second embodiment.
In a fifth embodiment, an electronic device for rate control includes:
a first memory and a first processor;
the first memory is used for storing a program for controlling the code rate; the program for rate control, when read executed by the first processor, performs the following operations:
obtaining a quantization parameter QP threshold value corresponding to a target coding rate;
when the actual coding rate is not consistent with the target coding rate, adjusting the QP value; and if the adjusted QP value is smaller than the QP threshold value, setting the QP value as the QP threshold value.
In this embodiment, when the program for performing rate control is read and executed by the first processor, the operations performed correspond to steps S110 to S120 in the first embodiment; for further details of the operations performed by the program, reference may be made to embodiment one.
An electronic device for rate control according to a sixth embodiment includes:
a second memory and a second processor;
the second memory is used for storing a program for controlling the code rate; the program for rate control, when read executed by the second processor, performs the following operations:
obtaining the buffer data volume, the data uploading speed and the actual coding code rate;
and when the preset conditions are met, determining the target coding rate according to the obtained buffer data volume, the data uploading speed and the actual coding rate.
In this embodiment, when the program for performing rate control is read and executed by the second processor, the operations performed correspond to steps S210 to S220 in the second embodiment; further details of the operations performed by the program can be found in example two.
In the case of using both the electronic device of the fifth embodiment and the electronic device of the sixth embodiment, it is possible to multiplex hardware with the two electronic devices, for example, the first memory and the second memory may multiplex the same memory, and the first processor and the second processor may multiplex the same processor.
It will be understood by those skilled in the art that all or part of the steps of the above methods may be implemented by instructing the relevant hardware through a program, and the program may be stored in a computer readable storage medium, such as a read-only memory, a magnetic or optical disk, and the like. Alternatively, all or part of the steps of the above embodiments may be implemented using one or more integrated circuits. Accordingly, each module/unit in the above embodiments may be implemented in the form of hardware, and may also be implemented in the form of a software functional module. The present application is not limited to any specific form of hardware or software combination.
There are, of course, many other embodiments of the invention that can be devised without departing from the spirit and scope thereof, and it will be apparent to those skilled in the art that various changes and modifications can be made herein without departing from the spirit and scope of the invention.

Claims (28)

1. A method of rate control, comprising:
obtaining a quantization parameter QP threshold value corresponding to a target coding rate;
when the actual coding rate is not consistent with the target coding rate, adjusting the QP value; if the adjusted QP value is smaller than the QP threshold value, setting the QP value as the QP threshold value;
obtaining the buffer data volume, the data uploading speed and the actual coding code rate;
when the preset conditions are met, determining a target coding rate according to the obtained buffer data volume, the data uploading speed and the actual coding rate, wherein the target coding rate comprises the following steps:
when the buffer data volume is larger than a preset threshold value, if the data uploading speed is smaller than the actual coding code rate, setting the target coding code rate to be a first coding code rate smaller than the data uploading speed;
when the buffer data amount is larger than a preset threshold value and the data uploading speed is larger than the actual coding code rate, setting a second coding code rate smaller than the data uploading speed;
if the second coding rate is smaller than a preset coding rate, setting a target coding rate as the second coding rate;
and if the second coding rate is greater than the preset coding rate, setting the target coding rate to be a third coding rate which is less than the second coding rate.
2. The code rate control method of claim 1, wherein the obtaining the QP threshold corresponding to the target coding rate comprises:
and acquiring a QP value corresponding to the target coding rate according to the pre-established corresponding relation between the QP value and the coding rate, and taking the acquired QP value as a QP threshold value corresponding to the target coding rate.
3. The code rate control method of claim 1, wherein:
the first encoding rate is 90% of the data upload speed.
4. The code rate control method of claim 1, wherein:
the second encoding rate is 90% of the data upload speed;
the third coding rate is: the data uploading speed is 90% of the average value of the larger value of the actual coding rate and the preset coding rate.
5. The code rate control method of claim 1, wherein when the predetermined condition is satisfied, the determining the target coding rate according to the obtained buffer data amount, the data uploading speed, and the actual coding rate comprises:
when the buffer data volume is smaller than a preset threshold value and reaches a preset time length, if the target coding code rate is not smaller than the preset coding code rate, setting the target coding code rate to be a fourth coding code rate larger than the original target coding code rate; and if the target coding rate is smaller than the preset coding rate, setting the target coding rate to be a fifth coding rate which is larger than the fourth coding rate.
6. The code rate control method of claim 5, wherein:
the fourth coding rate is 110% of the original target coding rate; the fifth coding rate is 120% of the original target coding rate.
7. A method of rate control, comprising:
obtaining the buffer data volume, the data uploading speed and the actual coding code rate;
when the preset conditions are met, determining a target coding rate according to the obtained buffer data volume, the data uploading speed and the actual coding rate, wherein the target coding rate comprises the following steps:
when the buffer data volume is larger than a preset threshold value, if the data uploading speed is smaller than the actual coding code rate, setting the target coding code rate to be a first coding code rate smaller than the data uploading speed;
when the buffer data amount is larger than a preset threshold value and the data uploading speed is larger than the actual coding code rate, setting a second coding code rate smaller than the data uploading speed;
if the second coding rate is smaller than a preset coding rate, setting a target coding rate as the second coding rate;
and if the second coding rate is greater than the preset coding rate, setting the target coding rate to be a third coding rate which is less than the second coding rate.
8. The code rate control method of claim 7, wherein:
the first encoding rate is 90% of the data upload speed.
9. The code rate control method of claim 7, wherein:
the second encoding rate is 90% of the data upload speed;
the third coding rate is: the data uploading speed is 90% of the average value of the larger value of the actual coding rate and the preset coding rate.
10. The code rate control method of claim 7, wherein when the predetermined condition is satisfied, the determining the target coding rate according to the obtained buffer data amount, the data uploading speed, and the actual coding rate comprises:
when the buffer data volume is smaller than a preset threshold value and reaches a preset time length, if the target coding code rate is not smaller than the preset coding code rate, setting the target coding code rate to be a fourth coding code rate larger than the original target coding code rate; and if the target coding rate is smaller than the preset coding rate, setting the target coding rate to be a fifth coding rate which is larger than the fourth coding rate.
11. The code rate control method of claim 10, wherein:
the fourth coding rate is 110% of the original target coding rate; the fifth coding rate is 120% of the original target coding rate.
12. The code rate control method of any of claims 7 to 11, further comprising:
obtaining a quantization parameter QP threshold value corresponding to a target coding rate;
when the actual coding rate is not consistent with the target coding rate, adjusting the QP value; and if the adjusted QP value is smaller than the QP threshold value, setting the QP value as the QP threshold value.
13. The code rate control method of claim 12, wherein the obtaining the QP threshold corresponding to the target coding rate comprises:
and acquiring a QP value corresponding to the target coding rate according to the pre-established corresponding relation between the QP value and the coding rate, and taking the acquired QP value as a QP threshold value corresponding to the target coding rate.
14. An apparatus for controlling a code rate, comprising:
the acquisition module is used for acquiring a quantization parameter QP threshold value corresponding to the target coding rate;
the quantization parameter adjusting module is used for adjusting the QP value when the actual coding code rate is not consistent with the target coding code rate; if the adjusted QP value is smaller than the QP threshold value, setting the QP value as the QP threshold value;
the monitoring module is used for acquiring the buffer data volume, the data uploading speed and the actual coding code rate;
the encoding code rate adjusting module is used for determining a target encoding code rate according to the obtained buffer data volume, the data uploading speed and the actual encoding code rate when a preset condition is met, and comprises the following steps:
when the amount of the buffered data is larger than a preset threshold value, if the data uploading speed is smaller than the actual coding rate, the coding rate adjusting module sets the target coding rate to be a first coding rate smaller than the data uploading speed;
when the buffer data amount is larger than a preset threshold value and the data uploading speed is larger than the actual coding code rate, setting a second coding code rate smaller than the data uploading speed;
if the second coding rate is smaller than a preset coding rate, setting a target coding rate as the second coding rate;
and if the second coding rate is greater than the preset coding rate, setting the target coding rate to be a third coding rate which is less than the second coding rate.
15. The rate control device of claim 14, wherein the obtaining module obtains the QP threshold corresponding to the target coding rate comprises:
the obtaining module obtains a QP value corresponding to a target coding rate according to a pre-established corresponding relationship between the QP value and the coding rate, and the obtained QP value is used as a QP threshold value corresponding to the target coding rate.
16. The code rate control device of claim 14, wherein:
the first encoding rate is 90% of the data upload speed.
17. The code rate control device of claim 14, wherein:
the second encoding rate is 90% of the data upload speed;
the third coding rate is: the data uploading speed is 90% of the average value of the larger value of the actual coding rate and the preset coding rate.
18. The code rate control device of claim 14, wherein the code rate adjustment module, when the predetermined condition is satisfied, determining the target code rate according to the obtained buffer data amount, the data uploading speed, and the actual code rate comprises:
when the buffer data volume is smaller than a preset threshold value and reaches a preset time length, if the target coding code rate is not smaller than the preset coding code rate, setting the target coding code rate to be a fourth coding code rate larger than the original target coding code rate; and if the target coding rate is smaller than the preset coding rate, setting the target coding rate to be a fifth coding rate which is larger than the fourth coding rate.
19. The code rate control device of claim 18, wherein:
the fourth coding rate is 110% of the original target coding rate; the fifth coding rate is 120% of the original target coding rate.
20. An apparatus for controlling a code rate, comprising:
the monitoring module is used for acquiring the buffer data volume, the data uploading speed and the actual coding code rate;
the encoding code rate adjusting module is used for determining a target encoding code rate according to the obtained buffer data volume, the data uploading speed and the actual encoding code rate when a preset condition is met, and comprises the following steps:
when the buffer data volume is larger than a preset threshold value, if the data uploading speed is smaller than the actual coding code rate, setting the target coding code rate to be a first coding code rate smaller than the data uploading speed;
when the buffer data amount is larger than a preset threshold value and the data uploading speed is larger than the actual coding code rate, setting a second coding code rate smaller than the data uploading speed;
if the second coding rate is smaller than a preset coding rate, setting a target coding rate as the second coding rate;
and if the second coding rate is greater than the preset coding rate, setting the target coding rate to be a third coding rate which is less than the second coding rate.
21. The code rate control device of claim 20, wherein:
the first encoding rate is 90% of the data upload speed.
22. The code rate control device of claim 20, wherein:
the second encoding rate is 90% of the data upload speed;
the third coding rate is: the data uploading speed is 90% of the average value of the larger value of the actual coding rate and the preset coding rate.
23. The code rate control device of claim 20, wherein the code rate adjustment module, when the predetermined condition is satisfied, determining the target code rate according to the obtained buffer data amount, the data uploading speed, and the actual code rate comprises:
when the buffer data volume is smaller than a preset threshold value and reaches a preset time length, if the target coding code rate is not smaller than the preset coding code rate, setting the target coding code rate to be a fourth coding code rate larger than the original target coding code rate; and if the target coding rate is smaller than the preset coding rate, setting the target coding rate to be a fifth coding rate which is larger than the fourth coding rate.
24. The code rate control device of claim 23, wherein:
the fourth coding rate is 110% of the original target coding rate; the fifth coding rate is 120% of the original target coding rate.
25. The rate control device of any of claims 20-24, further comprising:
the acquisition module is used for acquiring a quantization parameter QP threshold value corresponding to the target coding rate;
the quantization parameter adjusting module is used for adjusting the QP value when the actual coding code rate is not consistent with the target coding code rate; and if the adjusted QP value is smaller than the QP threshold value, setting the QP value as the QP threshold value.
26. The apparatus for controlling code rate of claim 25, wherein the obtaining module obtains the QP threshold corresponding to the target coding rate comprises:
the obtaining module obtains a QP value corresponding to a target coding rate according to a pre-established corresponding relationship between the QP value and the coding rate, and the obtained QP value is used as a QP threshold value corresponding to the target coding rate.
27. An electronic device for rate control, comprising:
a first memory and a first processor;
the method is characterized in that:
the first memory is used for storing a program for controlling the code rate; the program for rate control, when read executed by the first processor, performs the following operations:
obtaining a quantization parameter QP threshold value corresponding to a target coding rate;
when the actual coding rate is not consistent with the target coding rate, adjusting the QP value; if the adjusted QP value is smaller than the QP threshold value, setting the QP value as the QP threshold value;
obtaining the buffer data volume, the data uploading speed and the actual coding code rate;
when the preset conditions are met, determining a target coding rate according to the obtained buffer data volume, the data uploading speed and the actual coding rate, wherein the target coding rate comprises the following steps:
when the buffer data volume is larger than a preset threshold value, if the data uploading speed is smaller than the actual coding code rate, setting the target coding code rate to be a first coding code rate smaller than the data uploading speed;
when the buffer data amount is larger than a preset threshold value and the data uploading speed is larger than the actual coding code rate, setting a second coding code rate smaller than the data uploading speed;
if the second coding rate is smaller than a preset coding rate, setting a target coding rate as the second coding rate;
and if the second coding rate is greater than the preset coding rate, setting the target coding rate to be a third coding rate which is less than the second coding rate.
28. An electronic device for rate control, comprising:
a second memory and a second processor;
the method is characterized in that:
the second memory is used for storing a program for controlling the code rate; the program for rate control, when read executed by the second processor, performs the following operations:
obtaining the buffer data volume, the data uploading speed and the actual coding code rate;
when the preset conditions are met, determining a target coding rate according to the obtained buffer data volume, the data uploading speed and the actual coding rate, wherein the target coding rate comprises the following steps:
when the buffer data volume is larger than a preset threshold value, if the data uploading speed is smaller than the actual coding code rate, setting the target coding code rate to be a first coding code rate smaller than the data uploading speed;
when the buffer data amount is larger than a preset threshold value and the data uploading speed is larger than the actual coding code rate, setting a second coding code rate smaller than the data uploading speed;
if the second coding rate is smaller than a preset coding rate, setting a target coding rate as the second coding rate;
and if the second coding rate is greater than the preset coding rate, setting the target coding rate to be a third coding rate which is less than the second coding rate.
HK18115147.0A 2018-11-27 Code rate control method and apparatus, and electronic device HK1256085B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
HK18115147.0A HK1256085B (en) 2018-11-27 Code rate control method and apparatus, and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
HK18115147.0A HK1256085B (en) 2018-11-27 Code rate control method and apparatus, and electronic device

Publications (2)

Publication Number Publication Date
HK1256085A1 HK1256085A1 (en) 2019-09-13
HK1256085B true HK1256085B (en) 2021-06-25

Family

ID=

Similar Documents

Publication Publication Date Title
US10645449B2 (en) Method and apparatus of content-based self-adaptive video transcoding
JP6134650B2 (en) Applicable bit rate control based on scene
US8867611B2 (en) Video transmitting method and system with image quality adjusting function
CN107846590B (en) Video coding method and video coder
US20170103577A1 (en) Method and apparatus for optimizing video streaming for virtual reality
US20200128246A1 (en) Dynamic codec adaptation
CN111901635A (en) Video processing method, device, storage medium and equipment
US10659514B2 (en) System for video monitoring with adaptive bitrate to sustain image quality
WO2014058713A1 (en) Proactive video frame dropping
CN114245196B (en) Screen recording and stream pushing method and device, electronic equipment and storage medium
CN112738516A (en) Encoding method, encoding device, storage medium and electronic equipment
US10097746B2 (en) Method and system for dynamically adjusting a camera setting for a video stream
CN114302145A (en) Video coding optimization method, device, device and storage medium for adaptive network environment
CN108124155B (en) Code rate control method and device and electronic equipment
JP6999633B2 (en) Adaptive storage across multiple cameras in a video recording system
Dalgic et al. Characterization of quality and traffic for various video encoding schemes and various encoder control schemes
US20180027244A1 (en) Video encoding apparatus with video encoder adaptively controlled according to at least transmission status of communication link and associated video encoding method
JP6168672B1 (en) Encoding device provided with video switching device and encoding method including video switching detection method
EP3468188B1 (en) Method and encoder for encoding video streams
HK1256085A1 (en) Code rate control method and apparatus, and electronic device
HK1256085B (en) Code rate control method and apparatus, and electronic device
US10270832B1 (en) Method and system for modifying a media stream having a variable data rate
US12356052B2 (en) Video image transmission method, device and system
US10721473B2 (en) Systems and methods for adjusting the frame rate of transmitted video based on the level of motion in the video
US10097609B1 (en) Method and system for dynamically adjusting a data rate of a video stream