Information acquisition method and device, storage medium and electronic device

文档序号:1925590 发布日期:2021-12-03 浏览:16次 中文

阅读说明:本技术 信息的获取方法和装置、存储介质和电子装置 (Information acquisition method and device, storage medium and electronic device ) 是由 樊鸿飞 成超 蔡媛 于 2020-05-29 设计创作,主要内容包括:本申请涉及一种信息的获取方法和装置、存储介质和电子装置,其中,该方法包括:从目标视频中获取多个参考帧,其中,所述目标视频包含多个视频帧,所述多个参考帧属于所述多个视频帧;使用多个码率分别对所述多个参考帧中的每个参考帧进行编码,得到多个编码结果,其中,所述多个编码结果与所述多个码率一一对应;根据所述多个码率和所述多个编码结果,获取与所述目标视频对应的率失真曲线。本申请解决了相关技术中的R-D曲线获取方式存在的由于获取的R-D曲线精度过低导致的数据处理误差过大的问题。(The application relates to an information acquisition method and device, a storage medium and an electronic device, wherein the method comprises the following steps: acquiring a plurality of reference frames from a target video, wherein the target video comprises a plurality of video frames, and the plurality of reference frames belong to the plurality of video frames; respectively encoding each reference frame in the plurality of reference frames by using a plurality of code rates to obtain a plurality of encoding results, wherein the plurality of encoding results are in one-to-one correspondence with the plurality of code rates; and acquiring a rate-distortion curve corresponding to the target video according to the plurality of code rates and the plurality of coding results. The method and the device solve the problem that data processing errors are too large due to too low precision of the obtained R-D curve in an R-D curve obtaining mode in the related technology.)

1. An information acquisition method, comprising:

acquiring a plurality of reference frames from a target video, wherein the target video comprises a plurality of video frames, and the plurality of reference frames belong to the plurality of video frames;

respectively encoding each reference frame in the plurality of reference frames by using a plurality of code rates to obtain a plurality of encoding results, wherein the plurality of encoding results are in one-to-one correspondence with the plurality of code rates;

and acquiring a rate-distortion curve corresponding to the target video according to the plurality of code rates and the plurality of coding results.

2. The method of claim 1, wherein obtaining the plurality of reference frames from the target video comprises:

acquiring the plurality of reference frames from the target video according to a target parameter, wherein the target parameter is used for indicating at least one of the following: a starting position of the plurality of reference frames, a length of the plurality of reference frames, a ratio between a number of the plurality of reference frames and a number of the plurality of video frames.

3. The method according to claim 2, wherein, in the case that the plurality of reference frames are video frames in a first video segment of the target video, acquiring the plurality of reference frames from the target video according to the target parameters comprises:

acquiring the first video segment from the target video according to the first starting position and the video segment length of the first video segment, wherein the target parameters comprise: the first starting location and the video segment length;

and performing video analysis on the first video segment to obtain the plurality of reference frames.

4. The method according to claim 2, wherein, in the case that the plurality of reference frames are video frames in a second video segment of the target video, acquiring the plurality of reference frames from the target video according to the target parameters comprises:

acquiring the second video segment from the target video according to a second starting position of the second video segment, the length of the target video and a target ratio, wherein the target parameters comprise: the second starting position, the length of the target video and the target ratio, wherein the target ratio is the ratio between the length of the second video segment and the length of the target video;

and performing video analysis on the second video segment to obtain the plurality of reference video frames.

5. The method of claim 1, wherein obtaining the plurality of reference frames from the target video comprises:

and under the condition that the plurality of reference frames are the plurality of video frames, performing video analysis on the target video to obtain the plurality of reference frames.

6. The method of claim 1, wherein before encoding each of the plurality of reference frames using a plurality of code rates to obtain a plurality of encoding results, the method further comprises:

and receiving configuration information sent by terminal equipment, wherein the configuration information is used for indicating the plurality of code rates.

7. The method according to any one of claims 1 to 6, wherein after obtaining the rate-distortion curve corresponding to the target video according to the plurality of code rates and the plurality of encoding results, the method further comprises:

and coding the target video by using the rate distortion curve to obtain coded data corresponding to the target video.

8. An apparatus for acquiring information, comprising:

a first obtaining unit, configured to obtain a plurality of reference frames from a target video, where the target video includes a plurality of video frames, and the plurality of reference frames belong to the plurality of video frames;

a first encoding unit, configured to encode each of the multiple reference frames using multiple code rates to obtain multiple encoding results, where the multiple encoding results are in one-to-one correspondence with the multiple code rates;

and the second obtaining unit is used for obtaining a rate-distortion curve corresponding to the target video according to the plurality of code rates and the plurality of coding results.

9. A computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to carry out the method of any one of claims 1 to 7 when executed.

10. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to execute the method of any of claims 1 to 7 by means of the computer program.

Technical Field

The present application relates to the field of computers, and in particular, to a method and an apparatus for acquiring information, a storage medium, and an electronic apparatus.

Background

The R-D (Rate-distortion) curve is a very important "feature" in the encoding process of video, different videos have different R-D curves, and the R-D curve changes after the encoder changes.

At present, strong correlation between video frames of a video is assumed when R-D curve estimation is carried out. In the encoding process, the R-D curve of the future frame is estimated by using the R-D result of the previous frames after encoding.

However, even if there is a correlation between the video frame and the video frame, an error thereof is present. Therefore, the R-D results of the previous frames are used to estimate the R-D curve of the future frame with a certain error. For some data processing scenes needing high-precision R-D curves, the acquisition mode of the R-D curves has the problem of overlarge data processing error caused by the fact that the precision of the acquired R-D curves is too low.

