Method for adjusting video duration, electronic device, storage medium, and chip
The video duration is adjusted through voice commands, which solves the problem that the time of automatically generating video does not meet user expectations, and realizes simple and efficient video duration adjustments, improving user experience.
Patent Information
- Application Number
- PCT/CN2024/143537
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-01-10
- Filing Date
- 2024-12-28
- Publication Date
- 2025-07-17
AI Technical Summary
In the prior art, the video time automatically generated by electronic devices often does not meet user expectations, resulting in users requiring cumbersome video editing operations to adjust the time, and the user experience is poor.
The video duration is adjusted through voice commands, the video duration is generated or adjusted according to the user's voice commands, and the duration of the time change constraints are set to ensure the filming effect, including extending or shortening a specific time, adjusting to a specific time, or adjusting the duration within a certain range.
It simplifies the video duration adjustment process, improves the user experience, reduces the cumbersome operations of video editing, and ensures that the generated video duration meets user expectations.
Smart Images

Figure CN2024143537_17072025_PF_FP_ABST
Abstract
Description
Method for adjusting video duration, electronic device, storage medium and chip
[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on January 10, 2024, with application number 202410040059.7 and application name “A method for adjusting video duration, electronic device, storage medium and chip”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the technical field of terminal devices, and in particular to a method for adjusting video duration, an electronic device, a storage medium, and a chip. Background Art
[0003] Many electronic devices are equipped with cameras, allowing users to take photos and videos. Electronic devices also have communication capabilities, allowing users to download images and videos from the internet or retrieve images and videos sent by other electronic devices. Users can edit images and / or videos stored on an electronic device to create a video from selected images and / or videos.
[0004] Currently, users can select one or more media materials (pictures and videos) in a gallery app, and then the gallery app automatically generates a video based on the selected media materials. However, the length of such automatically generated videos often does not meet the user's expectations, requiring the user to re-edit the video using the video editing functions provided by the electronic device (e.g., video splitting, video merging, etc.). This results in a cumbersome and inefficient way of obtaining videos, and a poor user experience. Summary of the Invention
[0005] The present application provides a method, electronic device, storage medium and chip for adjusting video duration, which can efficiently adjust the duration of generated videos and improve user experience.
[0006] To achieve the above objectives, the first aspect of this application adopts the following technical solutions:
[0007] A first aspect of the present application provides a method for adjusting video duration, comprising:
[0008] receiving a first voice instruction, wherein the first voice instruction carries a first keyword;
[0009] In response to the first voice command, displaying a cover of a first video on a first interface, where the first video is generated by media material related to the first keyword in the electronic device, and the duration of the first video is a first duration;
[0010] receiving a second voice instruction to adjust the duration of the first video;
[0011] In response to the second voice command, the cover of the second video is displayed on the first interface. The length of the second video is the second length, and the content of the second video is related to the content of the first video. For example, the second video contains part or all of the content of the first video.
[0012] In the present application, a first video is automatically generated in an electronic device based on media materials related to keywords in the voice command through a user's voice command. The method of generating a video is simple and fast. If the user is not satisfied with the length of the generated first video, the user can also adjust the length of the generated first video through a voice command. The electronic device automatically adjusts the length of the first video according to the voice command to adjust the length of the first video to obtain a second video. Of course, the second video is adjusted based on the first video, so the second video contains part or all of the content of the first video. It can be understood that the method of adjusting the length of the video is also relatively simple, fast and efficient, thereby improving the user experience.
[0013] As another implementation of the first aspect of the present application, before displaying the cover of the second video on the first interface, the method further includes:
[0014] According to the second voice instruction, the calculated duration of the second video is obtained; according to the calculated duration of the second video, the content of the first video is adjusted to obtain the second video.
[0015] In this application, the user's voice command may be of various types, for example, extending t1 seconds, shortening t1 seconds, adjusting to t2 seconds, adjusting to more than t3 seconds, or adjusting to less than t3 seconds. Therefore, according to the second voice command, the calculated duration of the second video is obtained and then adjusted.
[0016] As another implementation of the first aspect of the present application, obtaining the calculated duration of the second video according to the second voice instruction includes:
[0017] Obtaining an expected change duration between the second video and the first video according to the second voice instruction, where the expected change duration is determined by the duration indicated by the second voice instruction;
[0018] Get the duration change constraints;
[0019] According to the expected change duration and the duration change constraint conditions, the duration change value is obtained;
[0020] According to the first duration and the duration change value of the first video, a calculated duration of the second video is obtained.
[0021] In this application, since the first video is an automatically generated video, the first duration of the first video is related to the content and quantity of the media material corresponding to the user's first voice command, that is, when the video is generated according to the media material obtained according to the first voice command, the first duration is a relatively reasonable duration; therefore, in order to ensure the film-making effect, some duration change constraints will be set. The duration cannot be changed too much based on the first video, nor can it be changed too little based on the duration of the first video. Therefore, the duration change constraints are set, so that the duration of the second video is more reasonable and the film-making effect of the second video is better.
[0022] As another implementation of the first aspect of the present application, obtaining the expected change duration between the second video and the first video according to the second voice instruction includes:
[0023] When the second voice instruction indicates extending or shortening the first video by a third duration, the expected change duration is the third duration;
[0024] When the second voice instruction indicates changing the duration of the first video to a fourth duration, the expected changed duration is the difference between the fourth duration and the first duration;
[0025] When the second voice instruction indicates changing the duration of the first video to be longer or shorter than the fifth duration, the expected changed duration is the difference between the fifth duration and the first duration.
[0026] In this application, the user's voice command may be of various types, such as extending t1 seconds, shortening t1 seconds, adjusting to t2 seconds, adjusting to greater than t3 seconds, or adjusting to less than t3 seconds. Regardless of the type, it is necessary to obtain the expected change in duration between the second video and the first video, that is, the user's expected adjusted duration. Subsequently, based on the user's expected adjusted duration as a reference, the calculated duration of the second video is obtained.
[0027] As another implementation of the first aspect of the present application, obtaining the duration change constraint condition includes:
[0028] Calculating a first duration change constraint condition, where the first duration change constraint condition is: a first minimum value of the duration change is 0, a first maximum value of the duration change is a first percentage of an expected duration of the second video, and the expected duration of the second video is determined by the duration indicated in the second voice command;
[0029] Obtaining a second duration change constraint condition, wherein the second maximum value and the second minimum value of the duration change are set in the second duration change constraint condition;
[0030] A duration change constraint condition is obtained according to the first duration change constraint condition and / or the second duration change constraint condition.
[0031] In this application, for the sake of film-making effect, the length change of the new video and the original video is set to be controlled within a certain percentage of the expected length of the new video; of course, the user's expected length may be relatively outrageous, so a second length change constraint is also set to once again ensure the film-making effect of the second video through upper and lower limits.
[0032] As another implementation of the first aspect of the present application, obtaining a duration change constraint condition according to the first duration change constraint condition and / or the second duration change constraint condition includes:
[0033] When the first maximum value is less than the second minimum value, the duration change constraint condition is: the duration change value is the second minimum value;
[0034] When the first maximum value is greater than the second maximum value, the duration change constraint condition is the second duration change constraint condition;
[0035] When the first maximum value is greater than or equal to the second minimum value and less than or equal to the second maximum value, the duration change constraint condition is that the minimum value of the duration change is the second minimum value and the maximum value of the duration change is the first maximum value.
[0036] In this application, the intersection of the two constraints is taken as the final duration change constraint; however, in actual applications, the two constraints may not have an intersection. For example, when a certain percentage of the expected duration is less than the lower limit of the other constraint, in this case, the maximum and minimum values of the duration change range are set to the lower limit value, so as to ensure that the duration of each adjustment is not too small, and of course, not too large.
[0037] As another implementation of the first aspect of the present application, obtaining a duration change value according to the expected change duration and the duration change constraint condition includes:
[0038] When the expected change duration is within the range of the duration change constraint, the duration change value is the expected change duration;
[0039] When the expected change duration is less than the minimum value of the duration change constraint, the duration change value is the minimum value of the duration change constraint;
[0040] When the expected change duration is greater than the maximum value of the duration change constraint, the duration change value is the maximum value of the duration change constraint.
[0041] As another implementation of the first aspect of the present application, obtaining the calculated duration of the second video according to the first duration and the duration change value of the first video includes:
[0042] When the expected duration of the second video is greater than the first duration of the first video, the calculated duration of the second video is the sum of the first duration of the first video and the duration change value;
[0043] When the expected duration of the second video is less than the first duration of the first video, the calculated duration of the second video is the difference between the first duration of the first video and the duration change value.
[0044] As another implementation of the first aspect of the present application, before adjusting the content of the first video according to the calculated duration of the second video to obtain the second video, the method further includes:
[0045] Determine whether the calculated duration of the second video is within the first range;
[0046] If the calculated duration of the second video is less than the minimum value of the first range, the calculated duration of the second video is updated to the minimum value of the first range;
[0047] If the calculated duration of the second video is greater than the maximum value of the first range, then the calculated duration of the second video is updated to the maximum value of the first range;
[0048] The content of the first video is adjusted according to the calculated duration of the second video to obtain the second video.
[0049] In this application, the calculated duration of the second video may still be unreasonable. Therefore, in this embodiment, the duration of the second video needs to be constrained by the first range to ensure the final film effect. The final second video is made to be within the first range as much as possible.
[0050] As another implementation of the first aspect of the present application, the first video includes one or more sub-segments, each sub-segment corresponds to a parent segment, and each sub-segment is intercepted from the corresponding parent segment;
[0051] The minimum value of the first range is the preset minimum film duration, the maximum value of the first range is the minimum value between the first value and the preset maximum film duration, and the first value is the sum of the durations of the parent segments of the sub-segments in the first video.
[0052] As another implementation of the first aspect of the present application, before displaying the cover of the first video on the first interface, the method further includes:
[0053] Acquiring media materials related to the first keyword from the electronic device;
[0054] Obtain corresponding master clips from various media materials;
[0055] According to the preset minimum film duration and maximum film duration, sub-segments are cut out from each obtained parent segment to generate a first video, and the duration of the first video is greater than or equal to the minimum film duration and greater than or equal to the maximum film duration.
[0056] As another implementation of the first aspect of the present application, the first video includes a first number of sub-segments;
[0057] Adjusting the content of the first video according to the calculated duration of the second video to obtain the second video includes:
[0058] Obtaining a first difference based on the calculated duration of the second video and the first duration;
[0059] Obtaining a theoretical average change duration of each sub-segment in the first video according to the first difference and the first quantity;
[0060] For a first sub-segment, determine whether the theoretical duration of the first sub-segment is within a sub-segment duration interval, where the first sub-segment is any sub-segment in the first video, and the theoretical duration of the first sub-segment is the sum of the original duration of the first sub-segment, the theoretical average change duration, and the difference from the previous sub-segment, where the difference from the previous sub-segment is the difference between the theoretical duration of the previous sub-segment and the actual duration of the previous sub-segment;
[0061] If the theoretical duration of the first sub-segment is within the sub-segment duration interval, the actual duration of the first sub-segment is the theoretical duration of the first sub-segment;
[0062] If the theoretical duration of the first sub-segment is less than the minimum value of the sub-segment duration interval, the actual duration of the first sub-segment is the minimum value of the sub-segment duration interval;
[0063] If the theoretical duration of the first sub-segment is greater than the maximum value of the sub-segment duration interval, the actual duration of the first sub-segment is the maximum value of the sub-segment duration interval;
[0064] Obtaining a difference in the first sub-segment based on the theoretical duration of the first sub-segment and the actual duration of the first sub-segment;
[0065] After obtaining the actual duration of each sub-segment in the first video, the actual duration of each sub-segment is used as the duration of each sub-segment in the first video to obtain a second video, and the second duration of the second video is the sum of the actual durations of each sub-segment.
[0066] In the present application, the film-forming effect of the second video is ensured by averaging the lengths of the various sub-segments in the first video; in order to make the length of the second video as accurate as possible, when there is a difference between the actual length and the theoretical length of a sub-segment, the difference is rolled over to the next segment so that the next segment compensates for the difference, thereby making the final length of the second video closer to the calculated length of the second video.
[0067] As another implementation of the first aspect of the present application, each sub-segment in the first video corresponds to a parent segment, each sub-segment is cut from the corresponding parent segment, and using the actual duration of each sub-segment as the duration of each sub-segment in the first video includes:
[0068] For the first sub-segment, adjust the start time and / or end time of the first sub-segment in the first parent segment to obtain the first sub-segment with adjusted duration. The first parent segment is the parent segment in which the first sub-segment is located. The difference between the adjusted end time and start time of the first sub-segment is the actual duration of the first sub-segment.
[0069] As another implementation of the first aspect of the present application, when the second voice instruction is to adjust the duration of the first video to less than a sixth duration, before obtaining the calculated duration of the second video according to the second voice instruction, the method further includes:
[0070] Determining that the first duration is greater than the sixth duration;
[0071] When the second voice instruction is to adjust the duration of the first video to be greater than a sixth duration, before obtaining the calculated duration of the second video according to the second voice instruction, the method further includes:
[0072] It is determined that the first duration is less than the sixth duration.
[0073] In this application, the length of the first video may itself meet the expected length corresponding to the voice command issued by the user. In this case, the length of the first video is no longer adjusted. If the length of the first video does not meet the expected length corresponding to the voice command issued by the user, the length of the first video is adjusted to obtain the second video.
[0074] In a second aspect, an electronic device is provided, comprising a processor, wherein the processor is configured to call a computer program stored in a memory to implement any one of the methods of the first aspect of the present application.
[0075] In a third aspect, a chip is provided, comprising a processor, wherein the processor is coupled to a memory, and the processor executes a computer program stored in the memory so that the electronic device implements any method of the first aspect of the present application.
[0076] In a fourth aspect, a computer-readable storage medium is provided, which stores a computer program. When the computer instructions are executed on an electronic device, the electronic device implements any one of the methods of the first aspect of the present application.
[0077] In a fifth aspect, an embodiment of the present application provides a computer program product, which, when running on a device, enables the electronic device to execute any one of the methods in the first aspect of the present application.
[0078] It can be understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0079] FIG1 is a schematic diagram of a hardware structure of an electronic device provided in an embodiment of the present application;
[0080] FIG2 is a schematic diagram of an interface for generating a video through a voice assistant provided in an embodiment of the present application;
[0081] FIG3 is a schematic diagram of an interface for adjusting video duration through a voice assistant provided in an embodiment of the present application;
[0082] FIG4 is a schematic diagram of another interface for adjusting the video duration through a voice assistant provided in an embodiment of the present application;
[0083] FIG5 is a schematic diagram of another interface for adjusting the video duration through a voice assistant provided in an embodiment of the present application;
[0084] FIG6 is a schematic diagram of another interface for adjusting the video duration through a voice assistant provided in an embodiment of the present application;
[0085] FIG7 is a schematic diagram of a process for shortening or extending an original video by t1 seconds according to an embodiment of the present application;
[0086] FIG8 is a schematic diagram of a process for adjusting the original video to about t2 seconds according to an embodiment of the present application;
[0087] FIG9 is a schematic diagram of a process for adjusting the original video to be longer or shorter than t3 seconds according to an embodiment of the present application;
[0088] FIG10 is a schematic diagram of a process for calculating the new duration of each segment based on the duration of a new video according to an embodiment of the present application;
[0089] FIG11 is a timing diagram of generating a video through a voice assistant according to an embodiment of the present application;
[0090] Figure 12 is a timing diagram of adjusting the video length through a voice assistant provided in an embodiment of the present application. DETAILED DESCRIPTION
[0091] In the following description, specific details such as specific system structures and technologies are provided for illustration rather than limitation to facilitate a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details.
[0092] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or collections thereof.
[0093] It should also be understood that in the embodiments of this application, "one or more" refers to one, two, or more than two; "and / or" describes the relationship between associated objects, indicating that three relationships can exist; for example, A and / or B can mean: A exists alone, A and B exist simultaneously, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the associated objects are in an "or" relationship.
[0094] In addition, in the description of this application specification and the appended claims, the terms "first", "second", "third", "fourth", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0095] References to "one embodiment" or "some embodiments" in this specification mean that a particular feature, structure, or characteristic described in conjunction with that embodiment is included in one or more embodiments of the present application. Thus, phrases such as "in one embodiment," "in some embodiments," "in other embodiments," and "in other embodiments" appearing in various places in this specification do not necessarily refer to the same embodiment, but rather mean "one or more but not all embodiments," unless otherwise specifically emphasized. The terms "including," "comprising," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.
[0096] The embodiments of the present application provide a method for adjusting video duration. The method can be applied to electronic devices, such as tablet computers, mobile phones, wearable devices, laptop computers, ultra-mobile personal computers (UMPCs), netbooks, and personal digital assistants (PDAs). The embodiments of the present application do not limit the specific type of electronic device.
[0097] Figure 1 shows a schematic diagram of the structure of an electronic device. 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, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display 194, and a subscriber identification module (SIM) card interface 195. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air 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.
[0098] It should be understood that the structures illustrated in the embodiments of the present application do 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 shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0099] 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 can be independent devices or integrated into one or more processors. For example, the processor 110 is used to execute the frame playback method of the video in the embodiment of the present application.
[0100] Processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 110. If processor 110 needs to use the same instruction or data again, it can directly retrieve it from the memory. This avoids duplicate accesses, reduces processor 110 latency, and thus improves system efficiency.
[0101] The internal memory 121 can be used to store computer executable program codes, and the executable program codes include 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 an application required for at least one function (such as an image playback function, etc.). The touch sensor 180K is also called a "touch panel". The touch sensor 180K can be set on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also called a "touch screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass 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 other embodiments, the touch sensor 180K can also be set on the surface of the electronic device 100, which is different from the position of the display screen 194.
[0102] Electronic device 100 implements display functionality through a GPU, display screen 194, and an application processor. The GPU is a microprocessor for image processing that connects display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or modify display information. For example, the process of rendering YUV data in the embodiments of the present application can be implemented using a GPU.
[0103] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active matrix organic light-emitting diode or an active matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1. For example, the interfaces shown in Figure 2 or Figure 3 in the embodiments of the present application are all displayed by the display.
[0104] The embodiments of the present application do not particularly limit the specific structure of the execution subject of a method for adjusting the duration of a video. As long as the code recording the method for adjusting the duration of a video according to the embodiments of the present application can be run to communicate according to the method for adjusting the duration of a video provided by the embodiments of the present application. For example, the execution subject of the method for adjusting the duration of a video provided by the embodiments of the present application can be a functional module in an electronic device that can call and execute a program, or a communication device used in an electronic device, such as a chip.
[0105] Currently, many electronic devices are equipped with cameras, allowing users to take photos and videos. Electronic devices also have communication functions, allowing users to download images and videos from the Internet or retrieve images and videos sent by other electronic devices. Users can edit images and / or videos stored on their electronic devices to create new videos from selected images and / or videos.
[0106] As a scenario example, a user selects 3 videos and 3 pictures in a gallery application, and the gallery application automatically generates a new video based on the selected 3 videos and 3 pictures.
[0107] However, in practice, the length of the generated video may not meet user expectations. For example, some social media apps allow uploading videos up to 15 seconds, but videos generated through gallery apps may be 18 seconds long. Some product exhibition videos require a minimum length of 45 seconds, but videos generated through gallery apps are only 42 seconds long. In these cases, users may need to re-edit the generated video to meet their expectations.
[0108] Furthermore, statistics from a large number of users show that the number of times they used the Gallery app to generate videos in consecutive months was 180,319, 225,494, 198,392, 314,070, and 262,916 times, for an average of approximately 250,000 times per month. Correspondingly, after generating videos through the Gallery app, users used the video editing function to re-edit the resulting videos, thereby changing their duration, 107,844, 137,843, 127,113, 192,141, and 162,929 times, respectively. This translates to an average of approximately 150,000 times per month used to adjust the duration of videos generated by the Gallery app, equivalent to approximately 60% of users making secondary duration adjustments.
[0109] Moreover, in actual investigations, it was found that some users did not make a second adjustment to the video length. It was not because the initial video length met expectations, but because the method of making the second adjustment was more complicated and the user experience was not good.
[0110] In view of this, an embodiment of the present application provides a method for adjusting the length of a video. After generating a video (the video is recorded as the original video), the method can add a certain length or shorten a certain length to the original video according to user instructions to obtain a new video with the changed length; the method can also generate a new video of a specified length based on the original video according to user instructions, or obtain a new video with a length longer than or shorter than the specified length based on the original video according to user instructions.
[0111] For ease of distinction, the video before the duration adjustment will be recorded as the original video (which can be recorded as the first video), and the video after the duration adjustment will be recorded as the new video (which can be recorded as the second video). The duration of the first video is recorded as the first duration, and the duration of the second video is recorded as the second duration.
[0112] The user instructions in the embodiment of the present application can be voice instructions. Therefore, the embodiment of the present application can use the voice assistant or other applications with voice functions provided by the electronic device to call the video editing application through the voice assistant or other applications with voice functions, so as to call the video editing application through the voice instruction and generate a video (recorded as the original video) through the video editing application. The video editing application can also be called through the voice instruction to perform a second time adjustment on the generated original video to obtain a new video.
[0113] The following first describes a scenario diagram of the method for adjusting the video length provided in an embodiment of the present application. The diagram uses the voice assistant of an electronic device as an example to call a video editing application.
[0114] 2 is a schematic diagram of an interface for generating a video through a voice assistant according to an embodiment of the present application;
[0115] Referring to (a) in Figure 2, the user speaks 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 displays the interface shown in (a) in Figure 2 at the same time. In the interface shown in (a) in Figure 2, a voice assistant window 21 is displayed, and the voice assistant window 21 includes the text message "I'm listening, please speak". Of course, the purpose of the voice response and text message is to remind the user that the voice assistant has been awakened, and ask the user to speak a voice command. In actual applications, other voice response content and text message content can also be set according to the situation to play the same reminder role.
[0116] The user responds to the voice "I'm listening, please speak" and / or the text message "I'm listening, please speak", and speaks the voice "Generate a video of the child" within the voice monitoring range of the electronic device. After the electronic device detects the voice "Generate a video of the child", the user's voice message "Generate a video of the child" is displayed in the voice assistant window 21, and the video is generated based on the pictures and videos of the child stored in the electronic device. The material for generating the video can be pictures and / or videos in the gallery application; after the video is successfully generated, a voice "A video of the child has been generated for you" is issued. At the same time, the text content "A video of the child has been generated for you" and the cover of the generated video are displayed in the voice assistant window. The cover displays the play control 22 and the video duration "00:30". The video duration "00:30" indicates that the length of the generated video is 30 seconds. In actual application, the user can click the play control 22 to trigger the electronic device to play the video. This application will no longer use diagrams as examples.
[0117] In a specific implementation, when the electronic device detects the voice "generate a video of a child", it can also identify the "child" in the pictures and / or videos stored in the electronic device. When multiple different "children" are identified, multiple child options can be displayed in the voice assistant window, such as "son", "daughter", etc. The user chooses whether to generate a video based on the identified pictures and videos related to the "son", or to generate a video based on the identified pictures and videos related to the "daughter", or to generate a video based on the identified pictures and videos related to all children (for example, "son" and "daughter"). As an example, the user says "daughter", and after the electronic device detects the voice, the text "Ask you to select materials for your daughter" and the materials related to "daughter" screened out from the electronic device are displayed in the voice assistant window; the user can continue to say "generate video", and then the electronic device generates a video based on the materials related to "daughter" after detecting the voice. This application no longer uses diagrams as examples.
[0118] In this example, the user's voice message for instructing the generation of a video corresponds to a first voice instruction. This voice assistant window can serve as an example of a first interface for displaying the cover of the generated video. Of course, the keyword "child" or "daughter" in this example serves as an example of a first keyword for obtaining media material.
[0119] If the user is not satisfied with the length of the video, the user can continue to speak the voice to perform a second edit on the video and regenerate a video with a different length.
[0120] As an example of adjusting the duration of the original video, referring to FIG3 , when the electronic device displays the interface shown in (b) of FIG2 , the user speaks the voice message “shorten by 4 seconds” within the voice monitoring range of the electronic device. After the electronic device detects the voice message “shorten by 4 seconds”, it displays the user’s voice message “shorten by 4 seconds” in the voice assistant window 21 and adjusts the duration of the original video. After successfully adjusting the duration of the original video, it speaks the voice message “The duration of the video has been adjusted”. At the same time, the voice assistant window displays the text content “The duration of the video has been adjusted” and the cover of the new video. The cover also displays the playback controls 23 and the video duration “00:26”. The video duration “00:26” indicates that the duration of the generated new video is 26 seconds.
[0121] In actual application, the user can also click the play control 23 to trigger the electronic device to play the new video. This application will not use illustrations as examples.
[0122] As an example of adjusting the duration of the original video, referring to FIG4 , when the electronic device displays the interface shown in (b) of FIG2 , the user speaks the voice message “adjust to 35 seconds” within the voice monitoring range of the electronic device. After the electronic device detects the voice message “adjust to 35 seconds”, it displays the user’s voice message “adjust to 35 seconds” in the voice assistant window 21 and adjusts the duration of the original video. After successfully adjusting the duration of the original video, it speaks the voice message “The duration of the video has been adjusted”. At the same time, the voice assistant window displays the text content “The duration of the video has been adjusted” and the cover of the new video. The cover also displays the playback controls 24 and the video duration “00:35”. The video duration “00:35” indicates that the duration of the generated new video is 35 seconds.
[0123] In actual application, the user can also click the play control 24 to trigger the electronic device to play the new video. This application will not use illustrations as examples.
[0124] As an example of adjusting the duration of the original video, referring to FIG5 , when the electronic device displays the interface shown in (b) of FIG2 , the user speaks the voice message “adjust to more than 33 seconds” within the voice monitoring range of the electronic device. After the electronic device detects the voice message “adjust to more than 33 seconds”, it displays the user’s voice message “adjust to more than 33 seconds” in the voice assistant window 21 and adjusts the duration of the original video. After successfully adjusting the duration of the original video, it speaks the voice message “The duration of the video has been adjusted”. At the same time, the voice assistant window displays the text “The duration of the video has been adjusted” and the cover of the new video. The cover also displays the playback controls 25 and the video duration “00:35”. The video duration “00:35” indicates that the duration of the generated new video is 35 seconds.
[0125] In actual application, the user can also click the play control 25 to trigger the electronic device to play the new video. This application will not use illustrations as examples.
[0126] As an example of adjusting the duration of the original video, referring to FIG6 , when the electronic device displays the interface shown in (b) in FIG2 , the user speaks the voice "adjust to more than 30 minutes" within the voice monitoring range of the electronic device. After the electronic device detects the voice "adjust to more than 30 minutes", it displays the user's voice message "adjust to more than 30 minutes" in the voice assistant window 21 and adjusts the duration of the original video. In actual applications, the ability of electronic devices to adjust videos is limited. For example, the duration of the new video after adjustment is at least 1 second and at most 90 seconds. Therefore, when the electronic device determines that it cannot adjust the video length according to the user's instructions, it can calculate the video length that can be adjusted. After calculating the video length that can be adjusted (for example, 90 seconds), it issues a voice reminder "To ensure the film effect, it can be adjusted to 90 seconds at most. It has been adjusted to 90 seconds for you". At the same time, the text content "To ensure the film effect, it can be adjusted to 90 seconds at most. It has been adjusted to 90 seconds for you" and the cover of the new video are displayed in the voice assistant window. The cover also displays the playback controls 26 and the video length "00:90". The video length "00:90" indicates that the length of the generated new video is 90 seconds.
[0127] In actual application, the user can also click the play control 26 to trigger the electronic device to play the new video. This application will not use illustrations as examples.
[0128] In the above example, the voice message sent by the user to instruct to adjust the length of the video corresponds to the second voice command. The generated new video is also displayed in the voice assistant window.
[0129] The above embodiments all use the user instruction in the form of voice to trigger the electronic device to adjust the duration of the original video. As another embodiment of the present application, the user instruction can also be an instruction generated by the user through the adjustment method options and adjustment duration options provided on the interface. As an example, the adjustment method options "extend duration", "shorten duration", "adjust to duration", "adjust to above duration" and "adjust to below duration" can be set. Each adjustment method option corresponds to a different duration option. For example, the duration option can be an option from 1 second to 90 seconds. This method does not require the participation of a voice assistant, but it is necessary to set up an adjustment interface. The subsequent embodiments of this application are all described using the user instruction as voice as an example.
[0130] The above example describes three types of duration adjustment methods: Type 1: shortening (or extending) t1 seconds, Type 2: adjusting to t2 seconds, and Type 3: adjusting to more than (or less than) t3 seconds. In the subsequent embodiments of this application, each number is described in seconds. In actual applications, other time units can also be used.
[0131] The following first describes the duration adjustment method for type 1 (shortening (or extending) t1 seconds). When the electronic device detects that the user's voice contains the word "extend" or "shorten" and also contains time-related information, the electronic device determines that the duration adjustment method is type 1. Of course, "extend" and "shorten" are only examples. In actual applications, "increase", "increase", "decrease", "decrease", or "shrink" can also be used.
[0132] In an embodiment of the present application, when generating a new video of a different duration based on an original video, the material is not reselected to regenerate a completely new video. Instead, the duration of each segment that makes up the original video is adjusted based on the original video, thereby generating a new video based on the segments with adjusted duration.
[0133] When the user's instruction is to extend or shorten t1, the user's desired duration for the new video is the original video duration plus or minus t1. For example, when the user's instruction is to extend t1, the desired duration for the new video is the original video duration plus t1; when the user's instruction is to shorten t1, the desired duration for the new video is the original video duration minus t1. For ease of description, this embodiment of the application denotes the desired duration of the new video as dnewtotaltime.
[0134] To ensure the quality of the new video, the difference between the original video's duration and the new video's duration is set to be within 30% of the expected duration of the new video. That is, the difference in duration is less than or equal to dnewtotaltime*30%. This avoids excessive changes in the original video's duration, which could affect the quality of the new video.
[0135] For example, if the original video duration is 30 seconds and the extended duration t1 is 10 seconds, the expected duration of the new video dnewtotaltime is 40 seconds. The error duration change must be less than or equal to dnewtotaltime * 30%. This means the adjusted duration must be less than or equal to 12 seconds, and the duration of the new video must be between 0 and 12 seconds compared to the original, resulting in a duration range of 30 to 42 seconds.
[0136] In addition, to further ensure the quality of the new video, the time difference between the new video and the original video cannot be infinitely large or infinitely small. Therefore, the embodiment of the present application also sets a time difference of at least 3 seconds and at most 6 seconds compared to the original video. That is, the range of the ability duration change is [3,6].
[0137] Combining the above two constraints: the maximum value of the error duration change and the range of the ability duration change, it is determined that when the original video length is 30 seconds and the extended duration t1 is extended by 10 seconds, the ability duration changes to 6 seconds, and the determined new video length is 36 seconds.
[0138] The specific implementation process of the duration adjustment method is described in detail below.
[0139] In this application, the extension or shortening duration is constrained by the above two extension or shortening deviation constraints, so as to determine the specific change duration; then, the duration of the new video can be obtained based on the duration of the original video and the change duration.
[0140] The following describes a flow chart of the corresponding duration adjustment method of type one through FIG7 .
[0141] S101, calculating the maximum value of the error duration change dnewtotaltime*k1% based on the duration of the original video oldtotaltime and t1 in the user instruction.
[0142] When the instruction is to extend, the maximum value of the error duration change is (oldtotaltime+t1)*k1%. When the instruction is to shorten, the maximum value of the error duration change is (oldtotaltime-t1)*k1%.
[0143] S102 , determining a duration variation range based on the relationship between dnewtotaltime*k1% and the capability duration variation interval [a1, b1].
[0144] In the embodiment of the present application, there are equivalent to two duration variation ranges, one is the error duration variation range: 0 to dnewtotaltime*k1%; the other is the capability duration variation interval [a1, b1].
[0145] When determining the final duration variation range, the intersection of the two duration variation ranges can be calculated; however, in actual applications, the two duration variation ranges may not have an intersection. For example, when dnewtotaltime*30% is less than a1 seconds, the duration variation range has only one value, a1 seconds. Based on the above principle, we can obtain:
[0146] If dnewtotaltime*k1% is less than a1 seconds, the duration variation range is determined to be a1 seconds.
[0147] If dnewtotaltime*k1% is greater than b1 seconds, the duration is determined to be changed from a1 to b1 seconds.
[0148] If dnewtotaltime*k1% is within the capability duration variation interval [a1,b1], the duration variation range is determined to be from a1 to dnewtotaltime*k1%.
[0149] S103 , determining a duration change value Δt according to a relationship between t1 and a duration change range.
[0150] If t1 is within the duration variation range, the duration variation value Δt is t1;
[0151] If t1 is less than the minimum value of the duration variation range, then the duration variation value Δt is the minimum value of the duration variation range;
[0152] If t1 is greater than the maximum value of the duration variation range, then the duration variation value Δt is the maximum value of the duration variation range;
[0153] S104, obtaining a new video duration newtotaltime according to the original video duration and the duration change value.
[0154] Similarly, when the instruction is to extend, newtotaltime = oldtotaltime + Δt. When the instruction is to shorten, newtotaltime = oldtotaltime - Δt.
[0155] In the above example, k1% in the error duration variation is 30% for this example only. In actual applications, it can be set to other values, such as 25%, 35%, etc. a1 and b1 in the capability duration variation range are also only examples. In actual applications, a1 can be 1, 2, 4, 5, etc., and b1 can be 8, 10, 15, etc. For a clearer understanding of the specific calculation process, refer to the multiple examples in Table 1.
[0156] Table 1 shows the process of obtaining the length of a new video.
[0157] In practical applications, the maximum value of the error duration change (oldtotaltime*30%) can also be calculated based on the original video duration (oldtotaltime). Table 2 shows the process of obtaining the new video duration using oldtotaltime*30% as the maximum value of the error duration change.
[0158] Table 2: The process of obtaining the new video duration by taking oldtotaltime*30% as the maximum value of the error change duration
[0159] The following describes the second type of duration adjustment method (adjust to t2 seconds). When the electronic device detects that the user's voice contains "adjust to" and also contains time-related information, the electronic device determines that the duration adjustment method is type 2. Of course, "adjust to" is only an example. In actual applications, it can also be "change to," "change to," "extend to," "reduce to," "increase to," "decrease to," or "around," etc.
[0160] In an embodiment of the present application, when generating a new video of a different duration based on an original video, the material is not reselected to regenerate a completely new video. Instead, the duration of each segment that makes up the original video is adjusted based on the original video, thereby generating a new video based on each segment with adjusted duration, so that the duration of the generated new video is as close to t2 as possible.
[0161] To ensure the quality of the new video, the difference between the original video's duration and the new video's duration is set to be within 15% of the duration t2 specified by the user, that is, the error duration change is less than or equal to t2*15%. This avoids excessive changes in the original video's duration, which could affect the quality of the new video.
[0162] For example, if the duration t2 is 30 seconds, the error duration change is less than or equal to 4.5 seconds, and the duration of the new video changes from 25.5 seconds to 34.5 seconds. If the duration t2 is 32 seconds, the error duration change is less than or equal to 4.8 seconds, and the duration of the new video changes from 25.2 seconds to 34.8 seconds.
[0163] In addition, to further ensure the quality of the new video, the time difference between the new video and the original video cannot be infinitely large or infinitely small. Therefore, the embodiment of the present application also sets a time difference of at least 3 seconds and at most 10 seconds compared to the original video. That is, the range of the ability duration change is [3, 10].
[0164] In this application, the change duration is constrained by the above two duration change constraints, so as to determine the specific change duration; then, the duration of the new video can be obtained based on the duration of the original video and the change duration.
[0165] The specific implementation process of the duration adjustment method is described in detail below.
[0166] The following describes a flow chart of the duration adjustment method corresponding to type 2 with reference to FIG8 .
[0167] S201 , calculating the maximum value t2*k2% of the error duration change according to the duration t2 carried in the user instruction.
[0168] S202 , determining a duration variation range based on the relationship between t2*k2% and the capability duration variation interval [a2, b2].
[0169] If t2*k2% is less than a2 seconds, the duration variation range is determined to be a2 seconds.
[0170] If t2*k2% is greater than b2 seconds, the duration is determined to change from a2 to b2 seconds.
[0171] If t2*k2% is within the capability duration variation interval [a2, b2], the duration variation range is determined to be from a2 to t2*k2%.
[0172] S203 : Determine a duration change value Δt according to a relationship between an absolute value of a difference between t2 and the original video duration oldtotaltime and a duration change range.
[0173] If |t2-oldtotaltime| is within the duration change range, then the duration change value Δt is |t2-oldtotaltime|;
[0174] If |t2-oldtotaltime| is less than the minimum value of the duration variation range, then the duration variation value Δt is the minimum value of the duration variation range;
[0175] If |t2-oldtotaltime| is greater than the maximum value of the duration variation range, the duration variation value Δt is the maximum value of the duration variation range.
[0176] S204: Obtain a new video duration newtotaltime based on the original video duration and the duration change value.
[0177] When t2-oldtotaltime is greater than 0, newtotaltime=oldtotaltime+Δt.
[0178] When t2-oldtotaltime is less than 0, newtotaltime=oldtotaltime-Δt.
[0179] In the above example, k2% in the error duration change is 15% for this example only. In actual applications, it can be set to other values, such as 20%, 25%, 30%, 35%, etc. a2 and b2 in the capability duration change interval are also only examples. In actual applications, a2 can be 1, 2, 4, 5, etc., and b2 can be 6, 8, 12, 15, etc. For a clearer understanding of the specific calculation process, refer to the process for calculating the new video duration shown in Table 3.
[0180] Table 3 The process of calculating the length of a new video
[0181] In practical applications, the maximum value of the duration change (oldtotaltime*15%) can also be calculated based on the original video duration (oldtotaltime). Table 4 shows the process of obtaining the new video duration using oldtotaltime*15% as the maximum value of the error duration change.
[0182] Table 4 The process of calculating the new video duration using oldtotaltime*15% as the maximum error change duration
[0183] The following describes the duration adjustment method of type three (adjusting to more than or less than t3 seconds). When the electronic device detects that the user's voice contains "adjust to" or "above", or "adjust to" or "below", and also contains time-related information, the electronic device determines that the duration adjustment method is type three. Of course, "adjust to" is only an example. In actual applications, it can also be "change to", "change to", "extend to", "reduce to", "increase to", "decrease to", etc.
[0184] In an embodiment of the present application, when generating a new video of a different duration based on an original video, the material is not reselected to regenerate a completely new video. Instead, the duration of each segment that makes up the original video is adjusted based on the original video, thereby generating a new video based on each segment with adjusted duration, so that the duration of the generated new video is as close to t3 as possible.
[0185] To ensure the quality of the new video, the difference between the original video's duration and the new video's duration is set to be within 30% of the duration t3 specified by the user, that is, the error duration change is less than or equal to t3*30%. This avoids excessive changes in the original video's duration, which would affect the quality of the new video.
[0186] As an example, when the duration t3 is 30 seconds, the error duration change is less than or equal to 9 seconds, and the duration change range of the new video is between 21 seconds and 39 seconds.
[0187] In addition, to further ensure the quality of the new video, the time difference between the new video and the original video cannot be infinitely large or infinitely small. Therefore, the embodiment of the present application also sets a time difference of at least 5 seconds and at most 15 seconds compared to the original video. That is, the range of the ability duration change is [5,15].
[0188] In this application, the change duration is constrained by the above two duration change constraints, so as to determine the specific change duration; then, the duration of the new video can be obtained based on the duration of the original video and the change duration.
[0189] The following describes a schematic flow chart of the duration adjustment method corresponding to type three through FIG9 .
[0190] S301 , calculating the maximum value t3*k3% of the error duration change according to the duration t3 carried in the user instruction.
[0191] S302: Determine whether the original video length meets the user instruction.
[0192] In the embodiment of the present application, the user voice can correspond to the user instruction.
[0193] For example, if the user voice is "adjust to more than 45 seconds", the user instruction is greater than 45 seconds; if the user voice is "adjust to less than 45 seconds", the user instruction is less than 45 seconds.
[0194] If the original video is 30 seconds long and the user specifies a duration greater than 45 seconds, the original video does not meet the user's requirements and a new video needs to be generated.
[0195] If the original video duration is 30 seconds and the user instruction is less than 45 seconds, then the original video duration meets the user instruction. In this case, there is no need to generate a new video.
[0196] S303: If the duration of the original video meets the user's instruction, the process ends and returns information indicating that the original video meets the requirement.
[0197] S304: If the duration of the original video does not meet the user instruction, the duration variation range is determined according to the relationship between t3*k3% and the capability duration variation interval [a3, b3].
[0198] If t3*k3% is less than a3 seconds, the duration variation range is determined to be a3 seconds.
[0199] If t3*k3% is greater than b3 seconds, the duration is determined to change from a3 to b3 seconds.
[0200] If t3*k3% is within the capability duration variation interval [a3, b3], the duration variation range is determined to be from a3 to t3*k3%.
[0201] S305 , determining a duration change value Δt according to a relationship between the absolute value of the difference between t3 and the original video duration oldtotaltime and the duration change range.
[0202] If |t3-oldtotaltime| is within the duration change range, then the duration change value Δt is |t3-oldtotaltime|;
[0203] If |t3-oldtotaltime| is less than the minimum value of the duration variation range, then the duration variation value Δt is the minimum value of the duration variation range;
[0204] If |t3-oldtotaltime| is greater than the maximum value of the duration variation range, then the duration variation value Δt is the maximum value of the duration variation range;
[0205] S306: Obtain a new video duration newtotaltime based on the original video duration and the duration change value.
[0206] When t3-oldtotaltime is greater than 0, newtotaltime=oldtotaltime+Δt.
[0207] When t3 - oldtotaltime is less than 0, newtotaltime = oldtotaltime - Δt.
[0208] In the above example, k3% in the error duration variation is only an example. In actual applications, it can be set to other values, such as 25%, 35%, etc. a3 and b3 in the capability duration variation range are also only examples. In actual applications, a3 can be 1, 2, 4, 5, etc., and b3 can be 6, 8, 10, 12, 15, etc. For a clearer understanding of the specific calculation process, refer to the multiple examples in Table 5.
[0209] Table 5 shows the process of obtaining the new video duration.
[0210] In practical applications, the maximum value of the duration change (oldtotaltime*30%) can also be calculated based on the original video duration (oldtotaltime). Table 6 shows the process of obtaining the new video duration using oldtotaltime*30% as the maximum value of the error duration change.
[0211] Table 6 shows the process of obtaining the new video duration by taking oldtotaltime*30% as the maximum value of the error change duration.
[0212] It can be understood from the above three strategies that no matter which strategy is used, the duration of the new video newtotaltime needs to be calculated based on the user's voice information and the duration of the original video. This duration can be recorded as the calculated duration of the new video.
[0213] In the process of calculating the duration of the new video, newtotaltime, it is necessary to first determine the expected duration change between the new video and the original video based on the user's voice information, for example, t1, |t2-oldtotaltime|, |t3-oldtotaltime|; then obtain the duration change constraint (i.e., the duration change range determined by the two constraints in the above example); then, based on the expected duration change and the duration change constraint, determine the duration change value Δt; finally, based on the duration of the original video and the duration change value Δt, determine the calculated duration of the new video. Among them, t1 is recorded as the third duration, t2 is recorded as the fourth duration, and t3 is recorded as the fifth duration.
[0214] Of course, the range of error duration change can be recorded as the first duration change constraint, the first minimum value of the first duration change constraint is 0, and the first duration change constraint is the first percentage (for example, 15%, 30% in the above example, etc.) of the user's expected duration of the new video (for example, dnewtotaltime, t2 and t3); the capability duration change interval is recorded as the second duration change constraint, and the second maximum value and the second minimum value in the second duration change constraint are pre-set, for example, the maximum value and minimum value in any capability change interval in the above example.
[0215] As mentioned above, the duration of the new video can be obtained according to the method in the above embodiment. The following describes how to adjust the duration of each segment in the original video according to the duration of the new video through Figure 10.
[0216] S401: Determine whether the duration of the new video is within [1, min(n, 90)], where n is the maximum duration obtained based on the media material used to generate the original video. [1, min(n, 90)] can be recorded as a first range.
[0217] In the embodiment of the present application, when generating the original video, the media material used to generate the original video is sliced to obtain multiple highlight segments. A portion of each or part of the highlight segments is then cut to generate the original video. n is the sum of the durations of the multiple highlight segments obtained.
[0218] As an example, when generating the original video, 6 media materials are selected. These media materials are original pictures and / or original videos that match the keywords in the user's voice and are searched from the gallery by the voice assistant based on the keywords in the user's voice. By analyzing the media materials, highlight clips corresponding to each media material are obtained. The durations of these 6 highlight clips are 2 seconds, 23 seconds, 4 seconds, 8 seconds, 23 seconds and 1 second respectively. When generating the original video, the first 5 highlight clips are used, and clips of 1 second, 11.5 seconds, 2 seconds, 4 seconds and 11.5 seconds are selected from the first 5 highlight clips to form the original video. Therefore, the duration of the original video is 30 seconds. Among them, n is the total duration of the 6 highlight clips (61 seconds) or the total duration of the 5 highlight clips used to generate the original video (60 seconds). Among them, the clips of 1 second, 11.5 seconds, 2 seconds, 4 seconds and 11.5 seconds selected from the first 5 highlight clips can also be recorded as sub-segments. Each sub-segment has a corresponding highlight segment, and each sub-segment is obtained from the corresponding highlight segment. Of course, a picture can also correspond to a highlight segment. For example, a video segment of a certain length is generated based on the content of the picture, and the video segment is also a highlight segment.
[0219] In practical applications, the value of n can be set according to the situation. Of course, when generating the original video, it can also be set to cut out part or all of each highlight segment to generate the original video, and this embodiment of the application does not limit this.
[0220] In addition, 1 and 90 in [1, min(n, 90)] are just examples, and in actual applications, they can be set to other values.
[0221] S402: If the duration of the new video is less than 1, a prompt message is issued, the duration of the new video is determined to be 1 second, and S404 is executed.
[0222] S403: If the duration of the new video is greater than min(n, 90), the duration of the new video is determined to be min(n, 90), and S404 is executed.
[0223] For example, when min(n, 90) is 90, the original video is adjusted according to the length of the new video, which is 90 seconds, to obtain a new video; when min(n, 90) is n, the original video is adjusted according to the length of the new video, which is n seconds, to obtain a new video.
[0224] S404: If the new video duration is within [1, min(n, 90)], the theoretical average change duration of each segment is obtained based on the new video duration, the original video duration, and the number of segments in the original video (which can be recorded as the first number).
[0225] For example, the theoretical average change duration Averagetime of each segment is equal to the difference between the new video duration newtotaltime and the original video duration oldtotaltime (recorded as the first difference) divided by the number of segments m in the original video.
[0226] That is, Averagetime=(newtotaltime-oldtotaltime) / m.
[0227] For each segment in the original video, S405 and subsequent steps are executed to determine the new duration of each segment.
[0228] S405, for each fragment (can also be recorded as the first sub-fragment), determine whether the sum of the original fragment length oldfragmenttime (indicating the length of the sub-fragment in the original video, not the length of the highlight fragment where the sub-fragment is located), the theoretical average change length Averagetime, and the difference of the previous fragment is within the set fragment length range.
[0229] That is, determine whether (oldfragmenttimei+Averagetimei+difference(i-1)) is within the fragment duration interval.
[0230] The difference of each fragment is the difference between the theoretical duration of the fragment and the calculated actual duration newfragmenttimei. The theoretical duration of the fragment is the sum of the original duration oldfragmenttime of the fragment, the theoretical average change duration Averagetime and the difference of the previous sub-fragment.
[0231] In practice, the maximum length of a video clip is 12 seconds; the maximum length of an image clip is 7 seconds. The minimum length for both video and image clips is 0.5 seconds. Furthermore, for the first clip, the difference from the previous clip is 0.
[0232] That is, the video segment duration interval is [0.5, 12], that is, the video segment duration interval is [0.5, 7]. Of course, the 0.5, 7, and 12 in this example are only examples; in actual applications, other values can also be used. For ease of description, the segment duration interval is [a4, b4].
[0233] S406, if the sum of the original duration of the segment, the theoretical average change duration, and the difference of the previous segment is within the set segment duration range, then the new duration of the segment is determined to be the sum of the original duration of the segment, the theoretical average change duration, and the difference of the previous segment, and the difference of this segment is determined to be 0.
[0234] That is, when (oldfragmenttimei+Averagetimei+difference(i-1)) is within [a4, b4], newfragmenttimei=oldfragmenttimei+Averagetimei+difference(i-1).
[0235] S407, if the sum of the original duration of the segment, the theoretical average change duration, and the difference of the previous segment is less than the lower limit of the segment duration interval, then the new duration of the segment is determined to be the lower limit of the segment duration interval, and the difference of this segment is calculated as the sum of the original duration of the segment, the theoretical average change duration, and the difference of the previous segment minus the determined new duration of the segment.
[0236] That is, when (oldfragmenttimei+Averagetimei+difference(i-1)) is less than a4, newfragmenttimei=a4, difference i=oldfragmenttimei+Averagetimei+difference(i-1)-newfragmenttimei.
[0237] S408, if the sum of the original duration of the segment, the theoretical average change duration, and the difference of the previous segment is greater than the upper limit of the segment duration interval, then the new duration of the segment is determined to be the upper limit of the segment duration interval, and the difference of this segment is calculated as the sum of the original duration of the segment, the theoretical average change duration, and the difference of the previous segment minus the determined new duration of the segment.
[0238] That is, when (oldfragmenttimei+Averagetimei+difference(i-1)) is greater than b4, newfragmenttimei=b4, difference i=oldfragmenttimei+Averagetimei+difference(i-1)-newfragmenttimei.
[0239] In this way, after obtaining the new duration of each segment, the content of each segment is adjusted according to the new duration of each segment, and a new video is generated based on each segment with the adjusted content.
[0240] The following two examples describe the process of generating a new video based on the original video clips after calculating the duration of the new video.
[0241] Table 7: The original video is 30 seconds long, the new video is 35 seconds long, and the original video has 5 segments. The theoretical average increase in the length of each segment is 1 second.
[0242] Table 7 The process of calculating the new duration of each segment
[0243] When calculating the new duration of segment 1, the original duration of the segment plus the theoretical average increase in duration plus the difference from the previous segment equals 2. 2 is determined to be within the upper and lower limits; therefore, the new duration is 2, and the difference equals the original duration of the segment plus the theoretical average increase in duration plus the difference from the previous segment minus the determined new duration, which equals 0.
[0244] When calculating the new duration of segment 2, the original duration of the segment plus the theoretical average increase in duration plus the difference from the previous segment equals 12.5. It is determined that 12.5 is not within the upper and lower limits and is greater than the upper limit of 12. Therefore, the new duration is 12, and the difference is equal to the original duration of the segment plus the theoretical average increase in duration plus the difference from the previous segment minus the determined new duration of the segment, which equals 0.5.
[0245] When calculating the new duration of segment 3, the original duration of the segment plus the theoretical average increase in duration plus the difference from the previous segment equals 3.5. 3.5 is determined to be within the upper and lower limits; therefore, the new duration is 3.5, and the difference equals the original duration of the segment plus the theoretical average increase in duration plus the difference from the previous segment minus the determined new duration of the segment, which equals 0.
[0246] When calculating the new duration of segment 4, the original duration of the segment plus the theoretical average increase in duration plus the difference from the previous segment equals 5. 5 is determined to be within the upper and lower limits; therefore, the new duration is 5, and the difference equals the original duration of the segment plus the theoretical average increase in duration plus the difference from the previous segment minus the determined new duration of the segment, which equals 0.
[0247] When calculating the new duration of segment 5, the original duration of the segment plus the theoretical average increase in duration plus the difference from the previous segment equals 12.5. It is determined that 12.5 is not within the upper and lower limits and is greater than the upper limit of 12. Therefore, the new duration is 12, and the difference is equal to the original duration of the segment plus the theoretical average increase in duration plus the difference from the previous segment minus the determined new duration, which equals 0.5.
[0248] Therefore, if the original length of the video composed of the above 5 clips is 30 seconds, and the length of the new video calculated according to the corresponding strategy is 35 seconds, the final length of the new video is 34.5 seconds, and the difference is 0.5 seconds.
[0249] Table 8: The original video is 30 seconds long, the new video is 25 seconds long, and the original video has 5 segments. The theoretical average reduction in the length of each segment is -1 second.
[0250] Table 8 The process of calculating the new duration of each segment
[0251] When the average increased duration is negative, it means that the duration of the original video is shortened.
[0252] When calculating the new duration of segment 1, the original duration of the segment plus the theoretical average increase in duration + the difference from the previous segment equals 0. It is determined that 0 is not within the upper and lower limits and is less than 0.5; therefore, the new duration of the segment is 0.5, and the difference equals the original duration of the segment plus the theoretical average increase in duration plus the difference from the previous segment minus the determined new duration, which equals -0.5.
[0253] When calculating the new duration of segment 2, the original duration of the segment plus the theoretical average increase in duration plus the difference from the previous segment equals 10. 10 is determined to be within the upper and lower limits; therefore, the new duration is 10, and the difference equals the original duration of the segment plus the theoretical average increase in duration plus the difference from the previous segment minus the determined new duration, which equals 0.
[0254] When calculating the new duration of segment 3, the original duration of the segment plus the theoretical average increase in duration plus the difference from the previous segment equals 1. 1 is determined to be within the upper and lower limits; therefore, the new duration is 1, and the difference equals the original duration of the segment plus the theoretical average increase in duration plus the difference from the previous segment minus the determined new duration, which equals 0.
[0255] When calculating the new duration of segment 4, the original duration of the segment plus the theoretical average increase in duration plus the difference from the previous segment equals 3. 3 is determined to be within the upper and lower limits; therefore, the new duration is 3, and the difference equals the original duration of the segment plus the theoretical average increase in duration plus the difference from the previous segment minus the determined new duration, which equals 0.
[0256] When calculating the new duration of segment 5, the original duration of the segment plus the theoretical average increase in duration plus the difference from the previous segment equals 10.5. 10.5 is determined to be within the upper and lower limits; therefore, the new duration is 10.5, and the difference equals the original duration of the segment minus the theoretical average increase in duration + the difference from the previous segment minus the determined new duration, which equals 0.
[0257] Therefore, if the original length of the video composed of the above 5 clips is 30 seconds, and the length of the new video calculated according to the corresponding strategy is 25 seconds, the final length of the new video is 25 seconds, and the difference is 0 seconds.
[0258] By using the circular rolling difference method in the above example, the duration of each segment can be balanced, so that the duration of the final video is closer to the calculated new duration of the video.
[0259] Through the above process of obtaining a new video, it can be understood that the new video and the original video are both obtained based on the same media material. Of course, since it is necessary to extract highlight segments (recorded as parent segments) from the media material before generating the video, the new video and the original video are both generated based on the same highlight segments. The difference is that the original video: a part or all of the segments are again extracted from each highlight segment (of course, they can also be recorded as sub-segments) to generate the original video; the new video: according to the position of these sub-segments in the corresponding highlight segment, the duration of these sub-segments is extended or shortened, and each sub-segment after the duration is extended or shortened generates a new video. Of course, the content and duration of some sub-segments in the new video and the old video may not change. Based on the above description, the new video contains part or all of the content of the original video, and the content of the second video is related to the content of the first video.
[0260] To make the execution process of the steps in the above flowchart more clear, the following first describes the timing diagram of the electronic device generating a video related to the child after detecting the user's "generate child video" through Figure 11. This timing diagram corresponds to (b) in Figure 2.
[0261] S501: The voice assistant detects the user's voice.
[0262] In the embodiment of the present application, the user voice may be "generate a video of the child".
[0263] S502: The voice assistant obtains a video generation instruction based on the voice information corresponding to the user's voice.
[0264] In this embodiment of the present application, after the voice assistant detects the user's voice, it can first generate text information based on the user's voice, and then extract the keywords "generate", "child", and "video" from the text information to obtain a video generation instruction. The voice assistant can determine the material types "picture" and "video" based on the keyword "video", and can also determine the content identifier "child" based on the keyword "child". The material type and content identifier are carried in the video generation instruction.
[0265] Of course, in actual applications, after the voice assistant generates text information based on the user's voice, the text "Generate child's video" can be displayed in the voice assistant window.
[0266] S503: The voice assistant sends a video generation instruction to the media processing station 1.
[0267] S504: After receiving the video generation instruction, the media processing center 1 collects media materials related to the instruction from the electronic device.
[0268] For example, the video generation instruction carries the material types "picture" and "video," and also carries the content identifier "child." The media processing center 1 determines that the materials to be searched are pictures and videos based on the material types "picture" and "video," and determines that the search targets pictures and videos with the content identifier "child" based on the content identifier "child."
[0269] Of course, in actual applications, primary content tags and secondary content tags can be set for videos and pictures. The secondary content tags of the primary content tag "child" can include "daughter" and "son".
[0270] In addition, the electronic device may set a maximum number of media materials (eg, 30) for each video generation, that is, the maximum number of media materials collected when generating a video is 30.
[0271] S505: The media processing platform 1 sends the searched media material and theme (the content identifier itself or the theme determined according to the content identifier) to the light editing service.
[0272] As an example, the theme may be the content identifier “children” or the theme “children” determined by the content identifier “children.” Of course, the method of determining the theme is only an example.
[0273] A light editing service may be an example of a video editing application.
[0274] S506: After receiving the media material and theme, the light editing service obtains the configuration file.
[0275] In the embodiment of the present application, the configuration file defines each node in the film-forming module that needs to be created, and subsequently, the video can be generated through each node in the film-forming module.
[0276] 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.
[0277] Among them, the template acquisition node is used to obtain template materials; the theme matching node is used to find templates that match the theme from the template materials; the template parsing node is used to parse the template that matches the theme; the music parsing node is used to parse the rhythm points in the template, and the music loading node is used to match the rhythm points in the music with the rhythm points in the template; the special effects node is used to generate special effects; the cover generation node is used to generate video cover, and the duration adjustment node is used to calculate the duration of the new video when the second film is formed and adjust the duration of each clip in the original video to obtain a new video.
[0278] It can be understood that there is a specific processing order between these nodes.
[0279] S507, the light editing service creates a film module (and each node therein) according to the configuration file.
[0280] In this step, you can temporarily not create the adjustment duration node, and then create the adjustment duration node when you need to adjust the video duration. Of course, in actual applications, you can also set the configuration file not to include the adjustment duration node.
[0281] S508, after creating the film-making module, the light editing service sends the media materials and themes to the film-making module.
[0282] S509: After receiving the media material and theme, the film forming module sends the media material to the media processing center 2.
[0283] In the embodiment of the present application, the media processing middle platform 1 and the media processing middle platform 2 can be two media processing platforms, or they can be different functional modules in the same media processing platform.
[0284] S510: After receiving the media material, the media processing station 2 extracts the highlight segment from the media material.
[0285] In this application, the highlight clip can be a relatively exciting picture clip captured by the media processing center 2 from the media material. Multiple conditions can be used as reference standards when capturing, such as the composition ratio, the proportion of characters, etc.
[0286] One or more highlight segments may be captured from each media material, or highlight segments may be captured from part of the media material, which is not limited in this embodiment of the present application.
[0287] S511, the media processing center 2 sends the captured highlight segment to the film forming module.
[0288] S512: After receiving the highlight segment, the video module obtains the model of the video through each node.
[0289] Corresponding to each created node, the template acquisition node acquires the template material; the theme matching node searches for the template that matches the theme from the template material; the template parsing node parses the template that matches the theme; the music parsing node parses the rhythm points in the template; the music loading node matches 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 new video data is obtained after processing by the above nodes.
[0290] This process is only an example. In actual applications, different nodes, or more or fewer nodes, can be set. Regardless of which nodes are used, the film module can obtain video data through these nodes.
[0291] In addition, when generating the original video, it is also necessary to be within the preset minimum film length and the preset maximum film length. When the total duration of the highlight segments is greater than 90 seconds, it is necessary to extract a portion of the segments from each highlight segment (the segments can also be recorded as sub-segments) to generate the original video. Similarly, when the total duration of the highlight segments is less than 1 second, it is necessary to generate the original video based on each highlight segment. When generating the original video, extend the duration of each highlight segment so that the duration of the original video is as close to 1 second as possible. When the total duration of the highlight segments is greater than or equal to 1 second and less than or equal to 90 seconds, the original video can be generated directly based on each highlight segment.
[0292] S513, the film-forming module sends the video data to the light editing service.
[0293] S514: After receiving the video data, the light editing service converts the video data into a video json file.
[0294] In this application, the video data is relatively large and contains a lot of information. The video data can be converted into a json file with smaller data volume for easy transmission.
[0295] S515, the light editing service sends the video json file to the media processing center 1.
[0296] S516: After receiving the video json file, the media processing station 1 sends the video json file to the voice assistant.
[0297] S517, after the voice assistant receives the video json file, the text "A video of your child has been generated for you" and the video cover are displayed in the voice assistant window.
[0298] As another embodiment of the present application, between step S504 and step S505, the following steps are further included:
[0299] S518, after collecting media materials related to the instruction, the media processing center 1 sends a confirmation request to the voice assistant, and the confirmation request includes multiple material options.
[0300] In an embodiment of the present application, when the electronic device detects the voice "generate video of children", it can also identify the "children" in the pictures and / or videos stored in the electronic device. When multiple different "children" are identified, a confirmation request can be sent to the voice assistant. For example, when "son" and "daughter" are identified, the returned confirmation request carries the "son" material option and the "daughter" material option.
[0301] S519, the voice assistant displays a confirmation message.
[0302] When the voice assistant receives the material option, it displays options for multiple children as confirmation information, such as "son", material option, and "daughter" material option.
[0303] The confirmation information is used to indicate whether the user can choose to generate a video based on the identified pictures and videos related to the "son", or to generate a video based on the identified pictures and videos related to the "daughter", or to generate a video based on the identified pictures and videos related to all children (for example, "son" and "daughter").
[0304] S520: The voice assistant receives the user's voice.
[0305] The user voice may be "daughter".
[0306] S521, the voice assistant sends a confirmation instruction to the media processing center 1.
[0307] As an example, the user says "daughter". After the voice assistant detects the voice, it sends a confirmation instruction to the media processing center, and the confirmation instruction carries "daughter".
[0308] S505, after receiving the confirmation instruction, the media processing center 1 sends the materials related to the confirmation instruction "daughter" to the light editing service.
[0309] FIG12 is a timing diagram for adjusting the duration of a video when the user is not satisfied with the duration of the video generated in FIG11 . The timing diagram corresponds to any interface in FIG3 to FIG6 , or to any example in FIG7 to FIG9 .
[0310] S601: The user sends a voice message.
[0311] In the embodiment of the present application, the user voice may be voice information corresponding to any one of the three types mentioned above.
[0312] As an example, the voice information may be “adjust to 35 seconds”, “extend 5 seconds”, “adjust to less than 30 seconds”, etc.
[0313] S602: The voice assistant determines the adjustment strategy type according to the voice information corresponding to the user's voice.
[0314] In the embodiment of the present application, after the voice assistant detects the user's voice, it can first generate text information based on the user's voice, then extract keywords from the text information, and then determine the adjustment strategy type based on the keywords. This process can be referred to the examples in Figures 7 to 9.
[0315] There are three types of adjustment strategies in the embodiments of the present application. For details, please refer to Type 1, Type 2 and Type 3 in the above embodiments.
[0316] In addition, in actual application, after the text information is generated according to the user voice in S602, the text information can also be displayed in the voice assistant window.
[0317] S603: The voice assistant sends a duration modification instruction to the media processing platform 1, which carries the adjustment strategy type and time.
[0318] For example, it may carry the identifier corresponding to type 1, the identifier corresponding to type 2, or the identifier corresponding to type 3 in the above example. Correspondingly, the time is t1, t2, or t3 in the above embodiment.
[0319] S604: After receiving the duration modification instruction, the media processing station 1 sends the duration modification instruction to the light editing service.
[0320] S605: After receiving the duration modification instruction, the light editing service checks the legitimacy of the duration modification instruction.
[0321] In this step, the duration of the new video is calculated based on the adjustment policy type determined by the duration modification instruction and the duration carried in the duration modification instruction, as shown in Figures 7, 8, or 9. Then, S401 in Figure 10 is executed to determine the legitimacy of the duration modification instruction.
[0322] As an example, when the calculated new video duration is within the range of [1, min(n, 90)], it indicates that the duration modification instruction is legal; when the calculated new video duration is not within the range of [1, min(n, 90)], it indicates that the duration modification instruction is illegal.
[0323] S606: If the duration modification instruction is illegal, the light editing service sends a message to the media processing center 1 indicating that the instruction is illegal.
[0324] S607: After receiving the information that the command is illegal, the media processing station 1 sends the information that the command is illegal to the voice assistant.
[0325] After receiving information indicating that the command is illegal, the voice assistant may display corresponding text information, such as "To ensure the film is a good film, the maximum adjustment is 90 seconds. It has been adjusted to 90 seconds for you" or "To ensure the film is a good film, the minimum adjustment is 1 second. It has been adjusted to 1 second for you" as shown in Figure 6. Of course, the text information and the cover of the new video can also be displayed after the new video is actually obtained, and this application does not impose any restrictions on this.
[0326] Regardless of whether the instruction is legal or not, the light editing service needs to execute step 608 and subsequent steps to perform secondary filming, that is, the process of generating a new video.
[0327] S608, the light editing service obtains the video json file of the last film, and obtains the video data from the video json file.
[0328] The video JSON file records the media assets used in the last video (e.g., the highlight clips used in the previous video), configuration information (e.g., the selected templates and special effects), the duration of the highlight clips of each clip that makes up the original video, and the duration of each clip that makes up the original video. Of course, once the video data is obtained, the above information is also included in the video data.
[0329] S609, the light editing service creates a duration adjustment node in the film-making module.
[0330] S610, the light editing service sends the video data and the calculated new video duration to the adjustment duration node in the filming module.
[0331] S611, the duration adjustment node executes S404 to S408 to obtain a new duration of each segment in the original video.
[0332] S612: The duration adjustment node adjusts the content of each segment in the original video data according to the calculated new duration of each segment.
[0333] In this embodiment of the present application, if the original duration of Segment 1 is 1 second and needs to be adjusted to 2 seconds, and the duration of the highlight segment in which Segment 1 is located is 5 seconds, and Segment 1 is from the 2nd to the 3rd second in the highlight segment, then the new duration of Segment 1 can be set to 2 seconds. After adjustment, Segment 1 will be from the 2nd to the 4th second, or from the 1st to the 3rd second, or from the 1.5th to the 3.5th second in the highlight segment.
[0334] As another example, if the original duration of Segment 1 is 1 second and needs to be adjusted to 2 seconds, the duration of the highlight segment where Segment 1 is located is 1 second, and Segment 1 is from second 0 to second 1 in the highlight segment. Then the new duration of Segment 1 can be set to 2 seconds, and the adjusted Segment 1 is from second 0 to second 1 in the highlight segment, but it is played in slow speed so that the playback duration of Segment 1 is 2 seconds. Of course, the new duration of Segment 1 can also be set to 1 second, the duration of the highlight segment where Segment 1 is located, and -1 second is rolled over to the next segment as the difference. The embodiment of the present application does not limit the specific implementation method.
[0335] S613, after adjusting the content of each segment, the duration adjustment node restores the configuration information of the original video, such as template, special effects, etc., in the video data after adjusting the segment content.
[0336] S614 , after restoring the configuration information of the original video in the video data after adjusting the segment content, the duration adjustment node sends the adjusted video data to the light editing service.
[0337] S615 , after receiving the adjusted video data, the light editing service converts the adjusted video data into a video json file.
[0338] S616, the light editing service sends the video json file to the voice assistant through the media processing center 1.
[0339] S617, after the voice assistant receives the video json file, it displays the text "The length of the video has been adjusted" and the cover of the video after the length is adjusted in the voice assistant window.
[0340] Of course, if the judgment result of S605 is illegal during the specific implementation process, the text displayed at this time will be "To ensure the film effect, it is adjusted to t (for example, 1, n or 90) seconds at most. It has been adjusted to t (for example, 1, n or 90) seconds for you" or "To ensure the film effect, it is adjusted to 1 second at least. It has been adjusted to 1 second for you."
[0341] It can be understood that this method can effectively adjust the duration of the generated video and improve the user experience.
[0342] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0343] An embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is run on an electronic device, it can implement the steps in the above-mentioned various method embodiments.
[0344] The embodiments of the present application further provide a computer program product. When the computer program product is run on an electronic device or a wireless router, the electronic device can implement the steps in the above-mentioned various method embodiments.
[0345] 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, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and when the computer program is executed by the processor, it can implement the steps of the above-mentioned various method embodiments. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include at least: any entity or device capable of carrying the computer program code to the first device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electric carrier signal, a telecommunication signal and a software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.
[0346] The present application also provides a chip comprising a processor coupled to a memory, wherein the processor invokes a computer program stored in the memory to implement the steps of any method embodiment of the present application. The chip may be a single chip or a chip module composed of multiple chips.
[0347] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant description of other embodiments.
[0348] Those skilled in the art will appreciate that the units and method steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0349] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present application, and should all be included in the scope of protection of the present application.
Claims
1. A method for adjusting the duration of a video, characterized in that, Including: Receiving a first voice command, the first voice command carrying a first keyword; In response to the first voice command, displaying a cover of a first video on a first interface, the first video being generated from media materials related to the first keyword in an electronic device, and the duration of the first video being a first duration; Receiving a second voice command for adjusting the duration of the first video; In response to the second voice command, displaying a cover of a second video on the first interface, the duration of the second video being a second duration, and the second video including some or all of the content of the first video.
2. The method according to claim 1, wherein Before displaying the cover of the second video on the first interface, the method further includes: Obtaining a calculated duration of the second video according to the second voice command; Adjusting the content of the first video according to the calculated duration of the second video to obtain the second video.
3. The method according to claim 2, wherein The obtaining a calculated duration of the second video according to the second voice command includes: Obtaining an expected change duration between the second video and the first video according to the second voice command, the expected change duration being determined by the duration indicated by the second voice command; Obtaining a duration change constraint condition; Obtaining a duration change value according to the expected change duration and the duration change constraint condition; Obtaining a calculated duration of the second video according to the first duration of the first video and the duration change value.
4. The method according to claim 3, characterized in that, The obtaining an expected change duration between the second video and the first video according to the second voice command includes: When the second voice command indicates extending or shortening the first video by a third duration, the expected change duration is the third duration; When the second voice command indicates changing the duration of the first video to a fourth duration, the expected change duration is the difference between the fourth duration and the first duration; When the second voice command indicates changing the duration of the first video to be more or less than a fifth duration, the expected change duration is the difference between the fifth duration and the first duration.
5. The method according to claim 3, characterized in that, The obtaining a duration change constraint condition includes: Calculating a first duration change constraint condition, the first duration change constraint condition being: the first minimum value of the duration change is 0, and the first maximum value of the duration change is the first percentage of the expected duration of the second video, the expected duration of the second video being determined by the duration indicated in the second voice command; Obtaining a second duration change constraint condition, the second duration change constraint condition setting a second maximum value and a second minimum value of the duration change; Obtaining the duration change constraint condition according to the first duration change constraint condition and / or the second duration change constraint condition.
6. The method according to claim 5, wherein The obtaining the duration change constraint condition according to the first duration change constraint condition and / or the second duration change constraint condition includes: When the first maximum value is less than the second minimum value, the duration change constraint condition is: the duration change value is the second minimum value; When the first maximum value is greater than the second maximum value, the duration change constraint condition is the second duration change constraint condition; When the first maximum value is greater than or equal to the second minimum value and less than or equal to the second maximum value, the duration change constraint condition is that the minimum value of the duration change is the second minimum value, and the maximum value of the duration change is the first maximum value.
7. The method according to any one of claims 3 to 6, characterized in that, The obtaining of the duration change value according to the expected change duration and the duration change constraint condition includes: When the expected change duration is within the range of the duration change constraint condition, the duration change value is the expected change duration; When the expected change duration is less than the minimum value of the duration change constraint condition, the duration change value is the minimum value in the duration change constraint condition; When the expected change duration is greater than the maximum value of the duration change constraint condition, the duration change value is the maximum value in the duration change constraint condition.
8. The method according to any one of claims 3 to 7, characterized in that The obtaining of the calculated duration of the second video according to the first duration of the first video and the duration change value includes: When the expected duration of the second video is greater than the first duration of the first video, the calculated duration of the second video is the sum of the first duration of the first video and the duration change value; When the expected duration of the second video is less than the first duration of the first video, the calculated duration of the second video is the difference between the first duration of the first video and the duration change value.
9. The method according to any one of claims 2 to 8, characterized in that Before adjusting the content of the first video according to the calculated duration of the second video to obtain the second video, the method further includes: Judging whether the calculated duration of the second video is within a first range; If the calculated duration of the second video is less than the minimum value of the first range, updating the calculated duration of the second video to the minimum value of the first range; If the calculated duration of the second video is greater than the maximum value of the first range, updating the calculated duration of the second video to the maximum value of the first range; Adjusting the content of the first video according to the calculated duration of the second video to obtain the second video.
10. The method according to claim 9, characterized in that, The first video includes one or more sub - segments, each sub - segment corresponds to a mother segment, and each sub - segment is intercepted from the corresponding mother segment; The minimum value of the first range is a preset minimum finished video duration, the maximum value of the first range is the minimum value between a first value and a preset maximum finished video duration, and the first value is the sum of the durations of the mother segments where the respective sub - segments in the first video are located.
11. The method according to any one of claims 2 to 10, characterized in that, Before displaying the cover of the first video on the first interface, the method further includes: Obtaining media materials related to the first keyword from the electronic device; Obtaining the corresponding mother segments from each media material; According to the preset minimum finished video duration and maximum finished video duration, intercepting sub - segments from the obtained mother segments to generate a first video, the duration of the first video being greater than or equal to the minimum finished video duration and greater than or equal to the maximum finished video duration.
12. The method according to claim 11, wherein The first video includes a first number of sub - segments; The adjusting of the content of the first video according to the calculated duration of the second video to obtain the second video includes: Obtaining a first difference according to the calculated duration of the second video and the first duration; Based on the first difference and the first quantity, obtain the theoretical average change duration of each sub - segment in the first video; For the first sub - segment, determine whether the theoretical duration of the first sub - segment is within a preset sub - segment duration range, where the first sub - segment is any sub - segment in the first video, and the theoretical duration of the first sub - segment is the sum of the original duration of the first sub - segment, the theoretical average change duration, and the difference of the previous sub - segment, and the difference of the previous sub - segment is the difference between the theoretical duration of the previous sub - segment and the actual duration of the previous sub - segment; If the theoretical duration of the first sub - segment is within the sub - segment duration range, the actual duration of the first sub - segment is the theoretical duration of the first sub - segment; If the theoretical duration of the first sub - segment is less than the minimum value of the sub - segment duration range, the actual duration of the first sub - segment is the minimum value of the sub - segment duration range; If the theoretical duration of the first sub - segment is greater than the maximum value of the sub - segment duration range, the actual duration of the first sub - segment is the maximum value of the sub - segment duration range; Based on the theoretical duration of the first sub - segment and the actual duration of the first sub - segment, obtain the difference of the first sub - segment; After obtaining the actual duration of each sub - segment in the first video, use the actual duration of each sub - segment as the duration of each sub - segment in the first video to obtain the second video, and the second duration of the second video is the sum of the actual durations of each sub - segment.
13. The method according to claim 12, characterized in that, Each sub - segment in the first video corresponds to a parent segment, and each sub - segment is intercepted from the corresponding parent segment. The operation of using the actual duration of each sub - segment as the duration of each sub - segment in the first video includes: For the first sub - segment, adjust the start time and / or end time of the first sub - segment in the first parent segment to obtain the first sub - segment with adjusted duration. The first parent segment is the parent segment where the first sub - segment is located, and the difference between the end time and the start time of the adjusted first sub - segment is the actual duration of the first sub - segment.
14. The method according to claim 2, characterized in that, When the second voice command is to adjust the duration of the first video to be less than the sixth duration, before obtaining the calculated duration of the second video according to the second voice command, the method further includes: Determine that the first duration is greater than the sixth duration; When the second voice command is to adjust the duration of the first video to be greater than the sixth duration, before obtaining the calculated duration of the second video according to the second voice command, the method further includes: Determine that the first duration is less than the sixth duration.
15. An electronic device, characterized in that, Comprising one or more processors and one or more memories; wherein, the one or more memories are coupled to the one or more processors, and the one or more memories are used to store computer programs. When the one or more processors execute the computer programs, the electronic device executes the method according to any one of claims 1 - 14.
16. A chip system, which is applied to an electronic device, and the chip system includes one or more processors, characterized in that, The processor is used to call computer instructions to enable the electronic device to execute the method according to any one of claims 1 - 14.
17. A computer-readable storage medium, comprising a computer program, characterized in that, When the computer program runs on an electronic device, the electronic device is caused to execute the method according to any one of claims 1-14.
Citation Information
Patent Citations
Method for adjusting video duration, electronic equipment, storage medium and chip
CN120343176A
Text based video synthesis method and system
CN105868176A
Video editing method and device, electronic equipment and computer readable medium
CN114666656A
Video generation method and device
CN116437163A
Video generation method and device, computer equipment and storage medium
CN117082304A