Video synthesis method, electronic equipment and computer readable storage medium
By adjusting the time span and the selection ratio in electronic devices, the material is selected evenly, and the problem of the number of materials exceeding the limitation of synthetic videos is solved, which improves the video synthesis effect and user experience.
Patent Information
- Application Number
- CN202410046074.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-10
- Publication Date
- 2025-07-18
- Estimated Expiration
- 2044-01-10
AI Technical Summary
When electronic devices synthesize videos, the number of materials obtained may exceed the maximum number of synthetic videos, resulting in the need to select materials. However, the existing technology has failed to effectively solve the balance of material selection, affecting the video effect and user experience.
After obtaining the material according to the user's instructions, the appropriate number of materials will be selected from the material evenly through the adjustment of the time span and the selection ratio to generate video.
This enables the synthetic video to display the materials of each time period evenly, improving the video effect and user experience.
Smart Images

Figure CN120343186A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing, and in particular, to a video synthesis method, an electronic device, and a computer-readable storage medium. Background Art
[0002] Currently, many electronic devices are equipped with cameras, and users can use the cameras of the electronic devices to take photos, videos, etc.; the electronic devices also have communication functions, and can also download pictures or videos from the Internet, or obtain pictures or videos sent by other electronic devices, etc. Users can edit the pictures and / or videos stored in the electronic device to generate a brand-new video from the selected pictures and / or videos.
[0003] However, in practical applications, the number of materials obtained by the electronic device according to the user's instructions may be relatively large, exceeding the maximum number of materials for synthesizing a video. In this case, it is necessary to select materials to meet the upper limit requirement of the number of materials for synthesizing a video. Summary of the Invention
[0004] This application provides a video synthesis method, an electronic device, and a computer-readable storage medium, which effectively improve the effect of the synthesized video and are beneficial to improving the user experience.
[0005] To achieve the above object, this application adopts the following technical solutions:
[0006] In a first aspect, a video synthesis method is provided, including:
[0007] Receiving a user instruction, where the user instruction carries semantic information of materials for synthesizing a video;
[0008] In response to the user instruction, obtaining first materials that conform to the semantics of the user instruction;
[0009] Selecting second materials from the first materials according to time;
[0010] Generating a first video according to the second materials;
[0011] Displaying a first interface, where the first interface is a playback interface of the first video.
[0012] In the embodiments of this application, materials are obtained according to the user instruction, and then a certain number of materials are evenly selected from the obtained materials according to time, and then a brand-new video is synthesized according to the selected materials. In this way, the synthesized video can evenly display the materials in each time period, effectively improving the effect of the synthesized video and being beneficial to improving the user experience.
[0013] The materials in the embodiments of this application include pictures and videos.
[0014] In the embodiments of the present application, the semantic information of the user instruction may include the material type and the material time. Correspondingly, the first material that conforms to the semantics of the user instruction may be a material that conforms to the material type in the user instruction and satisfies the material time in the user instruction.
[0015] In some implementation manners, the first interface may include a first control. When the user operates the first control, in response to the user operation, the electronic device plays the first video.
[0016] In an implementation manner of the first aspect, the extracting the second material from the first material according to time includes:
[0017] Count the quantity of the first material;
[0018] If the quantity of the first material exceeds a preset quantity, extract the second material from the first material according to time.
[0019] Among them, the preset quantity may be determined according to the maximum number of materials in the synthesized video. For example, if the upper limit requirement for the number of materials in the synthesized video is 30, the preset quantity may be set to 30 or a certain value less than 30.
[0020] It can be understood that in the embodiments of the present application, step S303 is executed on the premise that the quantity of the first material exceeds the preset quantity. If the quantity of the first material exceeds the preset quantity, it means that there are more first materials, and then the first materials need to be selected; if the quantity of the first material does not exceed the preset quantity, it means that there are fewer first materials. In this case, there is no need to select, and the video can be generated according to all the first materials.
[0021] In an implementation manner of the first aspect, the extracting the second material from the first material according to time includes:
[0022] Calculate the time span of the first material;
[0023] Determine the clustering time period according to the time span;
[0024] Cluster the first materials according to the time period to obtain material groups;
[0025] Extract the second material from each of the material groups.
[0026] In the embodiments of the present application, the time span refers to the time interval between the earliest shooting time and the latest shooting time in the acquired first materials. For example, if 3 first materials are acquired, and their respective shooting times are January 1, 2020, February 2, 2021, and March 3, 2023 respectively, then the time span of these 3 first materials is the time interval between January 1, 2020 and March 3, 2023.
[0027] In some implementation manners, the time period can be determined according to the largest time unit included in the time span. In other implementation manners, if the number of time periods included in the time span is relatively large, several time periods can be combined to determine a new time period.
[0028] In one implementation manner of the first aspect, the determining the clustering time period according to the time span includes:
[0029] Obtain a first preset period, where the first preset period is determined according to the maximum number of materials in the synthesized video;
[0030] If the time span is greater than the first preset period, then determine the time period according to the first preset period;
[0031] If the time span is less than the first preset period, then determine the time period according to a second preset period, where the second preset period is less than the first preset period.
[0032] Through the above method, a more appropriate time period can be determined, effectively reducing the occurrence of inappropriate material extraction caused by too large or too small time periods, which is beneficial to improving the quality of subsequent video synthesis.
[0033] In one implementation manner of the first aspect, the extracting the second material from each of the material groups includes:
[0034] Calculate the first extraction ratio corresponding to each of the material groups;
[0035] Extract the second material from each of the material groups according to the first extraction ratio corresponding to each of the material groups.
[0036] In one implementation manner, multiply the first extraction ratio corresponding to each material group by a preset quantity to obtain the extraction quantity M1 corresponding to each material group; extract M1 second materials from the material group.
[0037] In the embodiments of the present application, it is equivalent to determining the sampling ratio of each material group according to the maximum number of materials in the synthesized video, and then sampling the materials according to the ratio. In this way, the time distribution of the sampled materials is relatively uniform, ensuring that a certain proportion of materials can be sampled in each time period, which is beneficial to improving the effect of the synthesized video.
[0038] In one implementation manner of the first aspect, the step of sampling the second material from each material group according to the first sampling ratio corresponding to each material group includes:
[0039] If the first sampling ratio corresponding to the material group is greater than the preset ratio, adjust the first sampling ratio corresponding to the material group to obtain an adjusted second sampling ratio;
[0040] Sample the second material from the material group according to the adjusted second sampling ratio of the material group.
[0041] In the embodiments of the present application, by adjusting the relatively large sampling ratio, it can be ensured that the materials in each material group are sampled, which is beneficial to improving the effect of the synthesized video.
[0042] In one implementation manner, the first sampling ratio of the material group can be adjusted to the preset sampling ratio.
[0043] In one implementation manner of the first aspect, the step of adjusting the first sampling ratio corresponding to the material group to obtain an adjusted second sampling ratio includes:
[0044] Obtain the number of the material groups;
[0045] Calculate the adjusted second sampling ratio of the material group according to the number of the material groups and the preset multiple.
[0046] Through this implementation manner, the sampling ratio of the material group with a relatively large sampling ratio can be effectively adjusted to a more appropriate sampling ratio, so as to reduce the probability that the materials in other material groups cannot be sampled.
[0047] In one implementation manner of sampling the second material according to the second sampling ratio, multiply the number of materials included in the material group by the second sampling ratio corresponding to the material group to obtain the sampling quantity M2 corresponding to the material group; randomly sample M2 second materials from the material group.
[0048] In one implementation manner of the first aspect, the step of sampling the second material from the material group according to the adjusted second sampling ratio of the material group includes:
[0049] Sample n pieces of the second material from each material group, where n is a positive integer;
[0050] Select the second material from the remaining materials in each of the material groups according to the second selection ratio corresponding to each material group.
[0051] This implementation method is equivalent to performing the selection in two rounds. Among them, in the first round of selection, it is necessary to ensure that the same number of materials are selected from each material group. In the second round of selection, the second material is selected according to the second selection ratio corresponding to each material group. In this way, it can be ensured that each material group is selected, making the generated video more in line with the user's expectations.
[0052] In an implementation manner of the first aspect, the step of selecting the second material from the remaining materials in each of the material groups according to the second selection ratio corresponding to each material group includes:
[0053] Recalculate the selection ratio corresponding to the material group according to the second selection ratio and the number of remaining materials in the material group to obtain a third selection ratio;
[0054] Select the second material from the remaining materials in the material group according to the third selection ratio.
[0055] Specifically, the remaining selection quantity can be calculated according to the formula where p3 represents the remaining selection quantity, L represents the preset quantity, z represents the number of material groups, n0 represents the total number of selections for one material group, and nt represents the total number of the first materials. Among them, the third selection ratio is
[0056] In an implementation manner of the first aspect, after counting the quantity of the first material, the method further includes:
[0057] If the quantity of the first material does not exceed the preset quantity, generate a second video according to the first material;
[0058] Display a second interface, where the second interface is the playing interface of the second video.
[0059] In a second aspect, a chip system is provided. The chip system is applied to an electronic device. The chip system includes one or more processors, and the one or more processors are configured to call computer instructions to cause the electronic device to execute the method according to any one of the first aspect.
[0060] In a third aspect, an electronic device is provided, which includes one or more processors and a memory; the memory is coupled to the one or more processors, and the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to cause the electronic device to execute the method according to any one of the first aspect.
[0061] In a fourth aspect, a computer-readable storage medium is provided, which includes instructions that, when running on an electronic device, cause the electronic device to execute the method according to any one of the first aspect.
[0062] In a fifth aspect, a computer program product is provided, which, when running on an electronic device, enables the electronic device to implement the method according to any one of the first aspect. Description of the Drawings
[0063] Figure 1 is a schematic structural diagram of an electronic device provided by an embodiment of the present application;
[0064] Figure 2 is a schematic diagram of an application scenario of video synthesis provided by an embodiment of the present application;
[0065] Figure 3 is a schematic flowchart of a video synthesis method provided by an embodiment of the present application;
[0066] Figure 4 is a schematic flowchart of a material extraction method provided by an embodiment of the present application;
[0067] Figure 5 is a schematic diagram of a video synthesis process provided by an embodiment of the present application;
[0068] Figure 6 is a schematic diagram of a video synthesis process of an electronic device provided by an embodiment of the present application. Detailed Embodiments
[0069] In the following description, specific details such as specific system structures and technologies are presented for the purpose of illustration rather than limitation, so as to thoroughly understand the embodiments of the present application. However, those skilled in the art should clearly understand that the present application can also be implemented in other embodiments without these specific details.
[0070] It should be understood that when used in the specification and appended claims of the present application, the term "comprising" indicates the presence of the described features, wholes, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their combinations.
[0071] It should also be understood that in the embodiments of the present application, "one or more" means one, two or more than two; "and / or" describes the association relationship of associated objects, indicating that three relationships may exist; for example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone, where A and B may be singular or plural. The character " / " generally represents an "or" relationship between the associated objects before and after.
[0072] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", "fourth", etc. are only used for differential description and cannot be understood as indicating or implying relative importance.
[0073] The reference to "one embodiment" or "some embodiments" in the description of the present application specification means that a specific feature, structure or characteristic described in combination with the embodiment is included in one or more embodiments of the present application. Thus, statements such as "in one embodiment", "in some embodiments", "in other some embodiments", "in still other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "comprising", "including", "having" and their variants all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0074] The video synthesis method provided by the embodiments of the present application can be applied to an electronic device. The electronic device may be a tablet computer, a mobile phone, a wearable device, a smart screen, a laptop computer, a virtual reality (VR) terminal device, an augmented reality (AR) terminal device, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), or other electronic devices. The embodiments of the present application do not limit the specific type of the electronic device.
[0075] See Figure 1, which is a schematic structural diagram of an electronic device provided by an embodiment of the present application. The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. Among them, the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0076] It can be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than those illustrated, or combine certain components, or split certain components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0077] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units may be independent devices or integrated in one or more processors. For example, the processor 110 is used to execute the video frame playback method in the embodiment of the present application.
[0078] A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can hold the instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to use the instruction or data again, it can be directly retrieved from the memory. This avoids repeated accesses and reduces the waiting time of the processor 110, thus improving the efficiency of the system.
[0079] The internal memory 121 can be used to store computer-executable program code, and the executable program code includes instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system and application programs required for at least one function (such as an image playback function, etc.). The touch sensor 180K, also known as the "touch panel". The touch sensor 180K can be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also known as the "touch screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In some other embodiments, the touch sensor 180K can also be disposed on the surface of the electronic device 100, at a different position from the display screen 194.
[0080] The electronic device 100 implements the display function through the GPU, the display screen 194, and the application processor, etc. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs, which execute program instructions to generate or change display information. For example, in the embodiments of the present application, the process of rendering YUV data can be implemented through the GPU.
[0081] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can adopt a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLED, a Micro-OLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include one or N display screens 194, where N is a positive integer greater than 1. For example, in the embodiments of the present application Figure 2 or Figure 3 the interfaces shown are all displayed by the display.
[0082] The above is a specific description of the embodiments of the present application taking the electronic device 100 as an example. It should be understood that the structure schematically shown in the embodiments of the present application does not constitute a specific limitation on the electronic device 100. The electronic device 100 may have more or fewer components than those shown in the figure, may combine two or more components, or may have different component configurations. The various components shown in the figure may be implemented in hardware, software, or a combination of hardware and software including one or more signal processing and / or application-specific integrated circuits.
[0083] The embodiments of the present application do not particularly limit the specific structure of the execution subject of the video synthesis method. As long as the code recording a video synthesis method of the embodiments of the present application can be run to communicate according to a video synthesis method provided by the embodiments of the present application. For example, the execution subject of a video synthesis method provided by the embodiments of the present application may be a functional module in the electronic device that can call and execute a program, or a communication device applied to the electronic device, such as a chip.
[0084] Currently, many electronic devices are equipped with cameras, and users can use the cameras of the electronic devices to take photos, videos, etc.; the electronic devices also have a communication function and can also download pictures or videos from the Internet, or obtain pictures or videos sent by other electronic devices, etc. Users can edit the pictures and / or videos stored in the electronic device to generate a brand-new video from the selected pictures and / or videos.
[0085] As a scenario example, the user inputs a user instruction into the electronic device. In response to the user instruction, the electronic device obtains corresponding materials from the gallery application according to the user instruction, and generates a brand-new video with the obtained materials.
[0086] However, in practical applications, the number of materials obtained by the electronic device according to the user instruction may be relatively large, exceeding the maximum number of materials for synthesizing a video. In this case, it is necessary to select materials from the obtained materials to meet the upper limit requirement of the number of materials for synthesizing a video.
[0087] Based on this, an embodiment of the present application provides a video synthesis method. In the embodiment of the present application, materials are obtained according to the user instruction, and then a certain number of materials are evenly selected from the obtained materials according to time, and then a brand-new video is synthesized according to the selected materials. In this way, the synthesized video can evenly display the materials in each time period, effectively improving the effect of the synthesized video and being beneficial to improving the user experience.
[0088] The user instruction in the embodiment of the present application can be a text instruction. For example, the embodiment of the present application can call the video editing application by means of a search box provided by the electronic device or other applications with text instruction recognition functions. Specifically, the video editing application is called through the text instruction, so that the video editing application obtains materials that conform to the semantics of the text instruction and synthesizes a video according to the obtained materials.
[0089] The user instruction in the embodiment of the present application can be a voice instruction. For example, the embodiment of the present application can call the video editing application by means of a voice assistant provided by the electronic device or other applications with voice functions. Specifically, the video editing application is called through the voice instruction, so that the video editing application obtains materials that conform to the semantics of the voice instruction and synthesizes a video according to the obtained materials.
[0090] Taking the voice assistant of the electronic device calling the video editing application as an example below, the application scenario of the video synthesis method provided by the embodiment of the present application is introduced.
[0091] See Figure 2 , which is a schematic diagram of the application scenario of video synthesis provided by the embodiment of the present application.
[0092] Refer to Figure 2 As shown in (a) of [], the user says the voice "yoyo" within the voice monitoring range of the electronic device to wake up the voice assistant of the electronic device. After the electronic device detects the voice "yoyo", it issues a voice response "I'm listening, please speak", and at the same time displays Figure 2 As shown in (a) of []. In Figure 2In the interface shown in (a), a voice assistant window 21 is displayed. Inside the voice assistant window 21, there is text information "I'm listening. Please speak". Of course, the purpose of this voice response and text information is to prompt the user that the voice assistant has been awakened and ask the user to speak a voice command. In practical applications, other voice response contents and text information contents can also be set according to the situation to play the same reminder role.
[0093] Based on the voice response "I'm listening. Please speak" and / or the text information "I'm listening. Please speak", the user speaks the voice "Help me make a video of my daughter dancing from childhood to adulthood" within the voice monitoring range of the electronic device. After the electronic device detects the voice "Help me make a video of my daughter dancing from childhood to adulthood" (user instruction), it displays the user's voice information "Help me make a video of my daughter dancing from childhood to adulthood" in the voice assistant window 21, and generates a video (the first video) according to the pictures and videos containing the daughter's dancing stored in the electronic device; after successfully generating the video, it emits the voice "I have generated a video of your daughter dancing from childhood to adulthood" and, at the same time, displays the interface as shown in Figure 2 (b). As shown in Figure 2 (b), in the voice assistant window, it displays the text content "I have generated a video of your daughter dancing from childhood to adulthood" and the cover of the generated video (the first interface). On this cover, there is a play control 22 and a video duration "00:30". The video duration "00:30" indicates that the duration of the generated video is 30 seconds. In practical applications, the user can click the play control 22 to trigger the electronic device to play this video. This application will not give further examples through illustrations.
[0094] In specific implementation, when the electronic device detects the voice "Help me make a video of my daughter dancing from childhood to adulthood", it can generate a video according to the video synthesis method provided in the embodiments of this application.
[0095] The following introduces the video synthesis method provided in the embodiments of this application.
[0096] Refer to Figure 3 , which is a schematic flowchart of the video synthesis method provided in the embodiments of this application. By way of example and not limitation, as shown in Figure 3 , the video synthesis method may include the following steps:
[0097] S301, receive a user instruction, where the user instruction carries semantic information of materials for synthesizing a video.
[0098] As described above, the user instruction can be a text instruction or a voice instruction. In some implementations, if the user instruction is a text instruction, a text recognition algorithm can be used to recognize the semantic information of the user instruction. If the user instruction is a voice instruction, a voice recognition algorithm can be used to recognize the semantic information of the user instruction. In the embodiments of the present application, the recognition algorithm for the user instruction is not specifically limited.
[0099] The materials in the embodiments of the present application include pictures and videos.
[0100] S302. In response to the user instruction, the electronic device obtains a first material that conforms to the semantics of the user instruction.
[0101] In the embodiments of the present application, the semantic information of the user instruction may include the material type and the material time. Correspondingly, the first material that conforms to the semantics of the user instruction can be a material that conforms to the material type in the user instruction and satisfies the material time in the user instruction.
[0102] In some implementations, the electronic device can identify the search range of the material according to the user instruction, and then obtain the first material that conforms to the semantics of the user instruction according to the search range.
[0103] In one example, as Figure 2 In the example, the user instruction is "help me make a video of my daughter dancing from childhood to adulthood", and the electronic device identifies the search range of the material as the gallery application according to the user instruction. Then the electronic device can obtain the first material that conforms to the semantics of the user instruction from the gallery application.
[0104] In another example, the user instruction is "a video of today's news", and the electronic device identifies the search range of the material as the web page according to the user instruction. Then the electronic device searches for the first material that conforms to the semantics of the user instruction from the web page.
[0105] In some other implementations, the electronic device can first search for the first material that conforms to the semantics of the user instruction in the gallery application. If the first material is not found in the gallery application, it then searches for the first material from the web page.
[0106] S303. Select a second material from the first materials according to time.
[0107] In some embodiments, step S303 may include:
[0108] Count the number of the first materials;
[0109] If the number of the first materials exceeds a preset number, select a second material from the first materials according to time.
[0110] Among them, the preset quantity can be determined according to the maximum number of materials in the synthesized video. For example, if the upper limit requirement for the number of materials in the synthesized video is 30, the preset quantity can be set to 30 or a certain value less than 30.
[0111] It can be understood that in the embodiments of the present application, step S303 is executed on the premise that the number of the first materials exceeds the preset quantity. If the number of the first materials exceeds the preset quantity, it means that there are more first materials, and then the first materials need to be selected; if the number of the first materials does not exceed the preset quantity, it means that there are fewer first materials. In this case, there is no need to select, and a video can be generated according to all the first materials.
[0112] In some embodiments, if the number of the first materials does not exceed the preset quantity, a second video is generated according to the first materials; a second interface is displayed, and the second interface is the playing interface of the second video.
[0113] For the specific implementation manner of selecting the second materials from the first materials according to time, reference can be made to Figure 4 the description in the embodiments.
[0114] S304, generate a first video according to the second materials.
[0115] In some implementation manners, the second materials can be generated into the first video according to the categories of the materials. For example, if the second materials include images and videos, the second materials are generated into the first video in the order of images first and videos later.
[0116] In some other implementation manners, the second materials can be generated into the first video according to the time sequence of the materials. For example, if the second materials include image a and video b, and the shooting time of image a is before the shooting time of video b, the first video is generated in the order of image a first and video b later.
[0117] In the embodiments of the present application, the manner of generating a video according to the materials is not specifically limited.
[0118] S305, display a first interface, and the first interface is the playing interface of the first video.
[0119] In some implementation manners, the first interface may include a first control. When the user operates the first control, in response to the user operation, the electronic device plays the first video.
[0120] In the embodiments of the present application, materials are obtained according to a user instruction, and then a certain number of materials are evenly selected from the obtained materials according to time, and then a brand-new video is synthesized according to the selected materials. In this way, the synthesized video can evenly display the materials in each time period, effectively improving the effect of the synthesized video and being beneficial to improving the user experience.
[0121] The implementation method of selecting the second material from the first material according to time in step S303 will be introduced below.
[0122] See Figure 4 , which is a schematic flowchart of the material selection method provided by the embodiments of the present application. As Figure 4 shown, the method of selecting materials according to time may include:
[0123] S401, calculate the time span of the first material.
[0124] In the embodiments of the present application, the time span refers to the time interval between the earliest shooting time and the latest shooting time in the obtained first material. For example, if 3 first materials are obtained, and their respective shooting times are January 1, 2020, February 2, 2021, and March 3, 2023 respectively, then the time span of these 3 first materials is the time interval between January 1, 2020 and March 3, 2023.
[0125] S402, determine the time period of clustering according to the time span.
[0126] In some implementation manners, the time period may be determined according to the largest time unit included in the time span. For example, if the first materials are shot in different years, the largest time unit included in the time span is year, such as the time period is one year. If the first materials are shot in the same year but different months, the largest time unit included in the time span is month, such as the time period is one month. If the first materials are shot on the same month but different days, the largest time unit included in the time span is day, such as the time period is one day. If the first materials are shot on the same day but different times, the largest time unit included in the time span is hour, such as the time period is one hour.
[0127] In other implementation manners, if the number of time periods included in the time span is relatively large, several time periods may be combined to determine a new time period. For example, if the first materials are shot in different years and the time span is 10 years and the time period is one year. At this time, the time span is equivalent to including 10 time periods, and the number is relatively large. Two time periods can be combined, that is, the new time period is 2 years.
[0128] In other implementation manners, step S402 may include:
[0129] Obtain a first preset period, where the first preset period is determined according to the maximum number of materials in the synthesized video;
[0130] If the time span is greater than the first preset period, determine the time period according to the first preset period;
[0131] If the time span is less than the first preset period, the time period is determined according to the second preset period, where the second preset period is less than the first preset period.
[0132] Specifically, if the time span is greater than the first preset period, the time period is determined according to the time unit corresponding to the first preset period; if the time span is less than the first preset period, the second preset period is obtained; if the time span is greater than the second preset period and less than the first preset period, the time interval is determined according to the second preset period; if the time span is less than the second preset period, the third preset period is obtained, and so on. Wherein, the third preset period is less than the second preset period.
[0133] Exemplarily, assume that the maximum number of materials for the synthesized video is 30. If it is necessary to ensure that one material is selected every month, the number of materials corresponding to three years is 36 > 30, and the number of materials corresponding to two years is 24 < 30, then the first preset period can be set to 2 years. If the time span is greater than 2 years, clustering is performed in units of years, that is, the time period is set to 1 year; if the time span is less than 2 years, the second preset period is obtained, such as 1 month; if the time span is greater than 1 month, clustering is performed in units of months, that is, the time period is set to 1 month; if the time span is less than 1 month, the third preset period is obtained, such as 1 day; if the time span is greater than 1 day, clustering is performed in units of days, that is, the time period is set to 1 day; if the time span is less than 1 day, the fourth preset period is obtained, and so on.
[0134] S403, cluster the first material according to the time period to obtain a material group.
[0135] In a specific implementation manner, the time span of the first material is divided into multiple time ranges according to the time period; it is determined which time range each first material belongs to; the first materials belonging to the same time range are divided into a material group.
[0136] In some implementation manners, different data storage structures can be used to store material groups for different time periods. For example, if the time period is in years, the storage structure can be map[year,list <mediaitem>, such as [2019, list], [2022, list]. If the time period is in months, the storage structure can be map[month, list <mediaitem>, such as [201901, list], [202202, list]. If the time period is in days, the storage structure can be map[day, list <mediaitem>, such as [20190108, list], [20220202, list].
[0137] It should be noted that the above is an example of the data storage structure of the material group, and the embodiments of the present application do not make specific limitations thereto.
[0138] S404, select the second material from each of the material groups.
[0139] Figure 4 In the embodiment, the materials are clustered according to the time span of the materials, and then materials are selected from each of the material groups obtained by clustering. In this way, the synthesized video can evenly display the materials in each time period, effectively improving the effect of the synthesized video and being beneficial to improving the user experience.
[0140] In some implementation manners of step S404, the second material can be randomly selected from each material group. However, this way is likely to result in uneven time distribution of the selected materials and cannot ensure that materials can be selected in each time period.
[0141] To solve this problem, in some embodiments, step S404 may include:
[0142] I. Calculate the first selection ratio corresponding to each of the material groups.
[0143] II. Select the second material from each of the material groups according to the first selection ratio corresponding to each of the material groups.
[0144] In the embodiments of the present application, it is equivalent to determining the selection ratio of each material group according to the maximum number of materials in the synthesized video, and then selecting materials according to the ratio. In this way, the time distribution of the selected materials is relatively uniform, ensuring that a certain proportion of materials can be selected in each time period and being beneficial to improving the effect of the synthesized video.
[0145] In one implementation manner of step I, count the number of the first materials in each material group; calculate the ratio of the number of the first materials in each material group to the total number of the first materials to obtain the first selection ratio corresponding to each material group. For example, the total number of the obtained first materials is 1000, which is clustered into 3 material groups, and the numbers of the first materials included in each are 900, 60, and 40 respectively. The first selection ratio of the first material group is 900 / 1000 = 0.9, the first selection ratio of the second material group is 60 / 1000 = 0.06, and the first selection ratio of the third material group is 40 / 1000 = 0.04.
[0146] Correspondingly, in one implementation of step II, multiply the first selection ratio corresponding to each material group by a preset quantity to obtain the selection quantity M1 corresponding to each material group; select M1 second materials from the material group. Continuing with the above example, assume that the maximum number of materials in the synthesized video is 30, that is, the preset quantity is 30. Multiply the preset quantity by the first selection ratio of the first material group to obtain the selection quantity M1 of the first material group, M1 = 0.9×30 = 27; multiply the preset quantity by the first selection ratio of the second material group to obtain the selection quantity M1 of the second material group, M1 = 0.06×30 = 1.8; multiply the preset quantity by the first selection ratio of the third material group to obtain the selection quantity M1 of the third material group, M1 = 0.04×30 = 1.2.
[0147] In some implementations, if the calculated selection quantity is not an integer, it can be rounded up or down to obtain an integer selection quantity.
[0148] As can be seen from the above example, if a material group contains a large number of materials, there will be a situation where a large number of materials are selected within a certain material group, while the number of materials selected in other material groups is small (even 0), resulting in a relatively concentrated time of the selected materials and affecting the effect of the subsequent video.
[0149] To solve this problem, in some embodiments, step II may include:
[0150] If the first selection ratio corresponding to the material group is greater than the preset ratio, adjust the first selection ratio corresponding to the material group to obtain an adjusted second selection ratio; select the second material from the material group according to the adjusted second selection ratio of the material group.
[0151] In practical applications, the preset ratio can be set in advance according to experience. It can also be adjusted accordingly during the actual calculation process. For example, assume that the preset quantity (determined according to the maximum number of materials in the synthesized video) is 100, and there are 3 material groups in total. It is necessary to ensure that at least one material is selected from each material group, then the first selection ratio of each material group is at least 1 / 100 = 0.01, so the preset ratio can be set to 0.98. Assume that the first selection ratio of the first material group among the 3 material groups is 0.99, then one of the other 2 material groups will necessarily not reach the selection ratio of 0.01. In this case, it is determined that the first selection ratio of the first material group is greater than the preset ratio.
[0152] In one implementation, the first selection ratio of the material group can be adjusted to the preset selection ratio.
[0153] In another implementation, obtain the number of material groups; calculate the adjusted second selection ratio of the material group according to the number of the material groups and the preset multiple.
[0154] Specifically, the ratio of the preset multiple to the number of material groups can be determined as the second selection ratio.
[0155] Exemplarily, assume that the preset multiple is 2, the time span is 5 years, and the time period is 1 year, that is, the number of material groups is 5 / 1 = 5, then the second selection ratio is 2 / 5 = 0.4.
[0156] Among them, the preset multiple can be set according to actual needs. In one example, the preset multiple can be set to a value less than half of the number of material groups.
[0157] Correspondingly, for other material groups with a first selection ratio less than the preset ratio, the selection ratio also needs to be adjusted accordingly. In one implementation, according to the adjusted second selection ratio of the first target group (the material group with a first selection ratio greater than the preset ratio), calculate the remaining ratio; according to the number of materials in the second target group (the material group with a first selection ratio less than the preset ratio), allocate the remaining ratio to the second target group to obtain the adjusted second selection ratio for each second target group.
[0158] Exemplarily, the total number of the first materials obtained is 1000, clustered into 3 material groups, and the numbers of the first materials included in each are 900, 60, and 40 respectively. The first selection ratio of the first material group is 900 / 1000 = 0.9, the first selection ratio of the second material group is 60 / 1000 = 0.06, and the first selection ratio of the third material group is 40 / 1000 = 0.04. The selection ratio of the first material group is adjusted from 0.9 to 0.4, then the remaining ratio is 1 - 0.4 = 0.6. The numbers of materials in the other 2 material groups (the second target group) are 60 and 40 respectively. According to the proportional relationship of the number of materials, allocate the remaining ratio, and the adjusted selection ratio of the second material group is 60×0.6 / (60 + 40) = 0.36, and the adjusted selection ratio of the third material group is 40×0.6 / (60 + 40) = 0.24.
[0159] In the embodiments of the present application, by adjusting the larger selection ratio, it can be ensured that the materials in each material group are selected, which is beneficial to improving the effect of the synthesized video.
[0160] In one implementation of selecting the second material according to the second selection ratio, multiply the number of materials included in the material group by the second selection ratio corresponding to the material group to obtain the selection quantity M2 corresponding to the material group; randomly select M2 second materials from the material group.
[0161] In another implementation of selecting the second material according to the second selection ratio, n pieces of the second material are selected from each of the material groups, where n is a positive integer; according to the second selection ratio corresponding to each material group, the second material is selected from the remaining materials in each material group.
[0162] This implementation is equivalent to performing the selection in two rounds. Among them, in the first round of selection, it is necessary to ensure that the same number of materials are selected from each material group, and in the second round of selection, the second material is selected according to the second selection ratio corresponding to each material group. In this way, it can be ensured that each material group is selected, making the generated video more in line with the user's expectations.
[0163] In one implementation, the step of selecting the second material from the remaining materials may include:
[0164] According to the second selection ratio and the number of remaining materials in the material group, recalculate the selection ratio corresponding to the material group to obtain the third selection ratio; select the second material from the remaining materials in the material group according to the third selection ratio.
[0165] Specifically, the remaining selection quantity can be calculated according to the formula where p3 represents the remaining selection quantity, L represents the preset quantity, z represents the number of material groups, n0 represents the total selection quantity of one material group, and nt represents the total number of the first materials. Among them, the third selection ratio is
[0166] To more clearly illustrate the video synthesis method of the embodiments of the present application, the overall process of the video synthesis method will be introduced below. Refer to Figure 5 , which is a schematic diagram of the video synthesis process provided by the embodiments of the present application. As an example rather than a limitation, as Figure 5 shown, the video synthesis process may include the following steps:
[0167] S501, Obtain a user instruction.
[0168] S502, Obtain the first material according to the semantics of the user instruction.
[0169] Steps S501 - S502 can refer to the descriptions in the embodiments of steps S301 - S302.
[0170] S503, Calculate the time span of the first material.
[0171] S504, Determine whether the time span is greater than 2 years (the first preset period).
[0172] S505, If the time span is greater than 2 years, perform clustering in years, that is, the time period is 1 year.
[0173] If the time span is less than 2 years, clustering is performed on a monthly basis, that is, the time period is 1 month. Since the subsequent material extraction process in this case is the same as the material extraction process with a time period of 1 year, Figure 5 This situation is not shown in
[0174] Steps S503 - S504 can refer to the description in the embodiments of steps S401 - S403.
[0175] S506, determine whether the quantity of the first material is greater than a preset quantity.
[0176] It should be noted that steps S506 and S503 can be performed without considering the order, can be processed in parallel, or can be processed serially. When processed serially, S503 can be executed first and then S506, or S506 can be executed first and then S503.
[0177] S507, if the quantity of the first material is not greater than the preset quantity, generate a second video based on all the first materials.
[0178] S508, if the quantity of the first material is greater than the preset quantity, detect whether the first extraction ratio of the material group is greater than the preset ratio.
[0179] S509, if the first extraction ratio of each material group is less than the preset ratio, extract materials from each material group according to the first extraction ratio.
[0180] S510, if the first extraction ratio of a certain material group is greater than the preset ratio, adjust the extraction ratio of the material group to obtain a second extraction ratio.
[0181] S511, extract materials from each material group according to the adjusted second extraction ratio.
[0182] Steps S508 - S511 can refer to the description in the embodiments of step S404.
[0183] S512, generate a video based on the extracted second materials.
[0184] The following uses a specific example to illustrate the material extraction method in the above embodiments.
[0185] Exemplarily, assume that the preset quantity is 30, there are 5 material groups in total, and the quantities of the first materials included in each are 900, 30, 30, 20, and 20 respectively, and the total quantity of the first materials is 1000. Calculate the first selection ratio corresponding to each material group as 900 / 1000 = 0.9, 30 / 1000 = 0.03, 30 / 1000 = 0.03, 20 / 1000 = 0.02, 20 / 1000 = 0.02. Assume that the preset ratio is 0.5, then the selection ratio of the material group with a quantity of 900 exceeds the preset ratio, and it is necessary to adjust the selection ratio of this material group (the first target group). The adjusted second selection ratio is 2 / 5 = 0.4 (the preset multiple is 2). Correspondingly, adjust the selection ratios of other material groups (the second target groups). The second selection ratios of the 5 adjusted material groups are 0.4, 30×0.6 / (30 + 30 + 20 + 20) = 1.8, 30×0.6 / (30 + 30 + 20 + 20) = 1.8, 20×0.6 / (30 + 30 + 20 + 20) = 1.2, 20×0.6 / (30 + 30 + 20 + 20) = 1.2.
[0186] After determining the second selection ratios of each material group, first select 1 material from each material group. Then, according to the second selection ratio of each material group, select the second materials from the remaining materials in each material group. Specifically, for the first material group, the second selection ratio is 0.4, and the total selection quantity is 900×0.4 = 360, and the remaining selection quantity is Then, select 9 second materials from the remaining materials in the first material group. The selection methods of other material groups are similar and will not be elaborated.
[0187] To make the execution process of the steps in the above flowchart clearer, first, Figure 6 describe the timing diagram of generating a video related to the daughter's dancing after the electronic device detects the user's "Help me make a video of my daughter dancing from childhood to adulthood". This timing diagram corresponds to Figure 2 the application scenario described in the embodiment.
[0188] S601, the voice assistant detects the user's voice.
[0189] In the embodiment of the present application, the user's voice can be "Generate a video of the child".
[0190] S602, the voice assistant obtains a video generation instruction according to the voice information corresponding to the user's voice.
[0191] In the embodiment of the present application, after the voice assistant detects the user's voice, it can first generate text information according to the user's voice, and then extract the keywords "generate", "daughter", "dance", "from childhood to adulthood", and "video" from the text information, so as to obtain a video generation instruction.
[0192] Of course, in actual applications, after the voice assistant generates text information according to the user's voice, it can display the text "Help me make a video of my daughter dancing from childhood to adulthood" in the voice assistant window.
[0193] S603. The voice assistant sends the video generation instruction to the media processing middle platform.
[0194] S604. After receiving the video generation instruction, the media processing middle platform collects media materials related to the instruction from the electronic device.
[0195] As an example, the video generation instruction carries the material types "picture" and "video", and also carries the content identifier "daughter". The media processing middle platform determines the materials to be searched as pictures and videos according to the material types "picture" and "video"; and determines the pictures and videos with the content identifier "daughter" according to the content identifier "daughter". Then, image detection processing is performed on the pictures and videos with the content identifier "daughter" to detect the postures of the people in the pictures and videos, so as to determine whether the people in the pictures and videos are in a dancing posture.
[0196] Of course, in actual applications, first-level content tags and second-level content tags can be set for videos and pictures. The first-level content tag can be "person", and the second-level content tags of the first-level content can be attributes such as the actions or postures of the person.
[0197] In addition, the maximum number of media materials each time a video is generated (for example, 30) can be set, that is, the number of media materials collected when generating a video is at most 30.
[0198] S605. The media processing middle platform selects from the obtained materials.
[0199] For the method of material selection, reference can be made to the description in the above Figure 4 embodiment.
[0200] S606. The media processing middle platform sends the selected media materials (the second materials) and the theme (the content identifier itself or the theme determined according to the content identifier) to the light editing service.
[0201] As an example, the theme can be the content identifier "daughter", or the theme "daughter dancing" determined according to the first-level content tag and the second-level content tag. Of course, the way of determining the theme is only an example.
[0202] The light editing service can be an example of a video editing application.
[0203] After the light editing service receives the media material and the theme at S607, it obtains the configuration file.
[0204] In the embodiments of the present application, each node in the finished video module to be created is defined in the configuration file, and subsequently, the video can be generated through each node in the finished video module.
[0205] As an example, the nodes in the configuration file include: template acquisition node, theme matching node, template parsing node, music parsing node, music loading node, special effect node, cover generation node, duration adjustment node, etc.
[0206] Among them, the template acquisition node is used to acquire template materials; the theme matching node is used to find the template matching the theme from the template materials; the template parsing node is used to parse the template matching the theme; the music parsing node is used to parse the rhythm points in the template, and the music loading node is used to correspond the rhythm points in the music with the rhythm points in the template; the special effect node is used to generate special effects; the cover generation node is used to generate the video cover, and the duration adjustment node is used to calculate the duration of the new video during the secondary video production and adjust the duration of each segment in the original video, so as to obtain the new video.
[0207] It can be understood that there is a specific processing order among these nodes.
[0208] At S608, the light editing service creates the finished video module (and each node therein) according to the configuration file.
[0209] In this step, the duration adjustment node is not created temporarily, and the duration adjustment node is created when the video duration needs to be adjusted. Of course, in actual applications, it can also be set that the configuration file does not include the duration adjustment node.
[0210] After creating the finished video module at S609, the light editing service sends the media material and the theme to the finished video module.
[0211] At S610, after the finished video module receives the media material and the theme, it obtains the video model through each node.
[0212] Corresponding to each created node, the template acquisition node acquires template materials; the theme matching node finds the template matching the theme from the template materials; the template parsing node parses the template matching the theme; the music parsing node parses the rhythm points in the template; the music loading node corresponds the rhythm points in the music with the rhythm points in the template; the special effect node is used to generate special effects; the cover generation node is used to generate the video cover. After being processed by the above-mentioned each node, the video model is obtained, and the video model is a kind of video structure.
[0213] This process is only an example. In actual applications, different nodes can be set, or more or fewer nodes. Regardless of the nodes adopted, the video model can be obtained by the video module passing through these nodes.
[0214] S611. The video module sends the video model to the light editing service.
[0215] S612. After receiving the video model, the light editing service converts the video model into a video json.
[0216] The light editing service edits the video in the model structure during video editing; after the editing process, it needs to be converted into a json structure for transmission.
[0217] S613. The light editing service sends the video json to the media processing middle platform.
[0218] S614. After receiving the video json, the media processing middle platform sends the video json to the voice assistant.
[0219] S615. After receiving the video json, the voice assistant displays the text "A video of your daughter dancing from childhood to adulthood has been generated for you" and the video cover in the voice assistant window.
[0220] In summary, for the video synthesis method provided in the embodiments of the present application, materials are obtained according to user instructions, then a certain number of materials are evenly selected from the obtained materials according to time, and then a new video is synthesized according to the selected materials. In this way, the synthesized video can evenly display the materials in each time period, effectively improving the effect of the synthesized video and being beneficial to improving the user experience. Secondly, the materials are clustered according to the time span of the materials, and then materials are selected from each material group obtained by clustering. In this way, the synthesized video can evenly display the materials in each time period, effectively improving the effect of the synthesized video and being beneficial to improving the user experience. In addition, by adjusting the relatively large selection ratio, it can be ensured that the materials in each material group are selected, which is beneficial to improving the effect of the synthesized video.
[0221] It should be understood that the magnitudes of the sequence numbers of the steps in the above embodiments do not mean the order of execution. The execution order of each process should be determined according to its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
[0222] The embodiments of the present application also provide a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above method embodiments can be implemented.
[0223] The embodiments of the present application also provide a computer program product. When the computer program product runs on an electronic device, the electronic device can implement the steps in the above-mentioned method embodiments.
[0224] If the integrated unit is implemented in the form of 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, to implement all or part of the processes in the above-mentioned method embodiments of the present application, a computer program can be used to instruct the relevant hardware to complete. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in the form of source code, object code, executable file or some intermediate form, etc. The computer-readable medium can at least include: any entity or device that can carry the computer program code to the first device, recording medium, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal, and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disc, etc. In some jurisdictions, according to legislation and patent practice, the computer-readable medium cannot be an electrical carrier signal and a telecommunication signal.
[0225] The embodiments of the present application also provide a chip system. The chip system includes a processor, the processor is coupled with a memory, and the processor executes the computer program stored in the memory to implement the steps in any method embodiment of the present application. The chip system can be a single chip or a chip module composed of multiple chips.
[0226] In the above embodiments, the descriptions of the respective embodiments have their own emphases. For the parts not detailed or recorded in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0227] Those of ordinary skill in the art can realize that the units and method steps of the examples described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or by a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. A professional technician can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application. Finally, it should be noted that: the above is only the specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any change or replacement within the technical scope disclosed in the present application should be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.< / mediaitem> < / mediaitem> < / mediaitem>
Claims
1. A video synthesis method, characterized in that, Including: Receiving a user instruction, where the user instruction carries semantic information of materials for synthesizing a video; In response to the user instruction, obtaining a first material that conforms to the semantics of the user instruction; Selecting a second material from the first material according to time; Generating a first video according to the second material; Displaying a first interface, where the first interface is a playing interface of the first video.
2. The method according to claim 1, wherein The selecting the second material from the first material according to time includes: Counting the quantity of the first material; If the quantity of the first material exceeds a preset quantity, selecting the second material from the first material according to time.
3. The method according to claim 1 or 2, characterized in that, The selecting the second material from the first material according to time includes: Calculating the time span of the first material; Determining a clustering time period according to the time span; Clustering the first material according to the time period to obtain material groups; Selecting the second material from each of the material groups.
4. The method according to claim 3, wherein The determining the clustering time period according to the time span includes: Obtaining a first preset period, where the first preset period is determined according to the maximum number of materials in the synthesized video; If the time span is greater than the first preset period, determining the time period according to the first preset period; If the time span is less than the first preset period, determining the time period according to a second preset period, where the second preset period is less than the first preset period.
5. The method according to claim 3, wherein The selecting the second material from each of the material groups includes: Calculating a first selection ratio corresponding to each of the material groups; Selecting the second material from each of the material groups according to the first selection ratio corresponding to each of the material groups.
6. The method according to claim 5, wherein The selecting the second material from each of the material groups according to the first selection ratio corresponding to each of the material groups includes: If the first selection ratio corresponding to the material group is greater than a preset ratio, adjusting the first selection ratio corresponding to the material group to obtain an adjusted second selection ratio; Selecting the second material from the material group according to the adjusted second selection ratio of the material group.
7. The method according to claim 6, characterized in that, The adjusting the first selection ratio corresponding to the material group to obtain an adjusted second selection ratio includes: Obtaining the number of the material groups; Calculating the adjusted second selection ratio of the material group according to the number of the material groups and a preset multiple.
8. The method according to any one of claims 6 to 7, characterized in that, The selecting the second material from the material group according to the adjusted second selection ratio of the material group includes: Selecting n pieces of the second material from each of the material groups, where n is a positive integer; Selecting the second material from the remaining materials of each of the material groups according to the second selection ratio corresponding to each of the material groups.
9. The method according to claim 8, characterized in that, The selecting the second material from the remaining materials of each of the material groups according to the second selection ratio corresponding to each of the material groups includes: Recalculating the selection ratio corresponding to the material group according to the second selection ratio and the quantity of the remaining materials in the material group to obtain a third selection ratio; Selecting the second material from the remaining materials of the material group according to the third selection ratio.
10. The method according to claim 2, wherein After counting the quantity of the first material, the method further includes: If the quantity of the first material does not exceed a preset quantity, a second video is generated according to the first material; A second interface is displayed, and the second interface is a playback interface of the second video.
11. An electronic device, characterized in that, The electronic device includes one or more processors and a memory; The memory is coupled to the one or more processors. The memory is used to store computer program code, and the computer program code includes computer instructions. The one or more processors call the computer instructions to cause the electronic device to execute the method according to any one of claims 1 to 10.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes instructions. When the instructions run on an electronic device, the electronic device is caused to execute the method according to any one of claims 1 to 10.
13. A chip system, characterized in that, The chip system is applied to an electronic device. The chip system includes one or more processors, and the one or more processors are used to call computer instructions to cause the electronic device to execute the method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Video processing method and device, electronic device and computer readable storage medium
CN110087143A
Anchor identifier generation method and device, equipment, storage medium and program product
CN113542801A
Travel video generation method and device based on cockpit, vehicle and storage medium
CN115529423A
Video content generation method and device, electronic equipment and storage medium
CN115580758A
Method for generating a composition of audible and visual media
US20170026719A1