Therefore, the R-D curve acquisition method in the related art has a problem of an excessive data processing error due to an excessively low accuracy of the acquired R-D curve.

Disclosure of Invention

The application provides an information acquisition method and device, a storage medium and an electronic device, which are used for at least solving the problem of overlarge data processing error caused by too low accuracy of an acquired R-D curve in an R-D curve acquisition mode in the related art.

According to an aspect of an embodiment of the present application, there is provided an information obtaining method, including: acquiring a plurality of reference frames from a target video, wherein the target video comprises a plurality of video frames, and the plurality of reference frames belong to the plurality of video frames; respectively encoding each reference frame in the plurality of reference frames by using a plurality of code rates to obtain a plurality of encoding results, wherein the plurality of encoding results correspond to the plurality of code rates one to one; and acquiring a rate-distortion curve corresponding to the target video according to the plurality of code rates and the plurality of coding results.

Optionally, the obtaining a plurality of reference frames from the target video includes: acquiring a plurality of reference frames from a target video according to a target parameter, wherein the target parameter is used for indicating at least one of the following: the starting position of the plurality of reference frames, the length of the plurality of reference frames, and the ratio of the number of the plurality of reference frames to the number of the plurality of video frames.

Optionally, in a case that the plurality of reference frames are video frames in a first video segment of the target video, acquiring the plurality of reference frames from the target video according to the target parameter includes: acquiring a first video segment from a target video according to a first starting position and a video segment length of the first video segment, wherein the target parameters comprise: a first start position and a video segment length; and carrying out video analysis on the first video segment to obtain a plurality of reference frames.

Optionally, in a case that the plurality of reference frames are video frames in a second video segment of the target video, acquiring the plurality of reference frames from the target video according to the target parameter includes: acquiring a second video segment from the target video according to a second starting position of the second video segment, the length of the target video and a target ratio, wherein the target parameters comprise: the second starting position, the length of the target video and a target ratio, wherein the target ratio is the ratio between the length of the second video segment and the length of the target video; and carrying out video analysis on the second video segment to obtain a plurality of reference video frames.

Optionally, the obtaining a plurality of reference frames from the target video includes: and under the condition that the plurality of reference frames are a plurality of video frames, carrying out video analysis on the target video to obtain the plurality of reference frames.

Optionally, before encoding each of the plurality of reference frames with a plurality of code rates respectively to obtain a plurality of encoding results, the method further includes: and receiving configuration information sent by the terminal equipment, wherein the configuration information is used for indicating a plurality of code rates.

Optionally, after obtaining a rate-distortion curve corresponding to the target video according to the multiple code rates and the multiple coding results, the method further includes: and coding the target video by using the distortion curve to obtain coded data corresponding to the target video.

According to another aspect of the embodiments of the present application, there is provided an apparatus for acquiring information, including: the device comprises a first acquisition unit, a second acquisition unit and a third acquisition unit, wherein the first acquisition unit is used for acquiring a plurality of reference frames from a target video, the target video comprises a plurality of video frames, and the plurality of reference frames belong to the plurality of video frames; the first coding unit is used for coding each reference frame in the multiple reference frames by using multiple code rates to obtain multiple coding results, wherein the multiple coding results correspond to the multiple code rates one to one; and the second obtaining unit is used for obtaining a rate-distortion curve corresponding to the target video according to the plurality of code rates and the plurality of coding results.

Optionally, the first obtaining unit includes: an obtaining module, configured to obtain a plurality of reference frames from a target video according to a target parameter, where the target parameter is used to indicate at least one of: the starting position of the plurality of reference frames, the length of the plurality of reference frames, and the ratio of the number of the plurality of reference frames to the number of the plurality of video frames.

Optionally, in a case where the plurality of reference frames are video frames in a first video segment of the target video, the obtaining module includes: the first obtaining sub-module is configured to obtain a first video segment from a target video according to a first start position of the first video segment and a video segment length, where the target parameter includes: a first start position and a video segment length; and the first analysis submodule is used for carrying out video analysis on the first video segment to obtain a plurality of reference frames.

Optionally, in a case where the plurality of reference frames are video frames in a second video segment of the target video, the obtaining module includes: the second obtaining sub-module is configured to obtain a second video segment from the target video according to a second start position of the second video segment, a length of the target video, and a target ratio, where the target parameter includes: the second starting position, the length of the target video and a target ratio, wherein the target ratio is the ratio between the length of the second video segment and the length of the target video; and the second analysis submodule is used for carrying out video analysis on the second video segment to obtain a plurality of reference video frames.

Optionally, the first obtaining unit includes: and the analysis module is used for carrying out video analysis on the target video under the condition that the plurality of reference frames are a plurality of video frames to obtain a plurality of reference frames.

Optionally, the apparatus further comprises: the receiving unit is configured to receive configuration information sent by the terminal device before the multiple code rates are used to encode each of the multiple reference frames respectively to obtain multiple encoding results, where the configuration information is used to indicate the multiple code rates.

Optionally, the apparatus further comprises: and the second coding unit is used for coding the target video by using the rate-distortion curve after obtaining the rate-distortion curve corresponding to the target video according to the multiple code rates and the multiple coding results, so as to obtain the coded data corresponding to the target video.

According to a further aspect of an embodiment of the present application, there is also provided a computer-readable storage medium having a computer program stored thereon, wherein the computer program is configured to perform the steps of any of the above method embodiments when executed.

According to a further aspect of an embodiment of the present application, there is also provided an electronic apparatus, including a memory and a processor, the memory storing a computer program therein, the processor being configured to execute the computer program to perform the steps in any of the above method embodiments.

