Video coding parameter processing method, video coding method and related equipment
By dynamically detecting the performance of the client encoder and selecting the optimal encoding frame rate and configuration, the problem of difficulty in balancing cost and user experience in the prior art is solved, and dynamic adjustment and adaptability of video encoding parameters are achieved.
Patent Information
- Application Number
- CN202411516261.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-28
- Publication Date
- 2025-02-07
AI Technical Summary
The prior art is difficult to balance cost with user experience in client video encoding, and cannot dynamically adapt to changes in the hardware and software environment of the client.
By dynamically detecting the performance of the client encoder, selecting the optimal encoding frame rate, the optimal encoder and its optimal configuration, and realizing dynamic adjustment of video encoding parameters.
Improve the adaptability of video encoding, reduce image quality degradation and intensified transmission delay caused by encoder misfit, and balance cost and experience.
Smart Images

Figure CN119402666A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of video processing technology, and in particular to a method for processing video encoding parameters, a video encoding method, a device for processing video encoding parameters, a video encoding device, an electronic device, a computer-readable storage medium, and a computer program product. Background Art
[0002] With the rise of real-time transmission scenarios such as live broadcasting, video conferencing, and cloud gaming, the importance of client video encoding has increased. Client video encoders can be implemented through a variety of encoders. You can choose open source or self-developed software encoders, or you can use the hardware encoding function of integrated graphics cards. Since video encoding directly affects costs (such as compression rate, bandwidth, etc.) and user experience (such as image quality, latency, smoothness, etc.), it is crucial to choose encoders and encoding parameters properly.
[0003] In related technologies, some solutions select fixed encoders and encoding parameters, such as using only software encoders or giving priority to hardware encoders, which makes it impossible to balance cost and experience; some solutions only configure encoders based on test results at the beginning of software release or when a new version is released, ignoring the impact of a wide variety of clients and changes in their status, resulting in encoder incompatibility. Although some solutions optimize configurations through large-scale testing, this not only increases testing costs, but also fails to cope with dynamic changes in client status.
[0004] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0005] The present disclosure provides a method for processing video coding parameters, a video coding method, a device for processing video coding parameters, a video coding device, an electronic device, a computer-readable storage medium and a computer program product, so as to overcome the above problems or at least partially solve the above problems.
[0006] An embodiment of the present disclosure provides a method for processing video encoding parameters, the method comprising: obtaining a preset encoding frame rate and at least one encoder supported by a client; based on the preset encoding frame rate, performing an encoding performance test on the at least one encoder to obtain a test result corresponding to the preset encoding frame rate; if the test result corresponding to the preset encoding frame rate is a pass, determining the preset encoding frame rate as a target encoding frame rate; obtaining at least one optional encoder corresponding to the target encoding frame rate, performing an encoding configuration evaluation on the at least one optional encoder, and obtaining a target encoder and target encoding configuration information of the target encoder.
[0007] In some embodiments of the present disclosure, the method further includes: if the detection result corresponding to the preset coding frame rate is failure, reducing the preset coding frame rate until the detection result corresponding to the reduced preset coding frame rate is a pass, and determining the reduced preset coding frame rate as the target coding frame rate.
[0008] In some embodiments of the present disclosure, the method further includes: for each of the encoders, obtaining a coding configuration information list of the encoder; the coding configuration information in the coding configuration information list is arranged in descending order of coding speed, and the information with the highest coding speed in the coding configuration information list is the first coding configuration information.
[0009] In some embodiments of the present disclosure, based on the preset encoding frame rate, the encoding performance test is performed on the at least one encoder to obtain the test result corresponding to the preset encoding frame rate, including: for each of the encoders, obtaining the first encoding configuration information of the encoder from the encoding configuration information list of the encoder; based on the preset encoding frame rate, the encoding performance test is performed on the encoder according to the first encoding configuration information of the encoder to obtain the test result of the first encoding configuration information corresponding to the encoder; if the test result of the first encoding configuration information corresponding to the encoder is a pass, marking the state parameter of the encoder as an available state; if there is an available state in the state parameter of the at least one encoder, determining that the test result corresponding to the preset encoding frame rate is a pass.
[0010] In some embodiments of the present disclosure, the performing coding configuration evaluation on the at least one optional encoder to obtain a target encoder and target coding configuration information of the target encoder includes: for each of the optional encoders, performing coding configuration evaluation on the coding configuration information in the coding configuration information list of the optional encoder to determine the optimal coding configuration information of the optional encoder; if there is one optional encoder, determining the one optional encoder as the target encoder, and determining the optimal coding configuration information of the one optional encoder as the target coding configuration information; if there are multiple optional encoders, calculating the quality score of each of the multiple optional encoders, selecting a maximum value from the calculated quality scores, determining the optional encoder corresponding to the maximum value as the target encoder, and determining the optimal coding configuration information of the optional encoder corresponding to the maximum value as the target coding configuration information.
[0011] In some embodiments of the present disclosure, the coding configuration evaluation is performed on the coding configuration information in the coding configuration information list of the optional encoder to determine the optimal coding configuration information of the optional encoder, including: if there is one coding configuration information in the coding configuration information list of the optional encoder, determining the one coding configuration information as the optimal coding configuration information of the optional encoder; if there are multiple coding configuration information in the coding configuration information list of the optional encoder, based on the target coding frame rate, performing coding performance detection in the arrangement order of the multiple coding configuration information to obtain the optimal coding configuration information of the optional encoder.
[0012] In some embodiments of the present disclosure, the coding performance test is performed based on the target coding frame rate and in the order of arrangement of the multiple coding configuration information to obtain the optimal coding configuration information of the optional encoder, including: selecting second coding configuration information arranged after the first coding configuration information according to the order of arrangement of the multiple coding configuration information; based on the target coding frame rate, performing a coding performance test on the optional encoder according to the second coding configuration information to obtain a test result of the second coding configuration information; if the test result of the second coding configuration information is passed, selecting the next coding configuration information for coding performance test according to the order of arrangement of the multiple coding configuration information, until the test result of the selected coding configuration information is failed, and determining the previous coding configuration information of the selected coding configuration information as the optimal coding configuration information of the optional encoder; if the test result of the second coding configuration information is failed, determining the first coding configuration information as the optimal coding configuration information of the optional encoder.
[0013] In some embodiments of the present disclosure, the encoding performance test includes: obtaining the encoding frame rate to be detected and the encoding configuration information to be detected; loading a test video; the test video includes multiple test video frames; for each of the test video frames, based on the encoding frame rate to be detected and the encoding configuration information to be detected, encoding the test video frame to obtain the encoding time of the test video frame; calculating the mean of the encoding time of all the test video frames to obtain the average encoding time of the multiple test video frames; analyzing the encoding time of all the test video frames to determine the proportion of slow video frames in the multiple test video frames; if the average encoding time is greater than the unit encoding time, or the slow video frame proportion is greater than the proportion threshold, it is determined that the performance test fails, otherwise, it is determined that the performance test passes; the unit encoding time is determined based on the encoding frame rate to be detected.
[0014] The embodiment of the present disclosure provides a video encoding method, which includes: obtaining a video to be encoded; determining a target encoding frame rate, a target encoder and target encoding configuration information; the target encoding frame rate, the target encoder and the target encoding configuration information are obtained according to the above-mentioned video encoding parameter processing method; using the target encoder, according to the target encoding frame rate and the target encoding configuration information, encoding the video to be encoded.
[0015] The embodiment of the present disclosure provides a device for processing video encoding parameters, the device comprising: a capability detection module, configured to obtain a preset encoding frame rate and at least one encoder supported by a client; an encoding performance detection module, configured to perform an encoding performance detection on the at least one encoder based on the preset encoding frame rate, and obtain a detection result corresponding to the preset encoding frame rate; if the detection result corresponding to the preset encoding frame rate is a pass, determining the preset encoding frame rate as a target encoding frame rate; an encoding configuration evaluation module, configured to obtain at least one optional encoder corresponding to the target encoding frame rate, perform an encoding configuration evaluation on the at least one optional encoder, and obtain a target encoder and target encoding configuration information of the target encoder.
[0016] An embodiment of the present disclosure provides a video encoding device, which includes: a video acquisition module, configured to acquire a video to be encoded; a coding parameter determination module, configured to determine a target coding frame rate, a target encoder and a target coding configuration information; the target coding frame rate, the target encoder and the target coding configuration information are obtained according to the above-mentioned video coding parameter processing method; and an encoding module, configured to use the target encoder to perform encoding processing on the video to be encoded according to the target coding frame rate and the target coding configuration information.
[0017] An embodiment of the present disclosure provides an electronic device, comprising: a processor; a memory for storing processor executable instructions; wherein the processor is configured to execute the executable instructions to implement the above-mentioned video encoding parameter processing method, or to implement the above-mentioned encoding method.
[0018] An embodiment of the present disclosure provides a computer-readable storage medium. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device can execute the above-mentioned video encoding parameter processing method or implement the above-mentioned encoding method.
[0019] An embodiment of the present disclosure provides a computer program product, including a computer program. When the computer program is executed by a processor, the computer program implements the above-mentioned video encoding parameter processing method, or implements the above-mentioned encoding method.
[0020] The method for processing video encoding parameters provided by the embodiment of the present disclosure dynamically detects the performance of the client encoder, selects the optimal encoding frame rate, the optimal encoder and its optimal configuration according to the detection result, avoids selecting a fixed encoder and encoding parameters, improves the adaptability of the encoding, can better adapt to the hardware and software environments of different clients, and reduces problems such as image quality degradation and increased transmission delay caused by encoder incompatibility; and, by dynamically detecting the performance of the client encoder to adjust the encoding configuration, large-scale testing to optimize the configuration is avoided; and, the adaptability of the encoder and the client is ensured, so that better encoding effects can be achieved in different client environments, thereby balancing cost and experience.
[0021] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.
[0023] Figure 1 A schematic diagram showing an exemplary system architecture to which a method for processing video encoding parameters or a video encoding method according to an embodiment of the present disclosure can be applied;
[0024] Figure 2 A flowchart of a method for processing video encoding parameters according to an embodiment of the present disclosure is shown;
[0025] Figure 3 A flowchart of determining video encoding parameters of a client according to an embodiment of the present disclosure is shown;
[0026] Figure 4 A flowchart of performing coding performance detection according to an embodiment of the present disclosure is shown;
[0027] Figure 5 A flow chart showing encoding configuration evaluation of an optional encoder to obtain a target encoder and target encoding configuration information;
[0028] Figure 6 A flowchart of determining optimal encoding configuration information from multiple encoding configuration information of optional encoders according to an embodiment of the present disclosure is shown;
[0029] Figure 7 A flowchart of a video encoding method according to an embodiment of the present disclosure is shown;
[0030] Figure 8 A block diagram showing a device for processing video encoding parameters according to an embodiment of the present disclosure is shown;
[0031] Fig. 9 A block diagram of a video encoding device according to an embodiment of the present disclosure is shown;
[0032] Fig.10 A schematic structural diagram of an electronic device according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0033] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this disclosure will be comprehensive and complete and will fully convey the concepts of the example embodiments to those skilled in the art. The same reference numerals in the figures represent the same or similar parts, and thus their repeated description will be omitted.
[0034] The features, structures or characteristics described in the present disclosure may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known methods, devices, implementations or operations are not shown or described in detail to avoid blurring the various aspects of the present disclosure.
[0035] The collection, collection, updating, analysis, processing, use, transmission, storage and other aspects of the user personal information involved in this disclosure are in compliance with the relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken for user personal information to prevent illegal access to user personal information data and maintain the security of user personal information, network security and national security.
[0036] The accompanying drawings are only schematic diagrams of the present disclosure, and the same reference numerals in the drawings represent the same or similar parts, so their repeated description will be omitted. Some block diagrams shown in the accompanying drawings do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in at least one hardware module or integrated circuit, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0037] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and steps, nor must they be executed in the order described. For example, some steps can be decomposed, and some steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0038] In this specification, the terms "a", "an", "the", "said" and "at least one" are used to indicate the presence of at least one element / component / etc.; the term "plurality" refers to two or more; the terms "comprising", "including" and "having" are used to express an open-ended inclusion and mean that additional elements / components / etc. may exist in addition to the listed elements / components / etc.; the terms "first", "second" and "third" etc. are used only as labels and are not intended to limit the quantity of their objects.
[0039] Figure 1 A schematic diagram showing an exemplary system architecture to which a method for processing video encoding parameters or a video encoding method according to an embodiment of the present disclosure can be applied is shown.
[0040] like Figure 1 As shown, the system architecture may include a server 101, a network 102, and a client 103. The network 102 is used to provide a medium for a communication link between the client 103 and the server 101. The network 102 may include various connection types, such as wired, wireless communication links, or optical fiber cables.
[0041] In an exemplary embodiment, the client 103 for data transmission with the server 101 may include but is not limited to a smart phone, a tablet computer, a laptop computer, a smart speaker, a digital assistant, an AR (Augmented Reality) device, a VR (Virtual Reality) device, a smart wearable device, etc., or the client 103 may also be a personal computer, such as a laptop computer and a desktop computer, etc. Optionally, the operating system running on the electronic device may include but is not limited to Android system, IOS system, Linux, Windows, etc.
[0042] Server 101 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. In some practical applications, server 101 can also be a server of a network platform, which can be, for example, a trading platform, a live broadcast platform, a social platform, or an audio platform, etc., which is not limited in the embodiments of the present disclosure. Among them, the server can be a single server or a cluster formed by multiple servers, and the present disclosure does not limit the specific architecture of the server.
[0043] In some embodiments of the present disclosure, the processing process of the client 101 for video encoding parameters may be: obtaining a preset encoding frame rate and at least one encoder supported by the client; based on the preset encoding frame rate, performing encoding performance detection on at least one encoder to obtain a detection result corresponding to the preset encoding frame rate; if the detection result corresponding to the preset encoding frame rate is passed, determining the preset encoding frame rate as the target encoding frame rate; obtaining at least one optional encoder corresponding to the target encoding frame rate, performing encoding configuration evaluation on at least one optional encoder, and obtaining the target encoder and the target encoding configuration information of the target encoder.
[0044] In addition, it should be noted that Figure 1 What is shown is only one application environment of the method for processing video encoding parameters provided by the present disclosure. Figure 1 The numbers of the clients 103, networks 102 and servers 101 are merely illustrative, and any number of clients, networks and servers may be provided according to actual needs.
[0045] Figure 2 A flowchart of a method for processing video encoding parameters according to an embodiment of the present disclosure is shown. Figure 2 The execution subject of the method provided in the embodiment may be any electronic device, such as Figure 1 The client 103 in the embodiment is also as follows Figure 1 Server 101 in Figure 1 In the embodiment, the server 101 and the client 103 jointly implement the method for processing video encoding parameters, but the present disclosure is not limited thereto. Figure 2 The video encoding parameter processing method provided by the embodiment of the present disclosure includes the following steps.
[0046] Step S210: Obtain a preset encoding frame rate and at least one encoder supported by the client.
[0047] In the disclosed embodiment, the preset encoding frame rate set_fps is a pre-set frame rate standard for video encoding, which determines the number of frames displayed per second in the video. The higher the encoding frame rate, the smoother the video experience can be provided, but it will also increase the encoding complexity and data size.
[0048] In the embodiment of the present disclosure, the preset encoding frame rate set_fps can be preset according to the actual application scenario and user needs. For example, for a video call scenario, the preset encoding frame rate set_fps is set to 15fps; for a cloud game scenario, the preset encoding frame rate set_fps is set to 60fps.
[0049] In the disclosed embodiments, the client may also be referred to as a terminal device, which refers to a device or software that can directly interact with a user and is used to access, process or display data. The client can be connected to a network (such as the Internet, a local area network, etc.) to communicate and exchange data with a server or other clients. Different clients (such as mobile phones, computers, smart TVs, etc.) may support different video encoders, which convert raw video data into compressed video streams for easy storage and transmission.
[0050] In the disclosed embodiment, obtaining at least one encoder supported by the client means determining the encoder available on the client. In one possible implementation, the encoder includes a hardware encoder and a software encoder. For a hardware encoder, it is possible to determine whether the client supports the hardware encoder through the client platform interface; for a software encoder, it is usually possible to directly obtain the software encoder supported by the client. Obtaining at least one encoder supported by the client helps to obtain the hardware and software environment of the client, providing a basis for subsequent performance testing and configuration evaluation.
[0051] Step S220: Based on the preset encoding frame rate, perform encoding performance detection on at least one encoder to obtain a detection result corresponding to the preset encoding frame rate.
[0052] In the disclosed embodiment, a performance test is performed on each encoder supported by the client to evaluate whether the encoder can work effectively at the preset encoding frame rate set_fps. This may include testing the encoding speed, encoded video quality, resource usage (such as CPU and memory usage), etc.
[0053] In the disclosed embodiment, the detection result of the preset encoding frame rate set_fps is obtained based on the performance test of the encoder supported by the client, indicating whether there is an encoder among the encoders supported by the client that can run stably at the preset encoding frame rate set_fps and maintain acceptable video quality and encoding efficiency.
[0054] Step S230: If the detection result corresponding to the preset encoding frame rate is passed, the preset encoding frame rate is determined as the target encoding frame rate.
[0055] In the disclosed embodiment, if the detection result corresponding to the preset encoding frame rate set_fps is passed, it means that the encoder supported by the client has passed the performance test under the preset encoding frame rate set_fps. Then, under the preset encoding frame rate set_fps, good video quality and encoding efficiency can be ensured, and the preset encoding frame rate set_fps is determined as the target encoding frame rate best_set_fps.
[0056] Step S240: obtaining at least one optional encoder corresponding to the target encoding frame rate, performing encoding configuration evaluation on the at least one optional encoder, and obtaining a target encoder and target encoding configuration information of the target encoder.
[0057] In the disclosed embodiment, the optional encoder corresponding to the target encoding frame rate refers to an encoder in the client that passes the performance test at the target encoding frame rate best_set_fps, that is, an encoder in the client that can support the target encoding frame rate.
[0058] In the disclosed embodiment, after obtaining at least one optional encoder corresponding to the target encoding frame rate, the encoding configuration of each optional encoder is evaluated, an optimal encoder is selected as the target encoder, and its optimal encoding configuration information is determined as the target encoding configuration information. Among them, the target encoding frame rate best_set_fps, the target encoder best_codec and the target encoding configuration information best_config will be used in the actual video encoding process to ensure that the output video meets the quality requirements and can be played efficiently.
[0059] The method for processing video encoding parameters provided by the embodiment of the present disclosure dynamically detects the performance of the client encoder, selects the optimal encoding frame rate, the optimal encoder and its optimal configuration according to the detection result, avoids selecting a fixed encoder and encoding parameters, improves the adaptability of the encoding, can better adapt to the hardware and software environments of different clients, and reduces problems such as image quality degradation and increased transmission delay caused by encoder incompatibility; and, by dynamically detecting the performance of the client encoder to adjust the encoding configuration, large-scale testing to optimize the configuration is avoided; and, the adaptability of the encoder and the client is ensured, so that better encoding effects can be achieved in different client environments, thereby balancing cost and experience.
[0060] In some embodiments of the present disclosure, the method for processing video encoding parameters also includes: if the detection result corresponding to the preset encoding frame rate is failure, the preset encoding frame rate is reduced until the detection result corresponding to the reduced preset encoding frame rate is passed, and the reduced preset encoding frame rate is determined as the target encoding frame rate.
[0061] In the disclosed embodiment, if the preset encoding frame rate set_fps fails to pass the encoding performance test, the encoding frame rate will be adjusted until a stably working encoding frame rate is found, that is, the target encoding frame rate best_set_fps.
[0062] In one possible implementation, the specific implementation of adjusting the encoding frame rate is: when the performance test result corresponding to the preset encoding frame rate set_fps fails, the preset encoding frame rate set_fps is reduced to obtain the reduced preset encoding frame rate, and an encoding performance test is performed based on the reduced preset encoding frame rate to evaluate whether it can pass the test. If it fails, the encoding frame rate is continued to be reduced, and the above encoding performance test process is repeated until the performance test result corresponding to the reduced preset encoding frame rate is passed, which means that the encoder supported by the client can support the reduced preset encoding frame rate, and the reduced preset encoding frame rate is determined as the target encoding frame rate best_set_fps. This target encoding frame rate best_set_fps will be used in subsequent encoding processes to ensure video quality and encoding efficiency.
[0063] In the disclosed embodiment, the strategy for reducing the encoding frame rate can be adjusted according to actual needs. In one possible implementation, set_fps = set_fps / fps_thr, where fps_thr is a threshold greater than 1.0, such as being set to 1.2. In another possible implementation, the fixed frame rate can be set to be reduced each time, such as reducing 5fps or 10fps each time. In another possible implementation, adjustments are made based on previous test results. Specifically, the reduction range can be dynamically adjusted based on the reasons for failure of the encoding performance test (such as excessive resource usage, substandard video quality, etc.). After each reduction in the encoding frame rate, a complete encoding performance test should be performed to evaluate whether the reduced encoding frame rate can meet the requirements.
[0064] In the disclosed embodiments, restrictive conditions may be set, for example, a minimum encoding frame rate requirement. If the reduced encoding frame rate is lower than the minimum encoding frame rate, other measures may need to be taken to improve encoding performance, such as optimizing encoder configuration, upgrading hardware, etc.
[0065] The video encoding parameter processing method provided in the embodiment of the present disclosure can automatically adjust the encoding frame rate to adapt to different clients and network environments, thereby ensuring the stability and efficiency of video encoding.
[0066] In some embodiments of the present disclosure, the method for processing video encoding parameters further includes: for each encoder, obtaining an encoding configuration information list of the encoder, wherein the encoding configuration information in the encoding configuration information list is arranged in descending order of encoding speed, and the information with the highest encoding speed in the encoding configuration information list is the first encoding configuration information.
[0067] In an embodiment of the present disclosure, for each encoder supported by the client, a coding configuration information list list of the encoder is obtained, and the list is used to store the coding configuration information of the encoder, and the coding configuration information in the list is defined as set_config_1, set_config_2, ..., set_config_n in descending order of coding speed, where n is the number of information in the configuration list list, and a fixed value or an adaptive configuration can be selected according to the actual application scenario, among which the information set_config_1 with the highest coding speed is called the first coding configuration information.
[0068] In the disclosed embodiment, the greater the encoding speed of the encoding configuration information, the lower the encoding efficiency, that is, the encoding configuration information in the encoding configuration information list is arranged in the order of decreasing encoding speed and increasing encoding efficiency. This means that in the encoding configuration information list, the front encoding configuration information has a higher encoding speed but a relatively low encoding efficiency, while the back encoding configuration information has a lower encoding speed but a higher encoding efficiency. It should be noted that the encoding efficiency in the disclosed embodiment is a relative concept, which generally refers to the video quality that can be achieved at a given encoding speed. In practical applications, there is often a balance between encoding speed and encoding efficiency.
[0069] In a possible implementation, if the encoder is a hardware encoder, a hard-coded configuration list hw_list is obtained, wherein the information in the hard-coded configuration list hw_list is arranged in descending order of encoding speed and increasing encoding efficiency and is defined as set_config_hw_1, set_config_hw_2, ..., set_config_hw_n1, where n1 is the number of information in the hard-coded configuration list hw_list, and a fixed value or an adaptive configuration can be selected according to the actual application scenario.
[0070] In a possible implementation, if the encoder is a software encoder, a software configuration list sw_list is obtained, wherein the information in the software configuration list sw_list is arranged in the order of decreasing encoding speed and increasing encoding efficiency and is defined as set_config_sw_1, set_config_sw_2, ..., set_config_sw_n2, where n2 is the number of information in the software configuration list sw_list, and a fixed value or an adaptive configuration can be selected according to the actual application scenario.
[0071] In the method for processing video encoding parameters provided by the embodiment of the present disclosure, the information in the encoding configuration list of the encoder is arranged in descending order of encoding speed, and the first encoding configuration information that is arranged at the front can be used to subsequently perform encoding performance detection on the encoder, which helps to give priority to using the encoding configuration information with the highest speed to evaluate whether the encoder supports a preset encoding frame rate when resources are limited, thereby optimizing resource utilization; and, subsequently, the optimal encoding configuration information can be determined in descending order of encoding speed, thereby finding the best balance between performance and efficiency.
[0072] In some embodiments of the present disclosure, based on a preset encoding frame rate, an encoding performance test is performed on at least one encoder to obtain a test result corresponding to the preset encoding frame rate, including: for each encoder, obtaining the first encoding configuration information of the encoder from the encoding configuration information list of the encoder; based on the preset encoding frame rate, an encoding performance test is performed on the encoder according to the first encoding configuration information of the encoder to obtain a test result of the first encoding configuration information corresponding to the encoder; if the test result of the first encoding configuration information corresponding to the encoder is a pass, marking a state parameter of the encoder as an available state; if an available state exists in the state parameter of at least one encoder, determining that the test result corresponding to the preset encoding frame rate is a pass.
[0073] In the disclosed embodiment, for each encoder supported by the client, an encoding performance test is performed on the encoder in the following manner to determine whether the encoder supports the preset encoding frame rate: the first encoding configuration information set_config_1, that is, the encoding configuration information with the fastest encoding speed, is obtained from the encoding configuration information list list of the encoder; then, an encoding performance test is performed on the encoder according to the preset encoding frame rate set_fps and the first encoding configuration information set_config_1 to obtain a test result of the first encoding configuration information corresponding to the encoder; if the test result of the first encoding configuration information corresponding to the encoder is passed, the status parameter of the encoder is marked as available.
[0074] In the disclosed embodiment, after obtaining the detection results of the first encoding configuration information corresponding to all encoders supported by the client, it is determined whether there is a pass in these detection results, that is, whether the state parameters of at least one encoder among the state parameters of all encoders are in an available state. If so, it means that at least one encoder among all encoders supports the preset encoding frame rate set_fps. In this case, it is determined that the detection result corresponding to the preset encoding frame rate is a pass. If not, it means that all encoders do not support the preset encoding frame rate set_fps, and it is determined that the detection result corresponding to the preset encoding frame rate is a fail.
[0075] The video encoding parameter processing method provided by the embodiment of the present disclosure is that for each encoder supported by the client, if its first encoding configuration information (i.e., the fastest encoding configuration information) can pass the performance test of the preset encoding frame rate, then it can be reasonably inferred that under a lower encoding speed configuration, its encoding efficiency is higher and can also support the preset encoding frame rate. Therefore, by using the first encoding configuration information (i.e., the fastest encoding configuration information) to determine whether the preset encoding frame rate is supported, the encoder that can support the preset encoding frame rate can be quickly screened out, reducing the time required to test each encoding configuration information one by one, and improving the detection efficiency.
[0076] For ease of understanding, a specific embodiment is provided to illustrate the process of determining video encoding parameters. Figure 3 A flowchart of determining video encoding parameters of a client according to an embodiment of the present disclosure is shown. Figure 3 The embodiment shown is described by taking the number of hardware encoders and software encoders as 1 as an example. The hardware encoder has a hard-coded configuration list hw_list, wherein the information in the hard-coded configuration list hw_list is defined as set_config_hw_1, set_config_hw_2, ..., set_config_hw_n1 in the order of decreasing coding speed and increasing coding efficiency. The software encoder has a soft-coded configuration list sw_list, wherein the information in the soft-coded configuration list sw_list is defined as set_config_sw_1, set_config_sw_2, ..., set_config_sw_n2 in the order of decreasing coding speed and increasing coding efficiency.
[0077] Reference Figure 3 , follow the steps below to determine the client's video encoding parameters.
[0078] Step S301, obtain a preset encoding frame rate set_fps, set a hard encoding support parameter hw_support to 0, and set a soft encoding support parameter sw_support to 0.
[0079] Step S302: Detect whether the client supports the hardware encoder, for example, by querying the API interface of the client platform.
[0080] Step 303: If the hardware encoder is not supported, the hard-coding support parameter hw_support is maintained at 0, indicating that the hardware encoder is not supported.
[0081] Step S304: If the hardware encoder is supported, the fastest hard-coded configuration set_config_hw_1 in the hard-coded configuration list hw_list is loaded to perform encoding performance test.
[0082] Step S305 , if the encoding performance detection result is passed, indicating that the hardware encoder can support encoding of the preset encoding frame rate set_fps under the configuration set_config_hw_1, the hard encoding support parameter hw_support is set to 1, otherwise the hard encoding support parameter hw_support is maintained at 0.
[0083] Step S306, loading the fastest hard-coding configuration set_config_sw_1 in the soft-coding configuration list sw_list, and performing a coding performance test.
[0084] Step S307 , if the encoding performance detection result is passed, indicating that the software encoder can support encoding of the preset encoding frame rate set_fps under the configuration set_config_sw_1, the software encoding support parameter sw_support is set to 1, otherwise the software encoding support parameter sw_support remains at 0.
[0085] Step S308: Determine whether the value of hw_support+sw_support is 0.
[0086] Step S309, if the value of hw_support+sw_support is 0, it means that the client cannot support the preset encoding frame rate set_fps, so set_fps=set_fps / fps_thr, where fps_thr is greater than 1, such as 1.2, and return to step S301.
[0087] Step S310: If the value of hw_support+sw_support is 0, determine whether the value of hw_support+sw_support is 1.
[0088] Step S311, if the value of hw_support+sw_support is 1, it means that only one of the hardware encoder and the software encoder supports set_fps, and test_quality is set to 0, that is, there is no need to compare the compression performance and image quality of the hardware encoder and the software encoder.
[0089] Step S312, if the value of hw_support+sw_support is not 1, that is, 2, it means that both the hardware encoder and the software encoder support set_fps, and test_quality=1 is set. Subsequently, the compression performance and image quality of the hardware encoder and the software encoder need to be compared.
[0090] Step S313: perform coding configuration evaluation to obtain a target encoder best_codec and a target coding configuration best_config.
[0091] exist Figure 3 In the illustrated embodiment, it is first determined whether the client supports the hardware encoder. If the client supports the hardware encoder, the encoding performance of the hardware encoder is tested based on the preset encoding frame rate, and the encoding performance of the software encoder is tested based on the preset encoding frame rate; then, if both the hard-coding support result and the soft-coding support result are supported, the preset encoding frame rate is reduced, and then the encoding performance test is performed using the reduced preset encoding frame rate; if the hard-coding support result and / or the soft-coding support result are supported, the encoding configuration evaluation is performed, and finally the target encoder and target encoding configuration are obtained. In this way, the encoder performance test is performed using the configuration information with the fastest encoding speed of the hardware encoder and the software encoder, and the logic of actively reducing the encoding frame rate and continuing the test when the performance is insufficient is added, which can alleviate the jamming of low-end models or abnormal clients.
[0092] Figure 4 FIG. 1 is a flowchart of performing coding performance detection according to an embodiment of the present disclosure. Figure 4 , follow the steps below to perform encoding performance testing.
[0093] Step S401, obtaining the frame rate of the code to be detected and the configuration information of the code to be detected.
[0094] The coding frame rate to be detected and the coding configuration information to be detected can be understood as parameters for coding performance testing. In a possible implementation, a coding performance detection module can be set to input the coding frame rate to be detected and the coding configuration information to be detected into the coding performance detection module for coding performance testing.
[0095] In the above embodiment, based on the preset encoding frame rate, the encoding performance of the encoder is detected according to the first encoding configuration information of the encoder, and the detection result of the first encoding configuration information corresponding to the encoder is obtained. In this case, the preset encoding frame rate set_fps is confirmed as the encoding frame rate to be detected, and the first encoding configuration information corresponding to the encoder is determined as the encoding configuration information to be detected, and is input into the encoding performance detection module for encoding performance detection.
[0096] Step S402, loading a test video; the test video includes a plurality of test video frames.
[0097] The test video is a pre-set or temporarily issued video used for coding performance detection. The test video includes k test video frames, where k is an integer greater than 1.
[0098] Step S403 : for each test video frame, encoding processing is performed on the test video frame based on the encoding frame rate to be detected and the encoding configuration information to be detected, so as to obtain the encoding time of the test video frame.
[0099] For each test video frame (frame number is i), the test video frame is encoded using the encoding frame rate to be detected and the encoding configuration information to be detected, and the encoding time time_i of the test video frame is recorded in milliseconds.
[0100] Step S404: average the encoding time of all the test video frames to obtain the average encoding time of the multiple test video frames.
[0101] The total encoding time encode_time of k test video frames is counted, that is, encode_time=time_0+time_1+…+time_k-1, and then the total encoding time encode_time is averaged to obtain the average encoding time of k test video frames as encode_time / k.
[0102] Step S405 , analyzing the encoding time of all the test video frames to determine the ratio of slow video frames in the multiple test video frames.
[0103] Analyze the encoding time time_i of each test video frame (frame sequence is i) to determine whether the test video frame is a slow video frame. In a possible implementation, a slow video frame can be defined as a frame that satisfies the encoding time time_i>slow_thr1*1000 / set1_fps, where slow_thr1 is a threshold greater than 1 and set1_fps is the encoding frame rate to be tested.
[0104] After analyzing k test video frames, the number of slow video frames slow_cnt in the k test video frames is counted, and then the ratio of slow video frames slow_cnt / k in the k test video frames is calculated.
[0105] Step S406, determining whether the average encoding time is greater than the unit encoding time or whether the slow video frame ratio is greater than the ratio threshold, if so, executing step S407, otherwise, executing step S408.
[0106] Step S407: determine whether the performance test fails.
[0107] Step S408: determine whether the performance test has passed.
[0108] The unit encoding time is determined according to the encoding frame rate set1_fps to be detected. The encoding frame rate refers to how many frames of video can be encoded per second s, that is, the number of frames that can be encoded per second s. For example, if the encoding frame rate is 24fps, it means that 24 frames of video can be encoded per second. The unit encoding time refers to the unit time required to encode one frame of video. The unit encoding time is set to 1000 milliseconds (i.e. 1 second) divided by the number of frames that can be encoded per second (set1_fps), that is, 1000 / set1_fps, which is actually calculating the unit time length required to encode each frame of video.
[0109] Determine whether encode_time / k>1000 / set1_fps or slow_cnt / k>slow_thr2 is satisfied, where slow_thr2 is a threshold greater than 0 and less than or equal to 1.0. If satisfied, it means that the average encoding time is too long to support the frame rate of set1_fps, or there are too many slow frames and the encoding frame rate stability is poor. Therefore, it is determined that the performance test fails. If not satisfied, it is determined that the performance test passes.
[0110] In some embodiments of the present disclosure, after determining that the performance test has passed, the bitstream encoded under the encoding frame rate to be detected and the encoding configuration information to be detected is saved, so that the encoding quality score can be obtained based on the bitstream later.
[0111] In the video encoding parameter processing method provided by the embodiment of the present disclosure, the encoding performance detection scheme can effectively evaluate the performance of the parameters that need to be encoded performance detected by comprehensively considering the average encoding time and the slow video frame ratio; by setting the unit encoding time and ratio thresholds, the performance standard of video encoding is ensured, and encoding performance detection based on the encoding performance detection scheme can improve the stability of the encoding frame rate and reduce the risk of frame rate drop and poor fluency during communication.
[0112] Figure 5 A flowchart of evaluating the encoding configuration of an optional encoder to obtain a target encoder and target encoding configuration information is shown. Figure 5 , follow the steps below to evaluate the encoding configuration of the optional encoder to obtain the target encoder and target encoding configuration information.
[0113] Step S501: for each optional encoder, perform encoding configuration evaluation on the encoding configuration information in the encoding configuration information list of the optional encoder to determine the optimal encoding configuration information of the optional encoder.
[0114] In the disclosed embodiment, the optional encoder corresponding to the target encoding frame rate refers to an encoder in the client that passes the performance test at the target encoding frame rate best_set_fps, that is, an encoder in the client that can support the target encoding frame rate. In a possible implementation, it can be determined whether the encoder is an optional encoder by determining whether the state parameter of the encoder is in an available state, that is, if the state parameter of a certain encoder is in an available state, the encoder is an optional encoder.
[0115] For each optional encoder, encoding configuration evaluation is performed on the encoding configuration information in the encoding configuration information list of the optional encoder to obtain optimal encoding configuration information.
[0116] Step S502: If there is an optional encoder, determine an optional encoder as a target encoder, and determine optimal encoding configuration information of an optional encoder as target encoding configuration information.
[0117] In the disclosed embodiment, if there is only one optional encoder, the optional encoder is directly determined as the target encoder best_codec, and the optimal encoding configuration information of the optional encoder is the target encoding configuration information best_config.
[0118] by Figure 3 The explanation is continued by taking the example that the number of hardware encoders and software encoders shown are both 1. If test_quality is 0, it means that the optional encoders only include hardware encoders, or only include software encoders. In this case, there is no need to compare the compression performance and picture quality of the hardware encoder and the software encoder. The optional encoder is directly determined to be the target encoder best_codec, and the optimal encoding configuration information of the optional encoder is the target encoding configuration information best_config.
[0119] Step S503, if there are multiple optional encoders, calculate the quality score of each of the multiple optional encoders, select the maximum value from the calculated quality scores, determine the optional encoder corresponding to the maximum value as the target encoder, and determine the optimal encoding configuration information of the optional encoder corresponding to the maximum value as the target encoding configuration information.
[0120] In the disclosed embodiment, if there are multiple optional encoders, the quality score of each optional encoder is calculated, the maximum value is selected from the calculated quality scores, the optional encoder corresponding to the maximum value is determined as the target encoder best_codec, and the optimal encoding configuration information of the optional encoder corresponding to the maximum value is determined as the target encoding configuration information best_config.
[0121] by Figure 3The explanation is continued by taking the example that the number of hardware encoders and software encoders shown are both 1. If test_quality is 1, it means that the optional encoders include hardware encoders and software encoders. In this case, it is necessary to compare the compression performance and picture quality of the hardware encoder and the software encoder, calculate the quality score of the hardware encoder and the quality score of the software encoder, select the maximum value from the two quality scores, determine the encoder corresponding to the maximum value as the target encoder best_codec, and determine the optimal encoding configuration information of the encoder corresponding to the maximum value as the target encoding configuration information best_config.
[0122] In the disclosed embodiment, the quality score can be calculated by using methods such as Peak Signal-to-Noise Ratio (PSNR), Structural Similarity (SSIM), and Video Multi-method Assessment Fusion (VMAF). Other quality indicators such as color fidelity and brightness uniformity can also be calculated according to specific needs. When selecting quality evaluation indicators, it is necessary to comprehensively consider factors such as evaluation accuracy, computational complexity, and actual application scenarios. Finally, a quality score is obtained based on the comprehensive performance of these indicators to evaluate the encoding quality of the encoder.
[0123] In the method for processing video encoding parameters provided by the embodiments of the present disclosure, the encoding configuration information of each optional encoder is evaluated one by one, which can ensure that the optimal configuration of each optional encoder is found, and the accuracy of the configuration selection is guaranteed. When there are multiple encoders, the optimal encoder and its configuration can be quickly determined by calculating the quality score and selecting the maximum value, thereby improving processing efficiency.
[0124] In some embodiments of the present disclosure, a coding configuration evaluation is performed on the coding configuration information in the coding configuration information list of the optional encoder to determine the optimal coding configuration information of the optional encoder, including: if there is one coding configuration information in the coding configuration information list of the optional encoder, then determining one coding configuration information as the optimal coding configuration information of the optional encoder; if there are multiple coding configuration information in the coding configuration information list of the optional encoder, then based on the target coding frame rate, performing coding performance detection in the arrangement order of the multiple coding configuration information to obtain the optimal coding configuration information of the optional encoder.
[0125] In the disclosed embodiment, for each optional encoder, the number of encoding configuration information in the encoding configuration list of the optional encoder is first determined. If there is only one encoding configuration information, the encoding configuration information is directly determined to be the optimal encoding configuration information of the optional encoder. If there are multiple encoding configuration information, encoding information detection is performed on these encoding configuration information based on the target encoding frame rate to obtain the optimal encoding configuration information.
[0126] In the method for processing video encoding parameters provided by the embodiment of the present disclosure, when the encoding configuration information list of the optional encoder contains only one encoding configuration information, the encoding configuration information is directly determined as the optimal encoding configuration information, which simplifies the processing flow and improves efficiency; when there are multiple encoding configuration information, by performing encoding performance detection based on the target encoding frame rate and in sequence, the encoding configuration information that best matches the target frame rate and has the best performance can be accurately identified.
[0127] In a possible implementation, the coding performance test may be performed according to the arrangement order of the coding configuration information in the coding configuration list to obtain the optimal coding configuration information, such as Figure 6 shown. Figure 6 The flowchart of determining the optimal encoding configuration information from multiple encoding configuration information of the optional encoder according to the embodiment of the present disclosure is shown. Figure 6 , determine the optimal encoding configuration information from multiple encoding configuration information according to the following steps.
[0128] Step 601: select second coding configuration information arranged after first coding configuration information according to the arrangement order of multiple coding configuration information.
[0129] In the disclosed embodiment, for each optional encoder, the encoding configuration information in its encoding configuration information list list is defined as set_config_1, set_config_2, ..., set_config_n in descending order of encoding speed, and the information set_config_1 with the highest encoding speed is the first encoding configuration information.
[0130] In the disclosed embodiment, the optional encoder corresponding to the target encoding frame rate refers to an encoder in the client that passes the performance test at the target encoding frame rate best_set_fps, and the encoding performance test is performed based on the first encoding configuration information set_config_1, that is, the test result of the first encoding configuration information is passed, so the next encoding configuration information, that is, the second encoding configuration information set_config_2 is selected for encoding performance test.
[0131] Step 602: Based on the target encoding frame rate, encoding performance detection is performed on the optional encoder according to the second encoding configuration information to obtain a detection result of the second encoding configuration information.
[0132] In the embodiment of the present disclosure, the target encoding frame rate best_set_fps is determined as the encoding frame rate to be detected, and the second encoding configuration information set_config_2 is determined as the encoding configuration information to be detected. Figure 4 The coding performance detection scheme shown is used to perform coding performance detection to obtain the detection result of the second coding configuration information set_config_2.
[0133] Step S603, if the detection result of the second coding configuration information is passed, then according to the arrangement order of multiple coding configuration information, select the next coding configuration information for coding performance detection, until the detection result of the selected coding configuration information is failed, and the previous coding configuration information of the selected coding configuration information is determined as the optimal coding configuration information of the optional encoder.
[0134] Step S604: If the detection result of the second coding configuration information is failure, determine that the first coding configuration information is the optimal coding configuration information of the optional encoder.
[0135] In the present disclosure embodiment, according to Figure 4 The coding performance detection scheme shown is used to detect coding performance. The coding performance detection scheme can effectively evaluate the performance of parameters that need to be detected by coding performance by comprehensively considering the average coding time and the slow video frame ratio.
[0136] Since the coding configuration information in the coding configuration information list is arranged in descending order of coding speed, the coding speed of the second coding configuration information set_config_2 is greater than the coding speed of the coding configuration information arranged after the second coding configuration information set_config_2, if the detection result of the second coding configuration information set_config_2 is failed, that is, the average encoding time corresponding to the second coding configuration information set_config_2 exceeds the unit encoding time, or the slow video frame ratio corresponding to the second coding configuration information set_config_2 is greater than the ratio threshold, then the performance test result of the coding configuration information arranged after the second coding configuration information set_config_2 is also failed.
[0137] Based on the above analysis, if the detection result of the second coding configuration information set_config_2 is not passed, the first coding configuration information is directly determined to be the optimal coding configuration information. If the detection result of the second coding configuration information set_config_2 is passed, the next coding configuration information is selected for coding performance detection according to the arrangement order of the coding configuration information in the coding configuration information list list, and the coding performance detection is stopped when the detection result of the selected coding configuration information is not passed, and the previous coding configuration information of the selected coding configuration information is determined as the optimal coding configuration information.
[0138] In the embodiments of the present disclosure, in addition to performing coding performance detection on the coding configuration information in the coding configuration information list in the coding order to obtain the optimal coding configuration information, other schemes may also be used to obtain the optimal coding configuration information, such as using a binary search method to determine the optimal coding configuration information, which is not limited in the embodiments of the present disclosure.
[0139] In the method for processing video encoding parameters provided by the embodiment of the present disclosure, the encoding configuration information is detected in the encoding order, and the detection is stopped once the encoding configuration information that fails the performance detection result is found, thereby avoiding blindly trying all the encoding configuration information, reducing unnecessary calculations and time consumption, and improving the detection efficiency; and the current optimal encoding configuration of the client can be detected in real time, that is, the encoding configuration information with the highest compression rate / image quality is found, thereby reducing costs.
[0140] Figure 7 A flowchart of a video encoding method according to an embodiment of the present disclosure is shown. Figure 7 The execution subject of the method provided in the embodiment may be any electronic device, such as Figure 1 The client 103 in the embodiment is also as follows Figure 1 Server 101 in Figure 1 In the embodiment, the server 101 and the client 103 jointly implement the method for processing video encoding parameters, but the present disclosure is not limited thereto. Figure 7 , the video encoding method provided by the embodiment of the present disclosure includes the following steps.
[0141] Step S710, obtaining a video to be encoded.
[0142] Step S720, determining a target encoding frame rate, a target encoder and target encoding configuration information; wherein the target encoding frame rate, the target encoder and the target encoding configuration information are obtained according to the above-mentioned video encoding parameter processing method.
[0143] Step S730: using a target encoder, encoding the video to be encoded according to the target encoding frame rate and the target encoding configuration information.
[0144] In the disclosed embodiment, before video encoding and real-time transmission, if the user has just started the application but has not yet performed functions such as video calls, the target encoding frame rate best_set_fps, target encoder best_codec, and target encoding configuration information best_config are obtained through the processing method of the video encoding parameters of the above embodiment. At this time, the target encoding frame rate best_set_fps, target encoder best_codec, and target encoding configuration information best_config are the optimal options that can take into account cost (compression rate, bandwidth) and experience (image quality, delay, smoothness) in the current state. After entering video encoding and real-time transmission, the target encoding frame rate best_set_fps, target encoder best_codec, and target encoding configuration information best_config are used for encoding processing.
[0145] It can be understood that the same / similar parts between the various embodiments of the above method in this specification can refer to each other, and each embodiment focuses on the differences from other embodiments. For related points, please refer to the description of other method embodiments.
[0146] Figure 8 FIG. 4 is a block diagram showing a video encoding parameter processing device according to an embodiment of the present disclosure. Figure 8 As shown, the device 800 includes a capability detection module 810 , a coding performance detection module 820 and a coding configuration evaluation module 830 .
[0147] Among them, the capability detection module 810 is configured to: obtain a preset encoding frame rate and at least one encoder supported by the client. The encoding performance detection module 820 is configured to: based on the preset encoding frame rate, perform encoding performance detection on at least one encoder to obtain a detection result corresponding to the preset encoding frame rate; if the detection result corresponding to the preset encoding frame rate is passed, the preset encoding frame rate is determined to be the target encoding frame rate. The encoding configuration evaluation module 830 is configured to: obtain at least one optional encoder corresponding to the target encoding frame rate, perform encoding configuration evaluation on at least one optional encoder, and obtain the target encoder and the target encoding configuration information of the target encoder.
[0148] In some embodiments of the present disclosure, the encoding performance detection module 820 is further configured to: if the detection result corresponding to the preset encoding frame rate is failure, the preset encoding frame rate is reduced until the detection result corresponding to the reduced preset encoding frame rate is a pass, and the reduced preset encoding frame rate is determined as the target encoding frame rate.
[0149] In some embodiments of the present disclosure, the capability detection module 810 is further configured to: for each encoder, obtain a coding configuration information list of the encoder; the coding configuration information in the coding configuration information list is arranged in descending order of coding speed, and the information with the largest coding speed in the coding configuration information list is the first coding configuration information.
[0150] In some embodiments of the present disclosure, the encoding performance detection module 820 is further configured to: for each encoder, obtain the first encoding configuration information of the encoder from the encoding configuration information list of the encoder; based on the preset encoding frame rate, perform encoding performance detection on the encoder according to the first encoding configuration information of the encoder, and obtain the detection result of the first encoding configuration information corresponding to the encoder; if the detection result of the first encoding configuration information corresponding to the encoder is passed, mark the state parameter of the encoder as an available state; if there is an available state in the state parameters of at least one encoder, determine that the detection result corresponding to the preset encoding frame rate is passed.
[0151] In some embodiments of the present disclosure, the coding configuration evaluation module 830 is further configured to: for each optional encoder, perform coding configuration evaluation on the coding configuration information in the coding configuration information list of the optional encoder, and determine the optimal coding configuration information of the optional encoder; if there is an optional encoder, determine an optional encoder as the target encoder, and determine the optimal coding configuration information of the optional encoder as the target coding configuration information; if there are multiple optional encoders, calculate the quality score of each of the multiple optional encoders, select the maximum value from the calculated quality scores, determine the optional encoder corresponding to the maximum value as the target encoder, and determine the optimal coding configuration information of the optional encoder corresponding to the maximum value as the target coding configuration information.
[0152] In some embodiments of the present disclosure, the coding configuration evaluation module 830 is further configured to: if there is a coding configuration information in the coding configuration information list of the optional encoder, then determine the coding configuration information as the optimal coding configuration information of the optional encoder; if there are multiple coding configuration information in the coding configuration information list of the optional encoder, then based on the target coding frame rate, perform coding performance detection in the arrangement order of the multiple coding configuration information to obtain the optimal coding configuration information of the optional encoder.
[0153] In some embodiments of the present disclosure, the coding configuration evaluation module 830 is further configured to: select second coding configuration information arranged after the first coding configuration information according to the arrangement order of multiple coding configuration information; based on the target coding frame rate, perform coding performance detection on the optional encoder according to the second coding configuration information to obtain the detection result of the second coding configuration information; if the detection result of the second coding configuration information is passed, select the next coding configuration information for coding performance detection according to the arrangement order of the multiple coding configuration information until the detection result of the selected coding configuration information is failed, and determine the previous coding configuration information of the selected coding configuration information as the optimal coding configuration information of the optional encoder; if the detection result of the second coding configuration information is failed, determine the first coding configuration information as the optimal coding configuration information of the optional encoder.
[0154] In some embodiments of the present disclosure, the encoding performance detection module 820 is further configured to: obtain the encoding frame rate to be detected and the encoding configuration information to be detected; load a test video; the test video includes multiple test video frames; for each test video frame, based on the encoding frame rate to be detected and the encoding configuration information to be detected, encode the test video frame to obtain the encoding time of the test video frame; calculate the mean of the encoding time of all test video frames to obtain the average encoding time of multiple test video frames; analyze the encoding time of all test video frames to determine the proportion of slow video frames in the multiple test video frames; if the average encoding time is greater than the unit encoding time, or the proportion of slow video frames is greater than the proportion threshold, it is determined that the performance test fails, otherwise, it is determined that the performance test passes; the unit encoding time is determined based on the encoding frame rate to be detected.
[0155] Fig. 9 FIG. 4 is a block diagram of a video encoding device according to an embodiment of the present disclosure. Fig. 9 As shown, the device 900 includes a video acquisition module 910 , a coding parameter determination module 920 and a coding module 930 .
[0156] The video acquisition module 910 is configured to acquire the video to be encoded. The encoding parameter determination module 920 is configured to determine the target encoding frame rate, the target encoder and the target encoding configuration information; wherein the target encoding frame rate, the target encoder and the target encoding configuration information are obtained according to the above-mentioned video encoding parameter processing method. The encoding module 930 is configured to use the target encoder to encode the video to be encoded according to the target encoding frame rate and the target encoding configuration information.
[0157] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0158] Fig.10 FIG. 1 is a schematic diagram showing the structure of an electronic device according to an embodiment of the present disclosure. It should be noted that: Fig.10 The electronic device 1000 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0159] like Fig.10 As shown, the electronic device 1000 is in the form of a general computing device. The components of the electronic device 1000 may include but are not limited to: the at least one processing unit 1010, the at least one storage unit 1020, and a bus 1030 connecting different system components (including the storage unit 1020 and the processing unit 1010).
[0160] The storage unit stores program codes, which can be executed by the processing unit 1010, so that the processing unit 1010 performs the steps according to various exemplary embodiments of the present invention described in the above “Exemplary Method” section of this specification. For example, the processing unit 1010 can perform the following steps: Figure 2 Follow the steps shown in .
[0161] The storage unit 1020 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 10201 and / or a cache storage unit 10202 , and may further include a read-only storage unit (ROM) 10203 .
[0162] The storage unit 1020 may also include a program / utility 10204 having a set (at least one) of program modules 10205, such program modules 10205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0163] Bus 1030 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0164] The electronic device 1000 may also communicate with one or more external devices 1100 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 1000, and / or communicate with any device that enables the electronic device 1000 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 1050. Furthermore, the electronic device 1000 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 1040. As shown, the network adapter 1040 communicates with other modules of the electronic device 1000 via a bus 1030. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 1000, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0165] In an exemplary embodiment of the present disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of the present specification is stored. In some possible implementations, various aspects of the present invention can also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary embodiments of the present invention described in the above "Exemplary Method" section of the present specification.
[0166] The program product for implementing the above method according to the embodiment of the present invention may adopt a portable compact disk read-only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto, and in this document, a readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, apparatus, or device.
[0167] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0168] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0169] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
[0170] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0171] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.
[0172] In addition, although the steps of the method in the present disclosure are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.
[0173] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the implementation of the present disclosure.
[0174] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any modification, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are to be considered as exemplary only, and the true scope and spirit of the present disclosure are indicated by the appended claims.
[0175] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A method for processing video encoding parameters, characterized in that: The method comprises: Obtain a preset encoding frame rate and at least one encoder supported by the client; Based on the preset encoding frame rate, performing encoding performance detection on the at least one encoder to obtain a detection result corresponding to the preset encoding frame rate; If the detection result corresponding to the preset encoding frame rate is passed, determining the preset encoding frame rate as the target encoding frame rate; At least one optional encoder corresponding to the target encoding frame rate is obtained, encoding configuration evaluation is performed on the at least one optional encoder, and a target encoder and target encoding configuration information of the target encoder are obtained.
2. The method according to claim 1, characterized in that The method further comprises: If the detection result corresponding to the preset coding frame rate is not passed, the preset coding frame rate is reduced until the detection result corresponding to the reduced preset coding frame rate is passed, and the reduced preset coding frame rate is determined as the target coding frame rate.
3. The method according to claim 1, characterized in that The method further comprises: For each encoder, a coding configuration information list of the encoder is obtained; the coding configuration information in the coding configuration information list is arranged in descending order of coding speed, and the information with the highest coding speed in the coding configuration information list is the first coding configuration information.
4. The method according to claim 3, characterized in that The performing encoding performance detection on the at least one encoder based on the preset encoding frame rate to obtain a detection result corresponding to the preset encoding frame rate includes: For each of the encoders, obtaining the first encoding configuration information of the encoder from the encoding configuration information list of the encoder; based on the preset encoding frame rate, performing encoding performance detection on the encoder according to the first encoding configuration information of the encoder to obtain a detection result of the first encoding configuration information corresponding to the encoder; if the detection result of the first encoding configuration information corresponding to the encoder is passed, marking the state parameter of the encoder as an available state; If an available state exists in the state parameters of the at least one encoder, it is determined that the detection result corresponding to the preset encoding frame rate is passed.
5. The method according to claim 3, characterized in that: The performing encoding configuration evaluation on the at least one optional encoder to obtain a target encoder and target encoding configuration information of the target encoder includes: For each of the optional encoders, performing encoding configuration evaluation on the encoding configuration information in the encoding configuration information list of the optional encoder to determine optimal encoding configuration information of the optional encoder; If there is an optional encoder, determining the optional encoder as the target encoder, and determining the optimal encoding configuration information of the optional encoder as the target encoding configuration information; If there are multiple optional encoders, the quality score of each optional encoder among the multiple optional encoders is calculated, the maximum value is selected from the calculated quality scores, the optional encoder corresponding to the maximum value is determined as the target encoder, and the optimal encoding configuration information of the optional encoder corresponding to the maximum value is determined as the target encoding configuration information.
6. The method according to claim 5, characterized in that The performing coding configuration evaluation on the coding configuration information in the coding configuration information list of the optional encoder to determine the optimal coding configuration information of the optional encoder includes: If there is one encoding configuration information in the encoding configuration information list of the optional encoder, determining the one encoding configuration information as the optimal encoding configuration information of the optional encoder; If there are multiple encoding configuration information in the encoding configuration information list of the optional encoder, encoding performance detection is performed based on the target encoding frame rate in the order of arrangement of the multiple encoding configuration information to obtain the optimal encoding configuration information of the optional encoder.
7. The method according to claim 6, characterized in that The performing coding performance detection based on the target coding frame rate and in the arrangement order of the plurality of coding configuration information to obtain the optimal coding configuration information of the optional encoder includes: According to the arrangement order of the multiple coding configuration information, select the second coding configuration information arranged after the first coding configuration information; Based on the target encoding frame rate, performing encoding performance detection on the optional encoder according to the second encoding configuration information to obtain a detection result of the second encoding configuration information; If the detection result of the second coding configuration information is passed, selecting the next coding configuration information for coding performance detection according to the arrangement order of the multiple coding configuration information, until the detection result of the selected coding configuration information is failed, and determining the previous coding configuration information of the selected coding configuration information as the optimal coding configuration information of the optional encoder; If the detection result of the second encoding configuration information is failure, the first encoding configuration information is determined to be the optimal encoding configuration information of the optional encoder.
8. The method according to any one of claims 1 to 7, characterized in that: The coding performance detection includes: Obtain the frame rate of the code to be detected and the configuration information of the code to be detected; Loading a test video; the test video includes multiple test video frames; For each of the test video frames, encoding the test video frame based on the encoding frame rate to be detected and the encoding configuration information to be detected, to obtain the encoding time of the test video frame; Calculating the mean of the encoding time of all the test video frames to obtain the average encoding time of the multiple test video frames; analyzing the encoding time of all the test video frames to determine the proportion of slow video frames in the multiple test video frames; If the average encoding time is greater than the unit encoding time, or the slow video frame ratio is greater than the ratio threshold, it is determined that the performance test fails, otherwise, it is determined that the performance test passes; the unit encoding time is determined based on the encoding frame rate to be detected.
9. A video encoding method, characterized in that: The method comprises: Get the video to be encoded; Determine a target encoding frame rate, a target encoder and target encoding configuration information; the target encoding frame rate, the target encoder and the target encoding configuration information are obtained according to the method for processing video encoding parameters according to any one of claims 1 to 8; The target encoder is used to encode the video to be encoded according to the target encoding frame rate and the target encoding configuration information.
10. A video coding parameter processing device, characterized in that: The device comprises: A capability detection module, configured to obtain a preset encoding frame rate and at least one encoder supported by the client; The coding performance detection module is configured to perform coding performance detection on the at least one encoder based on the preset coding frame rate to obtain a detection result corresponding to the preset coding frame rate; if the detection result corresponding to the preset coding frame rate is passed, determine the preset coding frame rate as a target coding frame rate; The encoding configuration evaluation module is configured to obtain at least one optional encoder corresponding to the target encoding frame rate, perform encoding configuration evaluation on the at least one optional encoder, and obtain a target encoder and target encoding configuration information of the target encoder.
11. A video encoding device, characterized in that: The device comprises: A video acquisition module is configured to acquire a video to be encoded; A coding parameter determination module, configured to determine a target coding frame rate, a target encoder and target coding configuration information; the target coding frame rate, the target encoder and the target coding configuration information are obtained according to the video coding parameter processing method according to any one of claims 1 to 8; The encoding module is configured to utilize the target encoder to perform encoding processing on the video to be encoded according to the target encoding frame rate and the target encoding configuration information.
12. An electronic device, characterized in that: include: processor; A memory for storing the processor executable instructions; wherein the processor is configured to execute the executable instructions to implement the method for processing video encoding parameters as described in any one of claims 1 to 8, or to implement the video encoding method as described in claim 9.
13. A computer-readable storage medium, when the instructions in the computer-readable storage medium are executed by a processor of an electronic device, enables the electronic device to execute the video encoding parameter processing method as described in any one of claims 1 to 8, or implement the video encoding method as described in claim 9.
14. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instruction is executed by a processor, the method for processing video encoding parameters as claimed in any one of claims 1 to 8 is implemented, or the video encoding method as claimed in claim 9 is implemented.