Video processing method and device, equipment, storage medium and program product
By acquiring and fusing low-level details and high-level semantic features of video clips and removing redundant content, the problem of poor deduplication effect before video splicing in the existing technology is solved, and better video deduplication and splicing effects are achieved.
Patent Information
- Application Number
- CN202310320658.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-23
- Publication Date
- 2024-09-24
AI Technical Summary
The existing technology has poor effect when deduplicating multiple video clips before video splicing, resulting in redundant content in the spliced video, which affects the look and feel.
By obtaining low-level detailed features and high-level semantic features of video clips, removing redundant content after fusion, generating target video clips, and generating spliced videos based on the target clips.
Improved video deduplication effect, reduced redundant content in spliced videos, and improved visual effects.
Smart Images

Figure CN118694870A
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of video data processing, and in particular to a video processing method, apparatus, device, storage medium and program product. Background Art
[0002] With the development of the video field, automatic video editing technology has emerged, that is, automatically cutting out multiple video clips from the original video, and then splicing the cut multiple video clips to obtain a spliced video.
[0003] In the related art, before video splicing, multiple video clips need to be deduplicated, for example, duplicate video clips with similar pictures and contents need to be removed, so as to avoid redundant video clips in the spliced video and affect the viewing experience.
[0004] However, in the related art, there is a problem of poor deduplication effect when deduplication is performed on multiple video clips. Summary of the invention
[0005] Based on this, it is necessary to provide a video processing method, device, equipment, storage medium and program product to address the above technical problems, which can improve the deduplication effect when deduplicating multiple video clips.
[0006] In a first aspect, the present application provides a video processing method, the method comprising:
[0007] Obtaining low-level detail features and high-level semantic features of each candidate video segment in the video segment group;
[0008] According to the low-level detail features and high-level semantic features of each candidate video segment, redundant video content between the candidate video segments is removed to obtain at least one target video segment corresponding to the video segment group;
[0009] Based on each target video segment, a spliced video of the video segment group is generated.
[0010] In one embodiment, obtaining low-level detail features of each candidate video segment in the video segment group includes:
[0011] For any candidate video segment, obtain the color features of each frame in the candidate video segment;
[0012] Determine the color features of the candidate video clips according to the color features of each frame;
[0013] The color features of each candidate video segment are determined as low-level detail features of each candidate video segment.
[0014] In one embodiment, determining the color features of the candidate video segments according to the color features of each frame includes:
[0015] The average value of the color features of all frames in the candidate video segment is determined as the color feature of the candidate video segment.
[0016] In one embodiment, obtaining high-level semantic features of each candidate video segment in the video segment group includes:
[0017] For any candidate video segment, the candidate video segment is input into the recognition model, and the high-level semantic features of the candidate video segment are obtained through the recognition model.
[0018] In one embodiment, the recognition model includes an action recognition model, an expression recognition model, and an object recognition model. The candidate video clip is input into the recognition model, and the high-level semantic features of the candidate video clip are obtained through the recognition model, including:
[0019] The candidate video clips are input into the action recognition model, and the action information in the candidate video clips is obtained through the action recognition model;
[0020] Inputting the candidate video clips into the expression recognition model, and obtaining the expression information in the candidate video clips through the expression recognition model;
[0021] The candidate video clips are input into the object recognition model, and the object information in the candidate video clips is obtained through the object recognition model.
[0022] In one of the embodiments, redundant video content between the candidate video segments is removed according to the low-level detail features and high-level semantic features of the candidate video segments to obtain at least one target video segment corresponding to the video segment group, including:
[0023] The low-level detail features and high-level semantic features of each candidate video segment are fused to obtain the fused features of each candidate video segment;
[0024] According to the fusion features of the candidate video segments, redundant video contents between the candidate video segments are removed to obtain at least one target video segment corresponding to the video segment group.
[0025] In one of the embodiments, according to the fusion features of the candidate video segments, redundant video content between the candidate video segments is removed to obtain at least one target video segment corresponding to the video segment group, including:
[0026] Determine the similarity between any two candidate video segments in the video segment group according to the fusion features of each candidate video segment;
[0027] Determine the redundant video content between the candidate video segments according to the similarity between any two candidate video segments;
[0028] Redundant video content between the candidate video segments is removed to obtain at least one target video segment corresponding to the video segment group.
[0029] In one embodiment, determining redundant video content between candidate video segments according to the similarity between any two candidate video segments includes:
[0030] If any two candidate video segments are from the same original video, then the target similarity between any two candidate video segments is determined based on the similarity between the any two candidate video segments and their positions in the original video;
[0031] According to the target similarity between any two candidate video segments, the redundant video content between the candidate video segments is determined.
[0032] In one embodiment, determining a target similarity between any two candidate video segments according to the similarity between the any two candidate video segments and the positions in the original video includes:
[0033] Determine the time interval between any two candidate video segments according to the positions of the any two candidate video segments in the original video;
[0034] If the time interval between any two candidate video segments is less than a preset time interval threshold, the target similarity between the any two candidate video segments is determined according to the similarity between the any two candidate video segments and a preset fixed threshold.
[0035] In one embodiment, determining redundant video content between any two candidate video segments according to the target similarity between the candidate video segments includes:
[0036] If the target similarity between any two candidate video segments is greater than a preset similarity threshold, one of the any two candidate video segments is determined as redundant video content between the candidate video segments.
[0037] In one of the embodiments, after removing redundant video content between the candidate video segments to obtain at least one target video segment corresponding to the video segment group, the method further includes:
[0038] If the number of target video segments is not within the preset number range, the similarity threshold is adjusted to make the number of target video segments within the preset number range.
[0039] In one of the embodiments, before obtaining the low-level detail features and high-level semantic features of each candidate video segment in the video segment group, the method further includes:
[0040] For any candidate video segment, sampling the video frames of the candidate video segment according to a preset frequency to obtain a sampled candidate video segment;
[0041] The sampled candidate video segments are scaled according to a preset size to obtain preprocessed candidate video segments.
[0042] In a second aspect, the present application further provides a video processing device, the device comprising:
[0043] An acquisition module, used for acquiring low-level detail features and high-level semantic features of each candidate video segment in the video segment group;
[0044] A removal module, used to remove redundant video content between each candidate video segment according to low-level detail features and high-level semantic features of each candidate video segment, to obtain at least one target video segment corresponding to the video segment group;
[0045] The splicing module is used to generate a spliced video of the video segment group based on each target video segment.
[0046] In a third aspect, an embodiment of the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method provided in any embodiment of the first aspect when executing the computer program.
[0047] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method provided in any embodiment of the first aspect above.
[0048] In a fifth aspect, an embodiment of the present application further provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the method provided in any embodiment of the first aspect above.
[0049] In the above-mentioned video processing method, apparatus, device, storage medium and program product, in the video processing method provided by the embodiment of the present application, the low-level detail features and high-level semantic features of each candidate video segment in the video segment group are first obtained, and the redundant video content between each candidate video segment is removed according to the low-level detail features and high-level semantic features of each candidate video segment, so as to obtain at least one target video segment corresponding to the video segment group, and generate a spliced video of the video segment group based on each target video segment. In this method, the low-level detail features and high-level semantic features of each candidate video segment are obtained, and the candidate video segments are characterized by features of two dimensions, which further improves the accuracy of determining the redundant video content between each candidate video segment, thereby improving the video deduplication effect when deduplicating multiple video segments; through a given video segment group, video segments with similar pictures and contents are removed, so as to avoid content redundancy in the video edited by all candidate video segments in the video segment group, and have better visual effects. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 is a schematic flow chart of a video processing method in one embodiment;
[0051] Figure 2 is a flow chart of a video processing method in another embodiment;
[0052] Figure 3 is a flow chart of a video processing method in another embodiment;
[0053] Figure 4 is a flow chart of a video processing method in another embodiment;
[0054] Figure 5 is a flow chart of a video processing method in another embodiment;
[0055] Figure 6 is a flow chart of a video processing method in another embodiment;
[0056] Figure 7 is a flow chart of a video processing method in another embodiment;
[0057] Figure 8 is a flow chart of a video processing method in another embodiment;
[0058] Fig. 9 is a structural block diagram of a video processing device in one embodiment;
[0059] Fig.10 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0060] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0061] In one embodiment, Figure 1 As shown, a video processing method is provided. This embodiment takes the method applied to a terminal as an example for illustration. It can be understood that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0062] S101, obtaining low-level detail features and high-level semantic features of each candidate video segment in a video segment group.
[0063] The low-level detail features can characterize the details of the candidate video clips and the feature map has a large resolution, while the high-level semantic features contain rich combination information and characterize the ability to distinguish the candidate video clips.
[0064] Low-level detail features may include features such as contour, edge, color, texture and shape; correspondingly, high-level semantic features may include visual space. For example, when extracting low-level detail features of a face, the contour, nose, eyes, etc. of the face can be extracted, and then the high-level semantic features will be displayed as a face.
[0065] In one embodiment, the method for obtaining the low-level detail features and high-level semantic features of each candidate video segment in the video segment group can be based on a preset feature extraction model. Specifically, each candidate video segment is input into the feature extraction model, the candidate video segment is analyzed by the feature extraction model, and the low-level detail features and high-level semantic features of the candidate video segment are output.
[0066] S102: removing redundant video content between the candidate video segments according to the low-level detail features and high-level semantic features of the candidate video segments, and obtaining at least one target video segment corresponding to the video segment group.
[0067] Based on the low-level detail features and high-level semantic features of the above-mentioned candidate video clips, the composite features of each candidate video clip are determined, and according to the composite features of each candidate video clip, the redundant video content in the video clip group is determined, and the redundant video content is removed to obtain at least one target video clip corresponding to the video clip group.
[0068] The method for obtaining the composite features of each candidate video segment is to describe any candidate video segment, add the low-level detail features and high-level semantic features of the candidate video segment, and use the result of the addition as the composite features of the candidate video segment.
[0069] Based on the composite features of each candidate video segment, continue to judge the similarity of the composite features of each candidate video segment, take one of the two candidate video segments with greater similarity as redundant video content, remove the redundant video content, and determine the remaining candidate video segments as the target video segments corresponding to the video segment group, and there is at least one target video segment.
[0070] The similarity of the composite features of each candidate video segment can be determined by calculating the difference between each candidate video segment and determining the similarity between the two corresponding candidate video segments based on the difference. For example, the smaller the difference, the greater the similarity; the larger the difference, the smaller the similarity.
[0071] For example, if the composite feature of candidate video segment A is A1, and the composite feature of candidate video segment B is B1, the difference between A1 and B1 is calculated. If the difference between A1 and B1 is greater than the preset difference threshold, it means that candidate video segment A and candidate video segment B are not similar video segments. If the difference between A1 and B1 is less than or equal to the preset difference threshold, it is determined that candidate video segment A and candidate video segment B are similar video segments, and candidate video segment A or candidate video segment B can be removed as redundant video content.
[0072] In another embodiment, the low-level detail features and high-level semantic features of each candidate video segment can be directly input into the video processing model according to a preset video processing model. Through analysis by the video processing model, the redundant video content between the candidate video segments is removed and the target video segment is output.
[0073] S103: Generate a spliced video of the video segment group based on each target video segment.
[0074] Directly splice the target video clips in chronological order to obtain a spliced video of the video clip group.
[0075] In the video processing method provided in the embodiment of the present application, the low-level detail features and high-level semantic features of each candidate video segment in the video segment group are first obtained, and the redundant video content between each candidate video segment is removed based on the low-level detail features and high-level semantic features of each candidate video segment to obtain at least one target video segment corresponding to the video segment group, and a spliced video of the video segment group is generated based on each target video segment. In this method, the low-level detail features and high-level semantic features of each candidate video segment are obtained, and the candidate video segments are characterized by features of two dimensions, which further improves the accuracy of determining the redundant video content between each candidate video segment, thereby improving the video deduplication effect when deduplicating multiple video segments; through a given video segment group, video segments with similar pictures and contents are removed, avoiding content redundancy in the video edited by all candidate video segments in the video segment group, and having a better visual effect.
[0076] Taking the low-level detail feature as a color feature as an example, the following describes how to obtain the low-level detail features of each candidate video segment in the video segment group through an embodiment. In one embodiment, Figure 2 As shown, obtaining low-level detail features of each candidate video segment in the video segment group includes the following steps:
[0077] S201, for any candidate video segment, obtaining color features of each frame in the candidate video segment.
[0078] Since the candidate video segment includes multiple video frames, when obtaining the color features of the candidate video segment, the color features of each frame in the candidate video segment are first obtained.
[0079] For example, the color feature is a color histogram, and the video frame images in the candidate video segment are characterized by the color histogram. Therefore, obtaining the color feature of each frame in the candidate video segment is essentially obtaining the color histogram of each frame in the candidate video segment.
[0080] Since the HSV (Hue, Saturation, Value) color space is closer to the color perception experience than RGB (Red, Green, Blue), the color histogram of each frame in the candidate video segment can be obtained by first converting each frame in the candidate video segment from the RGB space to the HSV space, and then calculating the corresponding color histogram based on the HSV space of each frame.
[0081] The color feature of each frame in the candidate video segment is the proportion of various colors in the current frame.
[0082] S202: Determine color features of candidate video segments according to color features of each frame.
[0083] In order to allow the color features of each frame to measure the entire candidate video segment rather than just a single video frame, the color features of each frame in the candidate video segment need to be fused to obtain the color features of the candidate video segment.
[0084] The color features of the candidate video segment can be determined by determining the average value of the color features of all frames in the candidate video segment as the color features of the candidate video segment; still taking the color feature as a color histogram as an example, the average value of the color histograms of all frames in the candidate video segment is determined as the color histogram of the candidate video segment.
[0085] The color feature of the candidate video segment may also be determined by determining the mode of the color features of all frames of the candidate video segment as the color feature of the candidate video segment.
[0086] S203: Determine the color feature of each candidate video segment as the low-level detail feature of each candidate video segment.
[0087] Based on the above method, the color features of each candidate video segment can be determined respectively. The color features of each candidate video segment are the low-level detail features of each candidate video segment.
[0088] In the video processing method provided in the embodiment of the present application, for any candidate video segment, the color features of each frame in the candidate video segment are obtained, and the color features of the candidate video segment are determined based on the color features of each frame, and the color features of each candidate video segment are determined as the low-level detail features of each candidate video segment. In this method, by calculating the color features of each frame of the candidate video segment and determining the color features of the candidate video segment, the low-level detail features of the candidate video segment can be more accurately characterized, thereby improving the accuracy of the low-level detail features of the candidate video segment.
[0089] Since color features are used to evaluate candidate video clips at a low level of semantics, they can only measure whether the images of the candidate video clips are similar. In order to measure whether the contents of the candidate video clips are similar (whether they contain similar objects or actions, etc.), a deep learning model is introduced to obtain high-level semantic features of the candidate video clips. In one embodiment, high-level semantic features of each candidate video clip in the video clip group are obtained, including: for any candidate video clip, the candidate video clip is input into a recognition model, and the high-level semantic features of the candidate video clip are obtained through the recognition model.
[0090] Each candidate video segment is input into the recognition model respectively, each candidate video segment is analyzed by the recognition model, and the high-level semantic features of each candidate video segment are output.
[0091] The recognition model includes an action recognition model, an expression recognition model, and an object recognition model. Therefore, in one embodiment, the candidate video segment is input into the recognition model, and the high-level semantic features of the candidate video segment are obtained through the recognition model, including:
[0092] The candidate video clips are input into the action recognition model, and the action information in the candidate video clips is obtained through the action recognition model.
[0093] The candidate video clips are input into the expression recognition model, and the expression information in the candidate video clips is obtained through the expression recognition model.
[0094] The candidate video clips are input into the object recognition model, and the object information in the candidate video clips is obtained through the object recognition model.
[0095] Among them, action information is the action state, expression information is the expression state, and object information includes the object state; the state indicates whether the corresponding information exists in the candidate video segment; for example, a vector with all values being 0 is preset, the dimension is 3, including actions, expressions and objects respectively, and this vector is used to measure the high-level semantic features of the candidate video segment; when the corresponding recognition model recognizes the action, expression or object in the candidate video segment, the corresponding vector is adjusted to 1.
[0096] Optionally, the action information may be the number of actions, and correspondingly, the expression information may be the number of expressions, and the object information may include the number of objects, and the number may represent the number of occurrences of the corresponding information in the candidate video clips. For example, a vector with all values being 0 and a dimension of 3 is preset, including actions, expressions, and objects, respectively, and this vector is used to measure the high-level semantic features of the candidate video clips. When the corresponding recognition model recognizes an action, expression, or object in the candidate video clip, the corresponding vector is added to 1.
[0097] According to the action information, expression information and object information in the candidate video segment, the high-level semantic features of the candidate video segment are determined, wherein the high-level semantic features are the three-dimensional vectors mentioned above.
[0098] In the video processing method provided in the embodiment of the present application, the candidate video clip is input into the action recognition model, and the action information in the candidate video clip is obtained through the action recognition model. The candidate video clip is input into the expression recognition model, and the expression information in the candidate video clip is obtained through the expression recognition model. The candidate video clip is input into the object recognition model, and the object information in the candidate video clip is obtained through the object recognition model. In this method, the high-level semantic features of the candidate video clip are obtained through the deep learning network model, which improves the efficiency of obtaining the high-level semantic features of the candidate video clip.
[0099] Based on the low-level detail features and high-level semantic features of each candidate video segment obtained in the above embodiment, an embodiment is used below to illustrate how to remove redundant video content between each candidate video segment based on the low-level detail features and high-level semantic features of each candidate video segment. In one embodiment, Figure 3 As shown, according to the low-level detail features and high-level semantic features of each candidate video segment, redundant video content between the candidate video segments is removed to obtain at least one target video segment corresponding to the video segment group, including the following steps:
[0100] S301 , fusing low-level detail features and high-level semantic features of each candidate video segment to obtain fused features of each candidate video segment.
[0101] Feature fusion can obtain the most distinctive information from the original features and eliminate the redundant information generated by the correlation between different features. Therefore, the low-level detail features and high-level semantic features of each candidate video clip can be fused.
[0102] Among them, the method of fusing the low-level detail features and high-level semantic features of each candidate video clip includes feature addition and feature splicing.
[0103] For any candidate video clip, taking feature splicing as an example, the low-level detail features and high-level semantic features of the candidate video clip are spliced to obtain the fused features of the candidate video clip; for example, the low-level detail features of the candidate video clip are (3, 5, 7), and the high-level semantic features are (1, 0, 1), then the fused features of the candidate video clip are (3, 5, 7, 1, 0, 1).
[0104] S302: According to the fusion features of the candidate video segments, redundant video contents between the candidate video segments are removed to obtain at least one target video segment corresponding to the video segment group.
[0105] According to the fusion features of each candidate video clip, the feature similarity between each candidate video clip is determined. If the feature similarity is large, it is determined that the pictures and contents of the two candidate video clips are similar. The candidate video clip with the smaller feature value in the two candidate video contents is regarded as redundant video content and is removed.
[0106] According to the above method, the redundant video content in each candidate video segment is removed, and the remaining candidate video segments in the video segment group that have not been removed are the target video segments.
[0107] In the video processing method provided by the embodiment of the present application, the low-level detail features and high-level semantic features of each candidate video segment are feature fused to obtain the fused features of each candidate video segment; according to the fused features of each candidate video segment, the redundant video content between each candidate video segment is removed to obtain at least one target video segment corresponding to the video segment group. In this method, the low-level detail features and high-level semantic features of each candidate video segment are feature fused so that the obtained fused features can better characterize the corresponding candidate video segment, thereby making it possible to more accurately determine the redundant video content and improve the video deduplication effect.
[0108] In one embodiment, Figure 4 As shown, according to the fusion features of each candidate video segment, redundant video content between each candidate video segment is removed to obtain at least one target video segment corresponding to the video segment group, including the following steps:
[0109] S401 : Determine the similarity between any two candidate video segments in the video segment group according to the fusion features of the candidate video segments.
[0110] Determining the similarity between any two candidate video segments in the video segment group is essentially determining the similarity between any two candidate video segments in the video segment group; wherein the similarity between any two candidate video segments can be characterized by log-likelihood similarity, cosine similarity, Manhattan distance, and the like.
[0111] For example, if the similarity is cosine similarity, the method for determining the similarity between any two candidate video segments in the video segment group may be the method shown in formula (1).
[0112]
[0113] Among them, similarity represents the similarity between two candidate video clips, A and B represent the fusion features of the two candidate video clips, A i represents the i-th value in the fusion feature A, B i represents the i-th value in the fused feature B, n represents the dimension of the fused feature; the similarity value range is [0, 1].
[0114] S402: Determine redundant video content between the candidate video segments according to the similarity between any two candidate video segments.
[0115] Based on the similarity between any two candidate video segments, a threshold can be set to filter duplicate video segments, that is, if the similarity between any two candidate video segments is higher than a fixed threshold, the two candidate video segments are determined to be similar and only one of them can be retained.
[0116] For any two candidate video segments in the video segment group, if the similarity between the two candidate videos is greater than a preset similarity threshold, the two candidate video segments are determined to be similar, and any one of the two candidate video segments can be determined as redundant video content.
[0117] If the similarity between the two candidate videos is less than or equal to a preset similarity threshold, it is determined that the two candidate video clips are not similar.
[0118] Based on the above method for determining whether two candidate video segments are similar, it is determined whether any two candidate video segments in the video segment group are similar, thereby determining redundant video content.
[0119] S403: Remove redundant video content between the candidate video segments to obtain at least one target video segment corresponding to the video segment group.
[0120] After removing redundant video contents between candidate video segments in the video segment group, the remaining candidate video segments in the video segment group are target video segments, wherein there is at least one target video segment.
[0121] In the video processing method provided by the embodiment of the present application, the similarity between any two candidate video segments in the video segment group is determined based on the fusion features of each candidate video segment, and the redundant video content between each candidate video segment is determined based on the similarity between any two candidate video segments, and then the redundant video content between each candidate video segment is removed to obtain at least one target video segment corresponding to the video segment group. In this method, the redundant video content between each candidate video segment is determined by considering the similarity between each two candidate video segments in the video segment group, thereby improving the accuracy of removing redundant video content.
[0122] In the above embodiment, the redundant video content is directly determined based on the similarity between the two candidate video segments, but the prior information of the candidate video segments is not considered. In one embodiment, the similarity between the two candidate video segments can be further improved based on the prior information of the candidate video segments, such as Figure 5 As shown, according to the similarity between any two candidate video segments, determining the redundant video content between the candidate video segments includes the following steps:
[0123] S501: If any two candidate video segments are from the same original video, a target similarity between the any two candidate video segments is determined according to the similarity between the any two candidate video segments and the positions in the original video.
[0124] If two candidate video clips come from similar positions in the same video, then the two candidate video clips are often very similar. Based on this prior, if we can obtain the video meta information of the candidate video clips and know which position of the original material they were originally edited from, we can improve the similarity obtained in the previous step based on this prior information.
[0125] Therefore, the target similarity between any two candidate video segments is further calculated based on the target similarity between any two candidate video segments and the video meta information; specifically, when any two candidate video segments are from the same original video, the target similarity between any two candidate video segments is determined based on the similarity between any two candidate video segments and their positions in the original video.
[0126] Furthermore, if two candidate video clips are from the same original video and are edited from positions that are relatively close to each other (for example, 1 second or 2 seconds apart), it means that the two candidate video clips are likely to be similar. In this case, a fixed value (such as 0.1 or 0.2) can be added to the similarity between the two candidate video clips to determine the target similarity between the two candidate video clips.
[0127] In one embodiment, Figure 6 As shown, according to the similarity between any two candidate video segments and the positions in the original video, determining the target similarity between any two candidate video segments includes the following steps:
[0128] S601, determining a time interval between any two candidate video segments according to positions of the any two candidate video segments in the original video.
[0129] The time interval between any two candidate video segments is determined according to the time positions of the any two candidate video segments in the original video.
[0130] The method for determining the time interval between two candidate video segments can be the shortest time interval between the two candidate video segments, that is, the difference between the start time of the later candidate video segment and the end time of the earlier candidate video segment is determined as the time interval between the two candidate video segments; for example, if the position of candidate video segment A in the original video is 5-9s, and the position of candidate video segment B in the original video is 18-24s, then the time interval between candidate video segments A and B is 9 (18-9)s.
[0131] S602: If the time interval between any two candidate video segments is less than a preset time interval threshold, determine the target similarity between any two candidate video segments according to the similarity between the any two candidate video segments and a preset fixed threshold.
[0132] If the time interval between any two candidate video segments is less than a preset time interval threshold, it can be determined that the distance between the two candidate video segments is close. Then, the target similarity between any two candidate video segments is determined based on the similarity between the any two candidate video segments and a preset fixed threshold.
[0133] Furthermore, the sum of the similarity between any two candidate video segments and a preset fixed threshold is determined as the target similarity between the corresponding two candidate video segments; for example, if the similarity between the two candidate video segments is 0.6 and the fixed threshold is 0.2, the target similarity between the two candidate video segments is 0.8.
[0134] It should be noted that, if any two candidate video segments come from different original videos, the similarity between any two candidate video segments is the target similarity between any two candidate video segments; if any two candidate video segments come from the same original video, but the time interval between any two candidate video segments is greater than or equal to a preset time interval threshold, then the similarity between the two candidate video segments is the target similarity between any two candidate video segments.
[0135] S502: Determine redundant video content between the candidate video segments according to the target similarity between any two candidate video segments.
[0136] If the target similarity between any two candidate video segments is greater than a preset similarity threshold, one of the any two candidate video segments is determined as redundant video content between the candidate video segments.
[0137] Among them, one of the two candidate video segments can be randomly selected as redundant video content, the longer of the two candidate video segments can be selected as redundant video content, and the shorter of the two candidate video segments can be selected as redundant video content; the embodiment of the present application does not limit the method of determining a redundant video content from two candidate video segments.
[0138] If the target similarity between any two candidate video segments is less than or equal to a preset similarity threshold, it is determined that the corresponding two candidate video segments are not similar, that is, they are not redundant video contents.
[0139] In the video processing method provided by the embodiment of the present application, if any two candidate video segments are from the same original video, the target similarity between any two candidate video segments is determined based on the similarity between the any two candidate video segments and their positions in the original video, and the redundant video content between each candidate video segment is determined based on the target similarity between any two candidate video segments. In this method, the time interval between the two candidate video segments is determined by combining their positions in the same original video, and the similarity between the two candidate video segments is accurately determined based on the time interval between the two candidate video segments, thereby improving the accuracy of the target similarity between the two candidate video segments.
[0140] After removing all redundant video content in the video clip group, the similarity threshold can also be dynamically adjusted according to preset conditions. In one embodiment, after removing redundant video content between candidate video clips and obtaining at least one target video clip corresponding to the video clip group, the embodiment includes: if the number of target video clips is not within a preset number range, adjusting the similarity threshold so that the number of target video clips is within a preset number range.
[0141] If the number of target video clips is greater than the number range, the similarity threshold is increased by a preset fixed similarity threshold; and the redundant video content is re-determined based on the fusion features of each candidate video clip in the video clip group until the number of target video clips is within the preset number range.
[0142] If the number of target video clips is less than the number range, the similarity threshold is lowered by a preset fixed similarity threshold; and the redundant video content is re-determined based on the fusion features of each candidate video clip in the video clip group until the number of target video clips is within the preset number range.
[0143] For example, the similarity threshold is fixed at 0.1. If the number of target video clips is 15, the number range is 10-12, and the similarity threshold is 0.7, the similarity threshold is increased to 0.8; and the redundant video content is re-determined based on the fusion features of each candidate video clip in the video clip group until the number of target video clips is within 10-12.
[0144] For example, the similarity threshold is fixed at 0.1. If the number of target video clips is 8, the number range is 10-12, and the similarity threshold is 0.9, the similarity threshold is lowered to 0.8; and the redundant video content is re-determined based on the fusion features of each candidate video clip in the video clip group until the number of target video clips is within 10-12.
[0145] Before obtaining the low-level detail features and high-level semantic features of each candidate video segment in the video segment group, the candidate video segments may be preprocessed, and the low-level detail features and high-level semantic features are obtained based on the preprocessed candidate video segments. That is, in the above embodiments, the low-level detail features and high-level semantic features of each candidate video segment are obtained by obtaining the low-level detail features and high-level semantic features of the preprocessed candidate video segments. In one embodiment, Figure 7 As shown, the preprocessing operation of the candidate video segments includes the following steps:
[0146] S701 : For any candidate video segment, sample the video frames of the candidate video segment according to a preset frequency to obtain a sampled candidate video segment.
[0147] Each candidate video segment may be a video segment edited from the same original video, or may be a video segment edited from multiple different original videos, that is, each candidate video segment may come from a different original video.
[0148] For any candidate video segment, the video frames in the candidate video segment are sampled at a preset frequency, for example, the video frames of the candidate video segment are sampled at 2 frames per second or 4 frames per second, and the sampled video frames are used as the corresponding candidate video segment.
[0149] S702: scaling the sampled candidate video segment according to a preset size to obtain a preprocessed candidate video segment.
[0150] In order to reduce the amount of computation for subsequent feature extraction and to maintain the size of the same candidate video feature, the sampled candidate video segments are scaled to a smaller fixed size.
[0151] Therefore, the sampled candidate video segments are all scaled according to a preset size to obtain preprocessed candidate video segments; wherein the video frames of the scaled candidate video segments maintain the original aspect ratio; for example, while the video frames in the candidate video segments maintain the aspect ratio, each video frame of the sampled candidate video segments is scaled to a long side of 640 or 320.
[0152] It should be noted that in the embodiment of the present application, when obtaining the low-level detail features and high-level semantic features of the candidate video segment, what are obtained are the pre-processed low-level detail features and high-level semantic features of the candidate video segment.
[0153] In the video processing method provided in the embodiment of the present application, for any candidate video segment, the video frames of the candidate video segment are sampled at a preset frequency to obtain a sampled candidate video segment, and the sampled candidate video segment is scaled according to a preset size to obtain a preprocessed candidate video segment. In this method, video frames are sampled in each candidate video segment, so that when calculating the low-level detail features and high-level semantic features of the candidate video segment, only the sampled frames are used for calculation instead of all the frames of the candidate video segment, which reduces the amount of calculation; in addition, each video frame is scaled to a smaller size, which further reduces the amount of calculation for calculating the low-level detail features and high-level semantic features.
[0154] In one embodiment, Figure 8 As shown, the present application also provides a video processing method, which includes the following contents:
[0155] S801 : For each candidate video segment in the video segment group, sampling is performed at a certain frequency, and the sampled candidate video segment is scaled to a preset size to obtain a preprocessed candidate video segment.
[0156] S802: For any candidate video segment, calculate the color histogram of each frame in the candidate video segment, and take the average value of the color histograms of all frames in the candidate video segment as the color histogram of the candidate video segment.
[0157] S803, analyzing the candidate video clips through models such as object recognition, expression recognition, and action recognition to obtain high-level semantic features of the candidate video clips;
[0158] Among them, the high-level semantic features of the candidate video clips include the number of objects, expressions, actions, or the states of objects, expressions, actions.
[0159] S804: Concatenate the color histogram and high-level semantic features of the candidate video segment to obtain fusion features of the candidate video segment.
[0160] S805, calculating the similarity between any two candidate video segments according to the fusion features of any two candidate video segments;
[0161] Among them, the similarity is cosine similarity.
[0162] S806, obtaining the time interval between any two candidate video segments in the original video; if the time interval is greater than a preset interval threshold, the sum of the similarity between any two candidate video segments and the preset time interval threshold is determined as the similarity between any two candidate video segments.
[0163] S807: Randomly remove one of the two candidate video segments whose similarity is higher than a preset similarity threshold, and keep the other candidate video segment.
[0164] S808, splicing the candidate video segments that have not been removed to obtain a spliced video after deduplication;
[0165] Among them, after the judgment of any two candidate video clips is completed, the remaining number of remaining candidate video clips can also be judged. If the remaining number is not within the preset number range, and the remaining number is greater than the preset number range, the threshold is increased and the judgment is made again; if the remaining number is not within the preset number range, and the remaining number is less than the preset number range, the threshold is lowered and the judgment is made again; until the remaining number is within the preset number range.
[0166] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0167] Based on the same inventive concept, the embodiment of the present application also provides a video processing device for implementing the above-mentioned video processing method. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above-mentioned method, so the specific limitations in one or more video processing device embodiments provided below can refer to the limitations on the video processing method above, and will not be repeated here.
[0168] In one embodiment, Fig. 9 As shown, a video processing device 900 is provided, including: an acquisition module 901, a removal module 902 and a splicing module 903, wherein:
[0169] An acquisition module 901 is used to acquire low-level detail features and high-level semantic features of each candidate video segment in the video segment group;
[0170] A removal module 902, configured to remove redundant video content between the candidate video segments according to the low-level detail features and high-level semantic features of the candidate video segments, and obtain at least one target video segment corresponding to the video segment group;
[0171] The stitching module 903 is used to generate a stitched video of the video segment group based on each target video segment.
[0172] In one embodiment, the acquisition module 901 includes:
[0173] A first acquisition unit is used to acquire, for any candidate video segment, a color feature of each frame in the candidate video segment;
[0174] A first determining unit, configured to determine a color feature of a candidate video segment according to a color feature of each frame;
[0175] The second determining unit is used to determine the color feature of each candidate video segment as the low-level detail feature of each candidate video segment.
[0176] In one embodiment, the first determining unit includes:
[0177] The first determining subunit is used to determine an average value of color features of all frames in the candidate video segment as the color feature of the candidate video segment.
[0178] In one embodiment, the acquisition module 901 includes:
[0179] The first recognition unit is used to input any candidate video segment into a recognition model, and obtain high-level semantic features of the candidate video segment through the recognition model.
[0180] In one embodiment, the first identification unit comprises:
[0181] A first recognition subunit is used to input the candidate video segment into the action recognition model, and obtain the action information in the candidate video segment through the action recognition model;
[0182] A second recognition subunit is used to input the candidate video segment into the expression recognition model, and obtain the expression information in the candidate video segment through the expression recognition model;
[0183] The third recognition subunit is used to input the candidate video segment into the object recognition model, and obtain the object information in the candidate video segment through the object recognition model.
[0184] In one embodiment, the removal module 902 includes:
[0185] A fusion unit, used for fusing low-level detail features and high-level semantic features of each candidate video segment to obtain fusion features of each candidate video segment;
[0186] The removal unit is used to remove redundant video content between the candidate video segments according to the fusion features of the candidate video segments, so as to obtain at least one target video segment corresponding to the video segment group.
[0187] In one embodiment, the removal unit comprises:
[0188] A second determination subunit is used to determine the similarity between any two candidate video segments in the video segment group according to the fusion features of each candidate video segment;
[0189] A third determination subunit, configured to determine redundant video content between the candidate video segments according to the similarity between any two candidate video segments;
[0190] The removal subunit is used to remove redundant video content between the candidate video segments to obtain at least one target video segment corresponding to the video segment group.
[0191] In one embodiment, the third determining subunit includes:
[0192] a fourth determination subunit, configured to determine a target similarity between any two candidate video segments according to the similarity between the any two candidate video segments and the positions in the original video if any two candidate video segments are from the same original video;
[0193] The fifth determining subunit is configured to determine redundant video content between the candidate video segments according to the target similarity between any two candidate video segments.
[0194] In one embodiment, the fourth determining subunit includes:
[0195] a sixth determining subunit, configured to determine a time interval between any two candidate video segments according to positions of the any two candidate video segments in the original video;
[0196] The seventh determination subunit is used to determine the target similarity between any two candidate video segments according to the similarity between the any two candidate video segments and a preset fixed threshold if the time interval between any two candidate video segments is less than a preset time interval threshold.
[0197] In one embodiment, the fifth determining subunit includes:
[0198] The eighth determination subunit is configured to determine one of the two candidate video segments as redundant video content between the candidate video segments if the target similarity between the two candidate video segments is greater than a preset similarity threshold.
[0199] In one embodiment, the apparatus 900 further includes:
[0200] The adjustment module is used to adjust the similarity threshold if the number of target video clips is not within a preset number range, so that the number of target video clips is within the preset number range.
[0201] In one embodiment, the apparatus 900 further includes:
[0202] A sampling module, used for sampling the video frames of any candidate video segment according to a preset frequency to obtain a sampled candidate video segment;
[0203] The scaling module is used to scale the sampled candidate video segments according to a preset size to obtain pre-processed candidate video segments.
[0204] Each module in the above video processing device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0205] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.10 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store video processing data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a video processing method is implemented.
[0206] Those skilled in the art will understand that Fig.10 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0207] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0208] The implementation principles and technical effects of each step implemented by the processor in the embodiment of the present application are similar to the principles of the above-mentioned video processing method and will not be repeated here.
[0209] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0210] The implementation principles and technical effects of the steps implemented when the computer program in the embodiment of the present application is executed by the processor are similar to the principles of the above-mentioned video processing method and will not be repeated here.
[0211] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0212] The implementation principles and technical effects of the steps implemented when the computer program in the embodiment of the present application is executed by the processor are similar to the principles of the above-mentioned video processing method and will not be repeated here.
[0213] It should be noted that the data involved in this application (including but not limited to data used for analysis, stored data, displayed data, etc.) are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.
[0214] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0215] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0216] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A video processing method, It is characterized in that The method comprises: Obtaining low-level detail features and high-level semantic features of each candidate video segment in the video segment group; According to the low-level detail features and high-level semantic features of each of the candidate video segments, redundant video content between the candidate video segments is removed to obtain at least one target video segment corresponding to the video segment group; Based on each of the target video segments, a spliced video of the video segment group is generated.
2. The method according to claim 1, It is characterized in that The obtaining of low-level detail features of each candidate video segment in the video segment group includes: For any candidate video segment, obtain the color features of each frame in the candidate video segment; Determining the color features of the candidate video clips according to the color features of each frame; The color features of each of the candidate video segments are determined as low-level detail features of each of the candidate video segments.
3. The method according to claim 2, It is characterized in that The step of determining the color feature of the candidate video segment according to the color feature of each frame includes: An average value of the color features of all frames in the candidate video segment is determined as the color feature of the candidate video segment.
4. The method according to claim 1, It is characterized in that The step of obtaining high-level semantic features of each candidate video segment in the video segment group includes: For any candidate video segment, the candidate video segment is input into a recognition model, and high-level semantic features of the candidate video segment are obtained through the recognition model.
5. The method according to claim 4, It is characterized in that The recognition model includes an action recognition model, an expression recognition model and an object recognition model. The candidate video segment is input into the recognition model, and the high-level semantic features of the candidate video segment are obtained through the recognition model, including: Inputting the candidate video clip into the action recognition model, and obtaining action information in the candidate video clip through the action recognition model; Inputting the candidate video clip into the expression recognition model, and obtaining expression information in the candidate video clip through the expression recognition model; The candidate video segment is input into the object recognition model, and the object information in the candidate video segment is obtained through the object recognition model.
6. The method according to any one of claims 1 to 5, It is characterized in that The removing redundant video content between the candidate video segments according to the low-level detail features and high-level semantic features of the candidate video segments to obtain at least one target video segment corresponding to the video segment group includes: Fusing low-level detail features and high-level semantic features of each of the candidate video clips to obtain fused features of each of the candidate video clips; According to the fusion features of the candidate video segments, redundant video contents between the candidate video segments are removed to obtain at least one target video segment corresponding to the video segment group.
7. The method according to claim 6, It is characterized in that The removing redundant video contents between the candidate video segments according to the fusion features of the candidate video segments to obtain at least one target video segment corresponding to the video segment group includes: Determining the similarity between any two candidate video segments in the video segment group according to the fusion features of each of the candidate video segments; Determining redundant video content between the candidate video segments according to the similarity between the arbitrary two candidate video segments; Redundant video content between the candidate video segments is removed to obtain at least one target video segment corresponding to the video segment group.
8. The method according to claim 7, It is characterized in that The determining, according to the similarity between the any two candidate video segments, the redundant video content between the candidate video segments comprises: If the arbitrary two candidate video segments are from the same original video, determining the target similarity between the arbitrary two candidate video segments according to the similarity between the arbitrary two candidate video segments and the positions in the original video; The redundant video content between the candidate video segments is determined according to the target similarity between the any two candidate video segments.
9. The method according to claim 8, It is characterized in that The step of determining the target similarity between the arbitrary two candidate video segments according to the similarity between the arbitrary two candidate video segments and the positions in the original video includes: Determine the time interval between the two candidate video segments according to the positions of the two candidate video segments in the original video; If the time interval between the arbitrary two candidate video segments is less than a preset time interval threshold, the target similarity between the arbitrary two candidate video segments is determined according to the similarity between the arbitrary two candidate video segments and a preset fixed threshold.
10. The method according to claim 9, It is characterized in that The step of determining redundant video content between the candidate video segments according to the target similarity between the arbitrary two candidate video segments includes: If the target similarity between any two candidate video segments is greater than a preset similarity threshold, one of the any two candidate video segments is determined as redundant video content between the candidate video segments.
11. The method according to claim 7, It is characterized in that After removing the redundant video content between the candidate video segments to obtain at least one target video segment corresponding to the video segment group, the method further includes: If the number of the target video segments is not within the preset number range, the similarity threshold is adjusted so that the number of the target video segments is within the preset number range.
12. The method according to any one of claims 1 to 5, It is characterized in that Before obtaining the low-level detail features and high-level semantic features of each candidate video segment in the video segment group, the method further includes: For any candidate video segment, sampling the video frames of the candidate video segment according to a preset frequency to obtain a sampled candidate video segment; The sampled candidate video segments are scaled according to a preset size to obtain preprocessed candidate video segments.
13. A video processing device, It is characterized in that The device comprises: An acquisition module, used for acquiring low-level detail features and high-level semantic features of each candidate video segment in the video segment group; A removal module, configured to remove redundant video content between the candidate video segments according to low-level detail features and high-level semantic features of the candidate video segments, to obtain at least one target video segment corresponding to the video segment group; The splicing module is used to generate a spliced video of the video segment group based on each of the target video segments.
14. A computer device comprising a memory and a processor, wherein the memory stores a computer program. It is characterized in that When the processor executes the computer program, the steps of the method according to any one of claims 1 to 12 are implemented.
15. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 12 are implemented.
16. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 12 are implemented.