In the embodiment of the application, a plurality of reference frames of a target video are obtained from the target video in a mode of encoding the plurality of reference frames of the target video for a plurality of times by adopting different code rates, wherein the target video comprises a plurality of video frames, and the plurality of reference frames belong to the plurality of video frames; respectively encoding each reference frame in the plurality of reference frames by using a plurality of code rates to obtain a plurality of encoding results, wherein the plurality of encoding results correspond to the plurality of code rates one to one; according to the multiple code rates and the multiple coding results, the rate-distortion curve corresponding to the target video is obtained, and due to the fact that multiple coding is carried out on multiple reference frames of the target video through different code rates, the RD curve with high accuracy can be obtained after the coding is completed, the purpose of improving the accuracy of the R-D curve is achieved, the technical effect of improving the accuracy of data processing is achieved, and the problem that data processing errors are too large due to the fact that the accuracy of the obtained R-D curve is too low in an R-D curve obtaining mode in the related technology is solved.

Drawings

The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.

In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.

Fig. 1 is a schematic diagram of a hardware environment of an information acquisition method according to an embodiment of the present application;

FIG. 2 is a flow chart of an alternative method of obtaining information according to an embodiment of the present application;

FIG. 3 is a schematic diagram of an alternative information acquisition method according to an embodiment of the present application;

FIG. 4 is a flow chart of another alternative method of obtaining information according to an embodiment of the present application;

FIG. 5 is a flow chart of yet another alternative method of obtaining information according to an embodiment of the present application;

FIG. 6 is a schematic diagram of an alternative information acquisition device according to an embodiment of the present application;

fig. 7 is a block diagram of an alternative electronic device according to an embodiment of the present application.

Detailed Description

In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only partial embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.

It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.

According to one aspect of the embodiment of the application, an information acquisition method is provided. Alternatively, in the present embodiment, the above-described information acquisition method may be applied to a hardware environment formed by the terminal 101 and the server 103 as shown in fig. 1. As shown in fig. 1, a server 103 is connected to a terminal 101 through a network, which may be used to provide services (such as game services, application services, etc.) for the terminal or a client installed on the terminal, and a database may be provided on the server or separately from the server for providing data storage services for the server 103, and the network includes but is not limited to: the terminal 101 is not limited to a PC, a mobile phone, a tablet computer, and the like. The information acquisition method according to the embodiment of the present application may be executed by the server 103, the terminal 101, or both the server 103 and the terminal 101. The method for acquiring information by the terminal 101 according to the embodiment of the present application may be executed by a client installed thereon.

Fig. 2 is a flowchart of an optional information obtaining method according to an embodiment of the present application, and as shown in fig. 2, the method may include the following steps:

step S202, a plurality of reference frames are obtained from a target video, wherein the target video comprises a plurality of video frames, and the plurality of reference frames belong to the plurality of video frames;

step S204, using a plurality of code rates to respectively code each reference frame in a plurality of reference frames to obtain a plurality of coding results, wherein the plurality of coding results are in one-to-one correspondence with the plurality of code rates;

and step S206, acquiring a rate-distortion curve corresponding to the target video according to the multiple code rates and the multiple coding results.

Through the steps S202 to S206, a plurality of reference frames are obtained from the target video, wherein the target video includes a plurality of video frames, and the plurality of reference frames belong to the plurality of video frames; respectively encoding each reference frame in the plurality of reference frames by using a plurality of code rates to obtain a plurality of encoding results, wherein the plurality of encoding results correspond to the plurality of code rates one to one; according to the multiple code rates and the multiple coding results, the rate-distortion curve corresponding to the target video is obtained, the problem that data processing errors are too large due to too low precision of the obtained R-D curve in an R-D curve obtaining mode in the related technology is solved, and the precision of data processing is improved.

In the technical solution provided in step S202, a plurality of reference frames are obtained from a target video, where the target video includes a plurality of video frames, and the plurality of reference frames belong to the plurality of video frames.

The information obtaining method in this embodiment may be applied to a scene in which video processing is performed by using a rate-distortion curve of a video, for example, in a video encoding process. A rate-distortion curve (R-D curve, i.e., rate-distortion curve) is an important feature in a video encoding process. Accurate R-D curve prediction can bring significant coding performance gains, including reducing code rate, improving picture quality, improving code rate control accuracy, and so on. The rate-distortion curve is a curve drawn by setting a corresponding code rate after the video is coded to obtain a corresponding distortion.

In the related art, video encoding assumes that there is a correlation between video frames. In order to obtain the R-D curve of the video, as shown in fig. 3, the k-th frame of the video may be obtained, the R-D curve of the previous k-th frame may be estimated according to the encoding result, and the R-D curve of the previous k-th frame may be used as the R-D curve of the (k +1) th frame, and the (k +1) th frame may be encoded. The R-D curve acquisition mode has large error and cannot be suitable for scenes with high precision R-D curve requirements.

For example, the rate-distortion function may be: and y is A/x, the corresponding distortion can be determined by using the coding results of the previous frames, and the code rate adopted by the coding and the determined distortion are brought into a rate-distortion function to obtain an R-D curve.

Optionally, in this embodiment, the same video is encoded for multiple times, and different code rate settings are used for each encoding, so that an R-D curve with high accuracy can be obtained after the encoding is completed.

The processing device (which may be a server or a terminal device) may obtain the target video by selecting a local file or by receiving a file from another device. The target video comprises a plurality of video frames, and different videos can comprise the same or different numbers of video frames.

