Video processing method and device, computer equipment and storage medium
By hierarchically classifying and segmenting the video frames to generate synthetic videos, the problem of poor presentation effect caused by lack of objectivity in video production in the prior art is solved, and the objectivity and efficiency of video processing are achieved.
Patent Information
- Application Number
- CN202310692604.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-12
- Publication Date
- 2024-12-13
AI Technical Summary
The existing video production technology lacks objectivity, resulting in poor presentation of synthetic videos.
By hierarchically classifying the video frames in the video to be processed, a collection of classified segments is formed, and the target segments are determined according to the preset video processing strategy, and finally a synthetic video is generated. The specific steps include segmenting the video according to the content level and quality level of the video frame, obtaining content classification clips and quality classification clips, merging or deleting clips to match the needs, and adjusting the clips until the splicing needs are met.
The presentation effect of synthetic videos is improved, the objectivity and efficiency of video processing is achieved, and the diversity and comprehensiveness of videos are enhanced.
Smart Images

Figure CN119136009A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a video processing method, apparatus, computer equipment and storage medium. Background Art
[0002] With the development of multimedia technology, various video playback software has been widely used in people's life, office and other aspects, and more and more people have been exposed to video production.
[0003] Taking video production as an example, video production is a process of obtaining partial clips from a single or multiple videos and recombining them to generate a new video. It is also an important way for people to record and share their lives. In related technologies, it is not only necessary to shoot video materials, but also to screen and edit the shot video materials and finally synthesize the video.
[0004] However, the video production process in the related art is not objective enough, resulting in poor presentation effect of the synthesized video. Summary of the invention
[0005] Based on this, it is necessary to provide a video processing method, apparatus, computer device and computer-readable storage medium to address the above technical problems.
[0006] In a first aspect, the present application provides a video processing method, comprising:
[0007] Classifying the video frames in the video to be processed to obtain a set of classified segments; wherein the set of classified segments includes classified segments formed by video frames of different levels;
[0008] Determine a target segment set according to a preset video processing strategy and a classification segment set;
[0009] Generate synthetic videos based on a set of target segments.
[0010] In one embodiment, the video frames in the video to be processed are classified into different levels to obtain a set of classified segments, including:
[0011] Determining the content level of each video frame according to the image content of each video frame in the video to be processed;
[0012] Determine the quality level of each video frame according to the image quality of each video frame in the video to be processed;
[0013] The video to be processed is segmented according to the content level and quality level of each video frame to obtain a set of classified segments.
[0014] In one embodiment, the video to be processed is segmented according to the content level and quality level of each video frame to obtain a set of classified segments, including:
[0015] Divide video frames with the same content level and continuous in time into a segment to obtain at least one content classification segment;
[0016] Divide video frames with the same quality level and continuous in time into a segment to obtain at least one quality classification segment;
[0017] A set of classified segments is formed according to at least one content classified segment and at least one quality classified segment.
[0018] In one embodiment, the classified segment set includes content classified segments under at least two determination indicators, and the target segment set is determined according to a preset video processing strategy and the classified segment set, including:
[0019] Acquire a first overlapping segment whose time sequence overlaps between content classification segments under at least two determination indicators;
[0020] Acquire a second overlapping segment having the same time sequence between the content classification segment and the quality classification segment under at least two determination indicators;
[0021] The classified segment set is processed according to the first overlapping segment and the second overlapping segment to obtain a target segment set.
[0022] In one embodiment, the classified segments are processed according to the first overlapping segments and the second overlapping segments to obtain a target segment set, including:
[0023] If the content levels corresponding to the first overlapping fragments match under at least two judgment indicators, the content classification fragments of the first overlapping fragment obtained in the classification fragment set are merged; if the content level corresponding to the second overlapping fragment is higher than the quality level, the second overlapping fragment in the corresponding content classification fragment in the classification fragment set is removed to form a target fragment set.
[0024] In one embodiment, generating a synthetic video based on a set of target segments includes:
[0025] Obtain the fragments to be spliced in the target fragment set;
[0026] When the segments to be spliced do not meet the splicing requirements, adjust the segments to be spliced until the splicing requirements are met;
[0027] The adjusted segments to be spliced are spliced to obtain a composite video.
[0028] In one embodiment, the splicing requirement includes the required number of segments to be spliced and the required duration of each segment to be spliced; when the segments to be spliced do not meet the splicing requirement, adjusting the segments to be spliced until the splicing requirement is met includes:
[0029] When the total number of segments to be spliced is less than the required number, the duration parameters are adjusted and the segments to be spliced are segmented until the total number of reference segments in the segments to be spliced after segmentation reaches the required number; wherein the reference segment is a segment to be spliced whose segment duration is greater than the required duration.
[0030] In a second aspect, the present application further provides a video processing device, including:
[0031] A level classification module classifies video frames in the processed video to obtain a set of classified segments; wherein the set of classified segments includes classified segments formed by video frames of different levels;
[0032] A target determination module, used to determine a target segment set according to a preset video processing strategy and a classification segment set;
[0033] The video synthesis module is used to generate a synthetic video based on a set of target clips.
[0034] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any of the above methods when executing the computer program.
[0035] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of any of the above methods when the computer program is executed by a processor.
[0036] In the above-mentioned video processing method, device, computer equipment and storage medium, by classifying the video frames in the video to be processed, a classified segment set including classified segments corresponding to the video frames of different levels is obtained, and a target segment set is determined according to a preset video processing strategy and the classified segment set, and then a synthetic video is generated based on the target segment set. In the above-mentioned method, by classifying the video frames in the video to be processed and determining the target segment set according to the preset video processing strategy, an objective means is used to objectively process the video to be processed, and then a synthetic video is generated based on the target segment set obtained after the processing, which greatly improves the presentation effect of the synthetic video. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 is an internal structure diagram of a computer device in one embodiment;
[0038] Figure 2 is a schematic flow chart of a video processing method in one embodiment;
[0039] Figure 3 A schematic diagram of a process for obtaining a set of classified fragments in one embodiment;
[0040] Figure 4A schematic diagram of a process for obtaining a set of classified fragments in another embodiment;
[0041] Figure 5 A schematic diagram of a process for obtaining a target fragment set in one embodiment;
[0042] Figure 6 A schematic diagram of a process for obtaining a composite video in one embodiment;
[0043] Figure 7 is a flow chart of a video processing method in another embodiment;
[0044] Figure 8 FIG. 4 is a structural block diagram of a video processing device in an embodiment. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0046] The video processing method provided in the embodiment of the present application can be applied to Figure 1 In the computer device shown. The computer device may be a terminal, including a processor, a memory, a communication interface, a display screen and an input device connected via a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a video processing method is implemented. The display screen of the computer device may be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device may be a touch layer covered on the display screen, or a button, a trackball or a touchpad provided on the housing of the computer device, or an external keyboard, touchpad or mouse, etc. The computer device may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices, and the Internet of Things devices may be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc.
[0047] Those skilled in the art will understand that Figure 1The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0048] In one embodiment, Figure 2 As shown, a video processing method is provided, which is applied to Figure 1 The computer device in the example is used to illustrate, including the following steps:
[0049] S210 , classify the video frames in the video to be processed into different levels to obtain a set of classified segments.
[0050] The classification segment set includes classification segments formed by video frames of different levels.
[0051] Optionally, the level classification of the video frames may be content level classification based on the image content of the video frames, or may be quality level classification based on the image quality of the video frames.
[0052] Optionally, the computer device may classify each video frame in the processed video based on an image analysis algorithm to determine the grade of each video frame, and segment video frames of the same grade and continuous in time into a group as a classified segment, and multiple classified segments corresponding to different grades form a classified segment set. For example, taking the quality grade classification of the processed video S1 as an example, the 1st to 12th frames of the processed video S1 are blurred, and the 13th to 20th frames are clear, so the 1st to 12th frames can be segmented into a group to form classified segments corresponding to poor quality grades, and the 13th to 20th frames can be segmented into a group to form classified segments corresponding to excellent quality grades.
[0053] Optionally, the above-mentioned videos to be processed may include multiple videos to be processed, which may be multiple videos to be processed obtained by segmenting an original video.
[0054] Optionally, the computer device may segment the original video according to a preset segmentation strategy to obtain multiple videos to be processed. For example, the computer device segments the original video according to a preset duration, removes or retains segments obtained by segmentation that are less than the preset duration, and then the original video is segmented to obtain at least two videos to be processed. The original video may also be segmented according to scenes to group video frames of the same scene together to obtain videos to be processed corresponding to each scene.
[0055] Optionally, when the original video is segmented according to a preset duration, the preset duration can be a fixed value, and videos to be processed with the same duration can be obtained; the preset duration can also be continuously increasing / decreasing, and videos to be processed with different durations can be obtained. Taking the preset duration as a fixed value as an example, the original video S includes 100 video frames. If every 10s includes 20 video frames, the original video is segmented according to the preset duration of 10s, and 5 videos to be processed can be obtained, namely, video to be processed S1[1,20] (the 1st frame to the 20th frame), video to be processed S2[21,40] (the 21st frame to the 40th frame), video to be processed S3[41,60] (the 41st frame to the 60th frame), video to be processed S4[61,80] (the 61st frame to the 80th frame), and video to be processed S5[81,100] (the 81st frame to the 100th frame).
[0056] S230: Determine a target segment set according to a preset video processing strategy and a classification segment set.
[0057] Optionally, the computer device may select the classified segments that meet the requirements from the classified segment set according to a preset video processing strategy to serve as the target segment set. The computer device may also process the classified segments in the classified segment set according to the preset video processing strategy to obtain the target segment set that meets the requirements.
[0058] S240: Generate a synthetic video based on the target segment set.
[0059] Optionally, after obtaining the target segment set, the computer device may generate a composite video based on the video frames in the target segment set. For example, the computer device may splice the video frames in the target segment set in a time sequence to obtain a composite video, or may filter the video frames in the target segment set according to the user's personalized needs, or perform personalized special effects processing to obtain personalized video frames, so as to generate a composite video by splicing the personalized video frames.
[0060] In this embodiment, the computer device classifies the video frames in the video to be processed, obtains a classification segment set including classification segments corresponding to the video frames of different levels, and determines the target segment set according to the preset video processing strategy and the classification segment set, and then generates a synthetic video based on the target segment set. In the above method, by classifying the video frames in the video to be processed and determining the target segment set according to the preset video processing strategy, it is achieved to use objective means to objectively process the video to be processed, and then generate a synthetic video based on the target segment set obtained after processing, which greatly improves the presentation effect of the synthetic video.
[0061] The classification of the video frames in the video to be processed includes both content classification to obtain the content level of each video frame and quality classification to obtain the quality level of each video frame. Based on this, in one embodiment, Figure 3 As shown, the above S210, classifying the video frames in the video to be processed, and obtaining a set of classified segments, includes:
[0062] S310: Determine the content level of each video frame according to the image content of each video frame in the video to be processed.
[0063] The content level is determined based on the image content information in the video frame. Optionally, the image content information may include at least one of the following criteria: whether the image includes a target element, the image content type, or the image composition ratio.
[0064] Optionally, the computer device may use single image content information as a determination indicator to determine the content level of the video frame, or may determine the content level of the video frame under different determination indicators.
[0065] Optionally, the computer device may input each video frame in the video to be processed into a pre-trained content classification model to obtain the content level of each video frame. For example, continuing the above example, taking the video S1 to be processed as an example, the 1st to 20th frames in the video S1 to be processed are respectively input into the content classification model, and the content levels of these 20 video frames are obtained as follows: the 1st to 5th frames, poor; the 6th to 9th frames, medium; the 10th to 16th frames, excellent; the 17th to 20th frames, poor.
[0066] S320: Determine the quality level of each video frame according to the image quality of each video frame in the video to be processed.
[0067] The quality level is determined based on the image quality information of the video frame. Optionally, the image quality information includes at least one determination index of whether the image is clear and the brightness of the image.
[0068] Optionally, the computer device may use a single image quality information as a determination index to determine the quality level of the video frame. For example, using whether the picture is clear as a determination index, if the picture of the video frame is clear, the quality level of the video frame is determined to be excellent; if the picture of the video frame is not clear, the quality level of the video frame is determined to be poor. The computer device may also use at least two determination indicators to determine the quality level of the video frame. For example, using whether the picture is clear and the brightness of the picture as determination indicators, if the picture of the video frame is clear and the brightness is appropriate, the quality level of the video frame is determined to be excellent; if the picture of the video frame is clear, but the brightness is too bright / too dark, or the brightness of the video frame is appropriate, but the picture is not clear, the quality level of the video frame is determined to be medium; if the picture of the video frame is not clear and the picture is too bright / too dark, the quality level of the video frame is determined to be poor.
[0069] Optionally, the computer device may input each video frame in the video to be processed into a pre-trained quality classification model to obtain the quality level of each video frame. For example, continuing the above example, taking the video S1 to be processed as an example, the 1st to 20th frames in the video S1 to be processed are respectively input into the quality classification model, and the quality levels of these 20 video frames are respectively: the 1st to 12th frames, poor; the 13th to 20th frames, excellent.
[0070] S330 , segment the video to be processed according to the content level and quality level of each video frame to obtain a set of classified segments.
[0071] Optionally, the computer device segments the video to be processed according to the content level of the video frames, such as dividing the video frames with the same content level into a content classification segment, so as to obtain content classification segments corresponding to different content levels, and segments the video to be processed according to the quality level of the video frames, such as dividing the video frames with the same quality level into a quality classification segment, so as to obtain quality classification segments corresponding to different quality levels, thereby obtaining a classification segment set consisting of content classification segments and quality classification segments.
[0072] In an alternative embodiment, Figure 4 As shown, the above S320, the video to be processed is segmented according to the content level and quality level of each video frame to obtain a set of classified segments, including:
[0073] S410: Divide video frames with the same content level and continuous time sequence into a segment to obtain at least one content classification segment.
[0074] Optionally, after obtaining the content level of each video frame, the computer device may count the video frames with the same content level, so as to divide the video frames with the same content level and continuous in time into a segment, and use it as the content classification segment of the corresponding content level, thereby obtaining at least one content classification segment. Continuing with the above example, for the content level of each video frame in the video S1 to be processed, the 1st to 5th frames are divided into a segment with a poor content level, the 6th to 9th frames are divided into a segment with a medium content level, the 10th to 16th frames are divided into a segment with a good content level, and the 17th to 20th frames are divided into a segment with a poor content level, thereby obtaining 4 content classification segments.
[0075] S420: Segment video frames with the same quality level and continuous time sequence into one segment to obtain at least one quality-classified segment.
[0076] Optionally, after obtaining the quality level of each video frame, the computer device may count the video frames with the same quality level, so as to divide the video frames with the same quality level and continuous in time into a segment, and use it as a quality classification segment of the corresponding quality level, thereby obtaining at least one quality classification segment. Continuing with the above example, for the quality level of each video frame in the video S1 to be processed, the 1st to 12th frames are segmented into a segment with a poor quality level, and the 13th to 20th frames are segmented into a segment with a good quality level, thereby obtaining two quality classification segments.
[0077] S430: Form a classification segment set according to at least one content classification segment and at least one quality classification segment.
[0078] Optionally, the computer device may aggregate the obtained at least one content classification segment and at least one quality classification segment to form a classification segment set. For example, continuing the above example, 4 content classification segments and 2 quality classification segments for the video S1 to be processed are obtained. When the video to be processed also includes S2 to S5, the above method can also be used to obtain content classification segments and quality classification segments for the videos S2 to S5 to be processed, and all content classification segments and quality classification segments of the videos S1 to S5 to be processed are aggregated to form a classification segment set.
[0079] In this embodiment, the computer device determines the content level of each video frame according to the image content of each video frame in the video to be processed, and determines the quality level of each video frame according to the image quality of each video frame, so as to segment the video to be processed according to the content level and quality level of each video frame to obtain a set of classified segments. Specifically, video frames with the same content level and continuous time sequence are divided into one segment to obtain at least one content classified segment, and video frames with the same quality level and continuous time sequence are divided into one segment to obtain at least one quality classified segment, and then a set of classified segments is formed according to at least one content classified segment and at least one quality classified segment. In the above method, the content level and quality level of the video frames in the video to be processed are respectively obtained, and the level segmentation of the video frames in the two dimensions of picture content and picture quality is realized, thereby improving the diversity and comprehensiveness of the segmentation.
[0080] The classification segment set may include content classification segments under at least two determination indicators. Based on this, in one embodiment, Figure 5 As shown, the above S230, determining the target segment set according to the preset video processing strategy and the classification segment set, includes:
[0081] S510: Obtain a first overlapping segment whose time sequence overlaps between content classification segments under at least two determination indicators.
[0082] Optionally, the computer device can obtain the content level of each video frame in the video to be processed under at least two judgment indicators, and form corresponding content classification segments. Taking the two judgment indicators of whether the picture in the video frame includes the target element (such as the smiling expression of the target person) and the composition ratio of the picture, and classifying the above-mentioned video S1 to be processed as an example, for judgment indicator 1 (whether the picture includes the target element), the computer device can determine that the 1st to 5th frames in the video segment S1 do not include the smiling expression of the target person, and the 1st to 5th frames form content classification segment S11, and the corresponding content level is poor; the 6th to 9th frames do not include the smiling expression of the target person, forming content classification segment S12, and the corresponding content level is poor; the 10th to 10th frames do not include the smiling expression of the target person, forming content classification segment S13, and the corresponding content level is poor; The 16th frame includes the smiling face of the target person, forming a content classification segment S13, and the corresponding content level is excellent; the 17th to 20th frames do not include the smiling face of the target person, forming a content classification segment S14, and the corresponding content level is poor; for judgment indicator 2 (the composition ratio of the picture), the computer device can determine that the 1st to 13th frames in the video to be processed S1 have an appropriate composition ratio, forming a content classification segment S11', and the corresponding content level is excellent; the 14th to 20th frames have too large an occluded part, forming a content classification segment S12', and the corresponding content level is poor.
[0083] Optionally, after obtaining the content classification segments under at least two judgment indicators, the computer device may determine the segments with overlapping timing between the content classification segments under at least two judgment indicators according to the timing information of each video frame in the content classification segments, and use them as the first overlapping segments. Continuing with the above example, for the video S1 to be processed, the content classification segments and the corresponding content levels under judgment indicator 1 are divided into: S11[1,5], poor; S12[6,9], poor; S13[10,16], excellent; S14[17,20], poor. Similarly, for the video S1 to be processed, the content classification segments and the corresponding content levels under judgment indicator 2 are divided into: S11'[1,13], excellent; S12'[14,20], poor. The first overlapping segments in which the video frames of the content classification segments S11-S14 overlap in time sequence with the content classification segments S11'-S12' include: [1, 5], [6, 9], [10, 13], [14, 16] and [17, 20].
[0084] S520: Obtain a second overlapping segment in which the time sequence of the content classification segment and the quality classification segment overlap under at least two determination indicators.
[0085] Optionally, after obtaining the content classification segments and quality classification segments under at least two determination indicators, the computer device can determine the segments with overlapping timing between the content classification segments and the quality classification segments according to the timing information of each video frame in each content classification segment, and use them as the second overlapping segments. Continuing with the above example, the quality classification segments and corresponding quality levels obtained for the video S1 to be processed are: [1, 12], excellent; [13, 20], poor. The second overlapping segments with overlapping timing of video frames between the content classification segments S11~S14, S11'~S12' and the quality classification segments [1, 12], [13, 20] include: [1, 5], [6, 9], [10, 12], [13, 16], [17, 20], and [1, 12],
[13] , [14, 20].
[0086] S530 , processing the classified segment set according to the first overlapping segment and the second overlapping segment to obtain a target segment set.
[0087] Optionally, the computer device may perform editing processing such as merging or deleting the content classification segments in the classification segment set according to the first overlapping segment and the second overlapping segment to obtain a target segment set.
[0088] In an optional embodiment, the above S530, processing the classified segment set according to the first overlapping segment and the second overlapping segment to obtain the target segment set, includes:
[0089] If the content levels corresponding to the first overlapping fragments match under at least two judgment indicators, the content classification fragments of the first overlapping fragment obtained in the classification fragment set are merged; if the content level corresponding to the second overlapping fragment is higher than the quality level, the second overlapping fragment in the corresponding content classification fragment in the classification fragment set is removed to form a target fragment set.
[0090] Optionally, for the first overlapping segment, the computer device may compare the content levels of the first overlapping segment under at least two judgment indicators. If the content levels match, the content classification segments of the first overlapping segment obtained in the classification segment set are merged to form a new content classification segment. For example, continuing the above example, for the first overlapping segment [10, 13] in the video to be processed S1, the content level under judgment indicator 1 is excellent, and the content level under judgment indicator 2 is excellent. It can be seen that the content levels of the first overlapping segment [10, 13] under judgment indicator 1 and judgment indicator 2 are the same, both of which are the highest. Then it is determined that the content levels match, and the computer device can merge the content classification segments S13 [10, 16] and S11 '[1, 13] obtained for the first overlapping segment [10, 13] to form a new content classification segment [1, 16], and mark the corresponding content level as excellent.
[0091] Optionally, for the second overlapping segment, the computer device may compare the content level and quality level of the second overlapping segment. If the content level is higher than the quality level, the second overlapping segment in the corresponding content classification segment in the classification segment set is removed to form a new content classification segment. For example, continuing the above example, for the second overlapping segment
[13] in the video to be processed S1, the content level under judgment indicator 1 is excellent, and the content level under judgment indicator 2 is also excellent, but the quality level is poor. It can be seen that the content level of the second overlapping segment
[13] under judgment indicator 1 and judgment indicator 2 is higher than the quality level. The computer device can delete the second overlapping segment
[13] in the content classification segments S13 [10, 16] and S11 '[1, 13] including the second overlapping segment
[13] to form new content classification segments [10, 12], [14, 16] and [1, 12], and mark the corresponding content level as excellent.
[0092] After processing the content classification segments in the classification segment set, a target segment set including new content classification segments can be obtained.
[0093] In this embodiment, the computer device can obtain a first overlapping segment with overlapping timing between content classification segments under at least two judgment indicators, and obtain a second overlapping segment with the same timing between content classification segments and quality classification segments under at least two judgment indicators, so as to process the classification segment set according to the first overlapping segment and the second overlapping segment to obtain a target segment set. The processing process includes merging the content classification segments of the first overlapping segment obtained in the classification segment set if the content levels under at least two judgment indicators corresponding to the first overlapping segment match; if the content level corresponding to the second overlapping segment is higher than the quality level, removing the second overlapping segment in the corresponding content classification segment in the classification segment set. In the above method, the classification segments in the classification segment set are managed by the content level and quality level of the video frame to merge the content classification segments with matching content levels, and delete the content classification segments with content levels higher than the quality level to reduce redundant segments and obtain a streamlined target segment set.
[0094] In the process of generating a composite video based on a target segment set, the target segment set is usually used as a material library, and segment materials are selected from the target segment set as segments to be spliced according to user requirements, and the segments to be spliced are spliced to obtain a composite video. Generally, there is a splicing requirement preset in the splicing process. Based on this, in one embodiment, Figure 6 As shown, the above S240, generating a synthetic video based on the target segment set, includes:
[0095] S610: Obtain the segments to be spliced from the target segment set.
[0096] The to-be-joined segments may be segments already in the target segment set, or may be segments obtained by reprocessing the segments already in the target segment set.
[0097] Optionally, the computer device may obtain the segment selected by the user as the segment to be spliced from the target segment set according to the user's autonomous selection, or may obtain the segment with the highest content level and the highest quality level from the target segment set as the segment to be spliced.
[0098] S620: When the segments to be spliced do not meet the splicing requirement, adjust the segments to be spliced until the splicing requirement is met.
[0099] Optionally, the splicing requirement may be a requirement for the segments to be spliced, or a requirement for the composite video. The requirement for the segments to be spliced may include the required number of segments to be spliced, the required duration of a single segment to be spliced, or the required level of the segments to be spliced; the requirement for the composite video may include the required overall duration of the composite video, or the required number of segments of different levels in the composite video, etc.
[0100] Optionally, before the segments to be spliced are spliced to form a composite video, the computer device may perform requirement verification on the segments to be spliced according to preset splicing requirements, so as to execute subsequent steps according to the verification results.
[0101] Optionally, if all the segments to be spliced meet the corresponding splicing requirements, that is, pass the requirement verification, the computer device can directly splice the segments to be spliced to form a composite video. Conversely, if there are segments to be spliced that do not meet the corresponding splicing requirements, the computer device can make targeted adjustments to the corresponding segments to be spliced according to the unsatisfied splicing requirements until the splicing requirements are met.
[0102] Optionally, the splicing requirement includes the required number of segments to be spliced and the required duration of a single segment to be spliced. When the total number of segments to be spliced is less than the required number, the duration parameter is adjusted and the segments to be spliced are segmented until the total number of reference segments in the segments to be spliced obtained after segmentation reaches the required number. The reference segment is a segment to be spliced whose segment duration is greater than the required duration.
[0103] Optionally, after obtaining the segments to be spliced, the computer device may count the total number of the segments to be spliced, and compare the total number with the required number in the preset splicing requirement, so as to determine whether to adjust the segments to be spliced according to the comparison result.
[0104] Optionally, if the total number of the segments to be spliced is less than the required number, the computer device segments the segments to be spliced using a preset duration parameter to segment the segments to be spliced into reference segments whose segment duration is equal to the duration parameter, and deletes segments whose segment duration is less than the duration parameter, wherein the duration parameter is greater than or equal to the required duration.
[0105] Optionally, after segmenting to obtain parameter segments, the computer device counts the total number of parameter segments and compares the total number of parameter segments with the required number. If the total number of parameter segments is less than the required number, the duration parameter is reduced and the reference segment is segmented again to increase the number of segments to obtain new reference segments until the total number of new reference segments obtained by segmentation is greater than or equal to the required number.
[0106] Optionally, when the total number of segments to be spliced is greater than the required number, in order to improve the quality of the composite video, the computer device may screen the segments to be spliced in a preset order of priority, so as to obtain a composite video by splicing the screened segments to be spliced. For example, the segments to be spliced with the highest content level and quality level are preferentially selected, then the segments to be spliced with a high content level are selected, and finally the segments to be spliced with a high quality level are selected. In order to allow all the segments to be spliced to participate in the splicing, the computer device may also directly merge the segments to be spliced whose segment length is less than the required length and whose time sequence overlaps, so as to reduce the number of segments and form new segments to be spliced.
[0107] S630: Splice the adjusted segments to be spliced to obtain a composite video.
[0108] Optionally, after obtaining the adjusted segments to be spliced that meet the splicing requirements, the computer device may splice the adjusted segments to be spliced in time sequence to obtain a composite video.
[0109] In this embodiment, the computer device obtains the to-be-joined segments from the target segment set, and when the to-be-joined segments do not meet the jointing requirements, adjusts the to-be-joined segments until they meet the jointing requirements, and then joins the adjusted to-be-joined segments to obtain a composite video. In the case where the jointing requirements include the required number of segments to be joined and the required duration of a single segment to be joined, if the total number of segments to be joined is less than the required number, the duration parameter is adjusted to segment the to-be-joined segments until the total number of reference segments in the to-be-joined segments obtained after segmentation reaches the required number, and then the reference segments are joined to obtain a composite video. Among them, the reference segment is a to-be-joined segment whose segment duration is greater than the required duration. In the above method, by adjusting the duration parameter to segment the to-be-joined segments, efficient adjustment of the total number of segments is achieved, so that the required number can be quickly reached and jointed, the time consumption of video processing is shortened, and the processing efficiency is improved.
[0110] To facilitate understanding by those skilled in the art, the video processing method provided by this application is described in detail below. Figure 7 As shown, the method may include:
[0111] S701, segmenting the original video to obtain at least two videos to be processed;
[0112] S702, obtaining the content level and quality level of each video frame in the video to be processed;
[0113] S703, dividing video frames with the same content level and continuous in time sequence into one segment, to obtain at least one content classification segment;
[0114] S704, dividing video frames with the same quality level and continuous in time sequence into a segment, to obtain at least one quality classification segment;
[0115] S705, forming a classification segment set according to at least one content classification segment and at least one quality classification segment;
[0116] S706, obtaining a first overlapping segment whose time sequence overlaps between content classification segments under at least two determination indicators;
[0117] S707, obtaining a second overlapping segment with the same time sequence between the content classification segment and the quality classification segment under at least two determination indicators;
[0118] S708, if the content levels under at least two judgment indicators corresponding to the first overlapping segment match, then merge the content classification segments of the first overlapping segment in the classification segment set; if the content level corresponding to the second overlapping segment is higher than the quality level, then remove the second overlapping segment in the corresponding content classification segment in the classification segment set to form a target segment set;
[0119] S709, obtaining the to-be-joined segments from the target segment set, and if the total number of the to-be-joined segments is less than the required number, adjusting the duration parameters and segmenting the to-be-joined segments until the total number of reference segments in the to-be-joined segments obtained after segmentation reaches the required number; wherein the reference segment is a to-be-joined segment whose segment duration is greater than the required duration;
[0120] S710: splice the reference clips to obtain a composite video.
[0121] It should be noted that for the description in the above S701-S710, reference may be made to the relevant description in the above embodiment, and the effects are similar, which will not be repeated in this embodiment.
[0122] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0123] Based on the same inventive concept, the embodiment of the present application also provides a video processing device for implementing the above-mentioned video processing method. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above-mentioned method, so the specific limitations in one or more video processing device embodiments provided below can refer to the limitations on the video processing method above, and will not be repeated here.
[0124] In one embodiment, Figure 8 As shown, a video processing device is provided, including: a level classification module 801, a target determination module 802 and a video synthesis module 803, wherein:
[0125] The level classification module 801 is used to classify the video frames in the video to be processed to obtain a set of classified segments; wherein the set of classified segments includes classified segments formed by video frames of different levels;
[0126] The target determination module 802 is used to determine the target segment set according to the preset video processing strategy and the classification segment set;
[0127] The video synthesis module 803 is used to generate a synthesized video based on the target segment set.
[0128] In one embodiment, the grade classification module 801 includes:
[0129] A content level submodule, used to determine the content level of each video frame according to the image content of each video frame in the video to be processed;
[0130] A quality level submodule, used to determine the quality level of each video frame according to the image quality of each video frame in the video to be processed;
[0131] The video segmentation submodule is used to segment the video to be processed according to the content level and quality level of each video frame to obtain a set of classified segments.
[0132] In one embodiment, the video segmentation submodule includes:
[0133] A first segmentation unit, configured to divide video frames having the same content level and being continuous in time sequence into a segment, to obtain at least one content classification segment;
[0134] A second segmentation unit is used to divide the video frames with the same quality level and continuous in time into a segment to obtain at least one quality classification segment;
[0135] The segment collection unit is used to form a classified segment collection according to at least one content classified segment and at least one quality classified segment.
[0136] In one embodiment, the classification segment set includes content classification segments under at least two determination indicators, and the target determination module 802 includes:
[0137] A first acquisition submodule, used for acquiring a first overlapping segment whose time sequence overlaps between content classification segments under at least two determination indicators;
[0138] A second acquisition submodule is used to acquire a second overlapping segment with the same time sequence between the content classification segment and the quality classification segment under at least two determination indicators;
[0139] The fragment processing submodule is used to process the classified fragment set according to the first overlapping fragment and the second overlapping fragment to obtain a target fragment set.
[0140] In one embodiment, the fragment processing submodule is further configured to:
[0141] If the content levels corresponding to the first overlapping fragments match under at least two judgment indicators, the content classification fragments of the first overlapping fragment obtained in the classification fragment set are merged; if the content level corresponding to the second overlapping fragment is higher than the quality level, the second overlapping fragment in the corresponding content classification fragment in the classification fragment set is removed to form a target fragment set.
[0142] In one embodiment, the video synthesis module 803 includes:
[0143] An acquisition submodule is used to acquire the fragments to be spliced in the target fragment set;
[0144] The adjustment submodule is used to adjust the segments to be spliced until they meet the splicing requirements when the segments to be spliced do not meet the splicing requirements;
[0145] The splicing submodule is used to splice the adjusted segments to be spliced to obtain a composite video.
[0146] In one embodiment, the adjustment submodule is used to:
[0147] When the total number of segments to be spliced is less than the required number, the duration parameters are adjusted and the segments to be spliced are segmented until the total number of reference segments in the segments to be spliced after segmentation reaches the required number; wherein the reference segment is a segment to be spliced whose segment duration is greater than the required duration.
[0148] Each module in the above video processing device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0149] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0150] The video frames in the processed video are classified into different levels to obtain a classified segment set; wherein the classified segment set includes classified segments formed by video frames of different levels; a target segment set is determined according to a preset video processing strategy and the classified segment set; and a synthetic video is generated based on the target segment set.
[0151] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0152] The content level of each video frame is determined according to the image content of each video frame in the video to be processed; the quality level of each video frame is determined according to the image quality of each video frame in the video to be processed; the video to be processed is segmented according to the content level and quality level of each video frame to obtain a set of classified segments.
[0153] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0154] The video frames with the same content level and continuous time sequence are divided into a segment to obtain at least one content classification segment; the video frames with the same quality level and continuous time sequence are divided into a segment to obtain at least one quality classification segment; and a classification segment set is formed according to the at least one content classification segment and the at least one quality classification segment.
[0155] In one embodiment, the classification segment set includes content classification segments under at least two determination indicators, and the processor further implements the following steps when executing the computer program:
[0156] Acquire a first overlapping segment whose timing overlaps between content classification segments under at least two judgment indicators; acquire a second overlapping segment whose timing is the same between content classification segments and quality classification segments under at least two judgment indicators; and process the classification segment set according to the first overlapping segment and the second overlapping segment to obtain a target segment set.
[0157] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0158] If the content levels corresponding to the first overlapping fragments match under at least two judgment indicators, the content classification fragments of the first overlapping fragment obtained in the classification fragment set are merged; if the content level corresponding to the second overlapping fragment is higher than the quality level, the second overlapping fragment in the corresponding content classification fragment in the classification fragment set is removed to form a target fragment set.
[0159] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0160] The to-be-joined segments are obtained from the target segment set; when the to-be-joined segments do not meet the joining requirements, the to-be-joined segments are adjusted until the joining requirements are met; and the adjusted to-be-joined segments are joined to obtain a composite video.
[0161] In one embodiment, the splicing requirement includes the required number of segments to be spliced and the required duration of a single segment to be spliced; when the processor executes the computer program, the following steps are further implemented:
[0162] When the total number of segments to be spliced is less than the required number, adjust the duration parameters and segment the segments to be spliced until the total number of reference segments in the segments to be spliced after segmentation reaches the required number; wherein the reference segments are segments to be spliced whose duration is greater than the required duration; and splice the reference segments to obtain a composite video.
[0163] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0164] The video frames in the processed video are classified into different levels to obtain a classified segment set; wherein the classified segment set includes classified segments formed by video frames of different levels; a target segment set is determined according to a preset video processing strategy and the classified segment set; and a synthetic video is generated based on the target segment set.
[0165] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0166] The content level of each video frame is determined according to the image content of each video frame in the video to be processed; the quality level of each video frame is determined according to the image quality of each video frame in the video to be processed; the video to be processed is segmented according to the content level and quality level of each video frame to obtain a set of classified segments.
[0167] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0168] The video frames with the same content level and continuous time sequence are divided into a segment to obtain at least one content classification segment; the video frames with the same quality level and continuous time sequence are divided into a segment to obtain at least one quality classification segment; and a classification segment set is formed according to the at least one content classification segment and the at least one quality classification segment.
[0169] In one embodiment, the classification segment set includes content classification segments under at least two determination indicators, and when the computer program is executed by the processor, the following steps are further implemented:
[0170] Acquire a first overlapping segment whose timing overlaps between content classification segments under at least two judgment indicators; acquire a second overlapping segment whose timing is the same between content classification segments and quality classification segments under at least two judgment indicators; and process the classification segment set according to the first overlapping segment and the second overlapping segment to obtain a target segment set.
[0171] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0172] If the content levels corresponding to the first overlapping fragments match under at least two judgment indicators, the content classification fragments of the first overlapping fragment obtained in the classification fragment set are merged; if the content level corresponding to the second overlapping fragment is higher than the quality level, the second overlapping fragment in the corresponding content classification fragment in the classification fragment set is removed to form a target fragment set.
[0173] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0174] The to-be-joined segments are obtained from the target segment set; when the to-be-joined segments do not meet the joining requirements, the to-be-joined segments are adjusted until the joining requirements are met; and the adjusted to-be-joined segments are joined to obtain a composite video.
[0175] In one embodiment, the splicing requirement includes the required number of segments to be spliced and the required duration of a single segment to be spliced; when the computer program is executed by the processor, the following steps are also implemented:
[0176] When the total number of segments to be spliced is less than the required number, adjust the duration parameters and segment the segments to be spliced until the total number of reference segments in the segments to be spliced after segmentation reaches the required number; wherein the reference segments are segments to be spliced whose duration is greater than the required duration; and splice the reference segments to obtain a composite video.
[0177] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0178] The video frames in the processed video are classified into different levels to obtain a classified segment set; the classified segment set includes classified segments formed by video frames of different levels; a target segment set is determined according to a preset video processing strategy and the classified segment set; and a synthetic video is generated based on the target segment set.
[0179] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0180] The content level of each video frame is determined according to the image content of each video frame in the video to be processed; the quality level of each video frame is determined according to the image quality of each video frame in the video to be processed; the video to be processed is segmented according to the content level and quality level of each video frame to obtain a set of classified segments.
[0181] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0182] The video frames with the same content level and continuous time sequence are divided into a segment to obtain at least one content classification segment; the video frames with the same quality level and continuous time sequence are divided into a segment to obtain at least one quality classification segment; and a classification segment set is formed according to the at least one content classification segment and the at least one quality classification segment.
[0183] In one embodiment, the classification segment set includes content classification segments under at least two determination indicators, and when the computer program is executed by the processor, the following steps are further implemented:
[0184] Acquire a first overlapping segment whose timing overlaps between content classification segments under at least two judgment indicators; acquire a second overlapping segment whose timing is the same between content classification segments and quality classification segments under at least two judgment indicators; and process the classification segment set according to the first overlapping segment and the second overlapping segment to obtain a target segment set.
[0185] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0186] If the content levels corresponding to the first overlapping fragments match under at least two judgment indicators, the content classification fragments of the first overlapping fragment obtained in the classification fragment set are merged; if the content level corresponding to the second overlapping fragment is higher than the quality level, the second overlapping fragment in the corresponding content classification fragment in the classification fragment set is removed to form a target fragment set.
[0187] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0188] The to-be-joined segments are obtained from the target segment set; when the to-be-joined segments do not meet the joining requirements, the to-be-joined segments are adjusted until the joining requirements are met; and the adjusted to-be-joined segments are joined to obtain a composite video.
[0189] In one embodiment, the splicing requirement includes the required number of segments to be spliced and the required duration of a single segment to be spliced; when the computer program is executed by the processor, the following steps are also implemented:
[0190] When the total number of segments to be spliced is less than the required number, adjust the duration parameters and segment the segments to be spliced until the total number of reference segments in the segments to be spliced after segmentation reaches the required number; wherein the reference segments are segments to be spliced whose duration is greater than the required duration; and splice the reference segments to obtain a composite video.
[0191] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0192] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0193] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A video processing method, It is characterized in that The method comprises: Classifying the video frames in the video to be processed to obtain a set of classified segments; wherein the set of classified segments includes classified segments formed by video frames of different levels; Determine a target segment set according to a preset video processing strategy and the classified segment set; A synthetic video is generated based on the set of target segments.
2. The method according to claim 1, It is characterized in that The video frames in the video to be processed are classified into different levels to obtain a set of classified segments, including: Determining the content level of each video frame according to the image content of each video frame in the video to be processed; Determining the quality level of each video frame according to the image quality of each video frame in the video to be processed; The video to be processed is segmented according to the content level and quality level of each of the video frames to obtain the classified segment set.
3. The method according to claim 2, It is characterized in that The step of segmenting the video to be processed according to the content level and the quality level of each of the video frames to obtain the set of classified segments includes: Divide the video frames with the same content level and continuous in time into a segment to obtain at least one content classification segment; Dividing the video frames with the same quality level and continuous in time into a segment to obtain at least one quality classification segment; The set of classification segments is formed according to the at least one content classification segment and the at least one quality classification segment.
4. The method according to claim 3, It is characterized in that The classified segment set includes content classified segments under at least two determination indicators, and the step of determining the target segment set according to a preset video processing strategy and the classified segment set includes: Acquire a first overlapping segment whose time sequence overlaps between the content classification segments under the at least two determination indicators; Acquire a second overlapping segment having the same time sequence between the content classification segment and the quality classification segment under the at least two determination indicators; The target segment set is obtained by processing the classified segment set according to the first overlapping segment and the second overlapping segment.
5. The method according to claim 4, It is characterized in that The step of processing the classified segments according to the first overlapping segments and the second overlapping segments to obtain the target segment set includes: If the content levels under at least two determination indicators corresponding to the first overlapping segments match, merging the content classification segments of the first overlapping segments obtained from the classification segment set; If the content level corresponding to the second overlapping segment is higher than the quality level, the second overlapping segment in the corresponding content classification segment in the classification segment set is removed to form the target segment set.
6. The method according to any one of claims 1 to 5, It is characterized in that The generating a synthetic video based on the target segment set comprises: Acquire the fragments to be spliced from the target fragment set; If the to-be-joined segments do not meet the joining requirement, adjusting the to-be-joined segments until the joining requirement is met; The adjusted segments to be spliced are spliced to obtain the composite video.
7. The method according to claim 6, It is characterized in that The splicing requirement includes the required number of the segments to be spliced and the required duration of a single segment to be spliced; when the segments to be spliced do not meet the splicing requirement, adjusting the segments to be spliced until the splicing requirement is met, includes: When the total number of the segments to be spliced is less than the required number, the duration parameters are adjusted and the segments to be spliced are segmented until the total number of reference segments in the segments to be spliced obtained after segmentation reaches the required number; wherein the reference segment is a segment to be spliced whose segment duration is greater than the required duration.
8. A video processing device, It is characterized in that The device comprises: A level classification module is used to classify the video frames in the video to be processed to obtain a set of classified segments; wherein the set of classified segments includes classified segments formed by video frames of different levels; A target determination module, used to determine a target segment set according to a preset video processing strategy and the classified segment set; A video synthesis module is used to generate a synthetic video based on the target segment set.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program. It is characterized in that When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
