Video generation method, apparatus, device, storage medium and program product
The embodiments of the present disclosure provide a video generation method, an apparatus, an electronic device, a storage medium, a computer program product and a computer program, the method including: obtaining a plurality of video segments; determining feature information corresponding to the plurality of video segments; according to the feature information and a plurality of pre-stored rendering effects, determining an effect combination to be added; the rendering effects being animation, special effects or a transition; and generating a target video according to the plurality of video segments and the effect combination to be added.
1 . A video generation method, comprising:
obtaining a plurality of video segments;
determining feature information corresponding to the plurality of video segments;
determining an effect combination to be added based on the feature information and a plurality of rendering effects, the rendering effects being animation, special effect, or transition; and
generating a target video based on the plurality of video segments and the effect combination to be added,
wherein the determining the effect combination to be added comprises:
performing a global filtration on the plurality of rendering effects to obtain a plurality of first candidate effects based on global features extracted from the plurality of video segments,
performing a type matching filtration on the plurality of first candidate effects to obtain a plurality of second candidate effects that match a video type corresponding to the plurality of video segments,
performing a local filtration on the plurality of second candidate effects to obtain a plurality of third candidate effects based on local features corresponding to each of the plurality of video segments and determining an attribute score corresponding to each of the plurality of third candidate effects with respect to each of the plurality of video segments,
determining at least a subset of the plurality of third candidate effects with the attribute score greater than or equal to a first threshold as at least one fourth candidate effect corresponding to each of the plurality of video segments,
determining at least one rendering combination based on the at least one fourth candidate effect corresponding to each of the plurality of video segments, and
determining the effect combination to be added based on the local features and the at least one rendering combination.
2 . The method according to claim 1 , wherein the feature information corresponding to the plurality of video segments comprises one or more of the followings:
video local features corresponding to each video segment, comprising one or more of video impact, video motion speed, video in-direction, or video out-direction;
the video type corresponding to the plurality of video segments;
first global features and first local features of a plurality of frames of images extracted from the plurality of video segments, the first global features comprising one or more of image emotion, image style, or image scene, and the first local features comprising the local features corresponding to each frame of image, which comprise one or more of image emotion, image style, or image scene;
second global features and second local features of music matching the plurality of video segments, the second global features comprising one or more of music emotion, music style, or music theme, the second local features comprising one or more of chorus point, phrase and section point, or beat point of a music segment corresponding to each video segment in the music.
3 . The method according to claim 2 , wherein the determination of the video local features corresponding to each video segment comprises:
by using a video feature extraction model, performing feature extraction on each of the plurality of video segments to obtain the video local features corresponding to each video segment.
4 . The method according to claim 2 , wherein the method further comprises determining the video type corresponding to the plurality of video segments, wherein the determining the video type corresponding to the plurality of video segments comprises:
in response to selecting a target video type from one or more preset video types, determining the target video type as the video type corresponding to the plurality of video segments.
5 . The method according to claim 2 , wherein the determination of the first global features and the first local features of the plurality of frames of images extracted from the plurality of video segments, comprises:
extracting frames from the plurality of video segments to obtain the plurality of frames of images; and
by using a pre-stored image feature extraction model, performing feature extraction on the plurality of frames of images to obtain the first global features and the first local features.
6 . The method according to claim 2 , wherein the determination of the second global features and the second local features of the music that matches the plurality of frames of images, comprises:
by using a pre-stored music algorithm, performing feature extraction on the music to obtain the second global features and the second local features.
7 . The method according to claim 2 , wherein:
the video local features comprise video impact, video motion speed, video in-direction, and video out-direction; and
the determining an attribute score corresponding to each of the plurality of third candidate effects with respect to each of the plurality of video segments comprises:
determining an impact score corresponding to each third candidate effect based on the video impact of the each video segment and impact corresponding to each third candidate effect;
determining a motion score corresponding to each third candidate effect based on the video motion speed of the each video segment and motion speed corresponding to each third candidate effect;
determining an in-direction score corresponding to each third candidate effect based on the video in-direction of the each video segment and in-direction corresponding to each third candidate effect;
determining an out-direction score corresponding to each third candidate effect based on the video out-direction of the each video segment and out-direction corresponding to each third candidate effect; and
for each third candidate effect, determining the product of the impact score, the motion score, the in-direction score, and the out-direction score corresponding to the each third candidate effect as the attribute score corresponding to the each third candidate effect.
8 . The method according to claim 7 , wherein the determining an impact score corresponding to each third candidate effect based on the video impact of the each video segment and impact corresponding to each third candidate effect comprises:
for the each third candidate effect, obtaining a first impact score of the video impact and a second impact score of the impact corresponding to the each third candidate effect; determining the impact score corresponding to the each third candidate effect based on the first and the second impact scores.
9 . The method according to claim 2 , wherein the generating a target video based on the plurality of video segments and the effect combination to be added comprises:
generating the target video based on the plurality of video segments, the effect combination to be added, and the music.
10 . The method according to claim 7 , wherein the determining a motion score corresponding to each third candidate effect based on the video motion speed of the each video segment and motion speed corresponding to each third candidate effect comprises:
for the each third candidate effect, judging whether the motion speed corresponding to the each third candidate effect is a preset speed;
in response to the motion speed corresponding to the each third candidate effect being the preset speed, determining a first preset score as the motion score corresponding to the each third candidate effect;
in response to the motion speed corresponding to the each third candidate effect not being the preset speed, obtaining a first motion score corresponding to the video motion speed and a second motion score corresponding to the motion speed corresponding to the each third candidate effect, and determining the motion score corresponding to the each third candidate effect based on the first and the second motion scores.
11 . The method according to claim 7 , wherein the determining an in-direction score corresponding to each third candidate effect based on the video in-direction of the each video segment and in-direction corresponding to each third candidate effect comprises:
for the each third candidate effect, judging whether the video in-direction is opposite to the in-direction corresponding to the each third candidate effect;
in response to the video in-direction being opposite to the in-direction corresponding to the each third candidate effect, determining a second preset score as the in-direction score corresponding to the each third candidate effect;
in response to the video in-direction not being opposite to the in-direction corresponding to the each third candidate effect, determining a third preset score as the in-direction score corresponding to the each third candidate effect.
12 . The method according to claim 7 , wherein the determining an out-direction score corresponding to each third candidate effect based on the video out-direction of the each video segment and out-direction corresponding to each third candidate effect comprises:
for the each third candidate effect, judging whether the video out-direction is opposite to the out-direction corresponding to the each third candidate effect;
in response to the video out-direction being opposite to the out-direction corresponding to the each third candidate effect, determining a fourth preset score as the out-direction score corresponding to the each third candidate effect;
in response to the video out-direction not being opposite to the out-direction corresponding to the each third candidate effect, determining a fifth preset score as the out-direction score corresponding to the each third candidate effect.
13 . An electronic device, comprising a processor and a memory connected in communication with the processor;
the memory storing computer-executable instructions;
the processor executing the computer-executable instructions stored in the memory to implement operations comprising:
obtaining a plurality of video segments;
determining feature information corresponding to the plurality of video segments;
determining an effect combination to be added based on the feature information and a plurality of pre-stored rendering effects, the rendering effects being animation, special effect, or transition; and
generating a target video based on the plurality of video segments and the effect combination to be added,
wherein the determining the effect combination to be added comprises:
performing a global filtration on the plurality of rendering effects to obtain a plurality of first candidate effects based on global features extracted from the plurality of video segments,
performing a type matching filtration on the plurality of first candidate effects to obtain a plurality of second candidate effects that match a video type corresponding to the plurality of video segments,
performing a local filtration on the plurality of second candidate effects to obtain a plurality of third candidate effects based on local features corresponding to each of the plurality of video segments and determining an attribute score corresponding to each of the plurality of third candidate effects with respect to each of the plurality of video segments,
determining at least a subset of the plurality of third candidate effects with the attribute score greater than or equal to a first threshold as at least one fourth candidate effect corresponding to each of the plurality of video segments,
determining at least one rendering combination based on the at least one fourth candidate effect corresponding to each of the plurality of video segments, and
determining the effect combination to be added based on the local features and the at least one rendering combination.
14 . The electronic device according to claim 13 , wherein the feature information corresponding to the plurality of video segments comprises:
the video type corresponding to the plurality of video segments;
video local features corresponding to each of the plurality of video segments, the video local features comprising one or more of video impact, video motion speed, video in-direction, or video out-direction;
first global features and first local features of a plurality of frames of images extracted from the plurality of video segments, the first global features comprising one or more of image emotion, image style, or image scene, and the first local features comprising the local features corresponding to each frame of image, which comprise one or more of image emotion, image style, or image scene;
second global features and second local features of music matching the plurality of video segments, the second global features comprising one or more of music emotion, music style, or music theme, the second local features comprising one or more of chorus point, phrase and section point, or beat point of a music segment corresponding to each video segment in the music.
15 . The electronic device according to claim 14 , wherein the operations further comprise determining the video type corresponding to the plurality of video segments, wherein the determining the video type corresponding to the plurality of video segments comprises:
in response to selecting a target video type from one or more preset video types, determining the target video type as the video type corresponding to the plurality of video segments.
16 . The electronic device according to claim 14 , the operations further comprising:
generating the target video based on the plurality of video segments, the effect combination to be added, and the music.
17 . A non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores the computer-executable instructions, which, when executed by a processor, cause the processor to implement operations comprising:
obtaining a plurality of video segments;
determining feature information corresponding to the plurality of video segments;
determining an effect combination to be added based on the feature information and a plurality of pre-stored rendering effects, the rendering effects being animation, special effect, or transition; and
generating a target video based on the plurality of video segments and the effect combination to be added,
wherein the determining the effect combination to be added comprises:
performing a global filtration on the plurality of rendering effects to obtain a plurality of first candidate effects based on global features extracted from the plurality of video segments,
performing a type matching filtration on the plurality of first candidate effects to obtain a plurality of second candidate effects that match a video type corresponding to the plurality of video segments,
performing a local filtration on the plurality of second candidate effects to obtain a plurality of third candidate effects based on local features corresponding to each of the plurality of video segments and determining an attribute score corresponding to each of the plurality of third candidate effects with respect to each of the plurality of video segments,
determining at least a subset of the plurality of third candidate effects with the attribute score greater than or equal to a first threshold as at least one fourth candidate effect corresponding to each of the plurality of video segments,
determining at least one rendering combination based on the at least one fourth candidate effect corresponding to each of the plurality of video segments, and
determining the effect combination to be added based on the local features and the at least one rendering combination.
18 . The non-transitory computer-readable storage medium according to claim 17 , wherein the feature information corresponding to the plurality of video segments comprises one or more of the followings:
video local features corresponding to each video segment, comprising one or more of video impact, video motion speed, video in-direction, or video out-direction;
the video type corresponding to the plurality of video segments;
first global features and first local features of a plurality of frames of images extracted from the plurality of video segments, the first global features comprising one or more of image emotion, image style, or image scene, and the first local features comprising the local features corresponding to each frame of image, which comprise one or more of image emotion, image style, or image scene;
second global features and second local features of music matching the plurality of video segments, the second global features comprising one or more of music emotion, music style, or music theme, the second local features comprising one or more of chorus point, phrase and section point, or beat point of a music segment corresponding to each video segment in the music.
19 . The non-transitory computer-readable storage medium according to claim 18 , wherein the determination of the video local features corresponding to each video segment comprises:
by using a video feature extraction model, performing feature extraction on each of the plurality of video segments to obtain the video local features corresponding to each video segment.
20 . The non-transitory computer-readable storage medium according to claim 18 , wherein the operations further comprise determining the video type corresponding to the plurality of video segments, wherein the determining the video type corresponding to the plurality of video segments comprises:
in response to selecting a target video type from one or more preset video types, determining the target video type as the video type corresponding to the plurality of video segments.