In order to obtain the R-D curve of the target video, the processing device may first obtain a plurality of reference frames of the target video, which may be all or part of a plurality of video frames included in the target video, so as to perform subsequent processing on the plurality of reference frames.

In the technical solution provided in step S204, each reference frame in the multiple reference frames is encoded using multiple code rates, so as to obtain multiple encoding results, where the multiple encoding results correspond to the multiple code rates one to one.

After obtaining the multiple reference frames, the processing device may perform multiple encoding on the multiple reference frames, and each encoding adopts a different code rate setting to obtain multiple encoding results, where each encoding result may correspond to one of the multiple code rates.

For example, depending on the configuration, the processing device may encode each of the plurality of reference frames with 4 code rates, respectively: r1, R2, R3, R4, which gave 4 coding results, S1, S2, S3, S4, wherein S1 corresponds to R1, S2 corresponds to R2, S3 corresponds to R3, and S4 corresponds to R4.

In the technical solution provided in step S206, a rate-distortion curve corresponding to the target video is obtained according to the multiple code rates and the multiple coding results.

After obtaining the plurality of encoding results, determining the R-D curves of the plurality of reference frames according to the code rate and the plurality of encoding results, and using the R-D curves of the plurality of reference frames as the R-D curves corresponding to the target video.

The manner of determining the R-D curves of the plurality of reference frames according to the code rate and the plurality of encoding results may be: determining distortion information corresponding to each code rate according to the plurality of coding results and the plurality of reference frames; and determining the R-D curves of the plurality of reference frames according to the corresponding relation between the code rate and the distortion information.

For example, the encoding results S1, S2, S3, and S4 are compared with a plurality of reference frames, respectively, to determine distortions D1, D2, D3, and D4 corresponding to each code rate, and an accurate R-D curve can be determined according to the correspondence between the code rates R1, R2, R3, and R4 and the distortions D1, D2, D3, and D4.

As an alternative embodiment, acquiring a plurality of reference frames from a target video includes:

s11, when the plurality of reference frames are a plurality of video frames, performing video analysis on the target video to obtain a plurality of reference frames.

There are various ways to obtain multiple reference frames from the target video, for example, all video frames contained in the target video may be directly encoded, that is, the multiple reference frames are multiple video frames.

When the plurality of reference frames are a plurality of video frames, the target video can be directly analyzed to obtain all video frames included in the target video, that is, the plurality of reference frames. The method for analyzing the target video may refer to related technologies, which are not described in this embodiment.

For example, as shown in FIG. 4, the k frames before encoding can be encoded using the code rates R1-R4, and a precise R-D curve of the k frames before encoding can be calculated, so that the k frames before encoding can be processed by the precise R-D curve.

Through the embodiment, the target video is directly processed, so that the video processing flow can be simplified, and the accuracy of the rate-distortion curve is improved.

As an alternative embodiment, acquiring a plurality of reference frames from a target video includes:

s21, acquiring a plurality of reference frames from the target video according to the target parameter, wherein the target parameter is used to indicate at least one of: the starting position of the plurality of reference frames, the length of the plurality of reference frames, and the ratio of the number of the plurality of reference frames to the number of the plurality of video frames.

The plurality of reference frames may also be part of a plurality of video frames, and the plurality of reference frames may be obtained by a target parameter, the target parameter being indicative of at least one of:

starting positions of a plurality of reference frames;

a length of the plurality of reference frames;

a ratio between a number of the plurality of reference frames and a number of the plurality of video frames.

The starting positions of the multiple reference frames may be used to indicate the distance between the first reference frame of the multiple reference frames and the first video frame of the target video, may be the number of the first reference frame, or may be other position information capable of locating the first reference frame.

The lengths of the multiple reference frames may be used to indicate the number of reference frames included in the multiple reference frames, may be the number of reference frames, or may be other information capable of indicating the lengths of the multiple reference frames.

The ratio of the number of the plurality of reference frames to the number of the plurality of video frames may be used to indicate a ratio of obtaining the reference frames from the plurality of video frames, and the number of the plurality of reference frames may be determined according to the ratio of the number of the plurality of reference frames to the number of the plurality of video frames and the number of the plurality of video frames.

By the embodiment, the reference frame is acquired from the target video according to the target parameters, and convenience in acquiring the reference frame can be improved.

Since the way of determining the R-D curve by encoding the entire video is performed too slowly, it is also possible to encode by selecting consecutive segments in the video.

As an optional implementation manner, in a case where the plurality of reference frames are video frames in a first video segment of the target video, acquiring the plurality of reference frames from the target video according to the target parameter includes:

s31, obtaining the first video segment from the target video according to the first start position and the video segment length of the first video segment, wherein the target parameters include: a first start position and a video segment length;

s32, performing video parsing on the first video segment to obtain a plurality of reference frames.

In the case where the plurality of reference frames are video frames within a first video segment of the target video, the length of the plurality of reference frames can be expressed as a video segment length of the first video segment. The target parameters may include: the starting position of the first video segment (i.e., the first starting position) and the video segment length. And according to the initial position of the first video segment and the length of the video segment, the first video segment can be obtained from the target video.

After the first video segment is obtained, video analysis may be performed on the first video segment to obtain a plurality of reference frames, and reference may be made to related technologies for a manner of obtaining video frames through video analysis, which is not described in detail in this embodiment.

For example, for 16 seconds of video, only 4 seconds of the video can be encoded, which can reduce the computational complexity, and the 4s of video can be indicated by the start position (e.g., the first video frame) and the video segment length (4 s).

As another optional implementation, in a case where the plurality of reference frames are video frames in a second video segment of the target video, acquiring the plurality of reference frames from the target video according to the target parameter includes:

