Disclosure of Invention
Aiming at the technical problems existing in the prior art, the embodiment of the application provides a code rate determining method and device, electronic equipment and a storage medium.
In a first aspect, an embodiment of the present application provides a method for determining a code rate, including:
Acquiring a target peak signal-to-noise ratio range, and determining a relation between physical resolution and code rate according to the target peak signal-to-noise ratio range, wherein under the condition of designating reference resolution and reference code rate, the physical resolution and the code rate are expressed in relation through a target adjustment factor, the target adjustment factor is designated value or is determined according to the reference code rate, and the peak signal-to-noise ratio determined according to the reference resolution and the reference code rate belongs to the target peak signal-to-noise ratio range;
And acquiring the physical resolution of the terminal equipment, and determining the code rate adapted to the terminal equipment according to the physical resolution of the terminal equipment and the relation between the physical resolution and the code rate.
In a second aspect, an embodiment of the present application further provides a code rate determining apparatus, including:
The first determining unit is used for obtaining a target peak signal-to-noise ratio range, determining the relation between the physical resolution and the code rate according to the target peak signal-to-noise ratio range, wherein under the condition of designating a reference resolution and a reference code rate, the physical resolution and the code rate are expressed in relation through a target adjustment factor, the target adjustment factor is designated value or is determined according to the reference code rate, and the peak signal-to-noise ratio determined according to the reference resolution and the reference code rate belongs to the target peak signal-to-noise ratio range;
And the second determining unit is used for acquiring the physical resolution of the terminal equipment and determining the code rate suitable for the terminal equipment according to the physical resolution of the terminal equipment and the relation between the physical resolution and the code rate.
In a third aspect, embodiments of the present application also provide a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the code rate determination method according to the first aspect.
In a fourth aspect, an embodiment of the present application further provides an electronic device, including a processor, a storage medium, and a bus, where the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium through the bus, and the processor executes the machine-readable instructions to perform the steps of the code rate determining method according to the first aspect.
In the above scheme, the finally determined code rate is determined based on the relationship between the physical resolution and the code rate, the relationship between the physical resolution and the code rate is determined based on the appointed reference resolution, the reference code rate and the target adjustment factor, and the peak signal-to-noise ratio determined according to the reference resolution and the reference code rate belongs to the target peak signal-to-noise ratio range, so that the cloud server obtains the cloud application video according to the finally determined code rate code, and after pushing the cloud application video to the terminal equipment, the image quality of the cloud application video played by the terminal equipment can meet the definition requirement.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more apparent, the technical solutions of the embodiments of the present application will be clearly and completely described with reference to the accompanying drawings in the embodiments of the present application, and it should be understood that the drawings in the present application are for the purpose of illustration and description only and are not intended to limit the scope of the present application. In addition, it should be understood that the schematic drawings are not drawn to scale. A flowchart, as used in this disclosure, illustrates operations implemented according to some embodiments of the present application. It should be understood that the operations of the flow diagrams may be implemented out of order and that steps without logical context may be performed in reverse order or concurrently. Moreover, one or more other operations may be added to or removed from the flow diagrams by those skilled in the art under the direction of the present disclosure.
In addition, the described embodiments are only some, but not all, embodiments of the application. The components of the embodiments of the present application generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the application, as presented in the figures, is not intended to limit the scope of the application, as claimed, but is merely representative of selected embodiments of the application. All other embodiments, which can be made by a person skilled in the art without making any inventive effort, are intended to be within the scope of the present application.
It should be noted that the term "comprising" will be used in embodiments of the application to indicate the presence of the features stated hereafter, but not to exclude the addition of other features.
Referring to fig. 1, a flow chart of a code rate determining method according to an embodiment of the present application is shown, where the method includes:
S10, acquiring a target peak signal-to-noise ratio range, and determining a relation between physical resolution and code rate according to the target peak signal-to-noise ratio range, wherein under the condition of designating reference resolution and reference code rate, the physical resolution and the code rate are expressed in a relation way through a target adjustment factor, the target adjustment factor is designated value or is determined according to the reference code rate, and the peak signal-to-noise ratio determined according to the reference resolution and the reference code rate belongs to the target peak signal-to-noise ratio range;
In this embodiment, it should be noted that the target peak snr range may be set to a value range of the peak snr psnr (for example, 40dB-41 dB) or a specific psnr value (for example, 40 dB) according to the requirement, that is, the target peak snr range includes at least one psnr value. Under the condition of designating the reference resolution, a peak signal-to-noise ratio range corresponds to a relationship between physical resolution and code rate, and after determining the target peak signal-to-noise ratio range, the relationship between the physical resolution and the code rate corresponding to the target peak signal-to-noise ratio range can be determined through the corresponding relationship. In order to obtain the relationship of the physical resolution and the code rate, it is necessary to specify the reference resolution and the reference code rate and determine the target adjustment factor, that is, the relationship of the physical resolution and the code rate can be exhibited by the reference resolution, the reference code rate, and the target adjustment factor. The target adjustment factor may be a specified value (such as 1.2) or determined from the target peak signal-to-noise ratio range.
S11, acquiring physical resolution of the terminal equipment, and determining the code rate adapted to the terminal equipment according to the physical resolution of the terminal equipment and the relation between the physical resolution and the code rate.
In this embodiment, it should be noted that, after the relationship between the physical resolution and the code rate is determined, the physical resolution of the terminal device is substituted into the relationship, so as to obtain the code rate adapted to the terminal device. The cloud server encodes cloud application pictures generated in the cloud application running process by using the code rate of the adaptive terminal equipment and then pushes the encoded cloud application pictures to the terminal equipment, the terminal equipment decodes and plays the encoded video data, and the psnr of the played video belongs to the target peak signal-to-noise ratio range.
According to the code rate determining method provided by the embodiment of the application, the finally determined code rate is determined based on the relation between the physical resolution and the code rate, the relation between the physical resolution and the code rate is determined based on the appointed reference resolution, the reference code rate and the target adjustment factor, and the peak signal-to-noise ratio determined according to the reference resolution and the reference code rate belongs to the target peak signal-to-noise ratio range, so that the cloud server obtains the cloud application video according to the finally determined code rate, and the image quality of the cloud application video played by the terminal equipment can meet the definition requirement after the cloud application video is pushed to the terminal equipment.
On the basis of the foregoing method embodiment, the calculating process of the target adjustment factor may include:
Obtaining a minimum code rate in a plurality of pieces of first image quality evaluation data as a reference code rate, obtaining a plurality of adjustment factors based on the relation among the reference resolution, the reference code rate, the physical resolution and the code rate and a plurality of pieces of second image quality evaluation data, wherein each piece of first image quality evaluation data comprises a video resolution, a code rate and a peak signal-to-noise ratio, the resolution in each piece of first image quality evaluation data is the reference resolution, the peak signal-to-noise ratio in each piece of first image quality evaluation data belongs to the target peak signal-to-noise ratio range, each piece of second image quality evaluation data comprises a video resolution, a code rate and a peak signal-to-noise ratio, and the peak signal-to-noise ratio in each piece of second image quality evaluation data belongs to the target peak signal-to-noise ratio range;
and obtaining a target adjustment factor according to the plurality of adjustment factors.
In this embodiment, it should be noted that, a video source obtained by collecting and encoding a cloud application picture generated in a cloud application running process by using a recording tool and/or a video formed by a segment of a video obtained by encoding a cloud server or a partial frame of the obtained video may be used as the video source. When determining a part of frames, only a specific cloud application picture rendered by the cloud application can be saved, and video frames obtained after encoding the specific cloud application picture are found through pts (presentation TIME STAMP, display time stamp) time stamps. The video source may be updated as the cloud application is up-to-date. And then transcoding the video source into videos with different resolutions and code rates to obtain a plurality of sections of videos, and calculating the peak signal-to-noise ratio of each section of video in the plurality of sections of videos. Thus, the plurality of first image quality evaluation data and the plurality of second image quality evaluation data can be obtained from the resolution, the code rate and the peak signal-to-noise ratio corresponding to the multi-segment video.
And after the minimum code rate in the plurality of pieces of first image quality evaluation data is used as the reference code rate, substituting the reference resolution, the reference code rate and the resolution and the code rate of the plurality of pieces of second image quality evaluation data into the relation between the physical resolution and the code rate to obtain a plurality of adjustment factors. And then, the multiple adjustment factors can be processed according to a preset processing strategy to obtain target adjustment factors, for example, the multiple adjustment factors are weighted and summed to obtain the target adjustment factors, wherein the weighting coefficient of the weighted and summed adjustment factors can be set according to requirements.
The plurality of pieces of second image quality evaluation data may or may not include at least one piece of first image quality evaluation data.
On the basis of the embodiment of the method, the video can be obtained by collecting and encoding cloud application pictures.
On the basis of the foregoing method embodiment, the relationship between the physical resolution and the code rate may be:
bitrate=(width×height×ref_bitrate)/(ref_width×ref_height)×(factor_x)n;
Where n=log 2 ((ref_width×ref_height)/(width×height)), bit indicates a code rate, width and height indicate width and height of a physical resolution, respectively, ref_bit indicates a reference code rate, ref_width and ref_height indicate width and height of a reference resolution, respectively, and factor_x indicates a target adjustment factor.
Referring to fig. 2, a schematic structural diagram of a code rate determining device according to an embodiment of the present application is shown, where the device includes:
a first determining unit 20, configured to obtain a target peak signal-to-noise ratio range, determine a relationship between a physical resolution and a code rate according to the target peak signal-to-noise ratio range, where, in a case of specifying a reference resolution and a reference code rate, the physical resolution and the code rate are expressed in a relationship by a target adjustment factor, where the target adjustment factor is a specified value or is determined according to the reference code rate, and a peak signal-to-noise ratio determined according to the reference resolution and the reference code rate belongs to the target peak signal-to-noise ratio range;
And the second determining unit 21 is configured to obtain a physical resolution of the terminal device, and determine a code rate adapted to the terminal device according to the physical resolution of the terminal device and a relationship between the physical resolution and the code rate.
According to the code rate determining device provided by the embodiment of the application, the finally determined code rate is determined based on the relation between the physical resolution and the code rate, the relation between the physical resolution and the code rate is determined based on the appointed reference resolution, the reference code rate and the target adjustment factor, and the peak signal-to-noise ratio determined according to the reference resolution and the reference code rate belongs to the target peak signal-to-noise ratio range, so that the cloud server obtains the cloud application video according to the finally determined code rate, and the image quality of the cloud application video played by the terminal equipment can meet the definition requirement after the cloud application video is pushed to the terminal equipment.
On the basis of the foregoing apparatus embodiment, the calculating process of the target adjustment factor may include:
Obtaining a minimum code rate in a plurality of pieces of first image quality evaluation data as a reference code rate, obtaining a plurality of adjustment factors based on the relation among the reference resolution, the reference code rate, the physical resolution and the code rate and a plurality of pieces of second image quality evaluation data, wherein each piece of first image quality evaluation data comprises a video resolution, a code rate and a peak signal-to-noise ratio, the resolution in each piece of first image quality evaluation data is the reference resolution, the peak signal-to-noise ratio in each piece of first image quality evaluation data belongs to the target peak signal-to-noise ratio range, each piece of second image quality evaluation data comprises a video resolution, a code rate and a peak signal-to-noise ratio, and the peak signal-to-noise ratio in each piece of second image quality evaluation data belongs to the target peak signal-to-noise ratio range;
and obtaining a target adjustment factor according to the plurality of adjustment factors.
On the basis of the device embodiment, the video can be obtained by collecting and encoding cloud application pictures.
Based on the foregoing apparatus embodiment, the relationship between the physical resolution and the code rate may be:
bitrate=(width×height×ref_bitrate)/(ref_width×ref_height)×(factor_x)n;
Where n=log 2 ((ref_width×ref_height)/(width×height)), bit indicates a code rate, width and height indicate width and height of a physical resolution, respectively, ref_bit indicates a reference code rate, ref_width and ref_height indicate width and height of a reference resolution, respectively, and factor_x indicates a target adjustment factor.
The implementation process of the code rate determining device provided by the embodiment of the application is consistent with the code rate determining method provided by the embodiment of the application, and the achieved effect is the same as the code rate determining method provided by the embodiment of the application, and the details are not repeated here.
As shown in fig. 3, an electronic device according to an embodiment of the present application includes a processor 30, a memory 31 and a bus 32, where the memory 31 stores machine-readable instructions executable by the processor 30, and when the electronic device is running, the processor 30 communicates with the memory 31 through the bus 32, and the processor 30 executes the machine-readable instructions to perform steps of a code rate determining method as described above.
Specifically, the above-mentioned memory 31 and processor 30 can be general-purpose memories and processors, and are not particularly limited herein, and the above-mentioned code rate determination method can be performed when the processor 30 runs a computer program stored in the memory 31.
Corresponding to the above code rate determining method, the embodiment of the present application further provides a computer readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the steps of the above code rate determining method are performed.
The foregoing is merely illustrative of the present application, and the present application is not limited thereto, and any person skilled in the art will readily appreciate variations or alternatives within the scope of the present application. Therefore, the protection scope of the application is subject to the protection scope of the claims.