Video code rate control method, device and equipment
By identifying the scene category of the video and setting reasonable upper and lower bit rate limits, the problem of unreasonable video bit rate control in the prior art is solved, and the effect of reducing the video bit rate on the basis of ensuring picture quality is achieved.
Patent Information
- Application Number
- CN202411441077.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-15
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2044-10-15
AI Technical Summary
The existing CRF bit rate control method cannot effectively reduce the overall bit rate of the video while ensuring the video quality, resulting in a large overall bit rate of the video in the video library.
By obtaining the scene category of the target video, determine the upper and lower limits of the code rate value of its encoding, ensuring that the code rate is within a reasonable range, thereby reducing the overall code rate of the video while ensuring picture quality.
It effectively reduces the overall code rate of videos in the video library, and at the same time improves the encoding quality of the video, avoiding the problem of greatly increasing the code rate in order to improve the picture quality.
Smart Images

Figure CN118972595A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of video coding technology, and in particular to a video bit rate control method, device and equipment. Background Art
[0002] In the prior art, when a constant rate factor (CRF) control method is used by an encoder to encode video data in a video library, a quality factor is usually set, and the encoder automatically adjusts the bit rate according to the set quality factor to control the encoding quality of the video, so that the encoding quality of the video reaches a specified quality level, thereby making the user's subjective feeling of the overall quality of the encoded video relatively the same. When the CRF bit rate control method is used to encode videos in a video library, a maximum bit rate is sometimes set, and the encoder controls the encoding bit rate of the video according to the set maximum bit rate, so that the encoding bit rate of the video is less than the maximum bit rate.
[0003] The maximum bitrate set in the prior art is usually determined by the transmission bandwidth; however, the maximum bitrate determined by the transmission bandwidth is usually large and cannot effectively control the encoding bitrate of the video, resulting in a large overall bitrate of the video. Based on this, how to ensure the overall image quality of the videos in the video library while reducing the overall bitrate of the videos in the video library has become a technical problem that needs to be solved urgently. Summary of the invention
[0004] The embodiments of this specification provide a video bit rate control method, apparatus and device to solve the technical problem of a large overall video bit rate under the same image quality in the existing CRF bit rate control method.
[0005] To solve the above technical problems, the embodiments of this specification are implemented as follows: A video bit rate control method provided in an embodiment of the present specification includes: Get the target video; Determine a target scene category to which the target video belongs; Determine an upper limit of a bit rate value for encoding the target video according to a target scene category to which the target video belongs; the upper limit of the bit rate value is less than a maximum bit rate determined according to a transmission bandwidth value in a CRF bit rate control method; Determining a lower limit of a bit rate value for encoding the target video according to a target scene category to which the target video belongs; The target video is encoded according to the bit rate upper limit and the bit rate lower limit.
[0006] The embodiment of this specification provides a video bit rate control device, including: A first acquisition module, used to acquire a target video; A first determination module, used to determine the target scene category to which the target video belongs; A second determination module is used to determine an upper limit of a bit rate value for encoding the target video according to a target scene category to which the target video belongs; the upper limit of the bit rate value is less than a maximum bit rate determined according to a transmission bandwidth value in a CRF bit rate control method; A third determination module, configured to determine a lower limit of a bit rate value for encoding the target video according to a target scene category to which the target video belongs; The encoding module is used to encode the target video according to the bit rate value upper limit and the bit rate value lower limit.
[0007] A video bit rate control device provided in an embodiment of the present specification includes: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to: Get the target video; Determine a target scene category to which the target video belongs; Determine an upper limit of a bit rate value for encoding the target video according to a target scene category to which the target video belongs; the upper limit of the bit rate value is less than a maximum bit rate determined according to a transmission bandwidth value in a CRF bit rate control method; Determining a lower limit of a bit rate value for encoding the target video according to a target scene category to which the target video belongs; The target video is encoded according to the bit rate upper limit and the bit rate lower limit.
[0008] At least one embodiment provided in this specification can achieve the following beneficial effects: When encoding the videos in the video library, the upper and lower limits of the bit rate value used for encoding the target video are determined according to the target scene category to which each target video in the video library belongs, and then the target video is encoded based on the upper and lower limits of the bit rate value. The upper and lower limits of the bit rate value are to first encode the video set of the target scene category to obtain the encoded video quality and video bit rate, and then determine a more reasonable maximum and minimum bit rate based on the encoded video quality and video bit rate, which can reduce the overall bit rate of the video set of the target scene category while ensuring the overall quality of the video set of the target scene category. Since setting the upper limit of the bit rate value can reduce the encoding bit rate of the target video in the video library, and setting the lower limit of the bit rate value can improve the encoding quality of the target video in the video library, when the upper and lower limits of the bit rate value are used to encode the videos in the video library, the overall bit rate of the videos in the video library can be effectively reduced while ensuring the overall quality of the videos in the video library. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] In order to more clearly illustrate the embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0010] Figure 1 A schematic diagram of an application scenario of a video bit rate control method provided in an embodiment of this specification; Figure 2 A schematic diagram of a flow chart of a video bit rate control method provided in an embodiment of this specification; Figure 3 A schematic diagram of the relationship between bit rate and image quality provided in an embodiment of this specification; Figure 4 A schematic diagram of the relationship between average bit rate and average image quality provided in an embodiment of this specification; Figure 5 A flowchart of another video bit rate control method provided in an embodiment of this specification; Figure 6 The embodiments of this specification provide corresponding to Figure 2 A structural schematic diagram of a video bit rate control device; Figure 7 The embodiments of this specification provide corresponding to Figure 2 A structural schematic diagram of a video bit rate control device. DETAILED DESCRIPTION
[0011] In order to make the purpose, technical solutions and advantages of one or more embodiments of this specification clearer, the technical solutions of one or more embodiments of this specification will be clearly and completely described below in combination with the specific embodiments of this specification and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of one or more embodiments of this specification.
[0012] The technical solutions provided by the embodiments of this specification are described in detail below in conjunction with the accompanying drawings.
[0013] With the development of live broadcast and short video services, video coding technology is being used more and more widely. The application of video coding technology can compress video data and control the bit rate to reduce the size of video files, save the storage space and transmission bandwidth required for video files, and maintain the video quality as much as possible.
[0014] Existing bit rate control methods usually include constant bit rate (CBR) control method and variable bit rate (VBR) control method. Among them, the CBR bit rate control method refers to encoding the video at a fixed bit rate. During the encoding process, the bit rate of the video is not affected by the complexity of the image and the bit rate remains unchanged; the CBR bit rate control method can ensure the stability of the bit rate during the video encoding process, but cannot guarantee the image quality. Usually, the CBR bit rate control method is suitable for scenarios with fixed and stable network bandwidth. The VBR bit rate control method refers to encoding the video at a variable bit rate. During the encoding process, the bit rate of the video is adjusted according to the complexity of the image content; for example, if the image is rich in details or contains a lot of motion, a higher bit rate is allocated; if the image is relatively flat, a lower bit rate is allocated. This ensures both quality and bandwidth limitations to adapt to changes in network bandwidth.
[0015] VBR can be further divided into the average bit rate (Average Bit Rate, English abbreviation ABR) control method, the constant QP (Constant Quantization Parameter, English abbreviation CQP) control method and the constant rate factor (Constant Rate Factor, English abbreviation CRF) control method. Among them, the ABR rate control method refers to the average bit rate of a certain continuous video frame block as a target bit rate; the CQP rate control method refers to encoding the video based on a fixed quantization parameter value (such as QP); the CRF rate control method refers to controlling the encoding quality of the video by setting a quality factor (for example, CRF value) instead of using a fixed bit rate. Generally, the lower the CRF value, the higher the quality of the compressed video will be, and the larger the compressed video file will be; conversely, the higher the CRF value, the lower the quality of the compressed video will be, and the smaller the compressed video file will be. In the CRF rate control method, a maximum bit rate is sometimes set. The maximum bit rate is usually determined based on the transmission bandwidth value to ensure that the user end does not experience freezing when playing the video; for example, if the user's network transmission bandwidth value is 3Mbps, the maximum bit rate can be 2.5Mbps. The encoder automatically adjusts the bit rate based on the set quality factor and maximum bit rate to control the video encoding bit rate while ensuring that the video quality reaches the specified quality level as much as possible, so that the video encoding bit rate is less than the maximum bit rate.
[0016] Generally speaking, increasing the bit rate will improve the quality of the encoded video, but in actual applications, the increase in bit rate is not proportional to the improvement in quality. For example, some videos will have a significant improvement in quality if the bit rate is increased slightly; while some videos will not have a significant improvement in quality even if the bit rate is increased a lot. When the existing CRF bit rate control method encodes the videos in the video library using the set quality factor and the maximum bit rate determined according to the transmission bandwidth value, there is a problem that a larger bit rate is allocated to the video to ensure the quality of the video, but the improvement rate of the video quality is low. Therefore, the existing CRF bit rate control method has an unreasonable bit rate allocation, which leads to a problem that the overall bit rate of the videos in the video library is larger when the overall video quality is the same.
[0017] Based on this, how to ensure the image quality of the videos in the video library while reducing the bit rate has become a technical problem that needs to be solved urgently.
[0018] In order to solve the defects in the prior art, this solution provides the following embodiments.
[0019] Figure 1 The figure is a schematic diagram of an application scenario of a video bit rate control method in an embodiment of the present specification.
[0020] like Figure 1 As shown, before sending the video from the first device 101 to the second device 102, the video can be encoded for the convenience of transmission. The first device 101 may include an encoding module for encoding the video, which is used to encode the video before sending it out. The first device 101 and the second device 102 can be connected via a wired or wireless network.
[0021] Despite Figure 1 In the figure, the first device 101 is a server and the second device 102 is a terminal device. However, in actual application, the first device may include a server or a terminal device, and the second device may include a terminal device or a server. Furthermore, the type and data of the server and the type and data of the terminal device may not be limited to the following. Figure 1 For example, the types of terminal devices may include but are not limited to mobile phones, tablets, desktop computers, smart home devices, smart wearable devices, vehicle-mounted terminals, etc. Optionally, the first device may be a server, and the second device may be a terminal device. In actual application, a user using the terminal device may obtain a video from a video library of the server, for example, online video on demand, network disk video download, and other scenarios. Specifically, the terminal device may send a video acquisition request for a target video to the server, and before the server sends the target video to the terminal device in response to the video acquisition request, the server may utilize an encoding module in the server and adopt a video bit rate control method of an embodiment of this specification to encode the target video.
[0022] Optionally, the first device may be a terminal device, and the second device may be a server. In actual application, a user using the terminal device may upload a video to the server, for example, a user may upload a video to a video platform, or a user may upload a video to a network disk. Specifically, a user using the terminal device may initiate a task of transmitting a target video to the server. Before transmitting the target video to the server, the target video may be encoded using the encoding module in the terminal device and the video bit rate control method of the embodiment of this specification.
[0023] Optionally, the first device may be a terminal device, and the second device may be another terminal device. In practical applications, a video may be transmitted from one user terminal device to another user terminal device, for example, in scenarios such as live video broadcasting and video chatting. Specifically, before transmitting the video of the first terminal device to the second terminal device, the target video may be encoded by using the encoding module in the first terminal device and the video bit rate control method of the embodiment of this specification.
[0024] Optionally, the first device may be a server or a server cluster, and the second device may be another server or a server cluster. In practical applications, the video may be transmitted from one server or a server cluster to another server or a server cluster as required by actual business. Specifically, before transmitting the video of the first server or a server cluster to another server or a server cluster, the target video may be encoded using the encoding module in the first server or a server cluster and the video bit rate control method of the embodiment of this specification.
[0025] Next, a video bit rate control method provided in the embodiment of the specification will be specifically described with reference to the accompanying drawings.
[0026] Figure 2 The flowchart of a video bit rate control method provided in the embodiment of this specification is shown in FIG. From the program perspective, the execution subject of the process can be a program installed in a terminal device or a server. From the hardware perspective, the execution subject of the process can be an encoding device or an encoding device. Figure 2 As shown, the process may include the following steps.
[0027] Step 202: Acquire the target video.
[0028] In the embodiment of the present specification, the target video may be a video in a video library that has not been rate controlled.
[0029] In actual applications, when a transmission terminal is used to transmit a video in a video library to another terminal, or when a user uses a user terminal to play a video, the video library can send the target video to be transmitted or played to the encoding module, so that after the encoding module obtains the target video, it can compress and encode the target video.
[0030] Step 204: Determine the target scene category to which the target video belongs.
[0031] In the embodiment of the present specification, the target scene category may be obtained by screening in advance from a plurality of preset scene categories.
[0032] In the embodiments of the present specification, each video in the video library including the target video may include multiple dimensional category tags. Specifically, the category tags of the video may include multiple dimensional tags such as first dimensional tags and second dimensional tags; wherein the first dimensional tags may be used to reflect the application scenario and business scenario of the video; for example, the first dimensional tags may be live broadcast, on-demand, etc.; the second dimensional tags may be used to reflect the content scenario of the video; for example, the second dimensional tags may be indoor, outdoor, etc. Of course, the category tags of the video may also include third dimensional tags and fourth dimensional tags and other dimensional tags, and the category tags of the video in multiple dimensions may also be tags used to reflect other contents of the video, which are not specifically limited here.
[0033] In practical applications, the preset scene category can be determined based on the scene category reflected by the category label of the video itself in the video library. Specifically, the preset scene category can be the scene category reflected by a category label of a single dimension. For example, the preset scene category can be the scene category reflected by the live category label and / or the scene category reflected by the on-demand category label; it can also be the scene category reflected by the indoor category label and / or the scene category reflected by the outdoor category label. Of course, the preset scene category can also be the scene category reflected by a combination of category labels of multiple dimensions. For example, the preset scene category can be the scene category reflected by the combination of the live category label and the indoor category label, and / or the scene category reflected by the combination of the live category label and the outdoor category label.
[0034] Usually, videos of different scene categories have different requirements for image quality and real-time performance. Therefore, in the embodiments of this specification, the maximum bit rate and the minimum bit rate set in the process of encoding videos can be different. For example, when the overall image quality requirements for videos in the video library are high, if the maximum bit rate is set to be small, the overall image quality of the video may not be guaranteed. Therefore, the maximum bit rate needs to be set to be larger. In the embodiments of this specification, when the target scene category is determined from the preset scene category, more reasonable maximum bit rates and minimum bit rates are determined for different target scene categories respectively, so as to ensure that when the maximum bit rate and the minimum bit rate are used to encode the videos in the video library, the overall image quality of the videos in the video library can be guaranteed, while reducing the overall bit rate of the videos. Among them, the overall bit rate of the videos in the video library can be the characteristic bit rate of all videos in the video library. The characteristic bit rate can be the sum of the bit rates of all videos in the video library, or it can be the average value of the bit rates of all videos in the video library.
[0035] In the embodiments of the present specification, after the target scene category is determined from the preset scene categories, the target scene category to which the target video belongs can be determined based on the category label of the target video. If the target video itself does not have a category label, a pre-trained deep learning model can also be used to identify the target scene category to which the target video belongs. Since the use of a deep learning model to identify the target scene category to which the target video belongs is relatively common in the prior art, it will not be repeated here. In practical applications, other image recognition technologies can also be used to determine the target scene category to which the target video belongs, which is not specifically limited here.
[0036] Step 206: Determine an upper bit rate value limit for encoding the target video according to the target scene category to which the target video belongs; the upper bit rate value limit is less than the maximum bit rate determined according to the transmission bandwidth value in the CRF bit rate control method.
[0037] In practical applications, bit rate refers to the number of data bits transmitted per unit time during data transmission, also known as bit rate, which indicates how many bits of data are required per second to transmit the encoded video data or audio data. The bit rate is generally expressed in kilobits per second (kbps) or megabits per second (Mbps). Bit rate can be a sampling rate. The higher the sampling rate per unit time, the higher the bit rate, the clearer the details of the video image, and the more bandwidth and storage space the encoded video file will occupy.
[0038] In the embodiment of the present specification, the upper limit of the bit rate value may be a maximum bit rate set when encoding the target video.
[0039] In the CRF bitrate control method, the maximum bitrate can be determined according to the transmission bandwidth value. Specifically, the maximum bitrate can be determined according to the transmission bandwidth value and the video content to ensure that the user end does not experience freezing when playing the video, while ensuring the video quality to a certain extent.
[0040] Figure 3 The bit rate-quality curves obtained by encoding three different videos using multiple quality factors. The three different videos can be any three different videos. In actual operation, in order to more clearly show the difference between the bit rate-quality curves of different videos, three different types of videos can be selected.
[0041] exist Figure 3In the example, a curve can correspond to a bitrate-quality curve after video encoding. A (bitrate, quality) data point on the curve can represent the bitrate data and quality data obtained by encoding the video using a quality factor. Different (bitrate, quality) data points on the same curve can correspond to different quality factors.
[0042] Specifically, for each video in the video library, multiple different quality factors (such as Figure 3 As shown in FIG. 1 , four different quality factors can be used to encode each video respectively to obtain the encoded (bitrate, image quality) data points corresponding to each quality factor of each video. Furthermore, based on the multiple encoded (bitrate, image quality) data points of each video, the encoded bitrate-image quality curve of each video can be drawn.
[0043] according to Figure 3 It can be seen that even if the bit rate of some videos is increased a lot, the video quality is not significantly improved, such as Figure 3 As shown in the third group of data in . For videos with a large increase in bit rate but no significant improvement in video quality, even if a part of the bit rate allocated to them is reduced, its image quality will not be significantly affected; and the maximum bit rate determined according to the transmission bandwidth value is usually large, and it is impossible to effectively reduce the bit rate of videos with a large increase in bit rate but no significant improvement in video quality. Therefore, in the embodiments of this specification, by setting a more reasonable bit rate value upper limit to control the encoding bit rate of the video, the overall bit rate of the video in the encoded video library can be reduced.
[0044] In an embodiment of the present specification, the upper limit of the bit rate value can be obtained by screening from multiple bit rate values based on the average bit rate and average picture quality after encoding the video set of the target scene category, which can be used to reduce the overall bit rate of the video set of the target scene category and ensure the overall picture quality of the video set of the target scene category.
[0045] In the embodiment of the present description, since the upper limit of the bit rate value is less than the maximum bit rate determined according to the transmission bandwidth value, and the upper limit of the bit rate value is obtained by screening from multiple bit rate values, the overall bit rate and overall image quality of the video set of the target scene category can be optimized; therefore, when the upper limit of the bit rate value corresponding to each target scene category is used to encode the target video of the corresponding target scene category in the video library, the overall bit rate of the video in the video library can be effectively reduced, but the overall image quality of the video in the video library is not affected or is not significantly affected.
[0046] Step 208: Determine a lower limit of a bit rate value for encoding the target video according to the target scene category to which the target video belongs.
[0047] In the embodiment of the present specification, the lower limit of the bit rate value may be a minimum bit rate set when encoding the target video.
[0048] The prior art usually does not set a minimum bit rate when encoding videos using the CRF method. After research, this application found that for some videos, the video quality will be significantly improved by increasing the bit rate value by a small amount. Figure 3 As shown in the first and second groups of data in . For videos whose video quality can be significantly improved by increasing a small bit rate value, even if a part of its quality is improved, it is not necessary to significantly increase its bit rate. Therefore, in the embodiments of this specification, by setting a more reasonable lower limit of the bit rate value to improve the video quality, the overall quality of the video in the encoded video library can be improved.
[0049] In the embodiments of the present specification, the lower limit of the bit rate value is the average bit rate and average picture quality of the video set encoded in advance based on the target scene category, which is screened from multiple bit rate values and can be used to improve the overall picture quality of the video set of the target scene category without increasing or significantly increasing the overall bit rate of the video set of the target scene category.
[0050] In the embodiment of this description, since the lower limit of the bit rate value is pre-screened from multiple bit rate values, it can be used to optimize the overall bit rate and overall image quality of the video set of the target scene category; therefore, by using the lower limit of the bit rate value corresponding to each target scene category to encode the target video of the corresponding target scene category in the video library, the overall image quality of the video in the video library can be effectively improved, but the overall bit rate of the video in the video library will not be increased or will not be significantly increased.
[0051] In the embodiments of the present specification, a correspondence between the target scene category and the upper and lower limits of the bit rate value can also be pre-established, so that the upper and lower limits of the bit rate value used to encode the target video can be quickly determined based on the correspondence. For example, if the target scene category is live broadcast, the upper limit of the bit rate value is determined to be 3000kbps, and the lower limit of the bit rate value is 500kbps, the live broadcast can be associated with the upper limit of the bit rate value 3000kbps and the lower limit of the bit rate value 500kbps.
[0052] Step 210: Encode the target video according to the bit rate upper limit and the bit rate lower limit.
[0053] In the embodiments of the present specification, among the numerous videos in the video library, there are usually videos whose video quality is not significantly improved by increasing the bit rate by a large amount, and videos whose video quality is significantly improved by increasing the bit rate by a small amount; when the target video is a video whose video quality is not significantly improved by increasing the bit rate by a large amount, the bit rate upper limit and the bit rate lower limit are used to encode the target video, which can effectively reduce the bit rate of the target video, but does not significantly affect the quality of the target video. When the target video is a video whose video quality is significantly improved by increasing the bit rate by a small amount, the bit rate upper limit and the bit rate lower limit are used to encode the target video, which can effectively improve the quality of the target video, but does not significantly increase the bit rate of the target video.
[0054] In the embodiment of the present specification, when the bit rate value upper limit and the bit rate value lower limit are used to encode all the videos in the video library, although the overall image quality of the videos in the video library is reduced when the bit rate value upper limit and the bit rate value lower limit are used to encode the videos whose video quality is significantly improved by increasing a large bit rate value, the overall image quality of the videos in the video library is effectively improved when the bit rate value upper limit and the bit rate value lower limit are used to encode the videos whose video quality is significantly improved by increasing a small bit rate value, thereby effectively ensuring the overall image quality of the videos in the video library. And because the bit rate value reduced by the bit rate value upper limit and the bit rate value lower limit for encoding the videos whose video quality is significantly improved by increasing a large bit rate value is much greater than the bit rate value increased by the bit rate value upper limit and the bit rate value lower limit for encoding the videos whose video quality is significantly improved by increasing a small bit rate value. Therefore, based on the embodiment of the present specification, the overall bit rate of the videos in the video library can be effectively reduced without affecting the overall image quality of the videos in the video library.
[0055] Figure 2In the method, when encoding the videos in the video library, the upper and lower limits of the bit rate value used for encoding the target video are determined according to the target scene category to which each target video in the video library belongs, and then the target video is encoded based on the upper and lower limits of the bit rate value. Since the upper and lower limits of the bit rate value are more reasonable maximum and minimum bit rates determined in advance based on the video quality and video bit rate of the video set encoded according to the target scene category, the overall image quality of the video set of the target scene category can be guaranteed, while the overall bit rate of the video set of the target scene category can be reduced. Since the upper limit of the bit rate value is less than the maximum bit rate determined according to the transmission bandwidth value, the overall bit rate of the videos in the video library can be effectively reduced by setting the upper limit of the bit rate value to encode the videos in the video library. In addition, the upper limit of the bit rate value is applied to encode the target video, which can avoid the problem of significantly increasing the bit rate of the target video in order to improve the image quality by a small margin during the encoding process, thereby further significantly reducing the encoding bit rate of the target video without significantly reducing the encoding image quality of the target video. Furthermore, applying the lower limit of the bit rate value to encode the target video can improve the encoding bit rate of the target video when the encoding bit rate of the target video is relatively low; especially when the target video can significantly improve the encoding quality by increasing the encoding bit rate, applying the lower limit of the bit rate value to encode the target video can significantly improve the image quality of the target video without significantly increasing the encoding bit rate of the target video. Since setting the upper limit of the bit rate value can reduce the encoding bit rate of the target video in the video library, and setting the lower limit of the bit rate value can improve the encoding quality of the target video in the video library, encoding the videos in the video library using the upper limit of the bit rate value and the lower limit of the bit rate value can ensure the overall image quality of the videos in the video library, while effectively reducing the overall bit rate of the videos in the video library.
[0056] In practical applications, the upper and lower bitrate values corresponding to different scene categories may be different. The upper and lower bitrate values for encoding videos of each target scene category can be determined in advance for subsequent applications.
[0057] Specifically, before determining the target scene category to which the target video belongs, the following steps may also be included: Get a collection of videos for a pre-defined category of scenes.
[0058] Based on the video set of the preset scene category, an upper limit and a lower limit of a bit rate value for encoding the video of the preset scene category are determined.
[0059] In an embodiment of the present specification, the pre-set scene category can be obtained by screening the category labels of the videos in the video library. Specifically, the pre-set scene category can be determined based on the category label of the video according to the business scenario; for example, the pre-set scene category can be determined based on the first dimension label, and the pre-set scene category can be live broadcast or on demand. Of course, the pre-set scene category can also be determined based on the category label of the video according to the video content; for example, the pre-set scene category can be determined based on the second dimension label, and the pre-set scene category can be movies, TV series, or indoor or outdoor. Of course, the pre-set scene category can also be determined according to other actual needs, which is not specifically limited here.
[0060] Among them, the video set can be obtained from a video library. Specifically, it can be determined whether the video is a video that needs to be obtained based on the category label of the video; when the category label of the video includes multiple dimensions, as long as the category label of the video includes a category label that can reflect that the video is a video of a pre-set scene category, the above video can be determined to be a video in the video set. Specifically, assuming that the pre-set scene category is movie, if the category label of the target video includes on-demand, movie, and indoor, since the category label of the target video includes a category label that reflects that the target video is a movie, it can be determined that the target video is a video in the video set that needs to be obtained. For another example, the pre-set scene category is movie, if the category label of the target video includes on-demand, TV series, and indoor, since the category label of the target video does not include a category label that reflects that the target video is a movie, it can be determined that the target video is not a video in the video set that needs to be obtained.
[0061] In the embodiments of the present specification, the upper and lower bitrate values may be determined based on the average bitrate and average image quality of the encoded video set obtained by encoding based on a preset bitrate upper and lower limits, and the average bitrate and average image quality of the encoded video set obtained by encoding based on a traditional CRF bitrate control method.
[0062] In the embodiments of the present specification, the upper and lower limits of the bit rate values used for encoding videos of each target scene category are determined in advance, which can facilitate subsequent applications and improve video encoding efficiency.
[0063] To facilitate understanding of the present solution, the embodiments of the present specification also provide specific contents for determining the upper and lower limits of the bit rate value for encoding the video of the preset scene category based on the video set of the preset scene category.
[0064] Specifically, the determining, based on the video set of the preset scene category, the upper limit and the lower limit of the bit rate value for encoding the video of the preset scene category may specifically include: A first video set of a first preset scene category is obtained.
[0065] Encoding the first video set respectively using a plurality of first constant quality factors to obtain a bit rate-quality curve; A preset second constant quality factor is obtained.
[0066] The first video set is encoded using the second constant quality factor and a plurality of preset bit rate pairs to obtain an encoding result; any of the preset bit rate pairs includes a preset bit rate value upper limit and a preset bit rate value lower limit.
[0067] According to the encoding result, a plurality of first data points in a bit rate-image quality coordinate system are obtained; the bit rate-image quality coordinate system is a coordinate system where the bit rate-image quality curve is located.
[0068] According to the positional relationship between the plurality of first data points and the bit rate-quality curve, an upper bit rate value limit and a lower bit rate value limit of the first preset scene category are determined.
[0069] In the embodiment of the present specification, the first preset scene category may be any scene category in the pre-set scene categories. The first video set may be obtained from a video library. The method for obtaining the first video set is substantially the same as the method for obtaining the video set of the pre-set scene category in the foregoing text, and will not be described in detail here.
[0070] In the embodiment of the present specification, the first constant quality factor may be a CRF value set when CRF bitrate control is performed on a video. Usually, the CRF value is any value between 0 and 51, where 0 represents lossless compression and 51 represents the highest compression rate. Since the purpose of the user terminal to watch videos of different scene categories may be different, the specific value of the first constant quality factor may be determined according to the scene category; for example, when the first preset scene category is live streaming with goods, since the user terminal may pay more attention to the explanation content of the live broadcast personnel when watching live streaming with goods videos, and not pay much attention to the details of the live video; and the surrounding environment usually changes less during live streaming, therefore, the requirements for the picture quality of the live video may usually be low, at this time, multiple first constant quality factors may be set to 22, 23, 24, 25, and 26 respectively. When the first preset scene category is on-demand, specifically, the on-demand video may be an online teaching video, a movie, or a TV series. For the on-demand video, the user terminal may pay more attention to the video picture content, therefore, the requirements for the picture quality of the on-demand video may usually be high, at this time, multiple first constant quality factors may be set to 7, 8, 9, 10, and 11 respectively to ensure that the needs of the user terminal are met.
[0071] In the embodiment of the present specification, the second constant quality factor may be any one of the first constant quality factors. Preferably, the second constant quality factor may be an intermediate value of multiple first constant quality factors. Specifically, when multiple first constant quality factors are 22, 23, 24, 25, and 26, the second constant quality factor may be 24. For another example, when multiple first constant quality factors are 7, 8, 9, 10, and 11, the second constant quality factor may be 9. Of course, the second constant quality factor may also be a specified value within a preset range from the first constant quality factor. For example, when the first constant quality factor is 22, 23, 24, 25, and 26, the second constant quality factor may be 21 or 27. No specific limitation is made here.
[0072] Figure 4 It is a schematic diagram of the relationship between average bit rate and average image quality. Figure 4 The horizontal axis of the bit rate-quality coordinate system in is the average bit rate, and the vertical axis is the average image quality. Each first constant quality factor can be used to encode the first video set, so as to obtain the average bit rate and average image quality of the encoded first video set corresponding to each first constant quality factor. According to the average bit rate and average image quality of the encoded first video set corresponding to each first constant quality factor, a bit rate-quality curve can be drawn in the bit rate-quality coordinate system, such as Figure 4 As shown in the curve.
[0073] exist Figure 4In the figure, each data point represented by a dot on the curve is used to represent the average bit rate and average picture quality of the first video set after encoding corresponding to each first constant quality factor. For example, when the first constant quality factor is 22, 23, 24, 25, and 26, the (average bit rate, average picture quality) of the first video set after encoding is (400, 42), (500, 43), (700, 44), (970, 44.7), and (1200, 45.4).
[0074] In the embodiment of the present specification, the preset bit rate upper limit can be determined according to the bit rate that is usually possible for the first video set of the first preset scene category, and the preset bit rate upper limit is less than the maximum bit rate determined according to the transmission bandwidth value.
[0075] In an embodiment of the present specification, the encoding result may include the encoded bit rate and image quality obtained by encoding each video in the first video set using the second constant quality factor and each set of preset bit rate pairs. Specifically, the second constant quality factor and a set of preset bit rate pairs may be used to encode each video in the first video set, thereby obtaining a set of encoded data including the encoded bit rate and image quality of each video in the first video set; then, the second constant quality factor and another set of preset bit rate pairs may be used to encode each video in the first video set, thereby obtaining another set of encoded data including the encoded bit rate and image quality of each video in the first video set; according to the above method, the encoded data corresponding to each set of preset bit rate pairs may be obtained, thereby obtaining the encoding result.
[0076] In the embodiments of the present specification, each first data point may represent the average bit rate and average image quality of the first video set after encoding using a second constant quality factor and a set of preset bit rates. Specifically, for any set of encoded data obtained in the foregoing text, the average bit rate of the first video set may be obtained based on the encoded bit rate of each video in the group, and the average image quality of the first video set may be obtained based on the encoded image quality of each video in the group. Based on the average bit rate and the average image quality, a first data point may be marked in a bit rate-image quality coordinate system. Similarly, other first data points may be obtained based on other sets of encoded data, which will not be described in detail here.
[0077] To facilitate understanding of the present solution, the embodiments of the present specification also provide specific contents for determining the upper and lower limits of the bitrate value of the first preset scene category based on the positional relationship between the multiple first data points and the bitrate-quality curve.
[0078] Specifically, determining the bit rate upper limit and the bit rate lower limit of the first preset scene category according to the positional relationship between the plurality of first data points and the bit rate-quality curve may include: If the positional relationship indicates that there is a second data point among the multiple first data points, then the distance from each of the second data points to the bit rate-image quality curve is calculated; the second data point is a data point whose image quality coordinates are greater than the image quality coordinates of a specific point in the bit rate-image quality curve, and the bit rate coordinates of the specific point are the same as the bit rate coordinates of the second data point.
[0079] The upper limit of the preset bit rate value in the preset bit rate pair corresponding to the second data point with the largest distance is determined as the upper limit of the bit rate value of the first preset scene category.
[0080] The lower limit of the preset bit rate value in the preset bit rate pair corresponding to the second data point with the largest distance is determined as the lower limit of the bit rate value of the first preset scene category.
[0081] In the embodiment of this specification, the first data points may include data points located above the bit rate-image quality curve, or data points located below the bit rate-image quality curve. Figure 4 The second data point can be understood as a data point located above the bit rate-quality curve, such as Figure 4 In the above, four first data points are located above the bit rate-quality curve; the quality coordinates of the second data points are greater than the quality coordinates of the specific points in the bit rate-quality curve with the same bit rate coordinates. If the second data point exists in the first data point, that is, when the quality coordinates are the same, the bit rate coordinates of the second data point are less than the bit rate coordinates of the specific point in the bit rate-quality curve; or when the bit rate coordinates are the same, the quality coordinates of the second data point are greater than the quality coordinates of the specific point in the bit rate-quality curve, it can be indicated that there is a bit rate pair in the preset bit rate pair that can optimize the bit rate and image quality of the first video set after encoding.
[0082] In the embodiment of the present specification, since the second data point is obtained by encoding the first video set using the second constant quality factor and different preset bitrate pairs, the bitrate value upper limit and bitrate value lower limit of the first preset scene category can be determined based on the second data point. In practical applications, the upper limit of the preset bitrate value in the preset bitrate pair corresponding to the second data point with the largest distance from the second data point to the bitrate-quality curve can be determined as the upper limit of the bitrate value of the first preset scene category, and the lower limit of the preset bitrate value in the preset bitrate pair corresponding to the second data point with the largest distance can be determined as the lower limit of the bitrate value of the first preset scene category.
[0083] In practical applications, the distance from the second data point to the bit rate-quality curve may be a vertical distance from the second data point to the bit rate-quality curve, or a longitudinal distance from the second data point to the bit rate-quality curve, which is not specifically limited here.
[0084] In the embodiments of this specification, in order to facilitate rapid determination of the bit rate upper limit and bit rate lower limit corresponding to the target scene category in subsequent applications, the target scene category may also be associated with the corresponding bit rate upper limit and bit rate lower limit and stored.
[0085] Specifically, after determining the bit rate upper limit and bit rate lower limit of the first preset scene category, the method may further include: Determine the first preset scene category as a target scene category.
[0086] The target scene category is associated with the bit rate value upper limit and the bit rate value lower limit and stored.
[0087] In an embodiment of the present specification, if a second data point exists in the first data point, it means that it is more reasonable to use the first preset scene category to divide the videos in the video library, and the upper and lower bitrate value limits of the videos in the video set of the first preset scene category are relatively uniform. Therefore, the first preset scene category can be determined as the target scene category.
[0088] In an embodiment of the present specification, the target scene category can be associated with the corresponding upper and lower bit rate values and stored, and the upper and lower bit rate values corresponding to the target scene category can be quickly determined in subsequent applications, thereby improving the encoding efficiency of the video.
[0089] In practical applications, if the selected first preset scene category is unreasonable, for example, the videos included in the first preset scene category are relatively complex, it may result in that the bit rate obtained by encoding the first video set using the preset bit rate is not lower than the bit rate obtained by encoding without using the preset bit rate under the same image quality. That is, the second data point does not exist in the first data point. Based on this, the embodiments of this specification also provide the following technical solutions.
[0090] Specifically, determining the bit rate upper limit and the bit rate lower limit of the first preset scene category according to the positional relationship between the plurality of first data points and the bit rate-quality curve may further include: If the positional relationship indicates that there is no second data point among the multiple first data points, then the second video set of the second preset scene category is filtered from the first video set of the first preset scene category; the second data point is a data point whose image quality coordinates are greater than the image quality coordinates of a specific point in the bit rate-image quality curve, and the bit rate coordinates of the specific point are the same as the bit rate coordinates of the second data point.
[0091] An upper bit rate value limit and a lower bit rate value limit of the second preset scene category under the first preset scene category are determined based on the second video set.
[0092] In the embodiment of the present specification, if the second data point does not exist in the first data point, it may be because the first preset scene category represents a large range of scenes, so that the types of videos in the first video set determined according to the first preset scene category are relatively complex, and thus no preset bit rate pair can be optimized for the first video set as a whole. Therefore, the videos in the first video set can be subdivided into scene categories. Specifically, the second video set of the second preset scene category can be screened out from the first video set, so as to determine the upper and lower bit rate values for encoding the videos of the second preset scene category under the first preset scene category based on the second video set.
[0093] In actual applications, the second video set of the second preset scene category can also be directly screened from the video library to determine the upper and lower bit rate values for encoding videos of the second preset scene category based on the second video set, which is not limited here.
[0094] In actual applications, based on the second video set, the method for determining the upper and lower limits of the bit rate value for encoding a video for a second preset scene category or a video for a second preset scene category under the first preset scene category is generally the same as the method for determining the upper and lower limits of the bit rate value for encoding a video for a preset scene category, and will not be repeated here.
[0095] In order to facilitate the understanding of the present application, the embodiments of the present specification also provide specific contents of encoding the first video set respectively using multiple first constant quality factors to obtain a bit rate-quality curve.
[0096] Specifically, encoding the first video set by using a plurality of first constant quality factors to obtain a bit rate-quality curve may include: The first video set is encoded using each of the first constant quality factors to obtain third data points corresponding to each of the first constant quality factors, wherein the third data points are used to reflect the average bit rate and average image quality of the encoded first video set.
[0097] The bit rate-image quality curve is drawn based on each of the third data points.
[0098] In the embodiments of the present specification, for each first constant quality factor, the first constant quality factor can be used to encode each video in the first video set to obtain the encoded bit rate and image quality of each video in the first video set; specifically, when the first constant quality factor is 7, 8, 9, 10, and 11, 7, 8, 9, 10, and 11 can be used to encode each video in the first video set to obtain the encoded bit rate and image quality of each video when the first constant quality factor is 7, the encoded bit rate and image quality of each video when the first constant quality factor is 8, and the encoded bit rate and image quality of each video when the first constant quality factor is 9, 10, and 11 respectively.
[0099] After obtaining the bit rate and picture quality after encoding the above-mentioned videos, the average value can be calculated for the bit rates after encoding of the videos obtained when using the specified first constant quality factor to obtain the average bit rate after encoding of the first video set corresponding to the specified first constant quality factor; and the average value can be calculated for the picture quality after encoding of the videos obtained when using the specified first constant quality factor to obtain the average picture quality after encoding of the first video set corresponding to the specified first constant quality factor.
[0100] Specifically, the average value of the encoded bit rates of each video obtained when the first constant quality factor is 7 can be calculated to obtain the average bit rate of the first video set when the first constant quality factor is 7; and the average value of the encoded picture quality of each video obtained when the first constant quality factor is 7 can be calculated to obtain the average picture quality of the first video set when the first constant quality factor is 7; according to the above method, the average bit rate and average picture quality of the first video set when the first constant quality factor is 8, 9, 10, and 11 can be obtained respectively, which will not be repeated here.
[0101] In the embodiment of the present specification, the third data point may be a data point representing the average bit rate and average image quality after encoding the first video set; it can be understood that the number of the third data points is the same as the number of the first constant quality factors. Based on the third data point, a bit rate-image quality curve can be drawn in the bit rate-image quality coordinate system.
[0102] To facilitate understanding of the present application, the embodiments of the present specification also provide specific contents of encoding the first video set using the second constant quality factor and multiple groups of preset bit rates to obtain encoding results.
[0103] Specifically, encoding the first video set using the second constant quality factor and multiple groups of preset bit rates to obtain an encoding result may include: For one set of preset bit rate pairs among the multiple sets of preset bit rate pairs, the second constant quality factor and the set of preset bit rate pairs are used to encode each video in the first video set to obtain the encoding bit rate and encoding image quality of each video corresponding to the set of preset bit rate pairs.
[0104] In the embodiment of this specification, multiple groups of preset bit rate pairs may be as shown in Table 1.
[0105] Table 1:
[0106] In an embodiment of the present specification, a second constant quality factor and a set of preset bit rates can be used to encode each video in the first video set to obtain a set of encoded bit rates and image qualities for each video in the first video set; for example, CRF=9, preset bit rate value upper limit=3000kbps, preset bit rate value lower limit=500kbps can be used to encode each video in the first video set, thereby obtaining a set of encoded data including the encoded bit rates and image qualities of each video when CRF=9, preset bit rate value upper limit=3000kbps, preset bit rate value lower limit=500kbps.
[0107] It can be understood that the second constant quality factor and each set of preset bit rate pairs can be used to encode each video in the first video set according to the method described above, so as to obtain multiple sets of encoded data corresponding to each set of preset bit rate pairs, and then obtain the encoding result.
[0108] In order to facilitate the understanding of the present application, the specific content of obtaining multiple first data points in the bit rate-image quality coordinate system according to the encoding result is also provided in the embodiments of this specification.
[0109] Specifically, obtaining a plurality of first data points in a bit rate-quality coordinate system according to the encoding result may specifically include: According to the encoding bit rates of the respective videos, an average bit rate of the first video set encoded based on the second constant quality factor and the set of preset bit rates is determined.
[0110] According to the encoded picture quality of each of the videos, an average picture quality of the first video set encoded based on the second constant quality factor and the set of preset bit rates is determined.
[0111] Based on the average picture quality and the average bit rate, a first data point corresponding to the second constant quality factor and the set of preset bit rate pairs is determined.
[0112] In practical applications, in the above-mentioned encoding results obtained, an average bit rate of the first video set can be determined according to the bit rates of each video in one group of the encoded first video set; an average picture quality of the first video set can be determined according to the picture quality of each video in one group of the encoded first video set, so that a first data point representing the average bit rate and average picture quality of the encoded first video set can be identified in the bit rate-quality curve; it can be understood that according to the bit rates and picture qualities of each video in multiple groups of encoded first video sets, multiple average bit rates and average picture qualities of the encoded first video set can be determined, and then multiple first data points representing the average bit rate and average picture quality of the encoded first video set can be identified in the bit rate-quality curve.
[0113] In order to facilitate understanding of the present application, the embodiments of the present specification also provide specific contents of encoding the target video according to the bit rate value upper limit and the bit rate value lower limit during the encoding process of the target video.
[0114] Specifically, encoding the target video according to the bit rate value upper limit and the bit rate value lower limit may include: If the bit rate value of the target video is greater than the bit rate value upper limit, the target video is encoded according to the bit rate value upper limit.
[0115] If the bit rate value of the target video is less than the bit rate value lower limit, the target video is encoded according to the bit rate value lower limit.
[0116] If the bit rate value of the target video is less than the bit rate value upper limit and greater than the bit rate value lower limit, encoding is performed on the target video according to the bit rate value of the target video.
[0117] In the embodiment of the present specification, the bit rate value of the target video may be the real-time bit rate of the target video obtained by setting a constant quality factor during the encoding process of the target video. If the bit rate value of the target video is greater than the bit rate value upper limit, the target video may be encoded according to the bit rate value upper limit; if the bit rate value of the target video is less than the bit rate value lower limit, the target video may be encoded according to the bit rate value lower limit, thereby effectively controlling the bit rate and image quality of the target video.
[0118] Of course, if the bit rate value of the target video is between the bit rate value upper limit and the bit rate value lower limit, encoding can be performed directly according to the bit rate value of the target video.
[0119] In the embodiments of the present specification, a video may generally include multiple different target scene categories. When the scene of the video frame changes, the scene category of the video will generally change as well. Therefore, in order to ensure the overall image quality of the video while effectively reducing the overall bit rate of the video, the embodiments of the present specification also split the video to be encoded according to the scenes of the video frames after obtaining the video to be encoded.
[0120] Specifically, before obtaining the target video, it also includes: obtaining the video to be encoded; for the video to be encoded, starting from the first frame image, judging whether the scene of the next frame image is consistent with the scene of the previous frame image, and obtaining a first judgment result; if the first judgment result indicates that the scene of the Nth frame image of the video to be encoded is inconsistent with the scene of the N-1th frame image, then determining that the first frame image to the N-1th frame image of the video to be encoded are the sub-videos to be encoded.
[0121] In order to improve the efficiency of scene determination, the video to be encoded may be divided into video sequences containing a preset number of frames, so that scene determination is performed simultaneously for each video frame sequence.
[0122] Specifically, starting from the first frame image, determining whether the scene of the next frame image is consistent with the scene of the previous frame image, before obtaining the first determination result, may further include: For the video to be encoded, the frame sequence is divided according to a preset number of frames to obtain a video frame sequence including the preset number of frames.
[0123] The step of determining whether the scene of a subsequent frame image is consistent with the scene of a previous frame image from the first frame image to obtain a first determination result may specifically include: For each of the video frame sequences including the preset number of frames, starting from the first frame image, it is determined whether the scene of the next frame image is consistent with the scene of the previous frame image, and a first determination result is obtained.
[0124] In the embodiment of the present specification, the target video may be one sub-video to be encoded or multiple sub-videos to be encoded. It can be understood that the scene categories of the video frame images in any of the sub-videos to be encoded are the same.
[0125] In the embodiment of the present specification, the preset frame number may be 256 frames. Of course, the preset frame number may also be other values set according to actual needs, which is not specifically limited here.
[0126] In the embodiments of the present specification, image recognition technology can be used to determine whether the scene of the subsequent frame image is consistent with the scene of the previous frame image. Specifically, whether the scene of the subsequent frame image is consistent with the scene of the previous frame image can be determined based on the similarity between the subsequent frame image and the previous frame image; if the similarity between the subsequent frame image and the previous frame image is greater than a preset value, it can be considered that the scene of the subsequent frame image is consistent with the scene of the previous frame image; if the similarity between the subsequent frame image and the previous frame image is less than a preset value, it can be considered that the scene of the subsequent frame image has changed compared to the scene of the previous frame image, and then the video frames of the same scene can be determined as a sub-video to be encoded.
[0127] In the embodiments of the present specification, when the scene of a video frame image changes, the target scene category of the video frame image may change; when the scene of a video frame image does not change, the target scene category of the video frame image usually does not change either; therefore, the video frame image of the same scene can be used as a sub-video to be encoded, and when it is determined that the scene of the video frame image has changed, the target scene category to which the video frame image belongs is re-determined, thereby effectively reducing the overall bit rate of the video while ensuring the overall picture quality of the video.
[0128] In an embodiment of the present specification, when the target video includes only one sub-video to be encoded, the determination of the target scene category to which the target video belongs may specifically include: determining the target scene category to which the sub-video to be encoded belongs. When the target video includes multiple sub-videos to be encoded, the determination of the target scene category to which the target video belongs may specifically include: respectively determining the target scene category to which each sub-video to be encoded belongs. It is understandable that when the target video includes multiple sub-videos to be encoded, encoding the target video according to the bit rate value upper limit and the bit rate value lower limit may specifically include: encoding each sub-video to be encoded using the bit rate value upper limit and the bit rate value lower limit associated with the target scene category to which each sub-video to be encoded belongs.
[0129] In the embodiments of this specification, based on Figure 2 With the same idea as the solution shown in , the embodiments of this specification also provide another video bit rate control method. Figure 5 A flowchart of another video bit rate control method provided in an embodiment of this specification. Figure 5 As shown, the process may include the following steps.
[0130] Step 502: Acquire a target video frame sequence.
[0131] In the embodiment of the present specification, the target video frame sequence may be a group of video frame sequences with the same scene and continuous video frames in the video to be encoded in the video library.
[0132] Since the scene of the video frame in the video to be encoded may change, that is, the scene of the next frame may be different from the scene of the previous frame, for example, the picture of the video frame may change from indoor to outdoor. When the scene of the video frame changes, the scene category of the video is very likely to change; and when the scene of the video frame does not change, the scene category of the video usually does not change; therefore, for the video frame in the video to be encoded, it can be first determined whether the scene of the video frame has changed, and a group of video frames with the same scene and continuous video frames are taken as a target video frame sequence. It can be understood that the video to be encoded can be divided into multiple target video frame sequences.
[0133] Since the method for determining whether the scene of a video frame has changed is basically the same as the method described above for determining whether the scene of a subsequent frame image is consistent with the scene of a previous frame image starting from the first frame image, it will not be repeated here.
[0134] Step 504: Determine the target scene category to which the target video frame sequence belongs.
[0135] In the embodiment of this specification, the target video frame sequence may include category labels of multiple dimensions. Figure 2 This has been described in detail in step 204 and will not be repeated here.
[0136] In the embodiment of this specification, the target scene category in step 504 is Figure 2 The target scene category mentioned in step 204 may be consistent, and the method for determining the target scene category of the video to be encoded in step 504 may be consistent with Figure 2 The method for determining the target scene to which the target video belongs in step 204 is basically the same and will not be described in detail here.
[0137] Step 506: Determine an upper limit and a lower limit of a bit rate for encoding the target video frame sequence according to the target scene category to which the target video frame sequence belongs; the upper limit of the bit rate is less than the maximum bit rate determined according to the transmission bandwidth value in the CRF bit rate control method.
[0138] In the embodiment of this specification, the upper limit of the bit rate value in step 506 is Figure 2 The upper limit of the bit rate value mentioned in step 206 may be consistent; it can be understood that the consistency here refers to the meaning and determination method of the upper limit of the bit rate value, rather than the specific value of the upper limit of the bit rate value. At the same time, the method for determining the upper limit of the bit rate value for encoding the target video frame sequence in step 506 can be basically the same as the method for determining the upper limit of the bit rate value for encoding the target video in step 206, and will not be repeated here.
[0139] In the embodiment of this specification, the lower limit of the bit rate value in step 506 is Figure 2The lower limit of the bit rate value mentioned in step 208 may be consistent; it can be understood that the consistency here refers to the meaning and determination method of the lower limit of the bit rate value, rather than the specific value of the lower limit of the bit rate value. At the same time, the method for determining the lower limit of the bit rate value for encoding the target video frame sequence in step 506 can be basically the same as the method for determining the lower limit of the bit rate value for encoding the target video in step 206, and will not be repeated here.
[0140] Step 508: Encode the target video frame sequence according to the bit rate upper limit and the bit rate lower limit.
[0141] In the embodiments of the present specification, the method for encoding the target video frame sequence using the upper and lower bit rate values corresponding to the target video frame sequence may be basically the same as the method for encoding the target video according to the upper and lower bit rate values in the previous text, and will not be repeated here.
[0142] Step 510: Determine whether the target video frame sequence in the video to be encoded has been encoded. If the encoding has not been completed, return to step 502. If the encoding has been completed, the encoding process for the video to be encoded ends.
[0143] Specifically, in an embodiment of the present specification, when it is determined that multiple target video frame sequences in a video to be encoded have not been encoded, the next target video frame sequence can be obtained after the encoding of one target video frame sequence is completed, and then encoded in the same manner until all target video frame sequences in the video to be encoded are encoded.
[0144] Based on the same idea, the embodiments of this specification also provide a device corresponding to the above method. Figure 6 The embodiments of this specification provide corresponding to Figure 2 A schematic diagram of the structure of a video bit rate control device. Figure 6 As shown, the device may include: The first acquisition module 602 is used to acquire a target video.
[0145] The first determination module 604 is configured to determine the target scene category to which the target video belongs.
[0146] The second determination module 606 is used to determine the upper limit of the bit rate value for encoding the target video according to the target scene category to which the target video belongs; the upper limit of the bit rate value is less than the maximum bit rate determined according to the transmission bandwidth value in the CRF bit rate control method.
[0147] The third determination module 608 is configured to determine a lower limit of a bit rate value for encoding the target video according to the target scene category to which the target video belongs.
[0148] The encoding module 610 is configured to encode the target video according to the bit rate upper limit and the bit rate lower limit.
[0149] based on Figure 6 The present specification also provides some specific implementation schemes of the device, which are described below.
[0150] Optional, Figure 6 The device described in the above method may further include: The second acquisition module is used to acquire a video set of a preset scene category.
[0151] The fourth determination module is used to determine, based on the video set of the preset scene category, an upper limit and a lower limit of a bit rate value for encoding the video of the preset scene category.
[0152] Optionally, the fourth determining module may specifically include: The first acquisition unit is used to acquire a first video set of a first preset scene category.
[0153] The first encoding unit is used to encode the first video set by using a plurality of first constant quality factors to obtain a bit rate-quality curve.
[0154] The second acquisition unit is used to acquire a preset second constant quality factor.
[0155] The second encoding unit is used to encode the first video set using the second constant quality factor and multiple sets of preset bit rate pairs to obtain an encoding result; any of the preset bit rate pairs includes a preset bit rate value upper limit and a preset bit rate value lower limit.
[0156] The data point processing unit is used to obtain a plurality of first data points in a bit rate-image quality coordinate system according to the encoding result; the bit rate-image quality coordinate system is a coordinate system where the bit rate-image quality curve is located.
[0157] The bit rate value determining unit is used to determine the bit rate value upper limit and the bit rate value lower limit of the first preset scene category according to the position relationship between the multiple first data points and the bit rate-image quality curve.
[0158] Optionally, the bit rate value determining unit may be specifically configured to: If the positional relationship indicates that there is a second data point among the multiple first data points, then the distance from each of the second data points to the bit rate-image quality curve is calculated; the second data point is a data point whose image quality coordinates are greater than the image quality coordinates of a specific point in the bit rate-image quality curve, and the bit rate coordinates of the specific point are the same as the bit rate coordinates of the second data point.
[0159] The upper limit of the preset bit rate value in the preset bit rate pair corresponding to the second data point with the largest distance is determined as the upper limit of the bit rate value of the first preset scene category.
[0160] The lower limit of the preset bit rate value in the preset bit rate pair corresponding to the second data point with the largest distance is determined as the lower limit of the bit rate value of the first preset scene category.
[0161] Optional, Figure 6 The device described in the above method may further include: A fifth determining module, configured to determine that the first preset scene category is a target scene category; The associating module is used to associate and store the target scene category with the bit rate value upper limit and the bit rate value lower limit.
[0162] Optionally, the bit rate value determining unit may also be used to: If the positional relationship indicates that there is no second data point among the multiple first data points, then the second video set of the second preset scene category is filtered from the first video set of the first preset scene category; the second data point is a data point whose image quality coordinates are greater than the image quality coordinates of a specific point in the bit rate-image quality curve, and the bit rate coordinates of the specific point are the same as the bit rate coordinates of the second data point.
[0163] An upper bit rate value limit and a lower bit rate value limit of the second preset scene category under the first preset scene category are determined based on the second video set.
[0164] Optionally, the first encoding unit may be specifically used for: The first video set is encoded using each of the first constant quality factors to obtain third data points corresponding to each of the first constant quality factors, wherein the third data points are used to reflect the average bit rate and average image quality of the encoded first video set.
[0165] The bit rate-image quality curve is drawn based on each of the third data points.
[0166] Optionally, the second encoding unit may be specifically used for: For one set of preset bit rate pairs among the multiple sets of preset bit rate pairs, the second constant quality factor and the set of preset bit rate pairs are used to encode each video in the first video set to obtain the encoding bit rate and encoding image quality of each video corresponding to the set of preset bit rate pairs.
[0167] Optionally, the data point processing unit may be specifically used for: According to the encoding bit rates of the respective videos, an average bit rate of the first video set encoded based on the second constant quality factor and the set of preset bit rates is determined.
[0168] According to the encoded picture quality of each of the videos, an average picture quality of the first video set encoded based on the second constant quality factor and the set of preset bit rates is determined.
[0169] Based on the average picture quality and the average bit rate, a first data point corresponding to the second constant quality factor and the set of preset bit rate pairs is determined.
[0170] Optionally, the encoding module 610 may be specifically used for: If the bit rate value of the target video is greater than the bit rate value upper limit, the target video is encoded according to the bit rate value upper limit.
[0171] If the bit rate value of the target video is less than the bit rate value lower limit, the target video is encoded according to the bit rate value lower limit.
[0172] If the bit rate value of the target video is less than the bit rate value upper limit and greater than the bit rate value lower limit, encoding is performed on the target video according to the bit rate value of the target video.
[0173] Figure 7 The embodiments of this specification provide corresponding to Figure 2 A schematic diagram of the structure of a video bit rate control device. Figure 7 As shown, the device 700 may include: at least one processor 710; and, A memory 730 in communication with the at least one processor; wherein, The memory 730 stores instructions 720 that can be executed by the at least one processor 710. The instructions are executed by the at least one processor 710 to enable the at least one processor 710 to: Get the target video; Determine the target scene category to which the target video belongs.
[0174] According to the target scene category to which the target video belongs, an upper limit of a bit rate value for encoding the target video is determined; the upper limit of the bit rate value is less than a maximum bit rate determined according to a transmission bandwidth value in a CRF bit rate control method.
[0175] According to the target scene category to which the target video belongs, a lower limit of a bit rate value for encoding the target video is determined.
[0176] The target video is encoded according to the bit rate upper limit and the bit rate lower limit.
[0177] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0178] Each embodiment in this specification is described in a progressive manner. The same or similar parts between the embodiments can be referred to each other. Each embodiment focuses on the differences from other embodiments. Figure 7 As for the device shown, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0179] In the 1990s, it was very clear whether the improvement of a technology was hardware improvement (for example, improvement of the circuit structure of diodes, transistors, switches, etc.) or software improvement (improvement of the method flow). However, with the development of technology, many improvements of the method flow today can be regarded as direct improvements of the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that the improvement of a method flow cannot be implemented with hardware entity modules. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask chip manufacturers to design and make dedicated integrated circuit chips. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one kind of HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.
[0180] The controller may be implemented in any suitable manner, for example, the controller may take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (e.g., software or firmware) executable by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, and the memory controller may also be implemented as part of the control logic of the memory. It is also known to those skilled in the art that, in addition to implementing the controller in a purely computer-readable program code manner, the controller may be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, such a controller may be considered as a hardware component, and the devices for implementing various functions included therein may also be considered as structures within the hardware component. Or even, the devices for implementing various functions may be considered as both software modules for implementing the method and structures within the hardware component.
[0181] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0182] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0183] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0184] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0185] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0186] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0187] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0188] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0189] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules 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 disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined in this article, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0190] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0191] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0192] The present application may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0193] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A video bit rate control method, comprising: Get the target video; Determine a target scene category to which the target video belongs; Determining an upper limit of a bit rate value for encoding the target video according to a target scene category to which the target video belongs; The upper limit of the bit rate value is less than the maximum bit rate determined according to the transmission bandwidth value in the CRF bit rate control mode; Determining a lower limit of a bit rate value for encoding the target video according to a target scene category to which the target video belongs; The target video is encoded according to the bit rate upper limit and the bit rate lower limit.
2. The method according to claim 1, before determining the target scene category to which the target video belongs, further comprising: Obtain a video set of a pre-set scene category; Based on the video set of the preset scene category, an upper limit and a lower limit of a bit rate value for encoding the video of the preset scene category are determined.
3. The method according to claim 2, wherein determining the upper and lower bitrate limits for encoding the video of the preset scene category based on the video set of the preset scene category comprises: Obtain a first video set of a first preset scene category; Encoding the first video set respectively using a plurality of first constant quality factors to obtain a bit rate-quality curve; Obtaining a preset second constant quality factor; Encoding the first video set using the second constant quality factor and multiple groups of preset bit rates to obtain an encoding result; Any of the preset bit rate pairs includes a preset bit rate value upper limit and a preset bit rate value lower limit; According to the encoding result, a plurality of first data points in a bit rate-image quality coordinate system are obtained; the bit rate-image quality coordinate system is a coordinate system where the bit rate-image quality curve is located; According to the positional relationship between the plurality of first data points and the bit rate-quality curve, an upper bit rate value limit and a lower bit rate value limit of the first preset scene category are determined.
4. The method according to claim 3, wherein determining the bit rate upper limit and bit rate lower limit of the first preset scene category according to the positional relationship between the plurality of first data points and the bit rate-quality curve comprises: If the positional relationship indicates that there is a second data point among the plurality of first data points, then calculating the distance between each of the second data points and the bit rate-quality curve; The second data point is a data point whose image quality coordinate is greater than the image quality coordinate of a specific point in the bit rate-image quality curve, and the bit rate coordinate of the specific point is the same as the bit rate coordinate of the second data point; Determine the upper limit of the preset bit rate value in the preset bit rate pair corresponding to the second data point with the largest distance as the upper limit of the bit rate value of the first preset scene category; The lower limit of the preset bit rate value in the preset bit rate pair corresponding to the second data point with the largest distance is determined as the lower limit of the bit rate value of the first preset scene category.
5. The method according to claim 3, after determining the bit rate upper limit and bit rate lower limit of the first preset scene category, further comprising: Determining the first preset scene category as a target scene category; The target scene category is associated with the bit rate value upper limit and the bit rate value lower limit and stored.
6. The method of claim 3, wherein determining the bitrate upper limit and bitrate lower limit of the first preset scene category according to the positional relationship between the plurality of first data points and the bitrate-quality curve further comprises: If the positional relationship indicates that there is no second data point among the plurality of first data points, a second video set of a second preset scene category is selected from the first video set of the first preset scene category; the second data point is a data point whose image quality coordinate is greater than the image quality coordinate of a specific point in the bit rate-image quality curve, and the bit rate coordinate of the specific point is the same as the bit rate coordinate of the second data point; An upper bit rate value limit and a lower bit rate value limit of the second preset scene category under the first preset scene category are determined based on the second video set.
7. The method according to claim 3, wherein the encoding of the first video set using a plurality of first constant quality factors to obtain a bit rate-quality curve comprises: Encoding the first video set using each of the first constant quality factors, respectively, to obtain third data points corresponding to each of the first constant quality factors, wherein the third data points are used to reflect an average bit rate and an average image quality of the encoded first video set; The bit rate-image quality curve is drawn based on each of the third data points.
8. The method according to claim 3, wherein the step of encoding the first video set using the second constant quality factor and multiple sets of preset bit rates to obtain an encoding result comprises: For one set of preset bit rate pairs among the multiple sets of preset bit rate pairs, the second constant quality factor and the set of preset bit rate pairs are used to encode each video in the first video set to obtain the encoding bit rate and encoding image quality of each video corresponding to the set of preset bit rate pairs.
9. The method according to claim 8, wherein obtaining a plurality of first data points in a bit rate-quality coordinate system according to the encoding result specifically comprises: Determining, according to the encoding bitrates of the respective videos, an average bitrate of the first video set encoded based on the second constant quality factor and the set of preset bitrates; Determining, according to the encoded picture quality of each video, an average picture quality of the first video set encoded based on the second constant quality factor and the set of preset bit rates; Based on the average picture quality and the average bit rate, a first data point corresponding to the second constant quality factor and the set of preset bit rate pairs is determined.
10. The method according to claim 1, wherein encoding the target video according to the bit rate upper limit and the bit rate lower limit comprises: If the bit rate value of the target video is greater than the bit rate value upper limit, encoding the target video according to the bit rate value upper limit; If the bit rate value of the target video is less than the bit rate value lower limit, encoding the target video according to the bit rate value lower limit; If the bit rate value of the target video is less than the bit rate value upper limit and greater than the bit rate value lower limit, encoding is performed on the target video according to the bit rate value of the target video.
11. A video bit rate control device, comprising: A first acquisition module, used to acquire a target video; A first determination module, used to determine the target scene category to which the target video belongs; A second determination module, configured to determine an upper limit of a bit rate value for encoding the target video according to a target scene category to which the target video belongs; The upper limit of the bit rate value is less than the maximum bit rate determined according to the transmission bandwidth value in the CRF bit rate control mode; A third determination module, configured to determine a lower limit of a bit rate value for encoding the target video according to a target scene category to which the target video belongs; The encoding module is used to encode the target video according to the bit rate value upper limit and the bit rate value lower limit.
12. The apparatus of claim 11, further comprising: A second acquisition module is used to acquire a video set of a preset scene category; The fourth determination module is used to determine, based on the video set of the preset scene category, an upper limit and a lower limit of a bit rate value for encoding the video of the preset scene category.
13. The apparatus according to claim 12, wherein the fourth determining module specifically comprises: A first acquisition unit, configured to acquire a first video set of a first preset scene category; A first encoding unit, configured to encode the first video set using a plurality of first constant quality factors to obtain a bit rate-quality curve; A second acquisition unit, used to acquire a preset second constant quality factor; A second encoding unit, configured to encode the first video set by using the second constant quality factor and a plurality of sets of preset bit rates to obtain an encoding result; Any of the preset bit rate pairs includes a preset bit rate value upper limit and a preset bit rate value lower limit; A data point processing unit, configured to obtain a plurality of first data points in a bit rate-image quality coordinate system according to the encoding result; the bit rate-image quality coordinate system is a coordinate system where the bit rate-image quality curve is located; The bit rate value determining unit is used to determine the bit rate value upper limit and the bit rate value lower limit of the first preset scene category according to the position relationship between the multiple first data points and the bit rate-image quality curve.
14. A video bit rate control device, comprising: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to: Get the target video; Determine a target scene category to which the target video belongs; Determine an upper limit of a bit rate value for encoding the target video according to a target scene category to which the target video belongs; the upper limit of the bit rate value is less than a maximum bit rate determined according to a transmission bandwidth value in a CRF bit rate control method; Determining a lower limit of a bit rate value for encoding the target video according to a target scene category to which the target video belongs; The target video is encoded according to the bit rate upper limit and the bit rate lower limit.
Citation Information
Patent Citations
Self-adaptive video coding method based on scene
CN110545418A
Video coding method and device and electronic equipment
CN113949874A
Code rate control method for real-time monitoring scene
CN115550655A
Video data transmission control method and device, equipment and storage medium
CN116962844A
Video coding method and device, storage medium and electronic device
CN117082245A