s41, obtaining the second video segment from the target video according to the second start position of the second video segment, the length of the target video and the target ratio, wherein the target parameters include: the second starting position, the length of the target video and a target ratio, wherein the target ratio is the ratio between the length of the second video segment and the length of the target video;

and S42, performing video analysis on the second video segment to obtain a plurality of reference video frames.

In the case where the plurality of reference frames are video frames within a first video segment of the target video, the ratio between the number of the plurality of reference frames and the number of the plurality of video frames may be expressed as a ratio between the length of the second video segment and the length of the target video, i.e., a target ratio. The target parameters may include: the start position of the second video segment (i.e., the second start position), the length of the target video, and the target ratio. And according to the initial position of the first video segment, the length of the target video and the target ratio, the second video segment can be obtained from the target video.

After the second video segment is obtained, video analysis may be performed on the second video segment to obtain a plurality of reference frames, and reference may be made to related technologies for a manner of obtaining video frames through video analysis, which is not described in detail in this embodiment.

For example, for 16 seconds of video, only 4 seconds of the video can be encoded, which can reduce the computational complexity, and the 4s of video can be indicated by the start position (e.g., the first video frame) and the length (16s) and target ratio (1/4) of the target video. It is to be understood that the present invention is not limited to the above numerical examples.

By the embodiment, the continuous segments in the video are selected for coding, so that the computational complexity can be reduced, and the requirement on the processing capacity of the processing equipment is reduced.

As an alternative embodiment, before using a plurality of code rates to encode each reference frame in a plurality of reference frames respectively, and obtaining a plurality of encoding results, the method further includes:

and S51, receiving configuration information sent by the terminal equipment, wherein the configuration information is used for indicating a plurality of code rates.

The plurality of code rates may be set according to configuration information input by a user, and the configuration information may be input by the user using a terminal device, which may be communicatively connected to the processing device via a network.

The user can perform configuration input through an input-output component (e.g., a keyboard, a touch screen, etc.) of the terminal device to configure the plurality of code rates. The terminal device may detect an input operation of a target object (i.e., a user), and obtain input information of the target object, i.e., configuration information, which may indicate a plurality of code rates used for encoding a target video.

After the configuration information input by the user is acquired, the terminal device may send the configuration information to the processing device through a communication link between the terminal device and the processing device. The processing device may receive the configuration information sent by the terminal device, obtain a plurality of code rates from the configuration information, and set the obtained plurality of code rates as the code rate used for encoding the target video.

By the embodiment, the setting of the code rate used for encoding the video is carried out according to the received configuration information, so that the control capability of a user on the encoding process can be improved.

As an alternative embodiment, after obtaining the rate-distortion curve corresponding to the target video according to the plurality of code rates and the plurality of encoding results, the method further includes:

and S61, coding the target video by using the distortion curve to obtain coded data corresponding to the target video.

After the R-D curve corresponding to the target video is obtained, various processes may be performed using the R-D curve, for example, the target video may be encoded to obtain encoded data corresponding to the target video. The specific encoding process may refer to related technologies, which is not specifically limited in this embodiment.

For example, after the accurate R-D curve prediction algorithm is used, encoding can be performed according to different code rates estimated for videos with different R-D curves, so that the overall code rate of the video is minimized, and the quality of the video is guaranteed to be lossless during visual observation.

By the embodiment, the whole video is encoded by using the accurate R-D curves of the multiple reference frames, so that the whole video code rate can be minimized, and the video quality is ensured to be free from loss during visual observation.

The following explains an information acquisition method in the embodiment of the present application with reference to an alternative example. In this example, the target video is a 16s video, and the plurality of reference frames are video frames included in the first 4s video.

According to the information acquisition method provided by the example, continuous video segments in the same video are coded for multiple times, different code rate settings are adopted for each coding, and the RD curve with high accuracy can be obtained after the coding is finished.

As shown in fig. 5, the flow of the information obtaining method provided in this optional embodiment may include the following steps:

step 1, selecting p frames from the previous k frames from the target video, wherein p is k/4.

And if the target video is a 16s video, the selected continuous video segments are as follows: video clips of the first 4 s.

And 2, coding the previous p frames by using a plurality of code rates.

The previous p frames may be encoded using code rates R1, R2, R3, and R4, respectively, resulting in an encoding result corresponding to each code rate.

And 3, calculating an accurate R-D curve of the previous p frames.

After the coding result corresponding to each code rate is obtained, the precise R-D curve of the previous p frames (each frame) can be further calculated.

The R-D curve of the p frames can be used as an estimate of the R-D curve of the previous k frames.

And 4, encoding the front k frames by using the accurate R-D curve.

After the precise R-D curve is obtained, the previous k frames can be coded by using the R-D curve to obtain the coded data of the previous k frames.

By the example, the R-D curve is accurately predicted by directly utilizing multiple times of coding at the expense of computational complexity; at the same time. The prediction accuracy of the R-D curve can be improved by using part of video segments and combining with multiple encoding to accelerate the prediction of the R-D curve.

It should be noted that, if a video segment (a video segment including a plurality of reference frames) is not properly selected, the selected video segment is not representative, which may affect the prediction accuracy of the R-D curve.

In order to guarantee the representing capability of a video segment containing a plurality of reference frames to a target video, a plurality of video features can be obtained, wherein the plurality of video features correspond to the plurality of video segments in the target video one to one; and determining a target video segment with the minimum feature deviation degree from the plurality of video segments, wherein the feature deviation degree is used for indicating the deviation degree between a first video feature and a second video feature, the first video feature is a video feature corresponding to one of the plurality of video segments, the second video feature is other video features except the first video feature in the plurality of video features, and the plurality of reference frames are video frames contained in the target video segment.

