Video synthesis method and device and related product
By performing frame segmentation and depth information map processing on video clips, combined with preset transition effect templates, the problems of complex operation and low efficiency of video compositing software are solved, and personalized transition effects and automated compositing are realized.
Patent Information
- Application Number
- CN202410876454.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-01
- Publication Date
- 2026-01-06
AI Technical Summary
Existing video compositing software is complex to operate, requires professional knowledge, lacks personalized customization, has low compositing efficiency, and poor transition effects.
By acquiring preset transition effect templates and video groups to be synthesized, video segments are extracted and framed to determine depth information maps. Based on the depth information map set and templates, preset transition effects are determined, and the target video is synthesized.
It enables personalized transition effects, improves video compositing efficiency, reduces operational complexity, and achieves automated video compositing.
Smart Images

Figure CN121284293A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a video synthesis method, apparatus and related products. Background Technology
[0002] Currently, to achieve transitions between videos, video compositing software is generally used to combine multiple videos into a single video. This software offers various transition effects and a library of materials, allowing users to manually add transition effects and adjust parameters to achieve transitions between video clips.
[0003] However, adjusting parameters using video compositing software is relatively complex and requires a certain level of expertise and experience, resulting in a lengthy video compositing process. Furthermore, transition effects are mostly preset modes, such as "fade," "slide," "rotate," and "light and shadow," lacking personalized customization for the video content, leading to poor video compositing results. In addition, if multiple videos need to be composited, they all need to be composited in the aforementioned manner, resulting in low compositing efficiency. Summary of the Invention
[0004] This application provides a video synthesis method, apparatus, and related products, aiming to solve the problems of poor video synthesis effect and low synthesis efficiency.
[0005] The first aspect of this application provides a video synthesis method, including:
[0006] Obtain the preset transition effect template and the video group to be composited; the preset transition effect template indicates the template that implements the transition effect between two videos; the video group to be composited includes n videos to be composited; the n videos to be composited are sorted according to preset rules; n is an integer greater than or equal to 2;
[0007] The video to be synthesized from the 2nd to the nth video in the video group is cut to obtain n-1 segments; the segments are segments of preset duration taken from the beginning of the video to be synthesized; the preset duration is the transition duration of the preset transition effect template;
[0008] Each captured segment is divided into frames to obtain n-1 frame sets; each frame set contains multiple captured images.
[0009] Determine the depth information map corresponding to the cropped image of each frame in each frame set to obtain n-1 sets of depth information maps;
[0010] Based on the preset transition effect templates and the set of n-1 depth information maps, determine n-1 preset transition effects;
[0011] The target video is synthesized based on n-1 preset transition effects and n videos to be synthesized.
[0012] A second aspect of this application provides a video synthesis apparatus, comprising:
[0013] The acquisition module is used to acquire preset transition effect templates and video groups to be synthesized; the preset transition effect templates indicate the templates that implement the transition effect between two videos; the video groups to be synthesized include n videos to be synthesized; the n videos to be synthesized are sorted according to preset rules; n is an integer greater than or equal to 2;
[0014] The trimming module is used to trim from the 2nd to the nth video in the video group to be synthesized, to obtain n-1 trimmed segments; the trimmed segments are segments of preset duration taken from the start time of the videos to be synthesized; the preset duration is the transition duration of the preset transition effect template;
[0015] The framing module is used to perform framing operations on each captured segment, resulting in n-1 frame sets; each frame set includes multiple captured images.
[0016] The depth information determination module is used to determine the depth information map corresponding to the cropped image of each frame in each frame set, and obtain n-1 sets of depth information maps.
[0017] The transition effect determination module is used to determine n-1 preset transition effects based on preset transition effect templates and n-1 depth information map sets;
[0018] The video compositing module is used to synthesize a target video based on n-1 preset transition effects and n videos to be synthesized.
[0019] Optionally, the transition effect determination module includes:
[0020] Add a unit to add the (n-1)th depth information map set to the preset layer of the preset transition effect template to obtain the (n-1)th preset transition effect;
[0021] The transition effect determination unit is used to determine n-1 preset transition effects according to the determination method of the (n-1)th preset transition effect.
[0022] Optionally, the video group to be synthesized can be obtained through the following methods:
[0023] The acquisition unit is used to acquire n videos to be synthesized.
[0024] The sorting unit is used to sort the n videos to be synthesized according to preset rules;
[0025] The determining unit is used to take the width and height of the first video to be synthesized from the sorted n videos to be synthesized as the width and height of the second to nth videos to be synthesized, thus obtaining a group of videos to be synthesized.
[0026] Optionally, the video compositing module includes:
[0027] The replacement unit is used to replace the video segments of preset duration from the start time of the second to the nth video segments to be synthesized with n-1 preset transition effects to obtain n-1 synthesized videos;
[0028] The video synthesis unit is used to determine the target video based on the first video to be synthesized and n-1 synthesized videos.
[0029] Optionally, the video compositing unit includes:
[0030] The script file subunit is used to determine the synthesis script file based on the first video to be synthesized and n-1 synthesized videos;
[0031] Add a sub-unit to add the composition script file to the rendering task queue;
[0032] The query sub-unit is used to query the rendering task queue according to a preset period.
[0033] The video compositing subunit is used to execute the compositing script file if a compositing script file exists in the rendering task queue, and then obtain the target video.
[0034] Optionally, the framing module includes:
[0035] The frame rate acquisition unit is used to acquire the preset frame rate; the preset frame rate is the frame rate corresponding to the video group to be synthesized.
[0036] The framing unit is used to perform framing operations on each segment according to a preset frame rate, resulting in n-1 frame sets; the number of frames of the image captured in the frame set is the product of the preset frame rate and the preset duration.
[0037] A third aspect of this application provides an electronic device, the device comprising a processor and a memory:
[0038] The memory is used to store program code and transmit the program code to the processor;
[0039] The processor is used to execute the steps of the video synthesis method provided in the first aspect according to the instructions in the program code.
[0040] A fourth aspect of this application provides a computer-readable storage medium for storing program code for performing the steps of the video synthesis method provided in the first aspect.
[0041] The fifth aspect of this application provides a computer program product, including a computer program or instructions that, when executed, implement the steps of the video synthesis method provided in the first aspect.
[0042] As can be seen from the above technical solutions, the embodiments of this application have the following advantages:
[0043] The video synthesis method provided in this application involves extracting n-1 segments from the second to the nth video in a group of videos to be synthesized. Each segment is a cut from the beginning of the video to be synthesized, with a preset duration equal to the transition duration of a preset transition effect template. Then, each segment is divided into frames to obtain n-1 frame sets, each containing multiple extracted images. Further, the depth information map corresponding to each frame in each frame set is determined to obtain n-1 depth information map sets. Then, n-1 preset transition effects are determined based on the preset transition effect template and the n-1 depth information map sets. Finally, a target video is synthesized based on the n-1 preset transition effects and the n videos to be synthesized. Specifically, by extracting segments of the 2nd to nth videos to be synthesized, each segment has a preset duration equal to the transition duration of a preset transition effect template. Furthermore, the depth information map set of each segment is determined to extract deeper information from each segment. This allows for the determination of multiple different transition effects based on different depth information map sets and the preset transition effect template, achieving personalized customization of the transition effects and improving the video synthesis effect. Simultaneously, this embodiment can also batch process videos to be synthesized, improving synthesis efficiency. Moreover, this embodiment can achieve automated video synthesis, eliminating the need for manual addition of transition effects and parameter settings, thus reducing the complexity of video synthesis. Attached Figure Description
[0044] Figure 1 A scene illustration of a video synthesis method provided in an embodiment of this application;
[0045] Figure 2 A flowchart illustrating a video synthesis method provided in an embodiment of this application;
[0046] Figure 3 A schematic diagram illustrating the import of a preset transition effect template provided in an embodiment of this application;
[0047] Figure 4 A schematic diagram illustrating the capture of an image and depth information map provided in an embodiment of this application;
[0048] Figure 5 A schematic diagram of a video transition process provided for related technologies;
[0049] Figure 6A schematic diagram of a video transition process provided in an embodiment of this application;
[0050] Figure 7a A schematic diagram illustrating a video synthesis method provided in an embodiment of this application;
[0051] Figure 7b A schematic diagram of a video compositing page provided in an embodiment of this application;
[0052] Figure 8 A schematic diagram of a depth information layer provided in an embodiment of this application;
[0053] Figure 9 A schematic diagram illustrating a preset transition effect setting provided in an embodiment of this application;
[0054] Figure 10 This is a schematic diagram of the structure of a video synthesis device provided in an embodiment of this application;
[0055] Figure 11 This is a schematic diagram of the server structure in an embodiment of this application;
[0056] Figure 12 This is a schematic diagram of the structure of a terminal device in an embodiment of this application. Detailed Implementation
[0057] Currently, to achieve transitions between videos, video compositing software is generally used to combine multiple videos into a single video. This software offers various transition effects and media libraries, allowing users to manually add transition effects and adjust parameters to create transitions between video segments. For example, assuming videos A, B, and C, a user can add a "rotation" transition effect between videos A and B, and a "fade" transition effect between videos B and C. Since transition effects require setting start time, end time, and duration, these parameters also need to be manually adjusted.
[0058] However, adjusting parameters using video compositing software is relatively complex and requires a certain level of expertise and experience, resulting in a lengthy video compositing process. For example, if a "fade" transition effect is added between video B and video C, then setting parameters such as fade time, fade intensity, and fade direction for this transition effect may be necessary, further increasing the time required for video compositing.
[0059] Furthermore, transition effects are mostly preset modes, such as "fade," "slide," "rotate," and "light and shadow," lacking personalized customization for the video content, resulting in poor video compositing. As an example, suppose video B first shows the tires of a motorcycle changing from stationary to rotating, then zooms out to show the motorcycle moving forward. However, if the transition effect between video A and video B is a preset mode, such as a "slide" transition, then this transition effect is abrupt compared to the beginning of video B, resulting in poor video compositing and an unsmooth transition.
[0060] In addition, if multiple videos need to be combined, the transitions between video segments can be achieved by manually adding transition effects and adjusting parameters, which results in low video compositing efficiency.
[0061] In view of the above problems, this application provides a video synthesis method, apparatus and related products. The method involves extracting n-1 segments from the second to the nth video in a group of videos to be synthesized. Each segment is a cut from the beginning of the video to be synthesized, with a preset duration equal to the transition duration of a preset transition effect template. Then, each segment is divided into frames to obtain n-1 frame sets, each including multiple frames of extracted images. Further, depth information maps corresponding to each frame in each frame set are determined to obtain n-1 depth information map sets. Then, n-1 preset transition effects are determined based on the preset transition effect template and the n-1 depth information map sets. Finally, a target video is synthesized based on the n-1 preset transition effects and the n videos to be synthesized.
[0062] Thus, by extracting segments of the same preset duration as the preset transition effect template from the 2nd to nth videos to be synthesized, and further determining the depth information map set of each segment, deeper information is extracted from each segment. This allows for the determination of multiple different transition effects based on different depth information map sets and the preset transition effect template, achieving personalized customization of transition effects and improving the video synthesis effect. Furthermore, this embodiment can also batch process videos to be synthesized, improving synthesis efficiency. In addition, this embodiment can achieve automated video synthesis, eliminating the need for manual addition of transition effects and parameter settings, reducing the complexity of video synthesis.
[0063] Figure 1 An exemplary scene architecture diagram of a video synthesis method is shown. Figure 1 It includes 101 types of terminal devices 102, including servers. Figure 1The server 101 shown can be a standalone physical server, a server cluster consisting of multiple physical servers, or a distributed system. Additionally, the server can also be a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. Figure 1 The terminal device 102 shown is a device with a display screen, including but not limited to mobile phones, tablets, computers, smart voice interaction devices, and vehicle terminals, but not limited to these. The terminal device and the server can be connected directly or indirectly through wired or wireless communication, which is not limited herein.
[0064] Server 101 or terminal device 102 obtains a preset transition effect template and a group of videos to be synthesized. The preset transition effect template indicates a template for implementing transition effects between two videos; the group of videos to be synthesized includes n videos; the n videos are sorted according to a preset rule; n is an integer greater than or equal to 2. As an example, assume the group of videos to be synthesized includes 3 videos, and the 3 videos are sorted according to user requirements (i.e., the preset rule), resulting in the group of videos to be synthesized as [Video 1, Video 2, Video 3].
[0065] Server 101 or terminal device 102 extracts segments from the second to the nth video in the video group to be synthesized, resulting in n-1 segments. Each segment is a pre-defined duration extracted from the beginning of the video to be synthesized; the pre-defined duration is the transition duration of a pre-defined transition effect template. For example, assuming the pre-defined transition effect template has a transition duration of 2 seconds, and the video group to be synthesized is [Video 1, Video 2, Video 3], then the first 2 seconds of Video 2 and the first 2 seconds of Video 3 need to be extracted as segments.
[0066] Server 101 or terminal device 102 performs frame segmentation on each captured segment to obtain n-1 frame sets. Each frame set includes multiple captured images. As an example, assuming there are 2 captured segments, a preset duration of 2 seconds, and a frame rate of 30, then 2 frame sets can be determined, each frame set including 60 captured images.
[0067] Server 101 or terminal device 102 determines the depth information map corresponding to each frame captured image in each frame set, resulting in n-1 depth information map sets. As an example, assuming each frame set includes 60 captured images, the depth information map corresponding to each of these 60 captured images is determined, and the depth information map set corresponding to that frame set is obtained, which includes 60 frame depth information maps.
[0068] Server 101 or terminal device 102 determines n-1 preset transition effects based on preset transition effect templates and n-1 sets of depth infographics. As an example, assuming there are two sets of depth infographics, depth infographic set 1 and depth infographic set 2, then preset transition effect 1 can be determined based on depth infographic set 1 and the preset transition effect template, and preset transition effect 2 can be determined based on depth infographic set 2 and the preset transition effect template.
[0069] Server 101 or terminal device 102 synthesizes a target video based on n-1 preset transition effects and n videos to be synthesized. As an example, assuming there are 2 preset transition effects and 3 videos to be synthesized, the 2 preset transition effects can be combined between the 3 videos to be synthesized to obtain the target video.
[0070] In other words, this embodiment extracts segments of the same preset duration as the preset transition effect template from the 2nd to nth videos to be synthesized, and further determines the depth information map set of each segment to extract deeper information from each segment. This allows for the determination of multiple different transition effects based on different depth information map sets and the preset transition effect template, achieving personalized customization of transition effects and improving video synthesis results. Simultaneously, this embodiment can also batch process videos to be synthesized, improving synthesis efficiency. Furthermore, this embodiment can achieve automated video synthesis, eliminating the need for manual addition of transition effects and parameter settings, thus reducing the complexity of video synthesis.
[0071] The video synthesis method provided in this application involves technologies such as artificial intelligence, computer vision, and machine learning.
[0072] Artificial intelligence (AI) is the theory, methods, technology, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive technology within computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine that can react in a way similar to human intelligence. AI studies the design principles and implementation methods of various intelligent machines, enabling them to possess the functions of perception, reasoning, and decision-making.
[0073] Artificial intelligence (AI) is a comprehensive discipline encompassing a wide range of fields, including both hardware and software technologies. Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, pre-trained model technology, operating / interactive systems, and mechatronics. Among these, pre-trained models, also known as large-scale models or foundational models, can be widely applied to downstream tasks across various AI fields after fine-tuning. AI software technologies primarily include computer vision, speech processing, natural language processing, and machine learning / deep learning.
[0074] Computer vision (CV) is a science that studies how to enable machines to "see." More specifically, it refers to machine vision, which uses cameras and computers to replace human eyes in recognizing and measuring targets, and further processes images to create images more suitable for human observation or transmission to instruments. As a scientific discipline, computer vision studies related theories and technologies, attempting to build artificial intelligence systems capable of extracting information from images or multidimensional data. Large model technology has brought significant changes to the development of computer vision technology. Pre-trained models in the vision field, such as Swin-transformer, ViT, V-MOE, and MAE, can be quickly and widely applied to downstream tasks after fine-tuning. Computer vision technology typically includes image processing, image recognition, image semantic understanding, image retrieval, OCR, video processing, video semantic understanding, video content / behavior recognition, 3D object reconstruction, 3D technology, virtual reality, augmented reality, simultaneous localization and mapping (SLAM), and common biometric recognition technologies such as facial recognition and fingerprint recognition.
[0075] Machine Learning (ML) is a multidisciplinary field involving probability theory, statistics, approximation theory, convex analysis, and algorithm complexity theory. It specifically studies how computers can simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to endow computers with intelligence; its applications span all areas of artificial intelligence. Machine learning and deep learning typically include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and pre-trained learning. Pre-trained models represent the latest development in deep learning, integrating all of these techniques.
[0076] In practice, the collection and processing of relevant data in this application should strictly comply with the requirements of relevant national laws and regulations, obtain the informed consent or separate consent of the subject of personal information, and carry out subsequent data use and processing within the scope of laws and regulations and the authorization of the personal information subject.
[0077] Figure 2 This is a flowchart illustrating a video synthesis method provided in an embodiment of this application.
[0078] Combination Figure 2 As shown, the video synthesis method provided in this application embodiment may include:
[0079] S201: Obtain preset transition effect templates and video groups to be composited.
[0080] Preset transition effect templates indicate templates for implementing transition effects between two videos, such as a transition effect template between video A and video B, or a transition effect template between video B and video C. Combined with... Figure 3 As shown, in some possible implementations, After Effects transition effect template files (i.e., preset transition effects) can be uploaded via the '+' sign in the upper left corner of the page. After uploading, they will be displayed on the right, allowing you to view and preview the uploaded preset transition effect template at any time. (The text abruptly ends here.) Figure 3 On the page shown, you can also perform simple operations such as adding, deleting, modifying, and searching for preset transition effect templates.
[0081] After Effects (AE) is a 2.5D animation software used for compositing animations, visual effects, and film. After Effects boasts powerful compositing and effects capabilities, supporting both 2D and 3D compositing to create a variety of stunning visual effects. After Effects allows the creation of complex motion graphics and animations using objects, including UI (user interface) animations and motion graphics (MG) animations. These animations can be used for designing animation effects for mobile device apps such as phones and tablets, and for animate text, graphics, and other information to better convey messages.
[0082] The group of videos to be combined consists of n videos. These n videos are sorted according to a preset rule. n is an integer greater than or equal to 2. A video to be combined refers to a video segment to be combined. The content of multiple videos to be combined can be the same or different, and the duration of multiple videos to be combined can be the same or different; no specific restrictions are placed here.
[0083] As one possible implementation method, the video group to be synthesized can be obtained in the following way:
[0084] A1: Obtain n videos to be synthesized.
[0085] Where n is an integer greater than or equal to 2.
[0086] A2: Sort the n videos to be synthesized according to preset rules.
[0087] Preset rules refer to rules formulated according to user needs, such as sorting by the video length of the video to be synthesized, or sorting by the type of video content. The specific content of the preset rules is not limited here.
[0088] A3: Take the width and height of the first video to be synthesized from the sorted n videos to be synthesized as the width and height of the second to nth videos to be synthesized, and obtain the video group to be synthesized.
[0089] It should be understood that, in this embodiment, in order to ensure that the content size in the final synthesized target video is the same, the width and height of the first video to be synthesized are used as the width and height of other videos to be synthesized in the same video group, so as to ensure that the width and height of the content played in the synthesized target video remains unchanged during playback, thereby improving the user experience.
[0090] S202: Extract segments from the second to the nth video in the video group to be synthesized, resulting in n-1 segments.
[0091] The extracted segment is a segment of preset duration extracted from the beginning of the video to be synthesized. The preset duration is the transition duration of a preset transition effect template. As an example, assuming the video to be synthesized is 3 seconds long and the transition duration is 1 second, then the preset duration is 1 second, meaning that the first second of the video to be synthesized needs to be extracted as the segment.
[0092] It should be understood that, in the embodiments of this application, by extracting segments of a preset duration from the 2nd to nth videos to be synthesized, that is, extracting segments with the same transition duration as the preset transition effect of the preset transition effect template, further analysis can be performed in conjunction with the extracted segments, so as to generate preset transition effects containing the features of the extracted segments in the subsequent generation, thereby realizing personalized customization of the transition effects.
[0093] S203: Perform frame segmentation on each captured segment to obtain n-1 frame sets; the frame sets include multiple captured images.
[0094] Frame segmentation is the process of breaking down a continuous video sequence into individual still image frames. By performing frame segmentation on each captured segment, we can gain a more detailed understanding of pixel changes in the video, process and analyze each frame individually, and thus more accurately determine the content of the video.
[0095] In one possible implementation, step S203 may include:
[0096] B1: Get the preset frame rate.
[0097] The preset frame rate is the frame rate corresponding to the video group to be synthesized.
[0098] Frame rate refers to the number of images displayed per second in a video or animation. It describes the smoothness and clarity of a video or animation. The higher the frame rate, the smoother the video or animation appears because more images are displayed per second. Common frame rates include 24fps (24 frames per second), 30fps (30 frames per second), and 60fps (60 frames per second).
[0099] That is, in this embodiment of the application, the frame rate corresponding to the video group is used as the preset frame rate, and each segment is divided into frames according to the preset frame rate.
[0100] B2: Perform frame segmentation on each captured segment according to the preset frame rate to obtain n-1 frame sets.
[0101] The number of frames extracted from the frame set is the product of the preset frame rate and the preset duration.
[0102] It should be understood that the number of frames captured in the frame set is related to the preset frame rate and preset duration. The preset duration represents the length of the captured segment, and the preset frame rate indicates the number of images displayed per second in the captured segment. Therefore, by multiplying the preset frame rate by the preset duration, the number of frames captured in the frame set can be obtained. As an example, assuming the preset duration is 2 seconds and the preset frame rate is 30, the number of frames captured in the frame set will be 60 frames.
[0103] It should be understood that in order to achieve personalized customization of transition effects, it is necessary to determine the transition effect based on the specific content of the segment. That is, to use frame segmentation to determine multiple frames in the segment, and then process and analyze each frame in the segment to determine the content of the video segment.
[0104] S204: Determine the depth information map corresponding to the cropped image of each frame in each frame set, and obtain n-1 sets of depth information maps.
[0105] A depth infographic (DRI) is a cropped image containing three-dimensional information about the distance between objects in a scene and the camera. This 3D information is typically represented as a grayscale or color image, where the value of each pixel reflects the distance (i.e., depth) of the corresponding point in the scene from the camera. A depth infographic is a two-dimensional image where the value of each pixel represents the depth of the corresponding point in the scene. Depth generally refers to the distance from the camera's position to a point in the scene. In a grayscale image, darker pixels typically represent farther distances, while brighter pixels represent closer distances. Grayscale values can range from 0 (representing the farthest distance) to 255 (representing the closest distance) or other appropriate ranges, combined with... Figure 4 As shown, Figure 4 In this context, 'a' indicates cropping the image. Figure 4 In this context, 'b' represents the depth information map, that is, Figure 4 In a color image, darker gray areas represent greater depth. In a color image, different colors or color depths can be used to represent different distances. For example, red might represent a farther distance, while blue might represent a closer distance. This method provides a more intuitive representation of depth information.
[0106] It should be understood that depth maps can be used to achieve precise integration of transition effects with real-world scenes. By using depth maps, the positions and distances of objects in the real-world scene can be determined, allowing transition effects to be placed in the correct locations, achieving a seamless blend of reality and the transition effect. In other words, it enables personalized customization of preset transition effects.
[0107] S205: Based on the preset transition effect template and the set of n-1 depth information maps, determine n-1 preset transition effects.
[0108] It should be understood that because depth maps can reflect the position and distance of objects in a real scene, they can achieve a smoother transition between two scenes. That is, by analyzing depth maps, preset transition effects can be made more natural based on the distance between objects in the scene, avoiding the abruptness caused by simple hard cuts or fade-ins and fade-outs.
[0109] In addition, depth maps can also be used to enhance transition effects. For example, by simulating depth of field, objects in the foreground can remain sharp during transitions, while distant objects gradually blur, thereby enhancing the sense of space and depth in the image.
[0110] Furthermore, the application of depth infographics in transition effects can create unique visual effects, such as cinematic transitions like "push-in" and "pull-out," enriching the user's visual experience.
[0111] Furthermore, depth maps allow for more complex transition effects, such as "depth dissolve" and "depth flip." These effects depend not only on image color and brightness information but also on depth information, thus enabling more refined and complex transitions.
[0112] Furthermore, depth maps can optimize the smoothness and naturalness of scene transitions. By analyzing depth information, it can be ensured that objects in the preceding and following scenes maintain a consistent or gradually changing depth during transitions, thus avoiding abrupt or illogical transitions.
[0113] Therefore, in this embodiment of the application, by combining the depth information map set with the preset transition effect template, a preset transition effect strongly associated with the corresponding video to be synthesized can be obtained, so as to achieve richer transition effects in subsequent transitions, improve the video synthesis effect, and enhance the smoothness of the transition effect.
[0114] As an example, combined Figure 5 and Figure 6 As shown, Figure 5 This demonstrates a transition process based on fixed transition effects in related technologies. Figure 6 This demonstrates a transition process based on preset transition effects in an embodiment of this application. Figure 5 and Figure 6 The last frame of video A (a person playing guitar) and the first frame of video B (a glacier) are used as examples for the transitions. Figure 5 The transition effect used was a "sliding" motion, resulting in a rather abrupt transition; while Figure 6 The transition was carried out from near to deep, following the outline of the glacier, and the whole process was relatively smooth.
[0115] In one possible implementation, step S205 may include: adding the (n-1)th depth information map set to a preset layer of the preset transition effect template to obtain the (n-1)th preset transition effect; and determining the (n-1)th preset transition effect according to the determination method of the (n-1)th preset transition effect. It should be understood that in this embodiment, the preset transition effect template needs to have a preset layer, which is used to add depth information map sets, for example, to achieve fusion between the depth information map sets and the preset transition effect template. This can result in a preset transition effect strongly correlated with the corresponding video to be synthesized, facilitating richer transition effects during subsequent transitions, improving the video synthesis effect, enhancing the smoothness of transition effects, and enabling personalized customization of the preset transition effects.
[0116] S206: Synthesize the target video based on n-1 preset transition effects and n videos to be synthesized.
[0117] It should be understood that if there are n videos to be synthesized, and a preset transition effect is set between two adjacent videos to be synthesized, then there are n-1 preset transition effects. The target video is synthesized by adding n-1 preset transition effects between the n videos to be synthesized.
[0118] In one possible implementation, step S206 may include:
[0119] C1: Replace the video segments of preset duration from the start time of the second to the nth video segments to be synthesized with n-1 preset transition effects to obtain n-1 synthesized videos.
[0120] The video segment with a preset duration at the start time is the segment obtained by the aforementioned cropping operation. Since the transition duration of the preset transition effect is the same as the preset duration of the video segment, and the preset transition effect incorporates the cropped segment (i.e., the video segment), the smoothness of the video transition can be improved by replacing the preset transition effect with the video segment to avoid repeated playback of the video.
[0121] C2: Determine the target video based on the first video to be synthesized and n-1 synthesized videos.
[0122] In one possible implementation, step C1 may include:
[0123] D1: Determine the synthesis script file based on the first video to be synthesized and n-1 videos to be synthesized.
[0124] A script file is a text file that contains a series of computer commands, typically used to automate tasks, customize functions, or perform specific operations.
[0125] D2: Add the composition script file to the rendering task queue.
[0126] The rendering task queue refers to the task queue used for compositing videos. This queue can include multiple compositing script files, which are called and executed according to the time they were added.
[0127] D3: Query the rendering task queue according to the preset cycle.
[0128] The preset period refers to a predefined query period, such as 10 seconds, 20 seconds, etc.
[0129] D4: If a compositing script file exists in the rendering task queue, execute the compositing script file to obtain the target video.
[0130] The compositing script file can automatically perform a series of tasks, such as compositing operations, reducing the need for manual operations. In other words, compositing target videos using the compositing script file enables automated processing, eliminating the need for manual compositing and improving video compositing efficiency.
[0131] It should be understood that, in the embodiments of this application, since the cut-out segment included in the preset transition effect is the beginning part of the video to be transitioned, for example, transitioning from video A to video B, where video B is the video to be transitioned and the cut-out segment is 1 second, that is, the first 1 second of video B is the cut-out segment, if the transition effect is directly set between video A and video B, it may cause the video to play repeatedly, affecting the smoothness of the transition. Therefore, the first 1 second of video B can be replaced with the preset transition effect to ensure the smoothness of the transition effect.
[0132] The video compositing method provided in this application involves extracting segments of the 2nd to nth video to be composited, each with a preset duration equal to the transition duration of a preset transition effect template. Furthermore, it determines the depth information map set of each extracted segment to extract deeper information. This allows for the determination of multiple different transition effects based on different depth information map sets and the preset transition effect template, achieving personalized customization of transition effects and improving the video compositing effect. Simultaneously, this application embodiment can also batch process videos to be composited, improving compositing efficiency. Moreover, this application embodiment can achieve automated video compositing, eliminating the need for manual addition of transition effects and parameter settings, thus reducing the complexity of video compositing.
[0133] Based on the video synthesis method provided in the above embodiments, see [link / reference]. Figure 7a This figure is a schematic diagram of a video synthesis method provided in an embodiment of this application, combined with... Figure 7a As shown, the video compositing method provided in this application embodiment can be described in three parts: the preset transition effect template creation part, the video processing part to be composited part, and the video compositing part. The different parts will be described in detail below.
[0134] Preset transition effect template creation: You can use After Effects software to create preset transition effect templates according to the needs of the users, and then package the preset transition effect templates and upload them to the server.
[0135] Video processing section to be synthesized:
[0136] Combination Figure 7b As shown, in one possible implementation, after uploading the preset transition effect template, users can access the video clip selection page. Users can select multiple video clips. Once the user selects the video clips for which transitions need to be added on the client and clicks "Batch Composite," the client will upload the video clips passed in by the user to the video composite server. After successfully uploading the video clips, the main steps are as follows:
[0137] Step 1: Use the width and height of the first video clip from the uploaded video clips as the width and height of the target video (that is, as the width and height of each video clip), set the preset frame rate to 30pfs, and create a new video group to be composited in AE software.
[0138] Step 2: Import each video segment into the video group to be synthesized in sequence (that is, import the videos to be synthesized in sequence according to the preset rules).
[0139] Specifically, the start and end times of multiple videos to be synthesized need to be adjusted first. The start time of the nth video to be synthesized is set to the end time of the (n-1)th video to be synthesized, the start time of the first video to be synthesized is set to the start time of the target video, and the end time of the nth video to be synthesized is set to the end time of the target video, so as to connect the beginning and end of each video to be synthesized.
[0140] Step 3: After determining the video group to be composited, import the previously uploaded preset transition effect template into the video group to be composited.
[0141] Step 4: Extract depth information from the second to the last video in the video group to be synthesized.
[0142] As an example, assuming the preset transition effect template has a 2-second transition time, the corresponding depth information is also the first 2 seconds of each video to be synthesized. Specifically, you can use Ffmpeg software to extract each frame from the first 2 seconds of the second to the last video to be synthesized (since the first video to be synthesized has no transition, it does not need to be cropped). Assuming the frame rate of the videos to be synthesized is 30pfs (which is the preset frame rate of 30pfs), there will be a total of 30 x 2 = 60 frames, which means you get 60 frames of cropped images corresponding to each video to be synthesized.
[0143] FFmpeg: An open-source audio and video processing software used for encoding, decoding, transcoding, mixing, streaming, and other operations on audio and video files.
[0144] Step 5: Determine the depth information map corresponding to each of the 60 frames of the video to be synthesized.
[0145] Specifically, you can use the depth capability of the ControlNet plugin in Stable Diffusion, select the depth_midas preprocessor, and pass in the base64 encoding of the 60 images above to output a depth information map of 60 images.
[0146] Stable Diffusion: A deep learning model for generating images from text, capable of producing high-quality images and adapting them to the text description.
[0147] ControlNet: An extension module of Stable Diffusion that allows users to influence the generated image by inputting additional control signals (such as edges, keypoints, semantic segmentation maps, depth maps, etc.).
[0148] depth_midas: A concrete implementation of the ControlNet module that uses MIDAS (or a similar model) to generate depth maps and inputs them as control signals into Stable Diffusion.
[0149] controlnet_module: A parameter in the API request that specifies the ControlNet module to use.
[0150] controlnet_input_images: A parameter in the API request that provides the input images required by the ControlNet module.
[0151] As an example, you can first install Stable Diffusion on the server, and then start the Stable Diffusion service via API parameters to invoke the capabilities of the Stable Diffusion API. Further, by using the Stable Diffusion API, setting the request parameter "controlnet_module" to "depth_midas" and "controlnet_input_images" to the content of the captured image for the corresponding frame, you can request the Stable Diffusion service to return the corresponding depth information map.
[0152] Step 6: After determining the depth information maps corresponding to the 60 frames captured from each video to be composited, import the 60 depth information maps into the depth information layer (i.e., the preset layer) of the preset transition effect template. See [link to template]. Figure 8 As shown.
[0153] Combination Figure 9 As shown, specifically, the transition time and size of the preset transition effect in the preset transition effect template need to be adjusted. That is, the start time of the preset transition effect should be set to 2 seconds before the start time of the next video to be synthesized, and the size of the preset transition effect should be adjusted to the width and height of the video group to be synthesized.
[0154] Step 7: Based on the import results of Step 6, determine the JSX script file (i.e., the composite script file).
[0155] Video compositing section:
[0156] After identifying the JSX script file, add it to the rendering task queue. The rendering task queue checks every 10 seconds; if there are tasks in the queue, they will automatically begin rendering in sequence. Specifically, you can use the `aerender` command to execute the generated JSX script file to composite the video and obtain the target video.
[0157] Once the target video is rendered and exported, the task can be removed from the rendering task queue. The process continues until there are no more tasks in the queue, indicating that all videos to be composited have been successfully combined.
[0158] In one possible implementation, combining Figure 7b As shown, when you click the "Batch Synthesis" button in the upper right corner to automatically add preset transition effects and synthesize them into the target video, it will be automatically pushed to the material library, and then it can enter the subsequent review and distribution process.
[0159] Based on the video synthesis method provided in the foregoing embodiments, this application also provides a corresponding video synthesis apparatus. The following, in conjunction with... Figure 10 Please provide an explanation. Figure 10 This is a schematic diagram of a video synthesis device provided in an embodiment of this application. Figure 10 The video compositing apparatus 1000 shown includes:
[0160] The acquisition module 1001 is used to acquire a preset transition effect template and a group of videos to be synthesized; the preset transition effect template indicates a template that implements the transition effect between two videos; the group of videos to be synthesized includes n videos to be synthesized; the n videos to be synthesized are sorted according to a preset rule; n is an integer greater than or equal to 2;
[0161] The trimming module 1002 is used to trim from the second to the nth video to be synthesized in the video group to obtain n-1 trimmed segments; the trimmed segments are segments of preset duration taken from the start time of the video to be synthesized; the preset duration is the transition duration of the preset transition effect template;
[0162] The framing module 1003 is used to perform framing operations on each captured segment to obtain n-1 frame sets; the frame sets include multiple captured images.
[0163] The depth information determination module 1004 is used to determine the depth information map corresponding to the cropped image of each frame in each frame set, and obtain n-1 sets of depth information maps.
[0164] The transition effect determination module 1005 is used to determine n-1 preset transition effects based on the preset transition effect template and n-1 depth information map sets;
[0165] The video compositing module 1006 is used to compose a target video based on n-1 preset transition effects and n videos to be composed.
[0166] As an example, the transition effect determination module 905 includes:
[0167] Add a unit to add the (n-1)th depth information map set to the preset layer of the preset transition effect template to obtain the (n-1)th preset transition effect;
[0168] The transition effect determination unit is used to determine n-1 preset transition effects according to the determination method of the (n-1)th preset transition effect.
[0169] As an example, the video group to be synthesized is obtained in the following way:
[0170] The acquisition unit is used to acquire n videos to be synthesized.
[0171] The sorting unit is used to sort the n videos to be synthesized according to preset rules;
[0172] The determining unit is used to take the width and height of the first video to be synthesized from the sorted n videos to be synthesized as the width and height of the second to nth videos to be synthesized, thus obtaining a group of videos to be synthesized.
[0173] As an example, video compositing module 1006 includes:
[0174] The replacement unit is used to replace the video segments of preset duration from the start time of the second to the nth video segments to be synthesized with n-1 preset transition effects to obtain n-1 synthesized videos;
[0175] The video synthesis unit is used to determine the target video based on the first video to be synthesized and n-1 synthesized videos.
[0176] As an example, a video synthesis unit includes:
[0177] The script file subunit is used to determine the synthesis script file based on the first video to be synthesized and n-1 synthesized videos;
[0178] Add a sub-unit to add the composition script file to the rendering task queue;
[0179] The query sub-unit is used to query the rendering task queue according to a preset period.
[0180] The video compositing subunit is used to execute the compositing script file if a compositing script file exists in the rendering task queue, and then obtain the target video.
[0181] As an example, the framing module 1003 includes:
[0182] The frame rate acquisition unit is used to acquire the preset frame rate; the preset frame rate is the frame rate corresponding to the video group to be synthesized.
[0183] The framing unit is used to perform framing operations on each segment according to a preset frame rate, resulting in n-1 frame sets; the number of frames of the image captured in the frame set is the product of the preset frame rate and the preset duration.
[0184] The video synthesis apparatus provided in this application has the same beneficial effects as the video synthesis method provided in the above embodiments, and therefore will not be described again.
[0185] The following sections will describe the structures for server-based and terminal-based configurations.
[0186] Figure 11 This is a schematic diagram of a server structure provided in an embodiment of this application. The server 900 can vary significantly due to different configurations or performance. It may include one or more central processing units (CPUs) 922 (e.g., one or more processors) and memory 932, and one or more storage media 930 (e.g., one or more mass storage devices) for storing application programs 942 or data 944. The memory 932 and storage media 930 can be temporary or persistent storage. The program stored in the storage media 930 may include one or more modules (not shown in the diagram), each module may include a series of instruction operations on the server. Furthermore, the CPU 922 may be configured to communicate with the storage media 930 and execute the series of instruction operations in the storage media 930 on the server 900.
[0187] Server 900 may also include one or more power supplies 926, one or more wired or wireless network interfaces 950, one or more input / output interfaces 958, and / or one or more operating systems 941, such as Windows Server. TM Mac OS X TM Unix TM Linux TM FreeBSD TM etc.
[0188] CPU 922 is used to perform the following steps:
[0189] Obtain the preset transition effect template and the video group to be composited; the preset transition effect template indicates the template that implements the transition effect between two videos; the video group to be composited includes n videos to be composited; the n videos to be composited are sorted according to preset rules; n is an integer greater than or equal to 2;
[0190] The video to be synthesized from the 2nd to the nth video in the video group is cut to obtain n-1 segments; the segments are segments of preset duration taken from the beginning of the video to be synthesized; the preset duration is the transition duration of the preset transition effect template;
[0191] Each captured segment is divided into frames to obtain n-1 frame sets; each frame set contains multiple captured images.
[0192] Determine the depth information map corresponding to the cropped image of each frame in each frame set to obtain n-1 sets of depth information maps;
[0193] Based on the preset transition effect templates and the set of n-1 depth information maps, determine n-1 preset transition effects;
[0194] The target video is synthesized based on n-1 preset transition effects and n videos to be synthesized.
[0195] This application also provides another electronic device, such as... Figure 12 As shown, for ease of explanation, only the parts related to the embodiments of this application are shown. For specific technical details not disclosed, please refer to the method section of the embodiments of this application. The terminal can be any terminal device including mobile phones, tablets, personal digital assistants (PDAs), point-of-sale (POS) terminals, in-vehicle computers, etc. Taking a mobile phone as an example:
[0196] Figure 12 This is a block diagram illustrating a portion of the structure of a mobile phone related to the terminal provided in the embodiments of this application. (Reference) Figure 12 The mobile phone includes: a radio frequency (RF) circuit 1010, a memory 1020, an input unit 1030, a display unit 1040, a sensor 1050, an audio circuit 1060, a wireless fidelity (WiFi) module 1070, a processor 1080, and a power supply 1090, etc. Those skilled in the art will understand that... Figure 12 The mobile phone structure shown does not constitute a limitation on the mobile phone and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0197] The following is combined with Figure 12 A detailed introduction to each component of a mobile phone:
[0198] The RF circuit 1010 can be used for receiving and transmitting signals during information transmission or calls. Specifically, it receives downlink information from the base station and processes it with the processor 1080; additionally, it transmits uplink data to the base station. Typically, the RF circuit 1010 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low-noise amplifier (LNA), a duplexer, etc. Furthermore, the RF circuit 1010 can also communicate wirelessly with networks and other devices. The aforementioned wireless communications may use any communication standard or protocol, including but not limited to Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, and Short Messaging Service (SMS).
[0199] The memory 1020 can be used to store software programs and modules. The processor 1080 executes various mobile phone functions and data processing by running the software programs and modules stored in the memory 1020. The memory 1020 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, applications required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, phonebook, etc.). In addition, the memory 1020 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0200] The input unit 1030 can be used to receive input numerical or character information, and to generate key signal inputs related to user settings and function control of the mobile phone. Specifically, the input unit 1030 may include a touch panel 1031 and other input devices 1032. The touch panel 1031, also known as a touch screen, can collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel 1031), and drive the corresponding connection devices according to a pre-set program. Optionally, the touch panel 1031 may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch position and the signal generated by the touch operation, and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends it to the processor 1080, and can also receive and execute commands sent by the processor 1080. In addition, the touch panel 1031 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch panel 1031, the input unit 1030 may also include other input devices 1032. Specifically, other input devices 1032 may include, but are not limited to, one or more of the following: physical keyboard, function keys (such as volume control buttons, power buttons, etc.), trackball, mouse, joystick, etc.
[0201] The display unit 1040 can be used to display information input by the user or information provided to the user, as well as various menus of the mobile phone. The display unit 1040 may include a display panel 1041, which may optionally be configured as a Liquid Crystal Display (LCD), Organic Light-Emitting Diode (OLED), or similar display panel 1041. Further, a touch panel 1031 may cover the display panel 1041. When the touch panel 1031 detects a touch operation on or near it, it transmits the information to the processor 1080 to determine the type of touch event. Subsequently, the processor 1080 provides corresponding visual output on the display panel 1041 according to the type of touch event. Although in Figure 12 In this embodiment, the touch panel 1031 and the display panel 1041 are two separate components to realize the input and output functions of the mobile phone. However, in some embodiments, the touch panel 1031 and the display panel 1041 can be integrated to realize the input and output functions of the mobile phone.
[0202] The mobile phone may also include at least one sensor 1050, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor. The ambient light sensor can adjust the brightness of the display panel 1041 according to the ambient light level, and the proximity sensor can turn off the display panel 1041 and / or the backlight when the phone is moved to the ear. As a type of motion sensor, an accelerometer sensor can detect the magnitude of acceleration in various directions (generally three axes). When stationary, it can detect the magnitude and direction of gravity and can be used for applications that recognize the phone's posture (such as landscape / portrait switching, related games, magnetometer posture calibration), vibration recognition-related functions (such as pedometer, taps), etc. Other sensors that may be configured in the mobile phone, such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors, will not be described in detail here.
[0203] The audio circuit 1060, speaker 1061, and microphone 1062 provide an audio interface between the user and the mobile phone. The audio circuit 1060 converts the received audio data into electrical signals and transmits them to the speaker 1061, where the speaker 1061 converts them into sound signals for output. On the other hand, the microphone 1062 converts the collected sound signals into electrical signals, which are then received by the audio circuit 1060, converted into audio data, and then processed by the processor 1080 before being transmitted via the RF circuit 1010 to, for example, another mobile phone, or the audio data can be output to the memory 1020 for further processing.
[0204] WiFi is a short-range wireless transmission technology. Through the WiFi module 1070, mobile phones can help users send and receive emails, browse web pages, and access streaming media, providing users with wireless broadband internet access. Although Figure 12 The WiFi module 1070 is shown, but it is understood that it is not an essential component of a mobile phone and can be omitted as needed without changing the essence of the invention.
[0205] The processor 1080 is the control center of the mobile phone, connecting various parts of the phone through various interfaces and lines. It executes software programs and / or modules stored in the memory 1020 and calls data stored in the memory 1020 to perform various functions and process data, thereby collecting overall data and information from the phone. Optionally, the processor 1080 may include one or more processing units; preferably, the processor 1080 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 1080.
[0206] The mobile phone also includes a power supply 1090 (such as a battery) that supplies power to various components. Preferably, the power supply can be logically connected to the processor 1080 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system.
[0207] Although not shown, mobile phones may also include a camera, Bluetooth module, etc., which will not be described in detail here.
[0208] In this embodiment of the application, the processor 1080 included in the terminal also has the following functions:
[0209] Obtain the preset transition effect template and the video group to be composited; the preset transition effect template indicates the template that implements the transition effect between two videos; the video group to be composited includes n videos to be composited; the n videos to be composited are sorted according to preset rules; n is an integer greater than or equal to 2;
[0210] The video to be synthesized from the 2nd to the nth video in the video group is cut to obtain n-1 segments; the segments are segments of preset duration taken from the beginning of the video to be synthesized; the preset duration is the transition duration of the preset transition effect template;
[0211] Each captured segment is divided into frames to obtain n-1 frame sets; each frame set contains multiple captured images.
[0212] Determine the depth information map corresponding to the cropped image of each frame in each frame set to obtain n-1 sets of depth information maps;
[0213] Based on the preset transition effect templates and the set of n-1 depth information maps, determine n-1 preset transition effects;
[0214] The target video is synthesized based on n-1 preset transition effects and n videos to be synthesized.
[0215] This application also provides a computer-readable storage medium for storing program code that executes any one of the implementation methods of the video synthesis method described in the foregoing embodiments.
[0216] This application also provides a computer program product including instructions that, when run on a computer, cause the computer to execute any one of the implementation methods of the video synthesis method described in the foregoing embodiments.
[0217] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working process of the system and equipment described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0218] In the several embodiments provided in this application, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the system embodiments described above are merely illustrative. For instance, the division of the system is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple systems may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.
[0219] The system described as separate components may or may not be physically separate. Components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment, depending on actual needs.
[0220] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0221] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes: USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, optical disks, and other media capable of storing program code.
[0222] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A method of video compositing, the method comprising: The method comprises: acquiring a preset transition effect template and a to-be-combined video group; the preset transition effect template indicates a template for realizing a transition effect between two videos; the to-be-combined video group comprises n to-be-combined videos; the n to-be-combined videos are sorted according to a preset rule; n is an integer greater than or equal to 2; performing cutting on the second to-be-combined video to the n-th to-be-combined video in the to-be-combined video group to obtain n-1 cutting segments; the cutting segment is a segment of a preset time length cut from the start time of the to-be-combined video; the preset time length is a transition time length of the preset transition effect template; performing a frame division operation on each cutting segment to obtain n-1 frame division sets; each frame division set comprises a plurality of cutting images; determining depth information maps corresponding to each frame of each frame division set to obtain n-1 depth information map sets; determining n-1 preset transition effects according to the preset transition effect template and the n-1 depth information map sets; combining a target video based on the n-1 preset transition effects and the n to-be-combined videos.
2. The method of claim 1, wherein, The determination of the n-1 preset transition effects according to the preset transition effect template and the n-1 depth information map sets comprises: adding the n-1th depth information map set to a preset layer of the preset transition effect template to obtain the n-1th preset transition effect; determining the n-1 preset transition effects according to the determination mode of the n-1th preset transition effect.
3. The method of claim 1, wherein, The to-be-combined video group is obtained by: acquiring n to-be-combined videos; sorting the n to-be-combined videos according to the preset rule; setting the width and height of the first to-be-combined video in the sorted n to-be-combined videos as the width and height of the second to-be-combined video to the n-th to-be-combined video to obtain the to-be-combined video group.
4. The method of claim 1, wherein, The combination of the target video based on the n-1 preset transition effects and the n to-be-combined videos comprises: replacing video segments of the preset time length from the start time of the second to-be-combined video to the n-th to-be-combined video with the n-1 preset transition effects to obtain n-1 combined videos; determining the target video according to the first to-be-combined video and the n-1 combined videos.
5. The method of claim 4, wherein, The determination of the target video according to the first to-be-combined video and the n-1 combined videos comprises: determining a combination script file according to the first to-be-combined video and the n-1 combined videos; adding the combination script file to a rendering task queue; querying the rendering task queue according to a preset period; if the combination script file exists in the rendering task queue, executing the combination script file to obtain the target video.
6. The method of claim 1, wherein, The frame division operation on each cutting segment to obtain n-1 frame division sets comprises: acquiring a preset frame rate; the preset frame rate is a frame rate corresponding to the to-be-combined video group; Frame the n-1 pieces of the intercepted segments according to the preset frame rate to obtain n-1 frame sets; the number of frames of the intercepted images in the frame set is the product of the preset frame rate and the preset time length.
7. A video compositing apparatus characterized by comprising: The apparatus comprises: An acquisition module is configured to acquire a preset transition effect template and a group of to-be-combined videos; the preset transition effect template indicates a template for implementing a transition effect between two videos; the group of to-be-combined videos includes n to-be-combined videos; the n to-be-combined videos are sorted according to a preset rule; n is an integer greater than or equal to 2; An intercepting module is configured to intercept the 2nd to-be-combined video to the nth to-be-combined video in the group of to-be-combined videos to obtain n-1 intercepted segments; the intercepted segment is a segment of a preset time length intercepted from the start time of a to-be-combined video; the preset time length is a transition time length of the preset transition effect template; A framing module is configured to frame each of the intercepted segments to obtain n-1 frame sets; the frame set includes multiple frames of intercepted images; A depth information determining module is configured to determine a depth information map corresponding to each frame of the intercepted images in each of the frame sets to obtain n-1 sets of depth information maps; A transition effect determining module is configured to determine n-1 preset transition effects according to the preset transition effect template and the n-1 sets of depth information maps; A video combining module is configured to combine a target video based on the n-1 preset transition effects and the n to-be-combined videos.
8. An electronic device, comprising: The device comprises a processor and a memory: The memory is configured to store program code and transmit the program code to the processor; The processor is configured to execute the steps of the video combining method according to the instructions in the program code.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium is configured to store program code for executing the steps of the video combining method.
10. A computer program product, characterised in that, The computer program or instructions are executed to implement the steps of the video combining method.