Video clip method, device and storage medium
By dividing video segments based on pre-defined editing configuration options and performing semantic matching, combined with user editing operations, the problem of accurate matching and intervention in video editing is solved, achieving an efficient and accurate video editing process.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHENZHEN EMEET TECH CO LTD
- Filing Date
- 2026-01-26
- Publication Date
- 2026-07-10
AI Technical Summary
In the current video editing process, users find it difficult to achieve accurate matching and cannot intervene in or fine-tune intermediate results, resulting in low efficiency.
By acquiring the video to be edited and the search text entered by the user, candidate video segments are divided based on pre-set editing configuration items, and the target video segment is determined through semantic matching. The user is allowed to preview and edit the target video segment, and finally the final edited video is generated.
It achieves standardized splitting of videos to be edited, improves the efficiency and accuracy of target segment selection and matching, and provides personalized editing space, reducing the operation threshold and editing efficiency.
Smart Images

Figure CN121603747B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of video processing technology, and in particular to a video editing method, device and storage medium. Background Technology
[0002] During video editing, users typically need to select segments from the original video that meet specific requirements and then splice them together. Currently, editing is generally done manually by reviewing each frame and manipulating the timeline, which is inefficient and makes it difficult to achieve accurate matching under complex conditions. While automatic editing using cloud-based AI models can directly output editing results based on user instructions, the entire editing process is executed in a closed system on the server side, and users cannot intervene in or fine-tune the intermediate results.
[0003] The above content is only used to help understand the technical solution of this application and does not represent an admission that the above content is prior art. Summary of the Invention
[0004] The main purpose of this application is to provide a video editing method, device and storage medium, which aims to solve the technical problem of inaccurate demand matching and inability to intervene in the video editing process.
[0005] To achieve the above objectives, embodiments of this application provide a video editing method, the video editing method comprising:
[0006] Obtain the video to be edited and the search text entered by the user;
[0007] According to the pre-set editing configuration options, the video to be edited is divided into multiple candidate video segments;
[0008] Based on the search text, semantic matching is performed on each of the candidate video segments to determine the target video segment that matches the search text;
[0009] In response to the user's preview and editing operation on the target video segment, the final edited video is generated.
[0010] In one embodiment, after the step of obtaining the video to be edited and the search text input by the user, the video editing method further includes:
[0011] The video to be edited is subjected to specification detection to obtain the video parameters of the video to be edited, including duration, resolution and bitrate;
[0012] Based on the comparison results between the video parameters and the corresponding preset parameter thresholds, specification prompts are output to the user.
[0013] In one embodiment, the step of dividing the video to be edited into multiple candidate video segments according to pre-set editing configuration options includes:
[0014] Obtain pre-defined editing configuration items, including editing precision parameters and matching segment duration;
[0015] The frame extraction frequency is determined based on the editing precision parameters, and the frame extraction process is performed on the video to be edited based on the frame extraction frequency to obtain a video frame sequence.
[0016] Based on the duration of the matched segments, the video frame sequence is divided into multiple candidate video segments.
[0017] In one embodiment, the step of performing semantic matching on each of the candidate video segments based on the search text to determine the target video segment that matches the search text includes:
[0018] Based on the search text, semantic matching is performed on each of the candidate video segments to obtain the matching metric value corresponding to each of the candidate video segments;
[0019] If the number of candidate video segments whose matching metric value is not lower than a preset threshold is lower than a preset number threshold, or the highest matching metric value among all candidate video segments is lower than the preset threshold, then information supplementation prompts are generated based on the content semantic features of the candidate video segments, and supplementary information input by the user based on the information supplementation prompts is received.
[0020] Based on the search text and the supplementary information, an enhanced search text is generated;
[0021] Based on the enhanced search text, semantic matching is re-performed on each of the candidate video segments to obtain the updated matching metric value corresponding to each of the candidate video segments;
[0022] Candidate video segments whose updated matching metric value is not lower than the preset threshold are identified as target video segments.
[0023] In one embodiment, the step of re-performing semantic matching on each of the candidate video segments based on the enhanced search text to obtain an updated matching metric value corresponding to each of the candidate video segments includes:
[0024] Obtain the candidate video segments and the enhanced search text;
[0025] The pre-trained video encoding model and text encoding model are invoked to encode the candidate video segment and the enhanced retrieval text, respectively, to obtain video features and text features;
[0026] Multi-head attention calculation is performed on the video features and the text features to obtain the attention weights corresponding to each attention head;
[0027] Based on the attention weights, a matching metric is generated between each candidate video segment and the enhanced search text.
[0028] In one embodiment, the step of generating the final edited video in response to a user's preview and editing operation on the target video segment includes:
[0029] Generate preview information for each of the target video segments, the preview information including segment thumbnails, semantic tags, matching confidence scores, and the duration of the target video segments;
[0030] The target video clip and corresponding preview information are displayed in the video clip preview interface, and editing instructions input by the user are received. The editing instructions include clip selection, order adjustment or clip duration trimming.
[0031] The final selected target video segments and their corresponding arrangement order are determined according to the editing instructions;
[0032] The final selected target video segments are spliced together based on the arrangement order to generate the final edited video.
[0033] In one embodiment, the video editing method further includes:
[0034] Obtain the target scene type corresponding to the video to be edited;
[0035] According to the target scene type, the corresponding scene rule library is loaded. The scene rule library includes preset search terms, preset editing configuration items, and event recognition rules. Each set of preset editing configuration items includes corresponding editing precision parameters and matching segment duration.
[0036] The search text entered by the user is matched with the preset search terms in the scene rule base to obtain the target preset search terms, and the target preset clip configuration item corresponding to the target preset search terms is determined.
[0037] Based on the target preset editing configuration items, the frame extraction frequency is determined, and the frame extraction process is performed on the video to be edited to obtain a video frame sequence;
[0038] Based on the event recognition rules and combined with the matching segment duration in the target preset editing configuration item, the video frame sequence is divided to obtain multiple candidate video segments containing key scene events;
[0039] Based on the retrieved text, perform semantic matching on each of the candidate video segments to determine the target video segment.
[0040] In one embodiment, the step of dividing the video frame sequence based on the event recognition rules and the matching segment duration in the target preset editing configuration item to obtain multiple candidate video segments containing key scene events includes:
[0041] Based on the event recognition rules, determine the scene features corresponding to each key event in the scene;
[0042] A dedicated recognition sub-model corresponding to the target scene type is activated, and based on the scene features, the start and end frames of each scene key event in the video frame sequence are determined by the dedicated recognition sub-model.
[0043] Based on the start frame and end frame of each key event in the scene and the duration of the matching segment in the target preset editing configuration item, the video frame sequence is divided to obtain multiple candidate video segments containing the key events in the scene.
[0044] This application embodiment also provides a video editing device, the video editing device including: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the video editing method as described above.
[0045] This application embodiment also provides a storage medium, which is a computer-readable storage medium, and stores a computer program thereon. When the computer program is executed by a processor, it implements the steps of the video editing method described above.
[0046] One or more technical solutions proposed in this application have at least the following technical effects:
[0047] This application achieves standardized and normalized segmentation of candidate video segments based on pre-defined editing configuration items, avoiding the subjectivity and randomness of manual segmentation and laying the foundation for subsequent accurate matching. By semantically matching the search text with the candidate video segments, it replaces the traditional method of manually browsing and filtering segment by segment, quickly locating the target video segments that match the user's needs, significantly improving the efficiency and accuracy of target segment selection. Furthermore, by responding to the user's preview and editing operations on the target video segments, it provides users with personalized adjustment space for the editing results, making the final edited video more in line with the user's actual needs. This application forms a complete technical chain of "standardized segmentation - accurate matching - personalized editing" through the above technical means, achieving a synergistic effect of improved video editing efficiency, optimized editing accuracy, and satisfaction of users' personalized needs, effectively reducing the operational threshold and efficiency of video editing. Attached Figure Description
[0048] Figure 1 This is a flowchart illustrating an embodiment of the video editing method of this application.
[0049] Figure 2 This is a flowchart illustrating Embodiment 2 of the video editing method of this application;
[0050] Figure 3 This is a flowchart illustrating Embodiment 3 of the video editing method of this application;
[0051] Figure 4 A schematic diagram of the structure of a video editing device in the hardware operating environment involved in the video editing method in this application embodiment.
[0052] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0053] It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit this application.
[0054] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.
[0055] During video editing, users typically need to select segments from the original video that meet specific requirements and then splice them together. Currently, editing is generally done manually by reviewing each frame and manipulating the timeline, which is inefficient and makes it difficult to achieve accurate matching under complex conditions. While automatic editing using cloud-based AI models can directly output editing results based on user instructions, the entire editing process is executed in a closed system on the server side, and users cannot intervene in or fine-tune the intermediate results.
[0056] In view of the above problems, this application proposes a video editing method, which involves obtaining a video to be edited and a search text input by the user; dividing the video to be edited into multiple candidate video segments according to pre-set editing configuration items; performing semantic matching on each of the candidate video segments based on the search text to determine a target video segment that matches the search text; and generating a final edited video in response to the user's preview and editing operation on the target video segment.
[0057] This application provides a solution that standardizes and normalizes the splitting of candidate video segments based on pre-defined editing configuration items, avoiding the subjectivity and randomness of manual segment splitting and laying the foundation for subsequent accurate matching. By semantically matching the search text with the candidate video segments, it replaces the traditional method of manually browsing and filtering segment by segment, quickly locating the target video segment that matches the user's needs, significantly improving the efficiency and accuracy of target segment filtering. Furthermore, by responding to the user's preview and editing operations on the target video segments, it provides users with personalized adjustment space for the editing results, making the final edited video more closely suited to the user's actual needs. This application forms a complete technical chain of "standardized splitting - accurate matching - personalized editing" through the above technical means, achieving a synergistic effect of improved video editing efficiency, optimized editing accuracy, and satisfaction of users' personalized needs, effectively reducing the operational threshold and efficiency of video editing.
[0058] It should be noted that the executing entity in this embodiment can be a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, or mobile phone, or an electronic device or video editing system capable of performing the above functions. The following description uses a video editing system as an example to illustrate this embodiment and the subsequent embodiments.
[0059] The video editing method of the first embodiment proposed in this application can be found in [reference needed]. Figure 1 The method includes steps S10 to S40:
[0060] Step S10: Obtain the video to be edited and the search text entered by the user.
[0061] It should be noted that the video to be edited refers to the original video file from which the user needs to perform editing operations such as segment extraction and splicing. This can be a video file stored locally by the user or a video file obtained through network transmission. The search text refers to the text information entered by the user to indicate their video editing needs; it reflects the target content characteristics the user hopes to extract from the video to be edited.
[0062] The methods for obtaining the retrieved text include text, voice, and images. Specifically, it receives text information entered by the user through a text input box; it receives the user's voice information through a voice recognition interface and converts it into text information; or it receives images uploaded by the user that contain editing requirements, extracts the text content from them, and converts it into text information.
[0063] Understandably, since videos to be edited often contain a lot of irrelevant content, and users find it difficult to manually locate the target video segment, explicitly obtaining the user's intent (i.e., the search text) and the material to be processed (i.e., the video to be edited) can avoid blindly traversing the entire video for manual screening, thereby improving editing efficiency and semantic relevance.
[0064] As one possible implementation, step S10 is followed by steps S11-S12:
[0065] Step S11: Perform specification detection on the video to be edited to obtain the video parameters of the video to be edited, including duration, resolution and bitrate.
[0066] Step S12: Based on the comparison result between the video parameters and the corresponding preset parameter thresholds, output specification prompt information to the user.
[0067] It should be noted that video parameters refer to data describing the basic attributes of the video to be edited. Among these, duration refers to the total playback time of the video, resolution refers to the pixel size of the video frame, and bitrate refers to the data transmission rate per unit time, which directly affects the video quality and file size. Specification prompts are prompts generated based on the comparison between video parameters and preset parameter thresholds. They are used to inform the user of the potential impact of the video's specifications on subsequent processing.
[0068] In this embodiment, the process of performing specification detection on the video to be edited includes calling the video decoding interface to read the file header information of the video to be edited, and extracting basic parameters such as duration, resolution and bitrate from the file header information; if the file header information is incomplete, the actual playback duration and screen resolution of the video to be edited are obtained by decoding part or all of the video frames.
[0069] Subsequently, each video parameter is compared with its corresponding preset parameter threshold. If any video parameter exceeds the preset parameter threshold range, a corresponding specification prompt is generated and fed back to the user through a graphical interface or pop-up window.
[0070] As an example, when the length of the video to be edited exceeds a preset threshold (such as 30 minutes), a prompt will be issued to the user that "the video is too long and the processing time may be extended"; when the video resolution of the video to be edited is lower than 720P or the bitrate is lower than 1Mbps, a prompt will be issued that "the video specifications are low and may affect the editing accuracy".
[0071] Optionally, based on the specification detection results, recommended editing configuration options are generated and fed back to the user, thus providing a reference for the user to configure editing options. For example, when a low-resolution video is detected to be to be edited, a configuration scheme that reduces the search accuracy is automatically recommended to balance processing speed and matching effect; when the duration of the video to be edited is detected to be too long, a configuration scheme that increases the duration of the matching segment is automatically recommended to reduce the total number of candidate video segments, thereby optimizing the processing flow.
[0072] In this embodiment, by supporting multiple input methods to acquire the video to be edited and the search text, it can adapt to the user's material input needs in different scenarios. Simultaneously, by performing specification detection on the video to be edited and outputting prompts, it can pre-identify video specification factors that may affect the subsequent editing process, thereby providing users with adaptive editing configuration recommendations, improving the stability, applicability, and intelligence of the video editing method.
[0073] Step S20: Divide the video to be edited into multiple candidate video segments according to the preset editing configuration items.
[0074] It should be noted that the editing configuration items refer to a complete set of parameters used to control the preprocessing, segmentation, and semantic matching processes of the video to be edited. Its function is to achieve a dynamic balance between processing efficiency and matching accuracy through the coordinated control of multiple parameters, thereby adapting to different video specifications and user needs.
[0075] The editing configuration parameters in the editing settings include editing precision parameters, retrieval precision parameters, and matching segment duration. Editing precision parameters adjust the granularity of computation during video preprocessing, including frame extraction frequency and image size adjustment strategies. By adjusting the sampling density and resolution of video frames, these parameters effectively control the input data scale and system computational load during the feature extraction stage. Retrieval precision parameters set the feature similarity threshold and the number of target video segments output during semantic matching. By adjusting the feature matching criteria, these parameters balance the recall, matching efficiency, and matching accuracy of target video segments. Matching segment duration is a reference duration used to divide candidate video segments. Its purpose is to standardize the segmentation scale, avoiding both excessively short segments that result in incomplete semantic information and inaccurate matching of retrieval needs, and excessively long segments that cause redundant computation for feature extraction and matching, thus affecting overall processing speed.
[0076] As one possible implementation, step S20 includes steps S210 to S230:
[0077] Step S210: Obtain the pre-set editing configuration items, which include editing precision parameters and matching segment duration.
[0078] Step S220: Determine the frame extraction frequency according to the clip precision parameter, and perform frame extraction on the video to be clipped based on the frame extraction frequency to obtain a video frame sequence.
[0079] Step S230: Divide the video frame sequence into multiple candidate video segments according to the matching segment duration.
[0080] In this embodiment, the clip configuration items can be manually set by the user through a graphical interface, or the system can automatically recommend adapted parameters according to the detection result of the specification of the video to be clipped. The clip precision parameter is positively correlated with the frame extraction frequency. The higher the clip precision parameter, the higher the corresponding frame extraction frequency, the more video frames are extracted, and the higher the subsequent feature extraction and analysis fineness (i.e., the retrieval precision parameter). The matching segment duration is negatively correlated with the number of candidate video segments. The longer the matching segment duration, the fewer the number of candidate video segments divided, and the smaller the subsequent semantic matching calculation amount.
[0081] As an example, when the clip precision parameter is set to high, the corresponding frame extraction frequency is 4 frames per second (i.e., 4 images are extracted per second). The image size adjustment (resize) operation uses the bilinear interpolation algorithm, which can maximize the retention of image details and provide high-granularity video feature data for subsequent model feature extraction and analysis. When the clip precision parameter is set to medium, the corresponding frame extraction frequency is 2 frames per second, and the resize operation uses the ordinary interpolation algorithm to balance between image detail retention and processing efficiency. When the clip precision parameter is set to low, the corresponding frame extraction frequency is 1 frame per second, and the resize operation uses the fast downsampling algorithm to prioritize the preprocessing speed of the video to be clipped. All preprocessing processes are invisible to the user and are only automatically completed in the background, and finally a standardized video frame sequence is output for subsequent module use such as segment division.
[0082] In addition, the system has a built-in parameter collaborative regulation logic to achieve the联动适配 of different clip configuration parameters and avoid the imbalance of single parameter settings. For example, when the clip precision parameter is set to high, the frame extraction frequency is higher, the picture details are richer, and the granularity and total amount of video data also increase. At this time, the system can automatically recommend a shorter matching segment duration to avoid the combination of high-granularity video data and too long matching segment duration, resulting in too much data volume in a single candidate video segment, which not only increases the calculation burden of feature extraction but also cannot fully utilize the advantages of high-granularity video data, ultimately causing waste of computing resources.
[0083] As an example, when the user sets the editing precision parameter to "high", the system automatically recommends the retrieval precision parameter to "medium" or "high" to avoid mismatch between high-granularity data and low-precision semantic matching strategies, which would waste data processing resources. When the user sets the matching segment duration to "10-20 seconds", the system automatically lowers the editing precision parameter to "medium" or "low". This is because longer candidate video segments have lower requirements for frame-level detail granularity. By reducing the frame extraction frequency, the computational load of subsequent feature extraction and matching can be effectively reduced, thereby improving overall processing efficiency.
[0084] As another example, when the user sets the retrieval precision parameter to "high", the system increases the feature similarity threshold in the semantic matching process to 0.7 and outputs 30 target video segments to ensure the recall rate of the target video segments; when the user sets the retrieval precision parameter to "low", the system lowers the feature similarity threshold to 0.4 and outputs only 5 target video segments, thereby speeding up the overall processing speed of semantic matching.
[0085] It should be noted that when the retrieval precision parameter is set to "high," the system prioritizes ensuring that no truly matching target video segments are missed. Therefore, it increases the feature similarity threshold to ensure that candidate video segments entering subsequent processing have high semantic reliability. Simultaneously, combined with a high output limit, the system can retain as many potentially matching target video segments as possible from high-quality candidate video segments, thus achieving high recall with high confidence. When the retrieval precision parameter is set to "low," the system prioritizes matching speed. In this case, the system lowers the feature similarity threshold to quickly filter out initially matching candidate video segments. Then, combined with a lower output limit, it further reduces the number of target video segments that need to be processed, thereby improving overall processing speed.
[0086] Recall refers to the proportion of the number of actually matched target video segments to the total number of truly matched target video segments. The higher the value, the less likely it is to miss the target video segment needed by the user. When the retrieval precision parameter is "high", a lower feature similarity threshold will lower the matching threshold, thus ensuring a high recall rate. When the retrieval precision parameter is "low", a higher feature similarity threshold will raise the matching threshold, which will lower the recall rate, but can significantly reduce the number of candidate video segments and improve processing speed.
[0087] This embodiment achieves standardized preprocessing and structured segmentation of the video to be edited through the overall control of editing configuration items, providing a suitable data foundation for subsequent accurate semantic matching. After the system obtains the video to be edited, it first performs preprocessing. By receiving the editing configuration items preset by the user or automatically recommended by the system, the corresponding editing precision parameters are obtained. Then, based on the editing precision parameters, the specific frame extraction frequency and image size adjustment strategy are determined, and adaptive frame extraction is performed on the video to be edited according to the frame extraction frequency. At the same time, through the corresponding interpolation or downsampling algorithm, each extracted frame image is uniformly adjusted to a preset standard size and center-aligned cropping is completed, finally forming a standardized video frame sequence arranged in chronological order. This allows for the control of data scale while achieving uniformity of input data specifications. Subsequently, based on the matching segment duration in the editing configuration items, the video frame sequence is divided using the matching segment duration as a reference benchmark to obtain multiple candidate video segments, forming a standardized processing unit suitable for batch semantic matching.
[0088] Step S30: Perform semantic matching on each of the candidate video segments based on the search text to determine the target video segment that matches the search text.
[0089] It should be noted that semantic matching refers to the process of analyzing the semantic content of the search text and the video features of each candidate video segment to select target video segments that semantically match the search text. Target video segments are those selected from the video to be edited through semantic matching that match the semantics of the user-input search text; they serve as the foundational material for subsequent previewing, editing, and generating the final edited video.
[0090] In this embodiment, after obtaining standardized candidate video segments through the aforementioned preprocessing procedure for the video to be edited, the system performs end-to-end semantic matching processing on each candidate video segment based on the retrieved text. Specifically, firstly, a pre-trained multimodal feature extraction model is invoked to encode features for both the retrieved text and each candidate video segment: for the retrieved text, semantic features are extracted through a text encoding network to generate a fixed-dimensional text feature vector; for each candidate video segment, visual semantic features of its frame sequence are extracted through a video encoding network to generate a video feature vector with the same dimension as the text feature vector. Subsequently, the system uses a cosine similarity algorithm to calculate the similarity value between the text feature vector and the video feature vector of each candidate video segment, thereby quantifying the degree of semantic matching between the two. Finally, the system filters according to the rules set by the retrieval accuracy parameter: candidate video segments with similarity values not lower than the feature similarity threshold are included in the preliminary matching result set. If the number of candidate video segments in the preliminary matching result set exceeds the preset number threshold, they are sorted in descending order of similarity value, and the candidate video segments with the highest preset number threshold are selected as the final target video segments. If the number of candidate video segments in the preliminary matching result set does not reach the preset number threshold, all candidate video segments in the preliminary matching result set are directly determined as target video segments, ensuring that while maintaining matching accuracy, the balance requirements of the retrieval accuracy parameter for matching efficiency and recall are met.
[0091] As one possible implementation, step S30 includes steps S310 to S350:
[0092] Step S310: Perform semantic matching on each of the candidate video segments based on the retrieved text to obtain the matching metric value corresponding to each of the candidate video segments.
[0093] Step S320: If the number of candidate video segments with matching metric values not lower than a preset threshold is lower than a preset number threshold, or the highest matching metric value among all candidate video segments is lower than the preset threshold, then information supplementation prompts are generated based on the content semantic features of the candidate video segments, and supplementary information input by the user based on the information supplementation prompts is received.
[0094] Step S330: Generate enhanced search text based on the search text and the supplementary information.
[0095] Step S340: Based on the enhanced search text, re-perform semantic matching on each of the candidate video segments to obtain the updated matching metric value corresponding to each of the candidate video segments.
[0096] Step S350: The candidate video segments whose updated matching metric value is not lower than the preset threshold are determined as the target video segments.
[0097] It should be noted that the matching metric value refers to a specific numerical value calculated by a specific algorithm to measure the similarity between the semantic content of the search text and the video features of the candidate video clips. The magnitude of this value is positively correlated with the degree of semantic matching between the two. The preset threshold (equivalent to the preset feature similarity threshold) refers to the pre-set critical value of the matching metric value used to determine whether the candidate video clips and the search text have initially matched. The preset quantity threshold refers to the pre-set critical value used to determine whether the number of candidate video clips that have initially matched meets the requirements. The content semantic features refer to the set of features contained in the candidate video clips, such as visual content, action behavior, scene environment, and emotional tendency, that can reflect its core semantics. The information supplement prompts refer to the prompt content generated by the system based on the content semantic features of the candidate video clips, used to guide users to supplement the search-related information. The enhanced search text refers to the text generated after semantically fusing the original search text with the supplementary information entered by the user, which has richer semantic information and a clearer search direction.
[0098] In this embodiment, a pre-trained multimodal feature extraction model can be used to encode the retrieved text and candidate video segments respectively, generating text feature vectors and video feature vectors with the same dimension. Then, cosine similarity algorithm, Euclidean distance algorithm or Manhattan distance algorithm are used to calculate the similarity between the text feature vector and the video feature vector. After normalizing the calculation results, a matching metric value is obtained.
[0099] As an example, when using the cosine similarity algorithm, if the cosine similarity between the text feature vector and the video feature vector of a candidate video segment is 0.8, the matching metric value corresponding to the candidate video segment after normalization is 0.8.
[0100] Next, in the process of generating enhanced search text, the core semantics of the search text can be fused with the semantic content of supplementary information through a semantic fusion model or a local lightweight large model. Alternatively, a text concatenation method can be used, where supplementary information is first added to the end of the search text, and then the concatenated text is grammatically optimized to generate enhanced search text. This grammatical optimization includes, but is not limited to, adding subjects, adding modifiers, and correcting ambiguities, with the aim of improving the accuracy of matching search requirements. Simultaneously, the information supplementation prompts generated by the system can be implemented through preset prompt words, such as setting the prompt words to "Please supplement key information related to the search scene, such as character characteristics, action types, etc., to improve editing accuracy." Optionally, the system also supports a multi-turn dialogue interaction mode. When incomplete search text information is detected, the system will proactively guide the user to supplement specific information based on the semantic features of candidate video clips. For example, when a candidate video clip contains a ball game scene, the user will be prompted to supplement the characteristics of the main character.
[0101] As an example, if the search text is "playing basketball" and the user inputs "shooting," the enhanced search text generated by the semantic fusion model will be "a basketball shooting scenario." When generating the enhanced search text, weights can be assigned to the search text and the supplementary information, giving the search text a higher weight to ensure that the core semantics of the enhanced search text remain consistent with the original search text.
[0102] Furthermore, in step S340, the same semantic matching method as in step S310 can be used to re-perform semantic matching on each candidate video segment based on the enhanced retrieval text; alternatively, a more suitable feature extraction algorithm and similarity calculation algorithm can be selected for semantic matching based on the semantic features of the enhanced retrieval text.
[0103] As an example, if the cosine similarity algorithm is used for matching calculation in step S310, the same algorithm can be used in step S340 to calculate the updated matching metric based on the text feature vector generated by the enhanced retrieval text and the video feature vector of the candidate video segment. When re-performing semantic matching, the video feature vector of the candidate video segment generated in step S310 can be directly called without further feature extraction, thereby reducing computation and improving matching efficiency.
[0104] Finally, in step S350, the updated matching metric values of all candidate video segments are iterated and judged. Candidate video segments that meet the condition that the matching metric value is not lower than the preset threshold are selected and determined as target video segments. If the number of selected candidate video segments exceeds the preset upper limit of the number of target video segments to be output, they can be sorted in descending order of the updated matching metric values, and the top N candidate video segments are selected as target video segments.
[0105] As an example, if the preset threshold is 0.5, the preset maximum number of target segments to be output is 10, and there are 15 candidate video segments with an updated matching metric value of not less than 0.5, then the top 10 candidate video segments are selected as target video segments, sorted from highest to lowest matching metric value. When determining the target video segment, the updated matching metric value can be compared with the original matching metric value obtained in step S310, and the improvement in matching degree can be recorded to provide data support for subsequent optimization of the semantic matching algorithm and grammatical optimization training of the retrieved text.
[0106] Further, step S340 includes steps S3410 to S3440:
[0107] Step S3410: Obtain the candidate video segment and the enhanced search text.
[0108] Step S3420: Call the pre-trained video encoding model and text encoding model to encode the candidate video segment and the enhanced retrieval text respectively to obtain video features and text features.
[0109] Step S3430: Perform multi-head attention calculation on the video features and the text features to obtain the attention weights corresponding to each attention head.
[0110] Step S3440: Based on the attention weights, generate the matching metric between each candidate video segment and the enhanced retrieval text.
[0111] It should be noted that multi-head attention computation refers to a feature interaction algorithm that maps video features and text features to multiple subspaces, calculates the attention weights between features in different subspaces, and then fuses the calculation results of each subspace. It can accurately capture the correlation information between video and text in different dimensions. Attention weight is a value obtained through multi-head attention computation, used to measure the degree of correlation between video features and text features in each dimension. The higher the weight value, the higher the feature matching degree of the corresponding dimension.
[0112] In this implementation, the video coding model can be a pre-trained model based on a convolutional neural network or a video coding model based on the Transformer architecture, while the text coding model can be a pre-trained language model such as RoBERTa or BERT. During the encoding process, video features and text features need to be mapped to the same dimensional space to provide suitable input data for subsequent multi-head attention calculations.
[0113] As an example, when using a Transformer-based video coding model to encode candidate video segments, the model first divides the frame sequence corresponding to the candidate video segment into blocks, and then captures the temporal correlation between frames through a self-attention mechanism, outputting a video feature vector with a dimension of 768; at the same time, the BERT model is used to encode the enhanced retrieval text, and the output text feature vector also has a dimension of 768.
[0114] When performing multi-head attention calculation, the mapped video features and text features are input into a preset multi-head attention module. This multi-head attention module divides the input features into multiple attention heads. Each attention head independently calculates the feature similarity weight (i.e., attention weight) between the video features and text features. Finally, the weight results of each attention head are fused through a concatenation layer.
[0115] Next, the attention weights output by each attention head are first weighted and summed to obtain the fused comprehensive attention weight. Then, the comprehensive attention weight is normalized and converted into a value in the range [0, 1], which is used as the matching metric between the candidate video segment and the enhanced search text.
[0116] As an example, the aforementioned steps have generated the enhanced search text "basketball shooting scene" and three standardized candidate video clips: clip 1 (containing basketball dribbling action), clip 2 (containing basketball shooting action), and clip 3 (containing basketball passing action). First, the three candidate video clips are encoded using a Transformer-based video coding model. The model first divides the frame sequence of each candidate video clip into blocks in temporal order (e.g., every four frames per block), then uses a self-attention mechanism to capture the temporal association between frames within a block (adjacent frames within the same block) and frames between blocks (frames between different blocks), such as the continuous frame association of "raising the ball - jumping - releasing" in a shooting action. Simultaneously, intra-frame visual features (such as basketball outline and human body posture) are extracted, ultimately outputting three 768-dimensional video feature vectors, corresponding to clip 1, clip 2, and clip 3, respectively. At the same time, the BERT model is called to encode the enhanced search text, using an attention mechanism to capture the contextual association between "playing basketball" and "shooting scene," outputting a single 768-dimensional text feature vector. Subsequently, the three video feature vectors and the text feature vectors were input into a multi-head attention module, with a total of eight attention heads. Four attention heads focused on capturing temporal-dimensional associations (e.g., the time sequence of "shooting action" matching the text description), two attention heads focused on capturing visual-dimensional associations (e.g., the visual feature matching between "shooting posture" in the video and "shooting" in the text description), and two attention heads focused on capturing semantic keyword associations (e.g., the matching between the element "basketball" in the candidate video segment and the keyword "playing basketball" in the text description). The calculated weight values for each attention head for segment 1 ranged from 0.2 to 0.4, segment 2 from 0.6 to 0.9, and segment 3 from 0.3 to 0.5, with each candidate video segment corresponding to eight sets of attention weight data. Finally, the eight attention weights of each segment are weighted and summed according to a preset ratio to obtain the comprehensive attention weight. For example, the comprehensive attention weight of segment 1 is 0.32, segment 2 is 0.78, and segment 3 is 0.41. After Sigmoid normalization, their corresponding matching metric values are 0.58, 0.82, and 0.60, respectively.
[0117] This implementation method first performs preliminary semantic matching. If the matching result does not meet the requirements, it triggers an information supplementation process to guide the user to input supplementary information to generate enhanced search text. Then, based on the enhanced search text, semantic matching is re-executed to finally determine the target video segment. This method can effectively solve the problem of poor matching results caused by semantic ambiguity or insufficient information in the search text, improve the accuracy and recall of semantic matching, and enhance the interactivity between the system and the user by allowing the user to supplement information, so that the generated target video segment is more in line with the user's actual search needs.
[0118] Step S40: In response to the user's preview and editing operation on the target video segment, generate the final edited video.
[0119] It should be noted that preview editing refers to the operations performed by the user on the target video segment after viewing the preview information, such as selection, order adjustment, and duration trimming, which can meet the user's personalized needs for the editing result; the final edited video refers to the video file generated after processing the target video segment according to the user's preview editing operations, which meets the user's needs.
[0120] In this embodiment, the process of responding to the user's preview editing operation includes first generating preview information of the target video segment and displaying it to the user, then receiving the editing instructions input by the user, filtering, sorting and cropping the target video segment according to the editing instructions, and finally splicing the processed target video segment according to the sorting result to generate the final edited video.
[0121] As an example, users can use preview editing to delete target video segments that do not meet expectations, adjust the playback order of the remaining target video segments, and trim the start and end positions of some target video segments to obtain a more suitable editing effect.
[0122] In this embodiment, during the process of generating the final edited video, transition effects can be inserted between adjacent target video segments. Transition effects include fade-in / fade-out, cut-out / cut-in, etc., which can improve the playback smoothness and visual effect of the final edited video.
[0123] This embodiment acquires the video to be edited and the searched text, performs semantic matching on the video to be edited based on the searched text to determine the target video segment, and then generates the final edited video in response to the user's preview and editing operations. This solves the problem that traditional video editing methods require users to manually select video segments frame by frame, which is cumbersome and inefficient. At the same time, semantic matching can accurately locate the video content required by the user, and combined with the user's preview and editing operations, it can meet personalized editing needs, thus improving the efficiency and accuracy of video editing.
[0124] Based on the above embodiments of this application, in the second embodiment of this application, the content that is the same as or similar to that in the first embodiment can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 2 In the video editing method, step S40 includes steps S410 to S440:
[0125] Step S410: Generate preview information corresponding to each target video segment, the preview information including segment thumbnail, semantic tag, matching confidence and target video segment duration.
[0126] It should be noted that the preview information refers to the summarized data used to help users quickly understand the core information of the target video clip. Among them, the clip thumbnail is a keyframe image extracted from the target video clip, used to intuitively display the core visual content of the clip; the semantic tags are keyword tags generated based on the content semantic features of the target video clip, used to summarize the core theme of the clip (such as "basketball shooting" or "outdoor morning run"); the matching confidence is the matching metric value generated in the previous steps, used to indicate to the user the degree of matching between the clip and the search text; the target video clip duration refers to the length of a single target video clip, used to assist users in planning the overall duration of the final edited video.
[0127] In this embodiment, when generating preview information, a keyframe extraction algorithm (such as a keyframe extraction algorithm based on inter-frame difference) can be used to select 1-3 frames from each target video segment that best represent the core content of the corresponding target video segment as segment thumbnails, avoiding user misjudgment due to blurry or unrepresentative single-frame images. Semantic tags can be generated by directly using the semantic features extracted in the aforementioned semantic matching process and then refining them into keywords; alternatively, a lightweight text generation model can be used to summarize the content of the target video segment. The matching confidence score directly calls the matching metric obtained in the aforementioned steps, retaining two decimal places for display. The duration of the target video segment is calculated by parsing the timestamp information of the target video segment.
[0128] Step S420: Display the target video segment and the corresponding preview information in the video segment preview interface, and receive editing instructions input by the user, including segment selection, order adjustment or segment duration trimming.
[0129] It should be noted that editing commands are operation commands that users use to process and adjust target video segments based on preview information. Among them, segment selection means that users select the target video segments that they want to keep, order adjustment means that users drag and drop segments to adjust their playback order in the final edited video, and segment duration trimming means that users cut off part of the duration of the target video segment (such as removing irrelevant content at the beginning and end of the segment).
[0130] In this embodiment, the video clip preview interface can use a grid layout to display each target video clip and its corresponding preview information. The display area of each target video clip includes a clip thumbnail, semantic tags, matching confidence score, and duration information. A checkbox is also provided in the preview interface for clip selection. Clip order can be adjusted using buttons or by dragging. Furthermore, a trimming entry point can be provided; clicking on the corresponding target video clip will take you to a duration trimming sub-interface, allowing for precise setting of the start and end times of a single target video clip, achieving fine-grained trimming of the clip content. During user operations, the system captures user actions such as selection, dragging, and trimming in real time through interface interaction components, converting them into standardized editing commands and caching them.
[0131] Optionally, the video clip preview interface supports sorting target video clips from highest to lowest matching confidence, allowing users to prioritize viewing clips with higher matching confidence. It also supports preview information filtering (such as filtering semantic tags by entering keywords), improving the efficiency of users finding target video clips. Furthermore, the video clip preview interface supports segment-by-segment preview and overall preview. Segment-by-segment preview allows users to view the complete content of a single target video clip, while the overall preview allows previewing all target video clips. It also provides a quick preview of the effect of splicing selected target video clips in the current order, helping users to pre-judge whether the editing effect meets expectations.
[0132] Step S430: Determine the final selected target video segments and their corresponding arrangement order according to the editing instructions.
[0133] It should be noted that the final selected target video segments refer to the set of video segments selected by the user through the segment selection command and determined to participate in the final video editing and splicing; the arrangement order refers to the order in which the target video segments are played in the final edited video, as set by the user through the order adjustment command.
[0134] In this embodiment, the system first parses the cached editing instructions, filters out the target video segments selected by the user, and removes the unselected target video segments. Then, according to the video sequence adjusted by the user through dragging and dropping, it assigns a unique sequence number to each selected target video segment. Simultaneously, it updates the valid duration range information of the corresponding selected target video segments to prevent invalid content from being included in the splicing. Finally, the system generates a splicing task list containing video segment IDs, valid duration ranges, and sequence numbers, providing clear data basis for subsequent video splicing.
[0135] Step S440: Based on the arrangement order, the finally selected target video segments are spliced together to generate the final edited video.
[0136] In this embodiment, the system reads the data from the splicing task list and retrieves the audio and video stream data within the effective duration range of the corresponding target video segment according to the sorted sequence number. During the splicing process, stream multiplexing technology can be used to directly splice the audio and video streams, or each selected target video segment can be transcoded first to unify parameters such as resolution, frame rate, and audio sampling rate before performing the splicing operation to avoid problems such as video stuttering, audio distortion, and sudden size changes. After the splicing is completed, the system automatically generates a temporary preview video for the user to view. If the user confirms that no further adjustments are needed, the system will transcode the temporary preview video into a common video format (such as MP4, MOV, AVI) and save it; if the user requests further editing, the system returns to step S420 to receive editing instructions again.
[0137] Optionally, after determining the final selected target video segments, this embodiment supports two output methods: either the selected target video segments can be spliced together into a complete final edited video according to a set arrangement order, or the selected target video segments can be saved separately as independent video files, meeting diverse user needs and offering flexible operation.
[0138] As an example, for three basketball shooting-related target video clips selected by the user, the system sequentially splices the effective content of each clip according to the order, uniformly adjusts the resolution to 1080P and the frame rate to 30 frames / second, and generates a temporary preview file after splicing. After the user confirms that there are no errors, the final basketball shooting-themed edited video is generated in MP4 format.
[0139] Based on the above embodiments of this application, in the third embodiment of this application, the same or similar content as the above embodiments can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 3 The video editing method further includes steps S50-S100:
[0140] Step S50: Obtain the target scene type corresponding to the video to be edited.
[0141] It should be noted that the target scene type refers to the scene category divided according to the core content, application scenario, or user needs of the video to be edited. For example, the sports event scene can be further divided into sub-scene types such as tennis match, basketball match, and football match. Different scene types correspond to different editing needs and content characteristics.
[0142] In this embodiment, the target scene type can be obtained in two ways: one is manual specification, which means receiving the scene type selection instruction input by the user through the interactive interface, such as the user directly selecting the basketball game scene; the other is automatic recognition, which means calling a lightweight scene recognition model to extract the underlying visual features of the video to be edited (such as scene environment layout, character action posture, key object categories), matching the extracted visual features with the preset scene type feature templates, and outputting the scene type with the highest matching degree as the target scene type.
[0143] Step S60: Based on the target scene type, load the corresponding scene rule library. The scene rule library includes preset search terms, preset editing configuration items, and event recognition rules. Each set of preset editing configuration items includes corresponding editing precision parameters and matching segment duration.
[0144] It should be noted that the scene rule base is a pre-built set of structured rules for each scene type, used to provide scene-specific adaptive parameter thresholds and event recognition standards for video editing tasks in specific scenes; the preset search terms are a set of pre-defined search keywords in the scene rule base that fit the core theme of the corresponding scene. For example, the preset search terms for a tennis match scene include serve, spike, rally, volley, and score, while the preset search terms for a basketball match scene include shot, dunk, steal, and assist; the event recognition rules are the feature judgment logic and threshold standards used to identify and locate key events in a scene from a video frame sequence. Key events refer to typical actions or plot nodes that can reflect the core content of the scene. For example, the recognition rule for a tennis serve event is "the combination of frame features of the player holding the racket in preparation + the trajectory of the tennis ball being tossed up + the moment the racket hits the ball".
[0145] In this embodiment, the system has multiple built-in scene rule bases, each associated with a scene type. Once the target scene type is determined, the system retrieves the corresponding scene rule base from local storage or a cloud server and loads it into system memory for subsequent use. For example, the basketball game scene rule base in sports events includes preset search terms such as shooting, dribbling, stealing, dunking, and assisting; similarly, the tennis game scene rule base includes preset search terms such as serving, spiking, rally, volley, and scoring. Preset editing configuration items are divided into three levels: high, medium, and low, with different levels corresponding to different editing precision parameters, search precision parameters, and matching segment duration thresholds.
[0146] As an example, in a tennis match scenario, the preset editing settings for a smash event are high editing precision, matching segment duration of 1-5 seconds, and high retrieval precision; the preset editing settings for a rally event are medium editing precision, matching segment duration of 5-10 seconds, and medium retrieval precision.
[0147] Step S70: Match the search text input by the user with the preset search terms in the scene rule base to obtain the target preset search term, and determine the target preset clip configuration item corresponding to the target preset search term.
[0148] In this embodiment, a semantic similarity calculation algorithm is used to match the user-input search text with preset search terms in the scene rule base, selecting the preset search term with the highest similarity as the target preset search term. If the similarity between the search text and multiple preset search terms is higher than a preset similarity threshold, a list of candidate preset search terms is displayed through the interactive interface for the user to manually select and confirm. If the similarity between the search text and all preset search terms is lower than the preset similarity threshold, a prompt mechanism is triggered to guide the user to supplement search information or reselect the target scene type. After the target preset search term is determined, the system directly calls its bound preset editing configuration item as the target preset editing configuration item for subsequent editing processes.
[0149] As an example, the target scenario is a tennis match, and the user inputs the search text "spiking". The system performs semantic matching between the search text and the preset search terms in the tennis match rule base. The similarity between "spiking" and the preset search term "spiking" is 1.0, so it is determined to be the target preset search term, and the corresponding high-precision preset editing configuration item is called (high editing precision, matching segment length 1-5 seconds, high search precision).
[0150] Step S80: Determine the frame extraction frequency based on the target preset editing configuration item, and perform frame extraction processing on the video to be edited to obtain a video frame sequence.
[0151] In this embodiment, the specific process of frame extraction can be executed with reference to the adaptive frame extraction algorithm disclosed in the previous embodiment; in addition, the screen size adjustment strategy in the previous embodiment can be used to uniformly adjust the extracted frame images to a preset standard resolution size, and finally obtain a standardized video frame sequence. This embodiment will not elaborate further on this.
[0152] Step S90: Based on the event recognition rules and the matching segment duration in the target preset editing configuration item, the video frame sequence is divided to obtain multiple candidate video segments containing key scene events.
[0153] In this embodiment, firstly, based on the event recognition rules in the scene rule base, frame-by-frame feature analysis and event localization are performed on the standardized video frame sequence to identify the effective frame interval containing key scene events. For example, the effective frame sequence interval corresponding to a basketball shooting action is frames 100-200. Then, using the matching segment duration in the target preset editing configuration item as the benchmark threshold, combined with the distribution characteristics of the effective frame interval of key scene events, the video frame sequence is adaptively divided. If the length of the effective frame interval of a key scene event is less than or equal to the matching segment duration threshold, the starting frame of the key scene event is used as the anchor point, and candidate video segments are divided according to the matching segment duration threshold to ensure that the key scene event is completely contained within the divided candidate video segments. If the length of the effective frame interval of a key scene event is greater than the matching segment duration threshold, the effective frame interval is split into multiple continuous and non-overlapping sub-frame intervals, each sub-frame interval corresponding to a candidate video segment, to avoid redundancy of key scene event information due to excessively long video segment durations.
[0154] Further, step S90 includes steps S910 to S930:
[0155] Step S910: Determine the scene features corresponding to each key event in the scene according to the event recognition rules.
[0156] Step S920: Activate the dedicated recognition sub-model corresponding to the target scene type, and determine the start frame and end frame of each scene key event in the video frame sequence through the dedicated recognition sub-model based on the scene features.
[0157] Step S930: Divide the video frame sequence according to the start frame, end frame and matching segment duration in the target preset editing configuration item of each scene key event to obtain multiple candidate video segments containing the scene key events.
[0158] It should be noted that scene features refer to a set of visual features that can characterize the core attributes of key events in a scene, including but not limited to features of human action postures, key object categories, scene environment features, and temporal action features. Different key events in different scenes correspond to different combinations of scene features. A dedicated recognition sub-model refers to a lightweight feature recognition model trained for a specific scene type. Compared with a general recognition model, it has higher recognition accuracy and efficiency for key event features of the target scene type. For example, a shooting action recognition sub-model for a basketball game scene and a spiking action recognition sub-model for a tennis game scene. The start frame refers to the first frame image where the key event in the scene begins to occur, and the end frame refers to the last frame image where the key event in the scene completes to occur. Together, they define the time interval of the key event in the video frame sequence.
[0159] In this embodiment, the system can perform structured parsing of event recognition rules in the scene rule base, extract the explicit feature dimensions and threshold conditions in the event recognition rules, and integrate them to form a scene feature set corresponding to key events in the scene.
[0160] As an example, the identification rule for a smash event in a tennis match is "player's side-facing backswing posture + tennis ball's high-speed trajectory + racket deformation characteristics at the moment of impact". After analysis, the scene features corresponding to the smash event are determined to include the human posture features of the side-facing backswing, the trajectory features of the tennis ball's high-speed movement, and the object shape features of the racket deformation at the moment of impact.
[0161] While loading the scene rule base, the system simultaneously activates a dedicated recognition sub-model bound to the target scene type. This model has been trained based on a large amount of labeled data for the target scene type and can accurately capture the key event features of the corresponding scene type. By inputting the determined scene features into the corresponding dedicated recognition sub-model, and then inputting the standardized video frame sequence frame by frame into the model for feature matching, when the feature matching degree of a certain frame reaches a preset threshold, it is determined to be the starting frame of the key event in the scene. When the feature matching degree of subsequent frames is lower than the preset threshold and there are no matching features in multiple consecutive frames, the previous frame is determined to be the ending frame of the key event in the scene.
[0162] As an example, for a tennis smash event, a dedicated recognition sub-model performs feature matching on each frame of the video frame sequence. When the human posture feature of a sideways backswing is detected in frame 80, the frame is determined to be the starting frame of the smash event. Subsequent frames are continuously tracked and matched. When no tennis ball trajectory or racket deformation features are detected in the next 10 consecutive frames after frame 120, frame 120 is determined to be the ending frame of the smash event. Finally, the frame range of the smash event is defined as frames 80-120.
[0163] Furthermore, the length of the frame interval corresponding to the start and end frames of each scene's key event is calculated, and then compared with the duration of the matching segment in the target preset clip configuration. If the length of the frame interval corresponding to the scene's key event is less than or equal to the duration of the matching segment, the frame sequence is extended forward or backward to the number of frames corresponding to the duration of the matching segment, based on the event's start frame, to form a candidate video segment containing the complete key event. If the length of the frame interval corresponding to the scene's key event is greater than the duration of the matching segment, the frame interval is divided equally into multiple continuous and non-overlapping sub-frame intervals according to the duration of the matching segment. Each sub-frame interval corresponds to a candidate video segment, while ensuring that each sub-frame interval contains the scene's key event.
[0164] As an example, the frame range of a tennis smash event is frames 80-120 (40 frames in total, corresponding to a maximum matching segment length of 5 seconds). The target preset clip configuration specifies a matching segment length of 1-5 seconds for the smash event. Since the frame range length meets the duration requirement, frames 80-120 are directly divided into a candidate video segment. If the frame range of a smash event is frames 80-180 (100 frames in total, corresponding to 12.5 seconds), which exceeds the 5-second duration limit, it is divided into three sub-frame ranges: frames 80-120, frames 121-160, and frames 161-180. Each sub-range contains different core elements of the smash action, resulting in three candidate video segments.
[0165] Step S100: Perform semantic matching on each of the candidate video segments based on the retrieved text to determine the target video segment.
[0166] In this embodiment, the semantic matching method disclosed in the previous embodiments can be used. The pre-trained multimodal feature extraction model is called to encode the features of the retrieved text and each candidate video segment respectively, generating text feature vectors and video feature vectors with the same dimension. Then, the similarity value (i.e., the matching metric value) of the two types of feature vectors is calculated by the cosine similarity algorithm. The candidate video segments with matching metric values not lower than the preset threshold are determined as the target video segments. This embodiment will not elaborate further on this.
[0167] This application provides a video editing device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, which are executed by the at least one processor to enable the at least one processor to perform the video editing method in the first embodiment described above.
[0168] The following is for reference. Figure 4 The diagram illustrates a structural schematic of a video editing device suitable for implementing embodiments of this application. The video editing device in the embodiments of this application may include various hardware and software components for implementing video editing methods. Figure 4 The video editing device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments of this application.
[0169] like Figure 4As shown, the video editing device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.) that can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1003 into a random access memory (RAM) 1004. The RAM 1004 also stores various programs and data required for the operation of the video editing device. The processing unit 1001, the ROM 1002, and the RAM 1004 are interconnected via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touchscreen, a touchpad, a keyboard, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 1003 including, for example, magnetic tape, a hard disk, etc.; and communication devices 1009. Communication device 1009 allows the video editing device to communicate wirelessly or wiredly with other devices to exchange data. Although the figures show video editing devices with various systems, it should be understood that implementation or possession of all the systems shown is not required. More or fewer systems may be implemented alternatively.
[0170] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from read-only memory 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.
[0171] The video editing device provided in this application, employing the video editing method described in the above embodiments, can solve the technical problems of inaccurate demand matching and lack of intervention during the video editing process. Compared with the prior art, the beneficial effects of the video editing device provided in this application are the same as those of the video editing method provided in the above embodiments, and other technical features of this video editing device are the same as those disclosed in the previous embodiment method, and will not be repeated here.
[0172] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.
[0173] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
[0174] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, which are used to execute the video editing method described above.
[0175] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, radio frequency (RF), etc., or any suitable combination thereof.
[0176] The aforementioned computer-readable storage medium may be included in the video editing device; or it may exist independently and not be assembled into the video editing device.
[0177] The aforementioned computer-readable storage medium carries one or more programs that, when executed by a video editing device, cause the video editing device to: acquire a video to be edited and search text input by a user; divide the video to be edited into multiple candidate video segments according to pre-set editing configuration items; perform semantic matching on each of the candidate video segments based on the search text to determine a target video segment that matches the search text; and generate a final edited video in response to a user's preview editing operation on the target video segment.
[0178] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0179] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0180] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.
[0181] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described video editing method, which can solve the technical problem of inaccurate demand matching and inability to intervene during video editing. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as the beneficial effects of the video editing method provided in the above embodiments, and will not be repeated here.
[0182] This application provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the video editing method described above.
[0183] The computer program product provided in this application can solve the technical problem of inaccurate demand matching and inability to intervene in the video editing process. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as the beneficial effects of the video editing method provided in the above embodiments, and will not be repeated here.
[0184] The above are merely preferred embodiments of this application and do not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent scope of this application.
[0185] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.
[0186] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method.
[0187] The above are merely preferred embodiments of this application and do not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.
Claims
1. A video editing method, characterized in that, The video editing method includes: Obtain the video to be edited and the search text entered by the user; The video to be edited is subjected to specification detection, and corresponding editing configuration items are generated based on the specification detection results. The specification detection results include the video parameters of the video to be edited, including duration, resolution, and bitrate. The editing configuration parameters in the editing configuration items include editing precision parameters, retrieval precision parameters, and matching segment duration. The retrieval precision parameters are parameters used to set the feature similarity threshold and the number of target video segments output during semantic matching. The frame extraction frequency is determined based on the editing precision parameter, and the frame extraction processing is performed on the video to be edited based on the frame extraction frequency to obtain a video frame sequence; the video frame sequence is divided into multiple candidate video segments according to the matching segment duration; wherein, the editing precision parameter is positively correlated with the frame extraction frequency, and the matching segment duration is negatively correlated with the number of candidate video segments; Based on the search text and the search precision parameters, semantic matching is performed on each of the candidate video segments to determine the target video segment that matches the search text. In response to the user's preview and editing operation on the target video segment, the final edited video is generated.
2. The video editing method as described in claim 1, characterized in that, After the steps of obtaining the video to be edited and the search text input by the user, the video editing method further includes: Based on the comparison results between the video parameters and the corresponding preset parameter thresholds, specification prompts are output to the user.
3. The video editing method as described in claim 1, characterized in that, The step of performing semantic matching on each of the candidate video segments based on the search text and the search precision parameters to determine the target video segment that matches the search text includes: Based on the search text, semantic matching is performed on each of the candidate video segments to obtain the matching metric value corresponding to each of the candidate video segments; If the number of candidate video segments whose matching metric value is not lower than a preset threshold is lower than a preset number threshold, or the highest matching metric value among all candidate video segments is lower than the preset threshold, then information supplementation prompts are generated based on the content semantic features of the candidate video segments, and supplementary information input by the user based on the information supplementation prompts is received. Based on the search text and the supplementary information, an enhanced search text is generated; Based on the enhanced search text, semantic matching is re-performed on each of the candidate video segments to obtain the updated matching metric value corresponding to each of the candidate video segments; Candidate video segments whose updated matching metric value is not lower than the preset threshold are identified as target video segments.
4. The video editing method as described in claim 3, characterized in that, The step of re-performing semantic matching on each of the candidate video segments based on the enhanced search text to obtain the updated matching metric value corresponding to each of the candidate video segments includes: Obtain the candidate video segments and the enhanced search text; The pre-trained video encoding model and text encoding model are invoked to encode the candidate video segment and the enhanced retrieval text, respectively, to obtain video features and text features; Multi-head attention calculation is performed on the video features and the text features to obtain the attention weights corresponding to each attention head; Based on the attention weights, a matching metric is generated between each candidate video segment and the enhanced search text.
5. The video editing method as described in claim 1, characterized in that, The step of generating the final edited video in response to the user's preview and editing operation on the target video segment includes: Generate preview information for each of the target video segments, the preview information including segment thumbnails, semantic tags, matching confidence scores, and target video segment durations; The target video clip and corresponding preview information are displayed in the video clip preview interface, and editing instructions input by the user are received. The editing instructions include clip selection, order adjustment or clip duration trimming. The final selected target video segments and their corresponding arrangement order are determined according to the editing instructions; The final selected target video segments are spliced together based on the arrangement order to generate the final edited video.
6. The video editing method as described in claim 1, characterized in that, The video editing method also includes: Obtain the target scene type corresponding to the video to be edited; According to the target scene type, the corresponding scene rule library is loaded. The scene rule library includes preset search terms, preset editing configuration items, and event recognition rules. Each set of preset editing configuration items includes corresponding editing precision parameters and matching segment duration. The search text entered by the user is matched with the preset search terms in the scene rule base to obtain the target preset search terms, and the target preset clip configuration item corresponding to the target preset search terms is determined. Based on the target preset editing configuration items, the frame extraction frequency is determined, and the frame extraction process is performed on the video to be edited to obtain a video frame sequence. Based on the event recognition rules and combined with the matching segment duration in the target preset editing configuration item, the video frame sequence is divided to obtain multiple candidate video segments containing key scene events; Based on the retrieved text, perform semantic matching on each of the candidate video segments to determine the target video segment.
7. The video editing method as described in claim 6, characterized in that, The step of dividing the video frame sequence based on the event recognition rules and the matching segment duration in the target preset editing configuration item to obtain multiple candidate video segments containing key scene events includes: Based on the event recognition rules, determine the scene features corresponding to each key event in the scene; A dedicated recognition sub-model corresponding to the target scene type is enabled, and based on the scene features, the start and end frames of each scene key event in the video frame sequence are determined by the dedicated recognition sub-model. Based on the start frame and end frame of each key event in the scene and the duration of the matching segment in the target preset editing configuration item, the video frame sequence is divided to obtain multiple candidate video segments containing the key events in the scene.
8. A video editing device, characterized in that, The video editing device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the video editing method as described in any one of claims 1 to 7.
9. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, it implements the steps of the video editing method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Intelligent video automatic editing method
CN112423023A
Video cross-modal retrieval method, device and equipment and computer medium
CN119397056A