In order to obtain the plurality of video segments, as an alternative embodiment, a target window may be used, and the plurality of video segments are obtained from the target video according to a target step size, wherein the size of the target window is the target length.

As an alternative embodiment, the obtaining a plurality of video features comprises: respectively extracting key frames of each video clip in the plurality of video clips to obtain the key frames corresponding to each video clip; and extracting the image characteristics of the key frame corresponding to each video clip to obtain the video characteristics corresponding to each video clip.

As an alternative embodiment, the determining the target video segment with the minimum feature deviation degree from the plurality of video segments includes: determining a feature deviation degree corresponding to each video clip in the plurality of video clips according to the plurality of video features; and determining a target video clip with the minimum characteristic deviation degree from the plurality of video clips according to the characteristic deviation degree corresponding to each video clip.

As an alternative embodiment, determining, from the plurality of video features, a feature deviation degree corresponding to each of the plurality of video segments comprises: determining a feature difference value corresponding to each of the plurality of video segments according to the plurality of video features, wherein the feature difference value is a difference value between the first video feature and the second video feature; and determining a characteristic deviation degree corresponding to each video segment according to the characteristic difference value, wherein the characteristic deviation degree is the average value of squares of the characteristic difference values.

For example, if a video has a total of N frames and continuous P frames (target length) need to be extracted as representative segments, feature statistics is performed according to a sliding window, and each sliding is performed to obtain a video segment, wherein the video features of the video segment are f (g, g + P-1), and g is greater than or equal to 0 and less than or equal to N-P +1, where g represents a start frame of the video segment, and f (g, g + P-1) represents the video features of the video segment whose frame number is g for the start frame and frame number is (g + P-1) for the end frame.

Calculating the feature variance of each segment and other segments in the following way as shown in formula (1):

where N is the number of video frames included in the target video, P is the length of the sliding window (i.e., the number of video frames included in the video clip), g is the frame number of the starting frame of the current clip, and i is the frame number of the starting frame of the other clip.

Then selecting the optimal initial frame g*Making it Var (g)*P) is the smallest of all g, so that a representative segment of the video, i.e., the target video segment, can be obtained.

It should be noted that, there is no representative segment in the partial video itself, for example, for a long video and some short videos, the representative segment obtained by the above scheme may be only a partial video rather than a representative segment of the whole video, that is, the target video includes a plurality of representative segments, each representative segment being a representative segment of a partial video of the target video.

To improve the ability of the resulting representative segment to characterize the entire video, determining the target video segment with the least deviation in features from the plurality of video segments may comprise: a target video segment with a minimum feature deviation and less than or equal to a first target threshold is determined from the plurality of video segments.

Optionally, in this embodiment, in a case that the feature deviation degree of the video segment with the minimum feature deviation degree is greater than or equal to the first target threshold, the target video may be segmented, and the representative segment of each video segment may be obtained from the video segment obtained after segmentation in a manner similar to that described above.

The target video may be sliced into a plurality of video slices by scene, wherein the target video contains a plurality of scenes and each video slice in the plurality of video slices corresponds to a scene.

For example, the target video may be subjected to scene switching, that is, whether there is scene switching in the target video is determined. If the scene is switched, the target video can be segmented to obtain a plurality of video slices.

Slicing the target video into a plurality of video slices by scene may include: determining the similarity between a first video frame and a second video frame, wherein the first video frame and the second video frame are two adjacent video frames in a target video; and in the case that the similarity between the first video frame and the second video frame is less than or equal to a first similarity threshold, determining the first video frame as the last video frame of the first slice, and determining the second video frame as the first video frame of the second slice, wherein the plurality of video slices comprise the first slice and the second slice, and the first slice and the second slice correspond to two adjacent scenes.

And respectively taking each video slice in the plurality of video slices as the target video, acquiring a target video segment corresponding to each video slice, and taking the rate-distortion curve of the target video segment corresponding to each video slice as the rate-distortion curve of each video slice.

For example, a video slice may be selected, whether the video slice has a representative portion or not may be determined, if so, an R-D curve of the representative portion may be calculated, and the R-D curve of the representative portion may be used as an estimate of the video slice, otherwise, the video slice may be continuously sliced to obtain smaller slices, i.e., video sub-segments, and whether the video sub-segments have representative portions or not may be determined.

The end condition of slice segmentation may be: the segmented slice length is less than or equal to a predetermined threshold. In this case, the slice may be directly encoded using a plurality of code rates, and distortion corresponding to each code rate may be calculated from the encoding result to obtain an R-D curve of the slice, and the slice may be further encoded using the R-D curve.

For a selected video slice, for example, a target slice, a plurality of first video features may be acquired, where the plurality of first video features correspond one-to-one to a plurality of first video segments in the target slice, and the target slice belongs to the plurality of video slices.

When a first target video segment is determined from the plurality of first video segments according to the plurality of first video features, determining a rate-distortion curve corresponding to the first target video segment as the rate-distortion curve corresponding to the target slice, wherein the first target video segment has the smallest feature deviation degree and is smaller than or equal to a first target threshold value.

As an alternative embodiment, in a case that the first target video segment is not determined from the plurality of first video segments according to the plurality of first video features, a similarity between a third video frame and a fourth video frame may be determined, wherein the third video frame and the fourth video frame are two adjacent video frames in the target slice; and determining the third video frame as the last video frame of the first sub-slice and determining the fourth video frame as the first video frame of the second sub-slice under the condition that the similarity between the third video frame and the fourth video frame is less than or equal to a second similarity threshold, wherein the target slice comprises the first sub-slice and the second sub-slice.

