Short video generation method and system based on artificial intelligence
By identifying and adjusting the duration and size of short videos through artificial intelligence, it solves the problems of poor splicing effects and audio overlap in the existing technology, and achieves high-quality short video splicing and audio fluency.
Patent Information
- Application Number
- CN202410929865.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-11
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2044-07-11
AI Technical Summary
Existing short video splicing technology requires users to manually adjust the video duration and size, resulting in poor splicing results, and audio data may be played overlapping, affecting audio fluency.
Using an artificial intelligence-based method, the LSTM model identifies video audio information, adjusts the video duration and size, and generates a coherent short video, ensuring that the audio data only contains the main video audio to avoid overlapping playback.
The effect of short video splicing and audio fluency are improved, without the need for manual adjustments by users, ensuring the coherence of the main video and auxiliary video and the purity of the audio data.
Smart Images

Figure CN118474274B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of communication and video technology, and specifically relates to a short video generation method and system based on artificial intelligence. Background Art
[0002] Short video is a short video, which is a way of disseminating Internet content. It is generally a video with a duration of less than 10 minutes that is disseminated on new Internet media. With the development of short video platforms, many online shopping platforms are promoted through short videos. The existing short video promotion is generally done by real people shooting videos and then editing them by professional editors to generate short videos.
[0003] A spliced short video is formed by splicing two videos, generally including a main video and a secondary video. However, the time of the main video and the secondary video may be inconsistent. In addition, the sizes of the two videos may not be able to be directly spliced together. The existing short video splicing is based on the user manually adjusting the above scheme, but the effect of manually adjusting the video is based on the user's video splicing level, which results in the effect of the spliced short video not being very good. Summary of the invention
[0004] The present application provides an artificial intelligence-based short video generation method and system, which can automatically generate spliced videos without the need to manually adjust the length and size, thereby improving the effect of the short video.
[0005] In a first aspect, the present application provides a short video generation method based on artificial intelligence, the method comprising the following steps:
[0006] Obtain the main video, auxiliary video and splicing area selected by the target object, extract the time t1 of the main video and the time t2 of the auxiliary video, if t1>t2, copy the auxiliary video by t1-t2 time to obtain the first auxiliary extended video, the duration of the first auxiliary extended video is t1; if t1<t2, cut the auxiliary video and remove the time t2-t1 to obtain the first auxiliary extended video;
[0007] The main audio information corresponding to the main video is determined by identifying the main video through a preset LSTM model, the auxiliary audio information corresponding to the first auxiliary extended video is determined by identifying the first auxiliary extended video through a preset LSTM model, and the volume of the auxiliary audio information of the first auxiliary extended video is shielded to obtain the second auxiliary extended video;
[0008] Extract the first size of the main area of the stitching area, adjust the size of the main video to the first size and add it to the main area, extract the second size of the auxiliary area of the stitching area, adjust the size of the second auxiliary extended video to the second size and add it to the auxiliary area, align the start time of the main area video and the auxiliary area video, and call the video generation command to combine the main area video and the auxiliary area video into a short video.
[0009] In a second aspect, a short video generation system based on artificial intelligence is provided, the system comprising:
[0010] An acquisition unit, used to acquire the main video, auxiliary video and splicing area selected by the target object, and extract the time t1 of the main video and the time t2 of the auxiliary video;
[0011] The adjusting unit is used for, if t1>t2, copying the auxiliary video by t1-t2 time to obtain a first auxiliary extended video, the duration of the first auxiliary extended video being t1; if t1<t2, editing the auxiliary video to remove t2-t1 time to obtain the first auxiliary extended video;
[0012] an identification unit, configured to identify the main video through a preset LSTM model to determine the main audio information corresponding to the main video, identify the first auxiliary extended video through a preset LSTM model to determine the auxiliary audio information corresponding to the first auxiliary extended video, and shield the volume of the auxiliary audio information of the first auxiliary extended video to obtain the second auxiliary extended video;
[0013] The stitching generation unit is used to extract the first size of the main area of the stitching area, adjust the size of the main video to the first size and add it to the main area, extract the second size of the auxiliary area of the stitching area, adjust the size of the second auxiliary extended video to the second size and add it to the auxiliary area, align the start time of the main area video and the auxiliary area video, and then call the video generation command to combine the main area video and the auxiliary area video into a short video.
[0014] In a third aspect, the present application provides a computer storage medium storing a computer program for electronic data exchange, wherein the computer program enables a computer to execute some or all of the steps described in the first aspect of the present application.
[0015] The embodiments of the present application have the following beneficial effects:
[0016] The technical solution provided in the present application obtains the main video, auxiliary video and splicing area selected by the target object, extracts the time t1 of the main video and the time t2 of the auxiliary video, and if t1>t2, copies the auxiliary video by time t1-t2 to obtain a first auxiliary extended video, the duration of the first auxiliary extended video is t1; if t1<t2, the auxiliary video is spliced to remove time t2-t1 to obtain the first auxiliary extended video; the main video is identified by a preset LSTM model to determine the main audio information corresponding to the main video, the first auxiliary extended video is identified by a preset LSTM model to determine the auxiliary audio information corresponding to the first auxiliary extended video, and the volume of the auxiliary audio information of the first auxiliary extended video is shielded to obtain the second auxiliary extended video; the first size of the main area of the splicing area is extracted, the size of the main video is adjusted to the first size and then added to the main area, the second size of the auxiliary area of the splicing area is extracted, the size of the second auxiliary extended video is adjusted to the second size and then added to the auxiliary area, and after aligning the start time of the main area video and the auxiliary area video, the video generation command is called to synthesize the main area video and the auxiliary area video into a short video. The video generated in this way can ensure the continuity of the main video and the auxiliary video, and the audio data of the generated video only contains the audio data of the main video. There will be no overlapping playback of audio data affecting the smoothness of audio playback. Therefore, it has the advantage of improving the video effect of the spliced video. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0018] Figure 1 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application;
[0019] Figure 2 It is a technical scenario diagram of a splicing area provided by the implementation of this application;
[0020] Figure 3 This is a flow chart of a short video generation method based on artificial intelligence provided in Example 1 of the present application;
[0021] Figure 4 It is a structural schematic diagram of a short video generation system based on artificial intelligence provided in an embodiment of the present application;
[0022] Figure 5 It is a schematic diagram of the hand outline provided by this application. DETAILED DESCRIPTION
[0023] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0024] The terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, systems, products or devices.
[0025] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0026] The following is a schematic diagram of the structure of an electronic device involved in an embodiment of the present application.
[0027] The present application also provides an electronic device, such as Figure 1 As shown, the electronic device includes at least one processor 11 and a memory 12, and may also include a communications interface 14, one or more cameras 15, a display screen 16 and a bus 13. Among them, the processor 11, the memory 12, the camera 15, the display screen 16 and the communication interface 14 can communicate with each other through the bus 13. The communication interface 14 can transmit information, and the above-mentioned communication interface 14 can have a wireless communication function, and the above-mentioned wireless communication function can be a short-range wireless communication or a long-range communication function (such as LTE or NR mode). The processor 11 can call the logic instructions in the memory 12 to execute or support the method in the embodiment of the present application. The above-mentioned remote terminal 20 may also include: a microphone, a lighting device, etc.
[0028] The memory 12, as a computer-readable storage medium, can be configured to store software programs, computer executable programs, such as program instructions or modules corresponding to the method in the embodiment of the present disclosure. The processor 11 executes functional applications and data processing by running the software programs, instructions or modules stored in the memory 12, that is, implementing or supporting the method in the embodiment of the present application.
[0029] The following introduces the main technical application scenarios of the embodiments of the present application. Figure 2 As shown, Figure 2 This is a schematic diagram of a technical scenario of a splicing area in an embodiment of the present application. Figure 2 The videos in are represented by boxes and include:
[0030] Stitching area 201, main video 202 and auxiliary video 203. For the main video 202, it should be located in the main area 2011 of the stitching area 201. For the auxiliary video 203, it can be located in the auxiliary area 2012 of the stitching area 201. However, in actual processing, the main video 202 and the auxiliary video 203 have different durations. For example, the main video 202 has a duration of 3 minutes, and the auxiliary video has a duration of 4 minutes or 2 minutes. The size of the auxiliary video 203 is also inconsistent with the size of the auxiliary area. Therefore, it is necessary to intelligently adjust the corresponding time and size to improve the display effect of the stitching video.
[0031] The specific methods are introduced in detail below.
[0032] Embodiment 1
[0033] Embodiment 1 of the present application provides a short video generation method based on artificial intelligence, and the above method is as follows Figure 1 The electronic device shown performs, Figure 3 A flowchart of a short video generation method based on artificial intelligence is provided in Example 1 of the present application, such as Figure 3 As shown, the above method comprises the following steps:
[0034] Step S301, obtaining the main video, auxiliary video and splicing area selected by the target object, extracting the time t1 of the main video and the time t2 of the auxiliary video, if t1>t2, copying the auxiliary video by the time t1-t2 to obtain a first auxiliary extended video, the duration of the first auxiliary extended video is t1; if t1<t2, editing the auxiliary video to remove the time t2-t1 to obtain the first auxiliary extended video;
[0035] For example, the copying of the auxiliary video for the time period t1-t2 to obtain the first auxiliary extended video may specifically include:
[0036] Calculate x = t1 / t2, round x upward to get x'; add x'-1 copies of the auxiliary video to the end of the auxiliary video to get x' auxiliary videos, and cut the x' auxiliary videos to remove x'-t1 time to get the first auxiliary extended video.
[0037] The above scheme adjusts the duration of the auxiliary video and the main video to be completely consistent, which can facilitate the continuity of the subsequent generated videos and avoid the situation where the auxiliary video is still playing after the main video is finished playing, or the main video is still playing after the auxiliary video is finished playing.
[0038] Step S302: identifying the main video through a preset LSTM model to determine the main audio information corresponding to the main video, identifying the first auxiliary extended video through a preset LSTM model to determine the auxiliary audio information corresponding to the first auxiliary extended video, and shielding the volume of the auxiliary audio information of the first auxiliary extended video to obtain the second auxiliary extended video;
[0039] The above-mentioned LSTM model can be a general long short-term memory model, and the above-mentioned identification method can also be identified using existing methods. This application does not limit the specific implementation method of the above-mentioned LSTM model, which will not be repeated here.
[0040] Step S303, extract the first size of the main area of the stitching area, adjust the size of the main video to the first size and add it to the main area, extract the second size of the auxiliary area of the stitching area, adjust the size of the second auxiliary extended video to the second size and add it to the auxiliary area, align the start time of the main area video and the auxiliary area video, and call the video generation command to combine the main area video and the auxiliary area video into a short video.
[0041] The technical solution provided in the present application obtains the main video, auxiliary video and splicing area selected by the target object, extracts the time t1 of the main video and the time t2 of the auxiliary video, and if t1>t2, copies the auxiliary video by time t1-t2 to obtain a first auxiliary extended video, the duration of the first auxiliary extended video is t1; if t1<t2, the auxiliary video is spliced to remove time t2-t1 to obtain the first auxiliary extended video; the main video is identified by a preset LSTM model to determine the main audio information corresponding to the main video, the first auxiliary extended video is identified by a preset LSTM model to determine the auxiliary audio information corresponding to the first auxiliary extended video, and the volume of the auxiliary audio information of the first auxiliary extended video is shielded to obtain the second auxiliary extended video; the first size of the main area of the splicing area is extracted, the size of the main video is adjusted to the first size and then added to the main area, the second size of the auxiliary area of the splicing area is extracted, the size of the second auxiliary extended video is adjusted to the second size and then added to the auxiliary area, and after aligning the start time of the main area video and the auxiliary area video, the video generation command is called to synthesize the main area video and the auxiliary area video into a short video. The video generated in this way can ensure the continuity of the main video and the auxiliary video, and the audio data of the generated video only contains the audio data of the main video. There will be no overlapping playback of audio data affecting the smoothness of audio playback. Therefore, it has the advantage of improving the video effect of the spliced video.
[0042] For example, adjusting the size of the second auxiliary extended video to the second size and then adding it to the auxiliary area may specifically include:
[0043] Extract the first height value and the first width value of the size of the second auxiliary extended video, extract the second height value and the second width value of the second size, calculate the ratio between the first height value and the second height value to obtain the height ratio, and calculate the ratio between the first width value and the second width value to obtain the width ratio; determine the editing strategy of the second auxiliary extended video according to the height ratio and the width ratio, edit the second auxiliary extended video to obtain the third auxiliary extended video, adjust the size of the third auxiliary extended video to the second size, and then add it to the auxiliary area.
[0044] For example, the above-mentioned determining the splicing strategy of the second auxiliary extended video based on the height ratio and the width ratio to obtain the third auxiliary extended video after splicing the second auxiliary extended video may specifically include:
[0045] If the height ratio is greater than the height threshold and the width ratio is less than the width threshold, the second auxiliary extended video is cut in the height direction to reduce the first height value and keep the first width value unchanged;
[0046] If the height ratio is less than the height threshold and the width ratio is greater than the width threshold, the second auxiliary extended video is cut in the width direction to reduce the first width value and keep the first height value unchanged;
[0047] If the height ratio is greater than the height threshold and the width ratio is greater than the width threshold, the second auxiliary extended video is cropped in a height direction to reduce the first height value, and the second auxiliary extended video is cropped in a width direction to reduce the first width value.
[0048] For example, the above-mentioned cutting of the second auxiliary extended video in the height direction to reduce the first height value may specifically include:
[0049] The neural network model is called to identify the area of the second auxiliary extended video to determine the background area and the activity area of the second auxiliary extended video, and the size of the background area is reduced in the height direction to reduce the first height value.
[0050] For example, the above-mentioned cutting of the second auxiliary extended video in the width direction to reduce the first width value and keep the first height value unchanged may specifically include:
[0051] The neural network model is called to identify the area of the second auxiliary extended video to determine the background area and the active area of the second auxiliary extended video, and the size of the background area is reduced in the width direction to reduce the first height value.
[0052] For example, the above-mentioned cutting the second auxiliary extended video in the height direction to reduce the first height value, and cutting the second auxiliary extended video in the width direction to reduce the first width value may specifically include:
[0053] A neural network model is called to identify the area of the second auxiliary extended video to determine the background area and the active area of the second auxiliary extended video, and the size of the background area is reduced in the width direction and the height direction to reduce the first width value and the first height value.
[0054] In some splicing scenarios, the above-mentioned main video may need to change people, such as the issue of user's portrait rights. With the development of AI technology, AI-generated images have become very mature, but the generation of AI direct video cannot restore some actions in the original main video, such as hand movements or arm movements, etc. This has a certain impact on some special application scenarios, for example, the promotion of sportswear (such as dance clothes, yoga clothes, etc.), so it needs to be improved.
[0055] For example, the above method may further include:
[0056] A digital human is generated based on the AI model, and a first video of the digital human is generated. The hand movements in the first video are adjusted according to the hand movements in the main video to obtain a second video. The second video is used to replace the main video and added to the main video area. After the start time of the main area video and the auxiliary area video are aligned, the video generation command is called to synthesize the main area video and the auxiliary area video into a new short video.
[0057] The generated digital human and the first video of the digital human can be generated by using an existing AI model. This application does not limit the specific method of the above generation. The first video is also a video in the same application scenario as the main video. For example, if the main video is a dancing video, the first video should also be a video of a dancing scene. This application mainly adjusts the hand movements of the first video to improve the effect of the first video.
[0058] For example, the above-mentioned adjusting the hand movements in the first video according to the hand movements in the main video to obtain the second video may specifically include:
[0059] The hand contour of the first frame of the main video is identified to obtain the first hand contour image, and the first hand contour image is input into the neural network model to identify n feature points in the first hand contour image, and a feature point is selected from the n feature points as the origin o1 (generally, the most edge point of the n feature points is taken as the origin o1, such as Figure 5 The first step is to extract the second frame corresponding to the first frame from the first video, identify the hand contour of the second frame, and obtain a second hand contour image. The second hand contour image is input into the neural network model to identify n' feature points in the second hand contour image, select one feature point from the n' feature points as the origin o2, calculate the n'-1 complex values corresponding to the n'-1 feature points based on the origin o2, and calculate the differences between the n'-1 complex values and the n-1 complex values to obtain n-1 differences. If the n-1 differences are both Within the threshold range, x differences less than the first threshold are selected from the n-1 differences, the x feature points corresponding to the x differences in the second hand contour image are fixed, the j-th feature point adjacent to the ith feature point among the x feature points is selected from the n-1-x feature points, the j-th feature point is rotated with the ith feature point as a reference so that the difference between the complex value of the rotated j'th feature point and the complex value corresponding to the first mapping table is less than the first threshold, the rotation is stopped and the rotated j'th feature point is fixed, the n-1-x feature points are traversed so that the difference between the complex values of all feature points in the second hand contour image and the complex values in the first mapping table is less than the first threshold; all frames in the first video are traversed to obtain the second video after frame skipping.
[0060] For example, the above n can be a value greater than 22, because there are 15 joints for the fingers, plus the farthest points of the five fingers and two positions on the edge of the wrist, so at least 22 feature points can be constructed. Of course, more detailed feature points can be subdivided. The specific confirmation method of these feature points can be determined by the manufacturer, and it only needs to include the above 15 joint points.
[0061] The principle of the above adjustment is that since the joints of each finger can rotate, their rotation will form different movements. Since the manual movements of the generated first video and the main video are mostly the same, only slight adjustments are required. Under this premise, all complex values of the feature points in the finger contour of the first frame of the main video are marked in the coordinate system, so that the specific movements of the hand can be obtained. In principle, as long as the feature points in the finger contour of the second frame corresponding to the first video are adjusted to be consistent with the first frame, the specific movements of the hand can be restored. Because the positions of some feature points in the two frames are the same, the feature points corresponding to these positions do not need to be adjusted, and based on these positions, the purpose of adjusting the hand video can be achieved by adjusting the adjacent feature points.
[0062] For example, the above method may further include:
[0063] The voice information of a synthesized short video is replaced with a synthesized voice, and the method for generating the synthesized voice specifically includes:
[0064] Call the language model to recognize the voice information to obtain the text information of the voice information, segment the text information to obtain multiple paragraphs of text, perform time recognition on the voice information to obtain multiple time periods corresponding to the multiple paragraphs of text, construct a first mapping in which the multiple time periods correspond to the multiple paragraphs of text, perform voiceprint recognition on each paragraph of text to obtain multiple voiceprint feature information corresponding to the multiple paragraphs of text, and construct a second mapping in which the multiple voiceprint feature information corresponds to the multiple paragraphs of text; number the same voiceprint feature information in the multiple voiceprint feature information to obtain α voiceprint feature information, number the α voiceprint feature information to obtain α numbers, extract the first paragraph of text and the corresponding first voiceprint feature information in the second mapping, mark the number of the first voiceprint feature information in the first paragraph of text, and traverse the first paragraph of text. Second, map all the text segments and all the corresponding voiceprint feature information to obtain multiple labeled text segments with numbered labels, collect the original voiceprint feature information of the target object, construct α voiceprint coefficients, and use the original voiceprint feature information and α voiceprint systems to construct α constructed voiceprint feature information, and construct a third mapping with a one-to-one correspondence between the α constructed voiceprint feature information and the α numbers, and extract the first text segment and the number β1; according to the third mapping, obtain the β1th constructed voiceprint feature information corresponding to the number β1, use the β1th constructed voiceprint feature information and the first text segment to generate the first synthesized speech, extract the first time period corresponding to the first text segment according to the first mapping, use the first synthesized speech to replace the speech data of the first time period in the voice information of the short video, and traverse all the text segments to synthesize the speech.
[0065] The above α is an integer greater than or equal to 1, and the above 1≤β1≤α.
[0066] For example, the language model can recognize voice information using existing voice recognition methods. The technical solution does not limit the specific methods of voice synthesis and recognition, and can be implemented using a general AI data model, which will not be described in detail here.
[0067] The above method of constructing α voiceprint coefficients may specifically include:
[0068] Extract α feature points according to the power function to obtain α voiceprint coefficients;
[0069] The above power function f(b)=b m ; Wherein, b is an independent variable, and the value of b is the number value of α voiceprint coefficients, and the above-mentioned -1≤b≤0.5; the specific value of the above-mentioned b can be selected by the target object.
[0070] The above-mentioned voice replacement mainly solves the problem that different people have different voiceprints when speaking, but the replaced voices all use a unified voice description, which leads to differences in the video experience. Therefore, this application constructs multiple coefficients by constructing custom voiceprint feature coefficients, and then changes the voiceprint features to obtain multiple voice feature information, which are then matched with the segments corresponding to the original voice information, so that the same person uses the same voiceprint feature information, and different people have different voiceprint information, thereby improving the effect of the voice information and thus improving the effect of the synthesized video.
[0071] See also Figure 4 , Figure 4 A schematic diagram of the structure of a short video generation system based on artificial intelligence provided in this application, the system comprising:
[0072] An acquisition unit 401 is used to acquire the primary video, the secondary video and the splicing area selected by the target object, and extract the time t1 of the primary video and the time t2 of the secondary video;
[0073] The adjusting unit 402 is used for, if t1>t2, copying the auxiliary video by t1-t2 time to obtain a first auxiliary extended video, the duration of the first auxiliary extended video being t1; if t1<t2, editing the auxiliary video to remove t2-t1 time to obtain the first auxiliary extended video;
[0074] The identification unit 403 is used to identify the main video through a preset LSTM model to determine the main audio information corresponding to the main video, identify the first auxiliary extended video through a preset LSTM model to determine the auxiliary audio information corresponding to the first auxiliary extended video, and shield the volume of the auxiliary audio information of the first auxiliary extended video to obtain the second auxiliary extended video;
[0075] The stitching generation unit 404 is used to extract the first size of the main area of the stitching area, adjust the size of the main video to the first size and add it to the main area, extract the second size of the auxiliary area of the stitching area, adjust the size of the second auxiliary extended video to the second size and add it to the auxiliary area, align the start time of the main area video and the auxiliary area video, and then call the video generation command to combine the main area video and the auxiliary area video into a short video.
[0076] The adjustment unit 402 is specifically used to calculate x= t1 / t2, round x up to get x'; add x'-1 copied auxiliary videos to the end of the auxiliary video to get x' auxiliary videos, and cut the x' auxiliary videos to remove x'-t1 time to get the first auxiliary extended video.
[0077] The splicing generation unit 404 is specifically used to extract the first height value and the first width value of the size of the second auxiliary extended video, extract the second height value and the second width value of the second size, calculate the ratio between the first height value and the second height value to obtain the height ratio, and calculate the ratio between the first width value and the second width value to obtain the width ratio; determine the splicing strategy of the second auxiliary extended video according to the height ratio and the width ratio to obtain the third auxiliary extended video after splicing the second auxiliary extended video, adjust the size of the third auxiliary extended video to the second size, and then add it to the auxiliary area.
[0078] The splicing generation unit 404 is specifically configured to cut the second auxiliary extended video in the height direction to reduce the first height value and keep the first width value unchanged if the height ratio is greater than the height threshold and the width ratio is less than the width threshold;
[0079] If the height ratio is less than the height threshold and the width ratio is greater than the width threshold, the second auxiliary extended video is cut in the width direction to reduce the first width value and keep the first height value unchanged;
[0080] If the height ratio is greater than the height threshold and the width ratio is greater than the width threshold, the second auxiliary extended video is cropped in a height direction to reduce the first height value, and the second auxiliary extended video is cropped in a width direction to reduce the first width value.
[0081] The splicing generation unit 404 is specifically configured to call a neural network model to identify the area of the second auxiliary extended video to determine the background area and the activity area of the second auxiliary extended video, and reduce the size of the background area in the height direction to reduce the first height value;
[0082] Calling a neural network model to identify the area of the second auxiliary extended video to determine the background area and the activity area of the second auxiliary extended video, and reducing the size of the background area in the width direction to reduce the first height value;
[0083] A neural network model is called to identify the area of the second auxiliary extended video to determine the background area and the active area of the second auxiliary extended video, and the size of the background area is reduced in the width direction and the height direction to reduce the first width value and the first height value.
[0084] The embodiment of the present application can divide the electronic device into functional units according to the above method example. For example, each functional unit can be divided according to each function, or two or more functions can be integrated into one processing unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units. It should be noted that the division of units in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0085] The above embodiments may be implemented in whole or in part by software, hardware, firmware or any other combination thereof. When implemented using software, the above embodiments may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable system. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website, computer, server or data center to another website, computer, server or data center by wired or wireless means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that contains one or more available media sets. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium. The semiconductor medium may be a solid-state hard disk.
[0086] An embodiment of the present application also provides a computer storage medium, wherein the computer storage medium stores a computer program for electronic data exchange, wherein the computer program enables a computer to execute part or all of the steps of any method described in the above method embodiments, and the above computer includes an electronic device.
[0087] The embodiment of the present application also provides a computer program product, the computer program product includes a non-transitory computer-readable storage medium storing a computer program, the computer program is operable to cause a computer to execute some or all of the steps of any method described in the method embodiment. The computer program product may be a software installation package, and the computer includes an electronic device.
[0088] It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0089] In the several embodiments provided in the present application, it should be understood that the disclosed methods, systems and systems can be implemented in other ways. For example, the system embodiments described above are only schematic; for example, the division of the units is only a logical function division, and there may be other division methods in actual implementation; for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of systems or units, which can be electrical, mechanical or other forms.
[0090] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0091] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may be physically included separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0092] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform some steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: a USB flash drive, a mobile hard disk, a magnetic disk, an optical disk, a volatile memory or a non-volatile memory. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM) or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of random access memory (RAM) are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM) and direct RAM bus RAM (DR RAM). Various media that can store program code are available.
[0093] Although the present invention is disclosed as above, the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions without departing from the spirit and scope of the present invention, and can make various changes and modifications, including the combination of the above-mentioned different functions and implementation steps, including software and hardware implementation methods, all of which are within the scope of protection of the present invention.
Claims
1. A short video generation method based on artificial intelligence, characterized in that: The method comprises the following steps: Get the main video, auxiliary video and splicing area selected by the target object, extract the time t1 of the main video and the time t2 of the auxiliary video, if t1>t2, copy the auxiliary video by t1-t2 to get the first auxiliary extended video, the duration of the first auxiliary extended video is t1; If t1<t2, the auxiliary video is edited to remove the time t2-t1 to obtain the first auxiliary extended video; The main audio information corresponding to the main video is determined by identifying the main video through a preset LSTM model, the auxiliary audio information corresponding to the first auxiliary extended video is determined by identifying the first auxiliary extended video through a preset LSTM model, and the volume of the auxiliary audio information of the first auxiliary extended video is shielded to obtain the second auxiliary extended video; Extracting a first size of the main area of the stitching area, adjusting the size of the main video to the first size and adding it to the main area, extracting a second size of the auxiliary area of the stitching area, adjusting the size of the second auxiliary extended video to the second size and adding it to the auxiliary area, aligning the start time of the main area video and the auxiliary area video, calling a video generation command to combine the main area video and the auxiliary area video into a short video; Generate a digital human based on the AI model, generate a first video of the digital human, adjust the hand movements in the first video according to the hand movements in the main video to obtain a second video, use the second video to replace the main video and add it to the main video area, align the start time of the main area video and the auxiliary area video, and call the video generation command to synthesize the main area video and the auxiliary area video into a new short video; The step of adjusting the hand movements in the first video according to the hand movements in the main video to obtain the second video specifically includes: The hand contour of the first frame of the main video is recognized to obtain a first hand contour image, the first hand contour image is input into the neural network model to recognize n feature points in the first hand contour image, a feature point is selected from the n feature points as the origin o1, the n-1 complex values corresponding to the n-1 feature points are calculated based on the origin o1, a one-to-one mapping between the n-1 complex values and the n-1 feature points is constructed to obtain a first mapping table, a second frame corresponding to the first frame is extracted from the first video, the hand contour of the second frame is recognized to obtain a second hand contour image, the second hand contour image is input into the neural network model to recognize n' feature points in the second hand contour image, a feature point is selected from the n' feature points as the origin o2, the n'-1 complex values corresponding to the n'-1 feature points are calculated based on the origin o2, and the first mapping table is obtained. The differences between n'-1 complex values and n-1 complex values are calculated separately to obtain n-1 differences. If the n-1 differences are all within the threshold range, x differences that are less than the first threshold are selected from the n-1 differences, and the x feature points corresponding to the x differences in the second hand contour image are fixed. The j-th feature point adjacent to the i-th feature point among the x feature points is selected from the n-1-x feature points, and the j-th feature point is rotated with respect to the i-th feature point as a reference so that the difference between the complex value of the rotated j'th feature point and the complex value corresponding to the first mapping table is less than the first threshold, then the rotation is stopped and the rotated j'th feature point is fixed, and the n-1-x feature points are traversed so that the differences between the complex values of all feature points in the second hand contour image and the complex values in the first mapping table are all less than the first threshold; all frames in the first video are traversed to obtain the second video after frame skipping.
2. The short video generation method based on artificial intelligence according to claim 1, characterized in that: The copying of the auxiliary video for the time period t1-t2 to obtain the first auxiliary extended video specifically includes: Calculate x = t1 / t2, round x upward to get x'; add x'-1 copies of the auxiliary video to the end of the auxiliary video to get x' auxiliary videos, and cut the x' auxiliary videos to remove x'-t1 time to get the first auxiliary extended video.
3. The short video generation method based on artificial intelligence according to claim 1, characterized in that: The step of adjusting the size of the second auxiliary extended video to the second size and then adding the video to the auxiliary area specifically includes: Extract the first height value and the first width value of the size of the second auxiliary extended video, extract the second height value and the second width value of the second size, calculate the ratio between the first height value and the second height value to obtain the height ratio, and calculate the ratio between the first width value and the second width value to obtain the width ratio; determine the editing strategy of the second auxiliary extended video according to the height ratio and the width ratio, edit the second auxiliary extended video to obtain the third auxiliary extended video, adjust the size of the third auxiliary extended video to the second size, and then add it to the auxiliary area.
4. The short video generation method based on artificial intelligence according to claim 3 is characterized in that: The method of determining the splicing strategy of the second auxiliary extended video according to the height ratio and the width ratio to obtain the third auxiliary extended video after splicing the second auxiliary extended video specifically includes: If the height ratio is greater than the height threshold and the width ratio is less than the width threshold, the second auxiliary extended video is cut in the height direction to reduce the first height value and keep the first width value unchanged; If the height ratio is less than the height threshold and the width ratio is greater than the width threshold, the second auxiliary extended video is cut in the width direction to reduce the first width value and keep the first height value unchanged; If the height ratio is greater than the height threshold and the width ratio is greater than the width threshold, the second auxiliary extended video is cropped in a height direction to reduce the first height value, and the second auxiliary extended video is cropped in a width direction to reduce the first width value.
5. The short video generation method based on artificial intelligence according to claim 4 is characterized in that: The step of cutting the second auxiliary extended video in the height direction to reduce the first height value specifically includes: Calling a neural network model to identify the area of the second auxiliary extended video to determine the background area and the activity area of the second auxiliary extended video, and reducing the size of the background area in the height direction to reduce the first height value; The step of cutting the second auxiliary extended video in the width direction to reduce the first width value and keep the first height value unchanged specifically includes: Calling a neural network model to identify the area of the second auxiliary extended video to determine the background area and the activity area of the second auxiliary extended video, and reducing the size of the background area in the width direction to reduce the first height value; The step of cutting the second auxiliary extended video in the height direction to reduce the first height value, and cutting the second auxiliary extended video in the width direction to reduce the first width value specifically includes: A neural network model is called to identify the area of the second auxiliary extended video to determine the background area and the active area of the second auxiliary extended video, and the size of the background area is reduced in the width direction and the height direction to reduce the first width value and the first height value.
6. A short video generation device based on artificial intelligence, characterized in that: The device comprises: An acquisition unit, used to acquire the main video, auxiliary video and splicing area selected by the target object, and extract the time t1 of the main video and the time t2 of the auxiliary video; The adjusting unit is used for, if t1>t2, copying the auxiliary video by t1-t2 time to obtain a first auxiliary extended video, the duration of the first auxiliary extended video being t1; if t1<t2, editing the auxiliary video to remove t2-t1 time to obtain the first auxiliary extended video; an identification unit, configured to identify the main video through a preset LSTM model to determine the main audio information corresponding to the main video, identify the first auxiliary extended video through a preset LSTM model to determine the auxiliary audio information corresponding to the first auxiliary extended video, and shield the volume of the auxiliary audio information of the first auxiliary extended video to obtain the second auxiliary extended video; The splicing generation unit is used to extract the first size of the main area of the splicing area, adjust the size of the main video to the first size and then add it to the main area, extract the second size of the auxiliary area of the splicing area, adjust the size of the second auxiliary extended video to the second size and then add it to the auxiliary area, align the start time of the main area video and the auxiliary area video, and call the video generation command to combine the main area video and the auxiliary area video into a short video; The device is used to generate a digital human based on an AI model, generate a first video of the digital human, adjust the hand movements in the first video according to the hand movements in the main video to obtain a second video, use the second video to replace the main video and add it to the main video area, align the start time of the main area video and the auxiliary area video, and then call a video generation command to synthesize the main area video and the auxiliary area video into a new short video; The step of adjusting the hand movements in the first video according to the hand movements in the main video to obtain the second video specifically includes: The hand contour of the first frame of the main video is recognized to obtain a first hand contour image, the first hand contour image is input into the neural network model to recognize n feature points in the first hand contour image, a feature point is selected from the n feature points as the origin o1, the n-1 complex values corresponding to the n-1 feature points are calculated based on the origin o1, a one-to-one mapping between the n-1 complex values and the n-1 feature points is constructed to obtain a first mapping table, a second frame corresponding to the first frame is extracted from the first video, the hand contour of the second frame is recognized to obtain a second hand contour image, the second hand contour image is input into the neural network model to recognize n' feature points in the second hand contour image, a feature point is selected from the n' feature points as the origin o2, the n'-1 complex values corresponding to the n'-1 feature points are calculated based on the origin o2, and the first mapping table is obtained. The differences between n'-1 complex values and n-1 complex values are calculated separately to obtain n-1 differences. If the n-1 differences are all within the threshold range, x differences that are less than the first threshold are selected from the n-1 differences, and the x feature points corresponding to the x differences in the second hand contour image are fixed. The j-th feature point adjacent to the i-th feature point among the x feature points is selected from the n-1-x feature points, and the j-th feature point is rotated with respect to the i-th feature point as a reference so that the difference between the complex value of the rotated j'th feature point and the complex value corresponding to the first mapping table is less than the first threshold, then the rotation is stopped and the rotated j'th feature point is fixed, and the n-1-x feature points are traversed so that the differences between the complex values of all feature points in the second hand contour image and the complex values in the first mapping table are all less than the first threshold; all frames in the first video are traversed to obtain the second video after frame skipping.
7. The short video generation device based on artificial intelligence according to claim 6 is characterized in that: The adjustment unit is specifically used to calculate x=t1 / t2, round x upward to get x'; add x'-1 copied auxiliary videos to the end of the auxiliary video to get x' auxiliary videos, and cut the x' auxiliary videos to remove x'-t1 time to get the first auxiliary extended video.
8. The short video generation device based on artificial intelligence according to claim 6, characterized in that: The splicing generation unit is specifically used to extract the first height value and the first width value of the size of the second auxiliary extended video, extract the second height value and the second width value of the second size, calculate the ratio between the first height value and the second height value to obtain the height ratio, and calculate the ratio between the first width value and the second width value to obtain the width ratio; determine the splicing strategy of the second auxiliary extended video according to the height ratio and the width ratio to obtain the third auxiliary extended video after splicing the second auxiliary extended video, adjust the size of the third auxiliary extended video to the second size, and then add it to the auxiliary area.
9. The short video generation device based on artificial intelligence according to claim 8, characterized in that: The splicing generation unit is specifically configured to cut the second auxiliary extended video in the height direction to reduce the first height value and keep the first width value unchanged if the height ratio is greater than the height threshold and the width ratio is less than the width threshold; If the height ratio is less than the height threshold and the width ratio is greater than the width threshold, the second auxiliary extended video is cut in the width direction to reduce the first width value and keep the first height value unchanged; If the height ratio is greater than the height threshold and the width ratio is greater than the width threshold, the second auxiliary extended video is cropped in a height direction to reduce the first height value, and the second auxiliary extended video is cropped in a width direction to reduce the first width value.
10. The short video generation device based on artificial intelligence according to claim 9, characterized in that: The splicing generation unit is specifically used to call the neural network model to identify the area of the second auxiliary extended video to determine the background area and the activity area of the second auxiliary extended video, and reduce the size of the background area in the height direction to reduce the first height value; Calling a neural network model to identify the area of the second auxiliary extended video to determine the background area and the activity area of the second auxiliary extended video, and reducing the size of the background area in the width direction to reduce the first height value; A neural network model is called to identify the area of the second auxiliary extended video to determine the background area and the active area of the second auxiliary extended video, and the size of the background area is reduced in the width direction and the height direction to reduce the first width value and the first height value.
Citation Information
Patent Citations
Image processing method and device and storage medium
CN112529765A
Image display method, electronic device thereof, and medium
CN116342639A
Knowledge graph construction method for futures field
CN117131935A
Video material editing method and device
CN117857719A