It should be noted that the second similarity threshold is higher than the first similarity threshold, that is, the similarity between any adjacent video frames in the target slice is higher than the first similarity threshold, but the similarity between adjacent video frames belonging to adjacent sub-scenes is not higher than the second similarity threshold.

As an optional embodiment, when the video length of the first target sub-slice is less than or equal to the target length threshold, the first target sub-slice may be encoded using a plurality of code rates, respectively, to obtain a plurality of first encoding results, where the first target sub-slice is one of the first sub-slice and the second sub-slice, and the plurality of first encoding results are in one-to-one correspondence with the plurality of code rates; and acquiring a rate-distortion curve corresponding to the first target sub-slice according to the plurality of code rates and the plurality of first coding results.

If the video length of the sub-slice obtained after the segmentation is smaller than or equal to the target length threshold, the sub-slice can be directly coded by using a plurality of code rates, and the rate-distortion curve of the sub-slice is obtained according to the plurality of code rates and a plurality of coding results.

As an alternative embodiment, under the condition that the video length of the second target sub-slice is greater than or equal to the target length threshold, acquiring a plurality of second video features, where the plurality of second video features are in one-to-one correspondence with a plurality of second video segments in the second target sub-slice, and the second target sub-slice is one of the first sub-slice and the second sub-slice; and in the case that a second target video segment is determined from the plurality of second video segments according to a plurality of second video features, determining a rate-distortion curve corresponding to the second target video segment as a rate-distortion curve corresponding to a second target sub-slice, wherein the degree of deviation between a first sub-video feature and a second sub-video feature is less than or equal to a second target threshold, the first sub-video feature is a sub-video feature corresponding to the second target video segment, and the second sub-video feature is other video features except the first sub-video feature in the plurality of second video features.

The plurality of second video segments may be video segments slid on the second target sub-slice using the sliding window and the sliding step size described above. The manner of determining the degree of deviation between video features (feature deviation degree) is similar to that described above, and is not described herein again.

It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present application is not limited by the order of acts described, as some steps may occur in other orders or concurrently depending on the application. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required in this application.

Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present application.

According to another aspect of the embodiment of the application, an information acquisition device for implementing the information acquisition method is also provided. Fig. 6 is a schematic diagram of an alternative information acquiring apparatus according to an embodiment of the present application, and as shown in fig. 6, the apparatus may include:

(1) a first obtaining unit 62, configured to obtain a plurality of reference frames from a target video, where the target video includes a plurality of video frames, and the plurality of reference frames belong to the plurality of video frames;

(2) a first encoding unit 64, connected to the first obtaining unit 62, configured to encode each of the multiple reference frames using multiple code rates, respectively, to obtain multiple encoding results, where the multiple encoding results correspond to the multiple code rates one to one;

(3) and a second obtaining unit 66, connected to the first encoding unit 64, configured to obtain a rate-distortion curve corresponding to the target video according to the multiple code rates and the multiple encoding results.

It should be noted that the first obtaining unit 62 in this embodiment may be configured to perform the step S202, the first encoding unit 64 in this embodiment may be configured to perform the step S204, and the second obtaining unit 66 in this embodiment may be configured to perform the step S206.

Acquiring a plurality of reference frames from a target video through the modules, wherein the target video comprises a plurality of video frames, and the plurality of reference frames belong to the plurality of video frames; respectively encoding each reference frame in the plurality of reference frames by using a plurality of code rates to obtain a plurality of encoding results, wherein the plurality of encoding results correspond to the plurality of code rates one to one; according to the multiple code rates and the multiple coding results, the rate-distortion curve corresponding to the target video is obtained, the problem that data processing errors are too large due to too low precision of the obtained R-D curve in an R-D curve obtaining mode in the related technology is solved, and the precision of data processing is improved.

As an alternative embodiment, the first obtaining unit 62 includes:

an obtaining module, configured to obtain a plurality of reference frames from a target video according to a target parameter, where the target parameter is used to indicate at least one of: the starting position of the plurality of reference frames, the length of the plurality of reference frames, and the ratio of the number of the plurality of reference frames to the number of the plurality of video frames.

As an alternative embodiment, in the case that the plurality of reference frames are video frames in a first video segment of the target video, the obtaining module includes:

the first obtaining sub-module is configured to obtain a first video segment from a target video according to a first start position of the first video segment and a video segment length, where the target parameter includes: a first start position and a video segment length;

and the first analysis submodule is used for carrying out video analysis on the first video segment to obtain a plurality of reference frames.

As an alternative embodiment, in the case that the plurality of reference frames are video frames in a second video segment of the target video, the obtaining module includes:

the second obtaining sub-module is configured to obtain a second video segment from the target video according to a second start position of the second video segment, a length of the target video, and a target ratio, where the target parameter includes: the second starting position, the length of the target video and a target ratio, wherein the target ratio is the ratio between the length of the second video segment and the length of the target video;

and the second analysis submodule is used for carrying out video analysis on the second video segment to obtain a plurality of reference video frames.

As an alternative embodiment, the first obtaining unit 62 includes:

and the analysis module is used for carrying out video analysis on the target video under the condition that the plurality of reference frames are a plurality of video frames to obtain a plurality of reference frames.

As an alternative embodiment, the apparatus further comprises:

the receiving unit is configured to receive configuration information sent by the terminal device before the multiple code rates are used to encode each of the multiple reference frames respectively to obtain multiple encoding results, where the configuration information is used to indicate the multiple code rates.

As an alternative embodiment, the apparatus further comprises:

and the second coding unit is used for coding the target video by using the rate-distortion curve after obtaining the rate-distortion curve corresponding to the target video according to the multiple code rates and the multiple coding results, so as to obtain the coded data corresponding to the target video.

It should be noted here that the modules described above are the same as the examples and application scenarios implemented by the corresponding steps, but are not limited to the disclosure of the above embodiments. It should be noted that the modules described above as a part of the apparatus may be operated in a hardware environment as shown in fig. 1, and may be implemented by software, or may be implemented by hardware, where the hardware environment includes a network environment.

According to another aspect of the embodiments of the present application, there is also provided an electronic device for implementing the above-mentioned information obtaining method, where the electronic device may be a server, a terminal, or a combination thereof.

Fig. 7 is a block diagram of an electronic device according to an embodiment of the present application, and as shown in fig. 7, the electronic device includes a memory 702 and a processor 704, the memory 702 stores a computer program, and the processor 704 is configured to execute the steps in any one of the method embodiments described above through the computer program.

Optionally, in this embodiment, the electronic apparatus may be located in at least one network device of a plurality of network devices of a computer network.

Optionally, in this embodiment, the processor may be configured to execute the following steps by a computer program:

s1, acquiring a plurality of reference frames from a target video, wherein the target video comprises a plurality of video frames, and the plurality of reference frames belong to the plurality of video frames;

s2, coding each reference frame in the multiple reference frames by using multiple code rates to obtain multiple coding results, wherein the multiple coding results correspond to the multiple code rates one to one;

and S3, acquiring a rate-distortion curve corresponding to the target video according to the multiple code rates and the multiple coding results.

The memory 702 may be used to store software programs and modules, such as program instructions/modules corresponding to the information obtaining method and apparatus in the embodiments of the present invention, and the processor 704 executes various functional applications and data processing by running the software programs and modules stored in the memory 702, that is, implements the information obtaining method. The memory 702 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 702 can further include memory located remotely from the processor 704, which can be connected to the terminal over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof. The memory 702 may be, but not limited to, used for storing target video, rate information, encoding results, R-D curves, and other information.

As an example, as shown in fig. 7, the memory 702 may include, but is not limited to, the first obtaining unit 62, the first encoding unit 64, and the second obtaining unit 66 in the obtaining device of the information. In addition, the device may further include, but is not limited to, other module units in the above information obtaining apparatus, which is not described in detail in this example.

Optionally, the transmitting device 706 is used for receiving or sending data via a network. Examples of the network may include a wired network and a wireless network. In one example, the transmission device 706 includes a Network adapter (NIC) that can be connected to a router via a Network cable and other Network devices to communicate with the internet or a local area Network. In one example, the transmission device 706 is a Radio Frequency (RF) module, which is used to communicate with the internet in a wireless manner.

In addition, the electronic device further includes: a display 708 for displaying the R-D curve; and a connection bus 710 for connecting the respective module parts in the above-described electronic apparatus.

Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment is not described herein again.

It can be understood by those skilled in the art that the structure shown in fig. 7 is only an illustration, and the device implementing the information obtaining method may be a terminal device, and the terminal device may be a terminal device such as a smart phone (e.g., an Android phone, an iOS phone, etc.), a tablet computer, a palm computer, a Mobile Internet Device (MID), a PAD, and the like. Fig. 7 is a diagram illustrating a structure of the electronic device. For example, the terminal device may also include more or fewer components (e.g., network interfaces, display devices, etc.) than shown in FIG. 7, or have a different configuration than shown in FIG. 7.

Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by a program instructing hardware associated with the terminal device, where the program may be stored in a computer-readable storage medium, and the storage medium may include: flash disks, Read-Only memories (ROMs), Random Access Memories (RAMs), magnetic or optical disks, and the like.

According to still another aspect of an embodiment of the present application, there is also provided a storage medium. Alternatively, in this embodiment, the storage medium may be a program code for executing the information acquisition method.

Optionally, in this embodiment, the storage medium may be located on at least one of a plurality of network devices in a network shown in the above embodiment.

Optionally, in this embodiment, the storage medium is configured to store program code for performing the following steps:

s1, acquiring a plurality of reference frames from a target video, wherein the target video comprises a plurality of video frames, and the plurality of reference frames belong to the plurality of video frames;

s2, coding each reference frame in the multiple reference frames by using multiple code rates to obtain multiple coding results, wherein the multiple coding results correspond to the multiple code rates one to one;

and S3, acquiring a rate-distortion curve corresponding to the target video according to the multiple code rates and the multiple coding results.

Optionally, the specific example in this embodiment may refer to the example described in the above embodiment, which is not described again in this embodiment.

Optionally, in this embodiment, the storage medium may include, but is not limited to: various media capable of storing program codes, such as a U disk, a ROM, a RAM, a removable hard disk, a magnetic disk, or an optical disk.

The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments.

The integrated unit in the above embodiments, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in the above computer-readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or a part of or all or part of the technical solution contributing to the prior art may be embodied in the form of a software product stored in a storage medium, and including instructions for causing one or more computer devices (which may be personal computers, servers, network devices, or the like) to execute all or part of the steps of the method described in the embodiments of the present application.

In the above embodiments of the present application, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.

In the several embodiments provided in the present application, it should be understood that the disclosed client may be implemented in other manners. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one type of division of logical functions, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.

The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution provided in the embodiment.

In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.

The foregoing is only a preferred embodiment of the present application and it should be noted that those skilled in the art can make several improvements and modifications without departing from the principle of the present application, and these improvements and modifications should also be considered as the protection scope of the present application.

20页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:视频处理方法和装置、存储介质和电子装置

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类