Method for adjusting video duration, electronic equipment, storage medium and chip

The method of adjusting the video duration through voice commands solves the problem that the time for automatically generating videos by electronic devices does not meet user expectations, and improves the efficiency and user experience of video generation.

CN120343176APending Publication Date: 2025-07-18HONOR DEVICE CO LTD

Patent Information

Application Number
CN202410040059.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-01-10
Publication Date
2025-07-18

AI Technical Summary

Technical Problem

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 and poor user experience.

Method used

Videos are automatically generated through voice commands, and the video duration is adjusted according to user's voice commands, and the duration changes are set to ensure that the adjustment is within a reasonable range and improve the efficiency of video generation and user experience.

Benefits of technology

It simplifies the video duration adjustment process, improves the user experience, reduces the cumbersome operations of video editing, and achieves fast and convenient adjustment of video duration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120343176A_ABST
    Figure CN120343176A_ABST
Patent Text Reader

Abstract

The invention provides a method for adjusting video duration, electronic equipment, a storage medium and a chip, and relates to the technical field of terminal equipment, and the method can control the electronic equipment to adjust the duration of a generated video in a voice form. In specific implementation, a duration adjustment strategy can be determined according to the voice of a user: 'prolonging or shortening t seconds', 'adjusting to about t seconds' or'adjusting to more than or below t seconds'; different modes for calculating the duration of the new video can be set according to different adjustment strategies; and after the duration of the new video is obtained, updating the duration of each segment in the video according to the difference between the duration of the new video and the duration of the original video, thereby adjusting the duration on the basis of the original video to obtain the new video. Through the method, the efficiency of adjusting the duration of the video can be improved, and the user experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of terminal devices, and in particular, to a method for adjusting the duration of a video, an electronic device, a storage medium, and a chip. Background Art

[0002] Many electronic devices are equipped with cameras, and users can use the cameras of the electronic devices to take photos, videos, etc.; the electronic devices also have a communication function and can also download pictures or videos from the Internet, or obtain pictures or videos sent by other electronic devices. Users can edit the pictures and / or videos stored in the electronic devices to edit the selected pictures and / or videos into a video.

[0003] Currently, users can select one or more media materials (pictures and videos) in the gallery application, and then the gallery application automatically generates a video according to the selected one or more media materials. However, the duration of such an automatically generated video often does not meet the user's expectations, and users need to re-edit the video through the video editing functions provided by the electronic device (such as video splitting, video merging, etc.), resulting in a more cumbersome and inefficient way of obtaining the video and a poor user experience. Summary of the Invention

[0004] This application provides a method for adjusting the duration of a video, an electronic device, a storage medium, and a chip, which can efficiently adjust the duration of the generated video and improve the user experience.

[0005] To achieve the above object, the first aspect of this application adopts the following technical solution:

[0006] The first aspect of this application provides a method for adjusting the duration of a video, including:

[0007] Receiving a first voice command carrying a first keyword;

[0008] In response to the first voice command, displaying a cover of a first video on a first interface, where the first video is generated from media materials related to the first keyword in the electronic device, and the duration of the first video is a first duration;

[0009] Receiving a second voice command for adjusting the duration of the first video;

[0010] In response to the second voice command, displaying a cover of a second video on the first interface, where the duration of the second video is a second duration, and the content of the second video is related to the content of the first video. For example, the second video includes some or all of the content of the first video.

[0011] In this application, a first video is automatically generated based on media materials related to keywords in the voice command in the electronic device through the user's voice command, and the method of generating the video is simple and fast; in the case where the user is not satisfied with the duration of the generated first video, the user can also adjust the duration of the generated first video through a voice command; the electronic device automatically adjusts the duration of the first video according to the voice command for adjusting the duration of the first video to obtain a second video. Of course, the second video is an adjustment based on the first video. Therefore, part or all of the content of the first video is included in the second video; it can be understood that the method of adjusting the duration of the video is also relatively simple, fast and efficient, so the user experience can be improved;

[0012] As another implementation manner of the first aspect of this application, before the cover of the second video is displayed on the first interface, the method further includes:

[0013] According to the second voice command, obtain the calculated duration of the second video; according to the calculated duration of the second video, adjust the content of the first video to obtain the second video.

[0014] In this application, the user's voice commands may be divided into multiple types. For example, extend by t1 seconds, shorten by t1 seconds, adjust to t2 seconds, adjust to more than t3 seconds, or adjust to less than t3 seconds. Therefore, according to the second voice command, obtain the calculated duration of the second video, and then make adjustments.

[0015] As another implementation manner of the first aspect of this application, obtaining the calculated duration of the second video according to the second voice command includes:

[0016] Obtain the expected change duration between the second video and the first video according to the second voice command, and the expected change duration is determined by the duration indicated by the second voice command;

[0017] Obtain the duration change constraint condition;

[0018] According to the expected change duration and the duration change constraint condition, obtain the duration change value;

[0019] According to the first duration of the first video and the duration change value, obtain the calculated duration of the second video.

[0020] 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 generating a video from the media material obtained according to the first voice command, the first duration is a relatively reasonable duration. Therefore, in order to ensure the final video effect, some duration change constraint conditions are usually set. The duration cannot change too much based on the first video, nor can it change too little based on the duration of the first video. Therefore, the duration change constraint conditions are set, so that the duration of the second video is more reasonable and the final video effect of the second video is better.

[0021] As another implementation of the first aspect of this application, obtaining the expected change duration between the second video and the first video according to the second voice command includes:

[0022] When the second voice command indicates that the first video is extended or shortened by a third duration, the expected change duration is the third duration;

[0023] When the second voice command indicates that the duration of the first video becomes a fourth duration, the expected change duration is the difference between the fourth duration and the first duration;

[0024] When the second voice command indicates that the duration of the first video becomes more than or less than a fifth duration, the expected change duration is the difference between the fifth duration and the first duration.

[0025] In this application, the user's voice commands may be divided into multiple types. For example, extend by t1 seconds, shorten by t1 seconds, adjust to t2 seconds, adjust to more than t3 seconds, or adjust to less than t3 seconds. No matter which type, it is necessary to obtain the expected change duration between the second video and the first video, that is, the adjusted duration expected by the user. Subsequently, based on the adjusted duration expected by the user as a reference, the calculated duration of the second video is obtained.

[0026] As another implementation of the first aspect of this application, obtaining the duration change constraint conditions includes:

[0027] Calculate the first duration change constraint condition. The first duration change constraint condition is: 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 is determined by the duration indicated in the second voice command;

[0028] Obtain the second duration change constraint condition. The second maximum value and the second minimum value of the duration change are set in the second duration change constraint condition;

[0029] According to the first duration change constraint condition and / or the second duration change constraint condition, obtain the duration change constraint condition.

[0030] In this application, for the consideration of the finished video effect, the duration change between the new video and the original video is set to be within a certain percentage of the expected duration of the new video. Of course, the user's expected duration may be relatively unreasonable. Therefore, a second duration change constraint condition is also set to ensure the finished video effect of the second video again through the upper and lower limits.

[0031] As another implementation manner of the first aspect of this application, according to the first duration change constraint condition and / or the second duration change constraint condition, a duration change constraint condition is obtained, including:

[0032] 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;

[0033] When the first maximum value is greater than the second maximum value, the duration change constraint condition is the second duration change constraint condition;

[0034] 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.

[0035] In this application, the intersection of the two constraint conditions is taken as the final duration change constraint condition. However, in practical applications, there may be no intersection between the two constraint conditions. For example, when a certain percentage of the expected duration is less than the lower limit of another constraint condition, in this case, both the maximum value and the minimum value of the duration change range are set to this lower limit value, so as to ensure that the duration adjusted each time cannot be too small, and of course, it cannot be too large.

[0036] As another implementation manner of the first aspect of this application, according to the expected change duration and the duration change constraint condition, a duration change value is obtained, including:

[0037] When the expected change duration is within the range of the duration change constraint condition, the duration change value is the expected change duration;

[0038] 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;

[0039] 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.

[0040] As another implementation manner of the first aspect of this application, according to the first duration of the first video and the duration change value, the calculated duration of the second video is obtained, including:

[0041] 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;

[0042] 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.

[0043] As another implementation of the first aspect of this 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:

[0044] Determine whether the calculated duration of the second video is within a first range;

[0045] If the calculated duration of the second video is less than the minimum value of the first range, update the calculated duration of the second video to the minimum value of the first range;

[0046] If the calculated duration of the second video is greater than the maximum value of the first range, update the calculated duration of the second video to the maximum value of the first range;

[0047] Adjust the content of the first video according to the calculated duration of the second video to obtain the second video.

[0048] In this application, the calculated duration of the second video that may be obtained is still not very reasonable. Therefore, in the embodiments of this application, it is also necessary to constrain the duration of the second video through the first range to ensure the final video effect. So that the final second video is preferably within the first range.

[0049] As another implementation of the first aspect of this application, 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;

[0050] The minimum value of the first range is the preset minimum video duration, the maximum value of the first range is the minimum of the first value and the preset maximum 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.

[0051] As another implementation of the first aspect of this application, before displaying the cover of the first video on the first interface, the method further includes:

[0052] Obtain media materials related to the first keyword from the electronic device;

[0053] Obtain the corresponding mother segments from the respective media materials;

[0054] According to the preset minimum video duration and maximum video duration, intercept sub - segments from the obtained mother segments to generate the first video, and the duration of the first video is greater than or equal to the minimum video duration and greater than or equal to the maximum video duration.

[0055] As another implementation of the first aspect of the present application, the first video includes a first number of sub - segments;

[0056] Adjust the content of the first video according to the calculated duration of the second video to obtain the second video, including:

[0057] Obtain a first difference according to the calculated duration of the second video and the first duration;

[0058] Obtain the theoretical average change duration of each sub - segment in the first video according to the first difference and the first number;

[0059] For the first sub - segment, determine whether the theoretical duration of the first sub - segment is within the sub - segment duration interval, where the first sub - segment is any sub - segment in the first video, 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 and the actual duration of the previous sub - segment;

[0060] 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;

[0061] 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;

[0062] 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;

[0063] Obtain the difference of the first sub - segment according to the theoretical duration and the actual duration of the first sub - segment;

[0064] 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.

[0065] In the present application, the finished - film effect of the second video is ensured by evenly changing the duration of each sub - segment in the first video; in order to make the duration of the second video as accurate as possible, when there is a difference between the actual duration and the theoretical duration of a certain sub - segment, roll this difference to the next segment so that the next segment compensates for this difference, thereby making the duration of the finally obtained second video closer to the calculated duration of the second video.

[0066] As another implementation of the first aspect of the present application, each sub - segment in the first video corresponds to a parent segment, and each sub - segment is intercepted from the corresponding parent segment. Taking the actual duration of each sub - segment as the duration of each sub - segment in the first video includes:

[0067] 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.

[0068] As another implementation of the first aspect of the present application, 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:

[0069] Determine that the first duration is greater than the sixth duration;

[0070] 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:

[0071] Determine that the first duration is less than the sixth duration.

[0072] In the present application, the duration of the first video may itself meet the expected duration corresponding to the voice command issued by the user. In this case, the duration of the first video is not adjusted. In the case where the duration of the first video does not meet the expected duration corresponding to the voice command issued by the user, the duration of the first video is adjusted to obtain the second video.

[0073] In a second aspect, there is provided an electronic device including a processor, and the processor is used to call a computer program stored in a memory to implement the method according to any one of the first aspects of the present application.

[0074] In a third aspect, there is provided a chip including a processor, the processor is coupled to a memory, and the processor executes a computer program stored in the memory so that an electronic device implements the method according to any one of the first aspects of the present application.

[0075] In a fourth aspect, there is provided a computer - readable storage medium storing a computer program, and when the computer instruction runs on an electronic device, the electronic device implements the method according to any one of the first aspects of the present application.

[0076] In a fifth aspect, an embodiment of the present application provides a computer program product, and when the computer program product runs on a device, the electronic device is caused to execute the method according to any one of the first aspects of the present application.

[0077] It can be understood that for the beneficial effects of the above second to fifth aspects, reference can be made to the relevant descriptions in the above first aspect, which will not be elaborated here. Brief Description of the Drawings

[0078] Figure 1 It is a schematic diagram of a hardware structure of an electronic device provided by an embodiment of the present application;

[0079] Figure 2 It is a schematic diagram of an interface for generating a video through a voice assistant provided by an embodiment of the present application;

[0080] Figure 3 It is a schematic diagram of an interface for adjusting the video duration through a voice assistant provided by an embodiment of the present application;

[0081] Figure 4 It is another schematic diagram of an interface for adjusting the video duration through a voice assistant provided by an embodiment of the present application;

[0082] Figure 5 It is another schematic diagram of an interface for adjusting the video duration through a voice assistant provided by an embodiment of the present application;

[0083] Figure 6 It is another schematic diagram of an interface for adjusting the video duration through a voice assistant provided by an embodiment of the present application;

[0084] Figure 7 It is a schematic diagram of a process when shortening or lengthening the original video by t1 seconds provided by an embodiment of the present application;

[0085] Figure 8 It is a schematic diagram of a process when adjusting the original video to about t2 seconds provided by an embodiment of the present application;

[0086] Figure 9 It is a schematic diagram of a process when adjusting the original video to more than or less than t3 seconds provided by an embodiment of the present application;

[0087] Figure 10 It is a schematic diagram of a process for calculating the new duration of each segment according to the duration of the new video provided by an embodiment of the present application;

[0088] Figure 11 It is a timing diagram for generating a video through a voice assistant provided by an embodiment of the present application;

[0089] Figure 12 It is a timing diagram for adjusting the video duration through a voice assistant provided by an embodiment of the present application. Detailed Embodiments

[0090] In the following description, specific details such as specific system architectures and technologies are presented for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, those skilled in the art should understand that the present application can also be implemented in other embodiments without these specific details.

[0091] It should be understood that when used in the specification of the present application and the appended claims, the term "comprising" indicates the presence of the described features, wholes, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their combinations.

[0092] It should also be understood that in the embodiments of the present application, "one or more" means one, two, or more than two; "and / or" describes the association relationship of associated objects and indicates that three relationships can exist; for example, A and / or B can represent: 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 before and after are in an "or" relationship.

[0093] In addition, in the description of the specification of the present application and the appended claims, the terms "first", "second", "third", "fourth", etc. are only used for distinguishing descriptions and cannot be understood as indicating or implying relative importance.

[0094] Reference to "one embodiment" or "some embodiments" etc. described in the specification of the present application means that a specific feature, structure, or characteristic described in connection with that embodiment is included in one or more embodiments of the present application. Thus, statements such as "in one embodiment", "in some embodiments", "in other some embodiments", "in still other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in another way. The terms "comprising", "including", "having", and their variants all mean "including but not limited to", unless otherwise specifically emphasized in another way.

[0095] A method for adjusting the video duration provided by the embodiments of the present application can be applied to an electronic device, which can be an electronic device such as a tablet computer, a mobile phone, a wearable device, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc. The embodiments of the present application do not limit the specific type of the electronic device.

[0096] Figure 1The structural schematic diagram of an electronic device is shown. The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. Among them, the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0097] It can be understood that the structure schematically shown in the embodiments of this application does not constitute a specific limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or have different component arrangements. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0098] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units may be independent devices or integrated in one or more processors. For example, the processor 110 is used to execute the frame playback method of the video in the embodiments of this application.

[0099] A memory can also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can hold the instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to use the instruction or data again, it can be directly retrieved from the memory. This avoids repeated accesses and reduces the waiting time of the processor 110, thus improving the efficiency of the system.

[0100] The internal memory 121 can be used to store computer-executable program code, and the executable program code includes instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 can include a program storage area and a data storage area. Among them, the program storage area can store an operating system and application programs required for at least one function (such as an image playback function, etc.). The touch sensor 180K, also known as the "touch panel". The touch sensor 180K can be disposed on the display screen 194, and the touch screen, also known as the "touch screen", is formed by the touch sensor 180K and the display screen 194. The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In some other embodiments, the touch sensor 180K can also be disposed on the surface of the electronic device 100 at a different position from that of the display screen 194.

[0101] The electronic device 100 realizes the display function through the GPU, the display screen 194, and the application processor, etc. The GPU is a microprocessor for image processing, and is connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 can include one or more GPUs, which execute program instructions to generate or change display information. For example, in the embodiments of the present application, the process of rendering YUV data can be implemented through the GPU.

[0102] 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 (AMOLED), a flexible light-emitting diode (FLED), a Miniled, a MicroLed, a Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include one or N display screens 194, where N is a positive integer greater than 1. For example, in the embodiments of the present application Figure 2 or Figure 3 the interfaces shown are all displayed by the display.

[0103] The embodiments of the present application do not particularly limit the specific structure of the execution subject of a method for adjusting the video duration. As long as the code recording the method for adjusting the video duration in the embodiments of the present application can be run to communicate according to the method for adjusting the video duration provided in the embodiments of the present application. For example, the execution subject of the method for adjusting the video duration provided in the embodiments of the present application can be a functional module in the electronic device that can call and execute the program, or a communication device applied to the electronic device, such as a chip.

[0104] Currently, many electronic devices are equipped with cameras, and users can use the cameras of the electronic devices to take photos, videos, etc.; the electronic devices also have communication functions and can also download pictures or videos from the Internet, or obtain pictures or videos sent by other electronic devices, etc. Users can edit the pictures and / or videos stored in the electronic device to generate a new video from the selected pictures and / or videos.

[0105] As a scenario example, the user selects 3 videos and 3 pictures in the gallery application, and the gallery application automatically generates a new video according to the selected 3 videos and 3 pictures.

[0106] However, in practical applications, the duration of the generated video may not meet the user's expectations. As an example, some social software allows a maximum upload of videos within 15 seconds. However, the duration of the videos generated by the gallery application may be 18 seconds. For some product exhibition videos, the minimum duration is required to be 45 seconds. However, the duration of the videos generated by the gallery application is only 42 seconds. In the above cases, the user may need to re-edit the generated video to meet the user's expectations.

[0107] In addition, after statistics on a large number of users, the number of times of using the gallery application to generate videos for several consecutive months are: 180,319 times, 225,494 times, 198,392 times, 314,070 times, and 262,916 times. The average number of times of using the gallery application to generate videos per month is about 250,000 times. Correspondingly, after generating videos through the gallery application, the number of times the user uses the video editing function to re-edit the obtained videos to change the video duration are: 107,844 times, 137,843 times, 127,113 times, 192,141 times, and 162,929 times. The average number of times of using the video editing function to adjust the videos generated by the gallery application per month is about 150,000 times. The proportion of equivalent secondary duration adjustment is about 60%.

[0108] Moreover, in the actual investigation, it is found that some users do not perform secondary duration adjustment, not because the duration of the video obtained for the first time meets the expectations, but because the method of secondary duration adjustment is rather cumbersome and the user experience is not good.

[0109] In view of this, the embodiments of the present application provide a method for adjusting the video duration, which can, after generating a video (this video is recorded as the original video), increase a certain duration or shorten a certain duration on the basis of the original video according to the user's instruction to obtain a new video with the changed duration; it can also generate a new video with a specified duration on the basis of the original video according to the user's instruction, or obtain a new video longer than or shorter than the specified duration on the basis of the original video according to the user's instruction.

[0110] For the convenience of distinction, the video before duration adjustment will be subsequently recorded as the original video (which can be recorded as the first video), and the video after 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.

[0111] The user instructions in the embodiments of the present application may be voice instructions. Therefore, the embodiments of the present application can utilize the voice assistant provided by the electronic device or other applications with voice functions to call the video editing application through the voice assistant or other applications with voice functions, so as to generate a video (denoted as the original video) by the video editing application through voice instructions, and can also call the video editing application through voice instructions to perform secondary duration adjustment on the generated original video to obtain a new video.

[0112] First, a scenario schematic diagram of the method for adjusting the video duration provided by the embodiments of the present application will be described below. This schematic diagram takes the voice assistant of the electronic device as an example to call the video editing application.

[0113] Refer to Figure 2 , which is a schematic diagram of the interface for generating a video through the voice assistant provided by the embodiments of the present application;

[0114] Refer to Figure 2 As shown in (a) in Figure 2 Figure 2 , the user says the voice "yoyo" within the voice monitoring range of the electronic device to wake up the voice assistant of the electronic device. After the electronic device detects the voice "yoyo", it emits a voice response "I'm listening. Please speak", and at the same time displays As shown in (a) in

[0115] the interface shown in (a) in

[0116] In the interface shown in (a) in

[0115] , a voice assistant window 21 is displayed. The voice assistant window 21 includes the text information "I'm listening. Please speak". Of course, the purpose of this voice response and text information is to prompt the user that the voice assistant has been awakened and ask the user to speak the voice instruction. In practical applications, other voice response contents and text information contents can also be set according to the situation to play the same reminder role.

[0115] According to the voice response "I'm listening. Please speak" and / or the text information "I'm listening. Please speak", the user says 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", it displays the user's voice information "Generate a video of the child" in the voice assistant window 21, and generates a video according to the pictures and videos containing children stored in the electronic device. The materials for generating this video can be pictures and / or videos in the gallery application; after successfully generating the video, it emits a voice "I have generated a video of the child for you", and at the same time, in the voice assistant window, it displays the text content "I have generated a video of the child for you" and the cover of the generated video. The cover displays a play control 22 and a video duration of "00:30". The video duration of "00:30" indicates that the duration of the generated video is 30 seconds. In practical applications, the user can click the play control 22 to trigger the electronic device to play this video, and the present application will not give examples through diagrams anymore.

[0116] In 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 options of children, such as "son" and "daughter", can be displayed in the voice assistant window. The user can choose to generate a video based on the pictures and videos related to the identified "son", or generate a video based on the pictures and videos related to the identified "daughter", or generate a video based on the pictures and videos related to all the identified children (e.g., "son" and "daughter"). As an example, when the user says "daughter", after the electronic device detects this voice, the text "Selecting materials of your daughter for you" and the materials related to "daughter" screened from the electronic device are displayed in the voice assistant window; if the user continues to say "generate a video", after the electronic device detects this voice, a video is generated according to the materials related to "daughter". This application will not give further examples through illustrations.

[0117] In this example, the voice information sent by the user for instructing video generation corresponds to a first voice command. This voice assistant window can be an example of a first interface for displaying the cover of the generated video. Of course, the keywords "child" or "daughter" in this example are examples of the first keywords for obtaining media materials.

[0118] In the case where the user is not satisfied with the duration of the video, the user can continue to speak to perform secondary editing on the video and regenerate a video with a different duration.

[0119] As an example of adjusting the duration of the original video, refer to Figure 3 As shown, when the electronic device displays the interface shown in (b) of Figure 2 the user says the voice "shorten by 4 seconds" within the voice monitoring range of the electronic device. After the electronic device detects the voice "shorten by 4 seconds", the user's voice information "shorten by 4 seconds" is displayed in the voice assistant window 21, and the duration of the original video is adjusted; after successfully adjusting the duration of the original video, a voice "The duration of the video has been adjusted" is issued. At the same time, the text content "The duration of the video has been adjusted" and the cover of the new video are displayed in the voice assistant window. The playback control 23 and the video duration "00:26" are also displayed on this cover. The video duration "00:26" indicates that the duration of the generated new video is 26 seconds.

[0120] In practical applications, the user can also click the playback control 23 to trigger the electronic device to play this new video. This application will not give further examples through illustrations.

[0121] As an example of adjusting the duration of the original video, refer to Figure 4 As shown, when the electronic device displays Figure 2In the case of the interface shown in (b), the user says the voice command "Adjust to 35 seconds" within the voice monitoring range of the electronic device. After the electronic device detects the voice command "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 emits the voice message "The duration of the video has been adjusted", and at the same time, it displays the text content "The duration of the video has been adjusted" and the cover of the new video in the voice assistant window. The cover also shows the play control 24 and the video duration "00:35", where the video duration "00:35" indicates that the duration of the generated new video is 35 seconds.

[0122] In practical applications, the user can also click on the play control 24 to trigger the electronic device to play the new video. This application will not provide further illustrations through diagrams.

[0123] As an example of adjusting the duration of the original video, refer to Figure 5 shown. When the electronic device displays Figure 2 In the case of the interface shown in (b), the user says the voice command "Adjust to more than 33 seconds" within the voice monitoring range of the electronic device. After the electronic device detects the voice command "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 emits the voice message "The duration of the video has been adjusted", and at the same time, it displays the text content "The duration of the video has been adjusted" and the cover of the new video in the voice assistant window. The cover also shows the play control 25 and the video duration "00:35", where the video duration "00:35" indicates that the duration of the generated new video is 35 seconds.

[0124] In practical applications, the user can also click on the play control 25 to trigger the electronic device to play the new video. This application will not provide further illustrations through diagrams.

[0125] As an example of adjusting the duration of the original video, refer to Figure 6 shown. When the electronic device displays Figure 2In the case of the interface shown in (b) in [the reference], the user says the voice command "Adjust to more than 30 minutes" within the voice monitoring range of the electronic device. After the electronic device detects the voice command "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 practical applications, the ability of the electronic device to adjust the video is limited. For example, the minimum duration of the new video after adjusting the duration is 1 second, and the maximum is 90 seconds. Therefore, when the electronic device determines that it cannot adjust the video duration according to the user's instruction, it can calculate the video duration that can be adjusted. After calculating the video duration that can be adjusted (for example, 90 seconds), it issues a voice reminder "To ensure the final video effect, the maximum adjustment is 90 seconds, and it has been adjusted to 90 seconds for you", and at the same time, it displays the text content "To ensure the final video effect, the maximum adjustment is 90 seconds, and it has been adjusted to 90 seconds for you" and the cover of the new video in the voice assistant window. The play control 26 and the video duration "00:90" are also displayed on this cover. The video duration "00:90" indicates that the duration of the generated new video is 90 seconds.

[0126] In practical applications, the user can also click the play control 26 to trigger the electronic device to play this new video. This application will not give examples through illustrations anymore.

[0127] In the above example, the voice message sent by the user to indicate adjusting the video duration corresponds to the second voice command. The generated new video is also displayed in the voice assistant window.

[0128] In the above embodiments, the user's instruction triggers the electronic device to adjust the duration of the original video in the form of voice. As another embodiment of this application, the user's 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 more than duration", and "Adjust to less than duration" can be set, etc. Each adjustment method option corresponds to different duration options. For example, the duration options can be options from 1 second to 90 seconds. This method does not require the participation of the voice assistant, but an adjustment interface needs to be set. In the subsequent embodiments of this application, the user's instruction being voice will be used as an example for description.

[0129] Three types of duration adjustment methods are described in the above example. Type 1: Shorten (or extend) by t1 seconds. Type 2: Adjust to t2 seconds. Type 3: Adjust to more than (or less than) t3 seconds. In the subsequent embodiments of this application, each number will be described in seconds as the unit. In practical applications, other time units can also be used.

[0130] The duration adjustment method of type 1 (shortening (or lengthening) by t1 seconds) is first described below. When the electronic device detects that the user's speech contains "lengthen" or "shorten", and at the same time contains time-related information, the electronic device determines that the duration adjustment method is type 1. Of course, "lengthen" and "shorten" are only examples. In actual applications, it can also be "increase", "enlarge", "decrease", "reduce", or "shrink", etc.

[0131] In the embodiments of the present application, when generating new videos with different durations based on the original video, it is not to reselect materials and generate a completely new video, but to adjust the durations of the individual segments that make up the original video on the basis of the original video, so as to generate a new video according to the segments with adjusted durations.

[0132] When the user's instruction is to lengthen or shorten the duration of t1, the expected duration of the new video is the original video duration plus or minus t1. As an example, when the user's instruction is to lengthen the duration of t1, the expected duration of the new video is the original video duration plus t1; when the user's instruction is to shorten the duration of t1, the expected duration of the new video is the original video minus t1. For the convenience of description, the embodiments of the present application denote the expected duration of the new video as dnewtotaltime.

[0133] To ensure the finished video effect of the new video, it is set that the duration change between the new video duration and the original video duration is controlled within 30% of the expected duration of the new video, that is, the error duration change is less than or equal to dnewtotaltime * 30%. This avoids too much change in the duration on the basis of the original video, which affects the finished video effect of the new video.

[0134] As an example, when the original video duration is 30 seconds and the lengthening duration t1 is 10 seconds, the expected duration dnewtotaltime of the new video is 40 seconds, then the error duration change needs to be less than or equal to dnewtotaltime * 30%. That is, the adjusted duration needs to be less than or equal to 12 seconds. The determined change range of the new video duration compared with the original video duration is between 0 second and 12 seconds, and the determined new video duration range is between 30 seconds and 42 seconds.

[0135] In addition, to further ensure the finished video effect of the new video, the time change of the new video duration compared with the original video duration cannot be infinitely large or infinitely small. Therefore, the embodiments of the present application also set that the determined change in the new video duration compared with the original video duration needs to change at least 3 seconds and at most 6 seconds on the basis of the original video. That is, the interval of the ability duration change is [3, 6].

[0136] Combining the above two constraint conditions: the maximum value of the error duration change and the ability duration change interval, when the original video duration is 30 seconds and the extended duration t1 is 10 seconds, the ability duration change is 6 seconds, and the determined new video duration is 36 seconds.

[0137] The following details the specific implementation process of the duration adjustment method.

[0138] In this application, the duration of extension or shortening is constrained by the above two constraint conditions of the deviation of extension or shortening, so as to determine the specific change duration; then, the new video duration can be obtained according to the original video duration and the change duration.

[0139] The following is through Figure 7 Describe the flow diagram corresponding to the duration adjustment method of type one.

[0140] S101, calculate the maximum value dnewtotaltime*k1% of the error duration change according to the original video duration oldtotaltime and t1 in the user instruction.

[0141] When the instruction is for extension, the maximum value of the error duration change is (oldtotaltime + t1)*k1%, and when the instruction is for shortening, the maximum value of the error duration change is (oldtotaltime - t1)*k1%.

[0142] S102, determine the duration change range according to the relationship between dnewtotaltime*k1% and the ability duration change interval [a1, b1].

[0143] In the embodiments of this application, there are equivalent to two duration change ranges. One is the error duration change range: 0 to dnewtotaltime*k1%; the other is the ability duration change interval [a1, b1].

[0144] When determining the final duration change range, the intersection of the above two duration change ranges can be calculated; however, in practical applications, there may be no intersection between the two duration change ranges. For example, when dnewtotaltime*30% is less than a1 seconds, the duration change range has only one value, which is a1 seconds. Based on the above principle, it is obtained that:

[0145] If dnewtotaltime*k1% is less than a1 seconds, then determine the duration change range to be a1 seconds.

[0146] If dnewtotaltime*k1% is greater than b1 seconds, then determine the duration change to be from a1 to b1 seconds.

[0147] If dnewtotaltime * k1% is within the range of the change in the duration of capabilities [a1, b1], then determine the range of the change in duration as from a1 to dnewtotaltime * k1%.

[0148] S103. Determine the change value Δt of the duration according to the relationship between t1 and the range of the change in duration.

[0149] If t1 is within the range of the change in duration, then the change value Δt of the duration is t1;

[0150] If t1 is less than the minimum value of the range of the change in duration, then the change value Δt of the duration is the minimum value of the range of the change in duration;

[0151] If t1 is greater than the maximum value of the range of the change in duration, then the change value Δt of the duration is the maximum value of the range of the change in duration;

[0152] S104. Obtain the new video duration newtotaltime according to the original video duration and the change value of the duration.

[0153] Similarly, when the instruction is to extend, newtotaltime = oldtotaltime + Δt. When the instruction is to shorten, newtotaltime = oldtotaltime - Δt.

[0154] In the above example, k1% in the change in the error duration being 30% is only an example. In actual applications, it can be set to other values, for example, 25%, 35%, etc. a1 and b1 in the range of the change in the duration of capabilities are also only an example. 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 described in Table 1.

[0155] Table 1 is the process of obtaining the new video duration.

[0156]

[0157] In actual applications, it is also possible to calculate the maximum value of the change in the error duration, which is oldtotaltime * 30%, according to the original video duration oldtotaltime. Referring to Table 2, it is the process of obtaining the new video duration with oldtotaltime * 30% as the maximum value of the change in the error duration.

[0158] Table 2 is the process of obtaining the new video duration with oldtotaltime * 30% as the maximum value of the change in the error duration

[0159]

[0160] The following describes the duration adjustment method of Type 2 (adjusted to t2 seconds). When the electronic device detects that the user's speech contains "adjusted to" and also contains time-related information, the electronic device determines that the duration adjustment method is Type 2. Of course, "adjusted to" is only an example. In actual applications, it can also be "changed to", "varied to", "extended to", "reduced to", "increased to", "decreased to", or "about", etc.

[0161] In the embodiments of the present application, when generating a new video with a different duration based on the original video, it is not to reselect materials and generate a completely new video, but to adjust the duration of each segment that makes up the original video on the basis of the original video, so as to generate a new video according to each segment after adjusting the duration, making the duration of the generated new video as close to t2 as possible.

[0162] To ensure the finished video effect of the new video, it is set that the duration change between the duration of the new video and the duration of the original video is controlled within 15% of the duration t2 in the user instruction, that is, the error duration change is less than or equal to t2 * 15%. This avoids too much change in the duration on the basis of the original video, which affects the finished video effect of the new video.

[0163] As an example, when the duration t2 is 30 seconds, the error duration change is less than or equal to 4.5 seconds, and the duration change range of the new video is between 25.5 seconds and 34.5 seconds. When the duration t2 is 32 seconds, the error duration change is less than or equal to 4.8 seconds, and the duration change range of the new video is between 25.2 seconds and 34.8 seconds.

[0164] In addition, to further ensure the finished video effect of the new video, the time change of the duration of the new video compared to the duration of the original video cannot be infinitely large or infinitely small. Therefore, the embodiments of the present application also set that the time change of the determined duration of the new video compared to the duration of the original video needs to change at least 3 seconds and at most 10 seconds on the basis of the original video. That is, the interval of the ability duration change is [3, 10].

[0165] In the present application, the change duration is constrained by the above two duration change constraint conditions to determine the specific change duration; then, the duration of the new video can be obtained according to the duration of the original video and the change duration.

[0166] The following details the specific implementation process of this duration adjustment method.

[0167] The following is through Figure 8 Describe the flow chart corresponding to the duration adjustment method corresponding to Type 2.

[0168] S201, calculate the maximum value t2 * k2% of the error duration change according to the duration t2 carried in the user instruction.

[0169] S202. Determine the duration change range according to the relationship between t2 * k2% and the ability duration change range [a2, b2].

[0170] If t2 * k2% is less than a2 seconds, determine the duration change range as a2 seconds.

[0171] If t2 * k2% is greater than b2 seconds, determine the duration change as from a2 to b2 seconds.

[0172] If t2 * k2% is within the ability duration change range [a2, b2], determine the duration change range as from a2 to t2 * k2%.

[0173] S203. Determine the duration change value Δt according to the relationship between the absolute value of the difference between t2 and the original video duration oldtotaltime and the duration change range.

[0174] If |t2 - oldtotaltime| is within the duration change range, the duration change value Δt is |t2 - oldtotaltime|;

[0175] If |t2 - oldtotaltime| is less than the minimum value of the duration change range, the duration change value Δt is the minimum value of the duration change range;

[0176] If |t2 - oldtotaltime| is greater than the maximum value of the duration change range, the duration change value Δt is the maximum value of the duration change range.

[0177] S204. Obtain the new video duration newtotaltime according to the original video duration and the duration change value.

[0178] When t2 - oldtotaltime > 0, newtotaltime = oldtotaltime + Δt.

[0179] When t2 - oldtotaltime < 0, newtotaltime = oldtotaltime - Δt.

[0180] In the above example, k2% in the error duration change being 15% is just an example. In actual applications, it can be set to other values, such as 20%, 25%, 30%, 35%, etc. Also, a2 and b2 in the ability duration change range are just 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 of calculating the new video duration shown in Table 3.

[0181] Table 3 Process of calculating the new video duration

[0182]

[0183] In practical applications, the maximum value of the duration change can also be calculated based on the duration oldtotaltime of the original video, which is oldtotaltime * 15%. Referring to Table 4, it is the process of obtaining the duration of the new video with oldtotaltime * 15% as the maximum value of the error change duration.

[0184] Table 4 Process of calculating the duration of the new video with oldtotaltime * 15% as the maximum value of the error change duration

[0185]

[0186] The following describes the duration adjustment method of Type III (adjusted to more than or less than t3 seconds). When the electronic device detects that the user's speech contains "adjusted to", "more than", or, "adjusted to", "less than", and at the same time contains time-related information, the electronic device determines that the duration adjustment method is Type III. Of course, "adjusted to" is only an example. In practical applications, it can also be "changed to", "varied to", "extended to", "reduced to", "increased to", "decreased to", etc.

[0187] In the embodiments of the present application, when generating a new video with a different duration based on the original video, it is not to reselect materials and generate a completely new video, but to adjust the duration of each segment that makes up the original video on the basis of the original video, so as to generate a new video according to each segment after adjusting the duration, making the duration of the generated new video as close to t3 as possible.

[0188] To ensure the finished video effect of the new video, it is set that the duration change between the duration of the new video and the duration of the original video is controlled within 30% of the duration t3 in the user instruction, that is, the error duration change is less than or equal to t3 * 30%. This avoids too much change in the duration on the basis of the original video, affecting the finished video effect of the new video.

[0189] 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.

[0190] In addition, to further ensure the finished video effect of the new video, the time change of the duration of the new video compared to the duration of the original video cannot be infinitely large or infinitely small. Therefore, the embodiments of the present application also set that the time change of the determined duration of the new video compared to the duration of the original video needs to change at least 5 seconds and at most 15 seconds on the basis of the original video. That is, the interval of the ability duration change is [5, 15].

[0191] In this application, the change duration is constrained by the above two constraints on the duration change, so as to determine the specific change duration; then, the duration of the new video can be obtained according to the duration of the original video and the change duration.

[0192] Next, Figure 9 a flow chart corresponding to the duration adjustment method for type three is described.

[0193] S301. Calculate the maximum value t3*k3% of the error duration change according to the duration t3 carried in the user instruction.

[0194] S302. Determine whether the duration of the original video meets the user instruction.

[0195] In the embodiment of this application, the user voice can correspondingly obtain the user instruction.

[0196] As an 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.

[0197] If the duration of the original video is 30 seconds and the user instruction is greater than 45 seconds, the duration of the original video does not meet the user instruction, and a new video needs to be generated;

[0198] If the duration of the original video is 30 seconds and the user instruction is less than 45 seconds, the duration of the original video meets the user instruction. In this case, there is no need to generate a new video.

[0199] S303. If the duration of the original video meets the user instruction, end and return information, which is used to indicate that the original video meets the requirements.

[0200] S304. If the duration of the original video does not meet the user instruction, determine the duration change range according to the relationship between t3*k3% and the ability duration change interval [a3, b3].

[0201] If t3*k3% is less than a3 seconds, determine the duration change range as a3 seconds.

[0202] If t3*k3% is greater than b3 seconds, determine the duration change as from a3 to b3 seconds.

[0203] If t3*k3% is within the ability duration change interval [a3, b3], determine the duration change range as from a3 to t3*k3%.

[0204] S305. Determine the duration change value Δt according to the relationship between the absolute value of the difference between t3 and the duration oldtotaltime of the original video and the duration change range.

[0205] If |t3 - oldtotaltime| is within the duration change range, then the duration change value Δt is |t3 - oldtotaltime|;

[0206] If |t3 - oldtotaltime| is less than the minimum value of the duration change range, then the duration change value Δt is the minimum value of the duration change range;

[0207] If |t3 - oldtotaltime| is greater than the maximum value of the duration change range, then the duration change value Δt is the maximum value of the duration change range;

[0208] S306. Obtain the new video duration newtotaltime based on the original video duration and the duration change value.

[0209] When t3 - oldtotaltime > 0, newtotaltime = oldtotaltime + Δt.

[0210] When t3 - oldtotaltime < 0, newtotaltime = oldtotaltime - Δt.

[0211] In the above example, k3% in the error duration change is only an example. In actual applications, it can be set to other values, such as 25%, 35%, etc. Also, a3 and b3 in the ability duration change interval are 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 described in Table 5.

[0212] Table 5 shows the process of obtaining the new video duration.

[0213]

[0214] In actual applications, it is also possible to calculate the maximum value of the duration change, oldtotaltime * 30%, based on the original video duration oldtotaltime. Refer to Table 6, which shows the process of obtaining the new video duration with oldtotaltime * 30% as the maximum value of the error change duration.

[0215] Table 6 shows the process of obtaining the new video duration with oldtotaltime * 30% as the maximum value of the error change duration.

[0216]

[0217]

[0218] As can be understood from the above three strategies, regardless of which strategy it belongs to, it is necessary to calculate the duration newtotaltime of the new video 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.

[0219] In the process of calculating the duration newtotaltime of the new video, it is necessary to first obtain the expected change duration between the new video and the original video according to the user's voice information. For example, t1, |t2 - oldtotaltime|, |t3 - oldtotaltime|; then obtain the duration change constraint condition (that is, the duration change range determined according to the two constraint conditions in the above example); then, based on the expected change duration and the duration change constraint condition, obtain the duration change value Δt; finally, based on the duration of the original video and the duration change value Δt, obtain 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.

[0220] Of course, the range of the error duration change can be recorded as the first duration change constraint condition. The first minimum value of the first duration change constraint condition is 0, and the first percentage (such as 15%, 30%, etc. in the above example) of the user's expected duration of the new video (such as dnewtotaltime, t2, and t3) in the first duration change constraint condition; the ability duration change interval is recorded as the second duration change constraint condition, and the second maximum value and the second minimum value in the second duration change constraint condition are preset, such as the maximum value and the minimum value in any ability change interval in the above example.

[0221] As described above, the duration of the new video can be obtained in the manner of the above embodiments. Next, Figure 10 describe how to adjust the duration of each segment in the original video according to the duration of the new video.

[0222] S401, determine whether the duration of the new video is within [1, min(n, 90)], where n is the maximum duration obtained from the media material for generating the original video. [1, min(n, 90)] can be recorded as the first range.

[0223] In the embodiment of the present application, when generating the original video, the media material for generating the original video is sliced to obtain multiple highlight segments, and then a part of the segments is intercepted from each or part of the highlight segments to generate the original video. n is the sum of the durations of the obtained multiple highlight segments.

[0224] 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, which are searched by the voice assistant from the picture library according to the keywords in the user's voice. By analyzing the media materials, highlight segments corresponding to each media material are obtained. The durations of these 6 highlight segments are 2 seconds, 23 seconds, 4 seconds, 8 seconds, 23 seconds, and 1 second respectively. When generating the original video, the first 5 highlight segments are used, and segments of 1 second, 11.5 seconds, 2 seconds, 4 seconds, and 11.5 seconds are selected from the first 5 highlight segments respectively to form the original video. Therefore, the duration of the original video is 30 seconds. Here, n is the total duration of the 6 highlight segments (61 seconds) or the total duration of the 5 highlight segments (60 seconds) used to generate the original video. Among them, the segments of 1 second, 11.5 seconds, 2 seconds, 4 seconds, and 11.5 seconds selected from the first 5 highlight segments can also be recorded as sub-segments. Each sub-segment has a corresponding highlight segment, and each sub-segment is intercepted from the corresponding highlight segment. Of course, pictures can also correspond to highlight segments. For example, a video segment with a certain duration is generated based on the content of the picture, and this video segment is also a highlight segment.

[0225] In practical applications, the value-taking principle of n can be set according to the situation. Of course, when generating the original video, it can also be set that partial or all of each highlight segment needs to be intercepted to generate the original video, and the embodiments of the present application do not limit this.

[0226] In addition, 1 and 90 in [1, min(n, 90)] are only an example. In practical applications, they can be set to other values.

[0227] S402, if the duration of the new video is less than 1, a prompt message is sent, the duration of the new video is determined to be 1 second, and S404 is executed.

[0228] 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.

[0229] For example, when min(n, 90) is 90, the original video is adjusted according to the duration of the new video being 90 seconds to obtain the new video; when min(n, 90) is n, the original video is adjusted according to the duration of the new video being n seconds to obtain the new video.

[0230] S404, if the duration of the new video is within [1, min(n, 90)], according to the duration of the new video, the duration of the original video, and the number of segments in the original video (which can be recorded as the first quantity), the theoretical average change duration of each segment is obtained.

[0231] 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 (denoted as the first difference) divided by the number of segments m in the original video.

[0232] That is, Averagetime = (newtotaltime - oldtotaltime) / m.

[0233] For each segment in the original video, execute S405 and subsequent steps to determine the new duration of each segment.

[0234] S405, for each segment (which can also be denoted as the first sub-segment), determine whether the sum of the original segment duration oldfragmenttime (representing the duration of the sub-segment in the original video, not the duration of the highlight segment where the sub-segment is located), the theoretical average change duration Averagetime, and the difference difference of the previous segment is within the set segment duration range.

[0235] That is, determine whether (oldfragmenttimei + Averagetimei + difference(i - 1)) is within the segment duration range.

[0236] The difference of each segment is the difference between the theoretical duration of the segment and the calculated actual duration newfragmenttimei. The theoretical duration of the segment is the sum of the original duration oldfragmenttime of the segment, the theoretical average change duration Averagetime, and the difference of the previous sub-segment.

[0237] In practical applications, for video segments, the upper limit of the duration is 12 seconds; for picture segments, the upper limit of the duration is 7 seconds. For both video segments and picture segments, the lower limit of the duration is 0.5 seconds. Additionally, for the first segment, the difference of the previous segment is 0.

[0238] That is, the segment duration range for video segments is [0.5, 12], and the segment duration range for picture segments is [0.5, 7]. Of course, the 0.5, 7, and 12 in this example are only examples. In practical applications, other values can also be used. For the sake of easy description, the segment duration range is [a4, b4].

[0239] S406, if the sum of the original segment duration, the theoretical average change duration, and the difference of the previous segment is within the set segment duration range, then determine the new duration of this segment as the sum of the original segment duration, the theoretical average change duration, and the difference of the previous segment, and determine the difference of this segment as 0.

[0240] That is, when (oldfragmenttimei + Averagetimei + difference(i - 1)) is within [a4, b4], newfragmenttimei = oldfragmenttimei + Averagetimei + difference(i - 1).

[0241] 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, determine the new duration of the segment as the lower limit of the segment duration interval, and calculate the difference of this segment 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.

[0242] That is, when (oldfragmenttimei + Averagetimei + difference(i - 1)) is less than a4, newfragmenttimei = a4, and difference i = oldfragmenttimei + Averagetimei + difference(i - 1) - newfragmenttimei.

[0243] 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, determine the new duration of the segment as the upper limit of the segment duration interval, and calculate the difference of this segment 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.

[0244] That is, when (oldfragmenttimei + Averagetimei + difference(i - 1)) is greater than b4, newfragmenttimei = b4, and difference i = oldfragmenttimei + Averagetimei + difference(i - 1) - newfragmenttimei.

[0245] In this way, after obtaining the new duration of each segment, according to the new duration of each segment, adjust the content of each segment, and generate a new video based on each segment of the adjusted content.

[0246] The following describes, through two examples, the process of generating a new video based on the segments of the original video after calculating the duration of the new video.

[0247] Table 7: The original video duration is 30 seconds, the new video duration is 35 seconds, and there are 5 segments in the original video duration, then calculate the theoretical average increase duration of each segment as 1 second.

[0248] Table 7 Process of calculating the new duration of each segment

[0249]

[0250] When calculating the new duration of segment 1, the original duration of the segment plus the theoretical average increase duration plus the difference of the previous segment equals 2; it is judged that 2 is within the upper and lower limits; so the new duration is 2, and the difference equals the original duration of the segment plus the theoretical average increase duration plus the difference of the previous segment minus the determined new duration, which is 0;

[0251] When calculating the new duration of segment 2, the original duration of the segment plus the theoretical average increase duration plus the difference of the previous segment equals 12.5; it is judged that 12.5 is not within the upper and lower limits and is greater than the upper limit of 12; so the new duration is 12, and the difference equals the original duration of the segment plus the theoretical average increase duration plus the difference of the previous segment minus the determined new duration of the segment, which is 0.5;

[0252] When calculating the new duration of segment 3, the original duration of the segment plus the theoretical average increase duration plus the difference of the previous segment equals 3.5; it is judged that 3.5 is within the upper and lower limits; so the new duration is 3.5, and the difference equals the original duration of the segment plus the theoretical average increase duration plus the difference of the previous segment minus the determined new duration of the segment, which is 0;

[0253] When calculating the new duration of segment 4, the original duration of the segment plus the theoretical average increase duration plus the difference of the previous segment equals 5; it is judged that 5 is within the upper and lower limits; so the new duration is 5, and the difference equals the original duration of the segment plus the theoretical average increase duration plus the difference of the previous segment minus the determined new duration of the segment, which is 0;

[0254] When calculating the new duration of segment 5, the original duration of the segment plus the theoretical average increase duration plus the difference of the previous segment equals 12.5; it is judged that 12.5 is not within the upper and lower limits and is greater than the upper limit of 12; so the new duration is 12, and the difference equals the original duration of the segment plus the theoretical average increase duration plus the difference of the previous segment minus the determined new duration, which is 0.5;

[0255] Therefore, when the original duration of the video composed of the above 5 segments is 30 seconds and the new duration of the video calculated according to the corresponding strategy is 35 seconds, the new duration of the final resulting video is 34.5 seconds, and the difference is 0.5 seconds.

[0256] Table 8: The original video duration is 30 seconds, the new video duration is 25 seconds, and the original video duration has 5 segments, then the calculated theoretical average reduction duration of each segment is -1 second.

[0257] Table 8 Process of calculating the new duration of each segment

[0258]

[0259]

[0260] When the average increase duration is negative, it means shortening the duration of the original video.

[0261] When calculating the new duration of segment 1, the original duration of the segment plus the theoretical average increase duration + the difference of the previous segment equals 0; it is judged that 0 is not within the upper and lower limits and is less than 0.5; so the new duration of the segment is 0.5, and the difference equals the original duration of the segment plus the theoretical average increase duration plus the difference of the previous segment minus the determined new duration, which is -0.5;

[0262] When calculating the new duration of segment 2, the original duration of the segment plus the theoretical average increase duration plus the difference of the previous segment equals 10; it is judged that 10 is within the upper and lower limits; so the new duration is 10, and the difference equals the original duration of the segment plus the theoretical average increase duration plus the difference of the previous segment minus the determined new duration, which is 0;

[0263] When calculating the new duration of segment 3, the original duration of the segment plus the theoretical average increase duration plus the difference of the previous segment equals 1; it is judged that 1 is within the upper and lower limits; so the new duration is 1, and the difference equals the original duration of the segment plus the theoretical average increase duration plus the difference of the previous segment minus the determined new duration, which is 0;

[0264] When calculating the new duration of segment 4, the original duration of the segment plus the theoretical average increase duration plus the difference of the previous segment equals 3; it is judged that 3 is within the upper and lower limits; so the new duration is 3, and the difference equals the original duration of the segment plus the theoretical average increase duration plus the difference of the previous segment minus the determined new duration, which is 0;

[0265] When calculating the new duration of segment 5, the original duration of the segment plus the theoretical average increase duration plus the difference of the previous segment equals 10.5; it is judged that 10.5 is within the upper and lower limits; so the new duration is 10.5, and the difference equals the original duration of the segment minus the theoretical average increase duration + the difference of the previous segment minus the determined new duration, which is 0;

[0266] Therefore, when the original duration of the video composed of the above 5 segments is 30 seconds and the new duration of the video calculated according to the corresponding strategy is 25 seconds, the new duration of the final resulting video is 25 seconds, and the difference is 0 seconds.

[0267] By means of the loop - rolling difference method in the above example, the durations of each segment can be balanced, making the duration of the final resulting video closer to the calculated new duration of the video.

[0268] As can be understood from the above process of obtaining the new video, both the new video and the original video are obtained based on the same media materials. Of course, since it is necessary to intercept the highlight segments (denoted as mother segments) from the media materials before generating the video, both the new video and the original video are generated based on the same highlight segments. The difference is that for the original video: a part or all of the segments are respectively intercepted again from each highlight segment (of course, it can also be denoted as sub-segments) to generate the original video; for the new video: according to the positions of these sub-segments in the corresponding highlight segments, the durations of these sub-segments are extended or shortened, and the sub-segments after the duration is extended or shortened generate the new video. Of course, the content and duration of some sub-segments may not change in the new video and the old video. Based on the above description, the new video contains some or all of the content in the original video, and the content of the second video is related to the content of the first video.

[0269] To more clearly understand the execution process of the steps in the above flowchart, first, Figure 11 a timing diagram of generating a video related to a child after the electronic device detects the user's "generate a video of the child" is described below. This timing diagram corresponds to Figure 2 (b) in

[0270] S501, the voice assistant detects the user's voice.

[0271] In the embodiment of the present application, the user's voice can be "generate a video of the child".

[0272] S502, the voice assistant obtains a video generation instruction according to the voice information corresponding to the user's voice.

[0273] In the embodiment of the present application, after the voice assistant detects the user's voice, it can first generate text information according to the user's voice, and then extract the keywords "generate", "child", and "video" in the text information to obtain a video generation instruction. The voice assistant can determine the material types "picture" and "video" according to the keyword "video", and can also determine the content identifier "child" according to the keyword "child". The material type and the content identifier are carried in the video generation instruction.

[0274] Of course, in actual applications, after the voice assistant generates text information according to the user's voice, the text "generate a video of the child" can be displayed in the voice assistant window.

[0275] S503, the voice assistant sends the video generation instruction to the media processing middle platform 1.

[0276] S504, after the media processing middle platform 1 receives the video generation instruction, it collects the media materials related to the instruction from the electronic device.

[0277] As an example, the video generation instruction carries the material types "picture" and "video", and also carries the content identifier "child". The media processing middle platform 1 determines that the materials to be searched are pictures and videos according to the material types "picture" and "video"; and determines to search for pictures and videos with the content identifier "child" according to the content identifier "child".

[0278] Of course, in actual applications, first-level content tags and second-level content tags can be set for videos and pictures. The second-level content tags of the first-level content tag "child" can include "daughter" and "son".

[0279] In addition, the maximum value (such as 30) of the number of media materials for each video generation can be set in the electronic device, that is, the number of media materials collected when generating a video is at most 30.

[0280] S505, the media processing middle platform 1 sends the searched media materials and the theme (the content identifier itself or the theme determined according to the content identifier) to the light editing service.

[0281] As an example, the theme can be the content identifier "child", or the theme "children" determined by the content identifier "child". Of course, the way of determining the theme is only an example.

[0282] The light editing service can be an example of a video editing application.

[0283] S506, after receiving the media materials and the theme, the light editing service obtains the configuration file.

[0284] In the embodiments of the present application, each node in the finished video module to be created is defined in the configuration file, and the video can be generated through each node in the finished video module subsequently.

[0285] As an example, the nodes in the configuration file include: a template acquisition node, a theme matching node, a template parsing node, a music parsing node, a music loading node, a special effect node, a cover generation node, a duration adjustment node, etc.

[0286] Among them, the template acquisition node is used to acquire template materials; the theme matching node is used to find the template matching the theme from the template materials; the template parsing node is used to parse the template matching the theme; the music parsing node is used to parse the rhythm points in the template, and the music loading node is used to correspond the rhythm points in the music to the rhythm points in the template; the special effect node is used to generate special effects; the cover generation node is used to generate a video cover, and the duration adjustment node is used to calculate the duration of the new video during secondary video production and adjust the duration of each segment in the original video, so as to obtain a new video.

[0287] It can be understood that there is a specific processing order among these nodes.

[0288] S507, The light editing service creates a finished video module (and each node therein) according to the configuration file.

[0289] In this step, the duration adjustment node may not be created temporarily and can be created when the video duration needs to be adjusted. Of course, in practical applications, it is also possible to set that the configuration file does not include the duration adjustment node.

[0290] S508, After creating the finished video module, the light editing service sends media materials and themes to the finished video module.

[0291] S509, After receiving the media materials and themes, the finished video module sends the media materials to the media processing middle platform 2.

[0292] In the embodiments of the present application, the media processing middle platform 1 and the media processing middle platform 2 may be two media processing platforms or different functional modules in the same media processing platform.

[0293] S510, After receiving the media materials, the media processing middle platform 2 intercepts the highlight segments from them.

[0294] In the present application, the highlight segments may be relatively wonderful picture segments intercepted by the media processing middle platform 2 from the media materials. When intercepting, multiple conditions can be used as reference criteria, such as the composition ratio, the proportion of characters, etc.

[0295] One or more highlight segments can be intercepted from each media material, or highlight segments can be intercepted from some media materials. The embodiments of the present application do not limit this.

[0296] S511, The media processing middle platform 2 sends the intercepted highlight segments to the finished video module.

[0297] S512, After receiving the highlight segments, the finished video module obtains the model of the video through each node.

[0298] Corresponding to each created node, the template acquisition node acquires template materials; the theme matching node searches for templates matching the theme from the template materials; the template parsing node parses the templates matching the theme; the music parsing node parses the rhythm points in the templates; the music loading node corresponds the rhythm points in the music to the rhythm points in the templates; the special effect node is used to generate special effects; the cover generation node is used to generate the video cover. After being processed by the above-mentioned nodes, new video data is obtained.

[0299] This process is only an example. In practical applications, different nodes or more or fewer nodes can be set. No matter what kind of nodes are adopted, the finished video module can obtain video data through these nodes.

[0300] In addition, when generating the original video, it is also necessary to be within the range of the preset minimum finished video duration and the preset maximum finished video duration. When the total duration of the highlight segments is greater than 90 seconds, it is necessary to extract a part of each highlight segment (this segment can also be recorded as a sub-segment) 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 obtained original video is as close as possible to 1 second. 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 directly generated based on each highlight segment.

[0301] S513, the video generation module sends video data to the light editing service.

[0302] S514, after receiving the video data, the light editing service converts the video data into a video json file.

[0303] 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 a smaller data volume for easy transmission.

[0304] S515, the light editing service sends the video json file to Media Processing Middleware 1.

[0305] S516, after receiving the video json file, Media Processing Middleware 1 sends the video json file to the voice assistant.

[0306] S517, after receiving the video json file, the voice assistant displays the text "Your child's video has been generated for you" and the video cover in the voice assistant window.

[0307] As another embodiment of this application, between step S504 and step S505, it also includes:

[0308] S518, after Media Processing Middleware 1 collects media materials related to the instruction, it sends a confirmation request to the voice assistant, and the confirmation request includes multiple material options.

[0309] In the embodiment of this application, when the electronic device detects the voice "Generate a video of the child", it can also recognize the "child" in the pictures and / or videos stored in the electronic device. When multiple different "children" are recognized, a confirmation request can be sent to the voice assistant. For example, when "son" and "daughter" are recognized, the confirmation request returned carries the "son" material option and the "daughter" material option.

[0310] S519, the voice assistant displays the confirmation information.

[0311] When the voice assistant receives the material option, it displays the options of multiple children as confirmation information, such as the "son" material option and the "daughter" material option.

[0312] This confirmation information is used to indicate that the user can choose to generate a video based on the recognized pictures and videos related to "son", or generate a video based on the recognized pictures and videos related to "daughter", or generate a video based on the recognized pictures and videos related to all children (e.g., "son" and "daughter").

[0313] S520, the voice assistant receives the user's voice.

[0314] The user's voice can be "daughter".

[0315] S521, the voice assistant sends a confirmation instruction to the media processing middleware 1.

[0316] As an example, when the user says "daughter", after the voice assistant detects the voice, it sends a confirmation instruction to the media processing middleware, and the confirmation instruction carries "daughter".

[0317] S505, after receiving the confirmation instruction, the media processing middleware 1 sends the material related to the confirmation instruction "daughter" to the light editing service.

[0318] The following is through Figure 12 Describe the timing diagram for adjusting the duration of the video when the user is not satisfied with the duration of the generated video. This timing diagram corresponds to Figure 11 Any interface in Figures 3 to 6 or corresponds to Figures 7 to 9 Any example in

[0319] S601, the user sends a voice message.

[0320] In the embodiment of the present application, the user's voice can be the voice information corresponding to any one of the above three types.

[0321] As an example, the voice information can be "Adjust to 35 seconds", "Extend by 5 seconds", "Adjust to less than 30 seconds", etc.

[0322] S602, the voice assistant determines the adjustment strategy type according to the voice information corresponding to the user's voice.

[0323] In the embodiment of the present application, after detecting the user's voice, the voice assistant can first generate text information according to the user's voice, and then extract the keywords in the text information, so as to determine the adjustment strategy type according to the keywords. This process can refer to Figures 7 to 9 The example in

[0324] There are three types of adjustment strategies in the embodiments of the present application. For details, reference can be made to Type 1, Type 2, and Type 3 in the above embodiments.

[0325] In addition, in actual applications, after generating text information according to the user's voice in S602, the text information can also be displayed in the voice assistant window.

[0326] S603, the voice assistant sends a duration modification instruction to the media processing platform 1, and the instruction carries the adjustment strategy type and time.

[0327] For example, it can carry the identifier corresponding to Type 1, the identifier corresponding to Type 2, or the identifier corresponding to Type 3 in the above examples. Correspondingly, the time is t1, t2, or t3 in the above embodiments.

[0328] S604, after receiving the duration modification instruction, the media processing middle platform 1 sends a duration modification instruction to the light editing service.

[0329] S605, after receiving the duration modification instruction, the light editing service detects the legality of the duration modification instruction.

[0330] In this step, it is necessary to calculate the duration of the new video according to the adjustment strategy type determined by the duration modification instruction and the duration carried in the duration modification instruction as shown in Figure 7 、 Figure 8 or Figure 9 . Then, execute S401 in Figure 10 to judge the legality of the duration modification instruction.

[0331] As an example, when the calculated duration of the new video is within the range of [1, min(n, 90)], it means that the duration modification instruction is legal; when the calculated duration of the new video is not within the range of [1, min(n, 90)], it means that the duration modification instruction is illegal.

[0332] S606, if the duration modification instruction is illegal, the light editing service sends information indicating that the instruction is illegal to the media processing middle platform 1.

[0333] S607, after receiving the information indicating that the instruction is illegal, the media processing middle platform 1 sends information indicating that the instruction is illegal to the voice assistant.

[0334] After receiving the information indicating that the instruction is illegal, the voice assistant can display the corresponding text information. For example, Figure 6 "To ensure the finished video effect, it can be adjusted up to 90 seconds at most, and it has been adjusted to 90 seconds for you" or "To ensure the finished video effect, it can be adjusted down to 1 second at least, and it has been adjusted to 1 second for you" as shown in . Of course, the text information and the cover of the new video can also be displayed after actually obtaining the new video. The present application does not limit this.

[0335] Regardless of whether the instruction is legal, the light editing service needs to execute step 608 and subsequent steps to generate a second finished video, that is, the process of generating a new video.

[0336] S608, the light editing service obtains the video json file during the previous video production and obtains video data from the video json file.

[0337] In the video json file, media materials during the previous video production (for example, the high - light segments used last time), configuration information (for example, selected templates, special effects, etc.), and the duration of the high - light segment where each segment that makes up the original video is located, the duration of each segment that makes up the original video, etc. are recorded. Of course, after obtaining the video data, the above - mentioned information is also carried in the video data.

[0338] S609, the light editing service creates a duration adjustment node in the video production module.

[0339] S610, the light editing service sends the video data and the calculated new video duration to the duration adjustment node in the video production module.

[0340] S611, the duration adjustment node executes S404 to S408 to obtain the new duration of each segment in the original video.

[0341] 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.

[0342] In the embodiment of the present application, if the original duration of segment 1 is 1 second and needs to be adjusted to 2 seconds, the duration of the high - light segment where segment 1 is located is 5 seconds, and segment 1 is from the 2nd second to the 3rd second in the high - light segment. Then the new duration of segment 1 can be set to 2 seconds, and the adjusted segment 1 is from the 2nd second to the 4th second, or from the 1st second to the 3rd second, or from the 1.5th second to the 3.5th second in the high - light segment.

[0343] 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 high - light segment where segment 1 is located is 1 second, and segment 1 is from the 0th second to the 1st second in the high - light segment. Then the new duration of segment 1 can be set to 2 seconds, and the adjusted segment 1 is from the 0th second to the 1st second in the high - light segment, only playing it slowly so that the playing duration of segment 1 is 2 seconds. Of course, the new duration of segment 1 can also be set to the duration of the high - light segment where segment 1 is located, which is 1 second, and the - 1 second is rolled as a difference to the next segment. The embodiment of the present application does not limit the specific implementation manner.

[0344] S613, after adjusting the content of each segment, the duration adjustment node restores the original video configuration information, such as templates, special effects, etc., in the video data after adjusting the segment content.

[0345] S614. After restoring the configuration information of the original video in the video data with the duration node adjusted and the content of the adjusted segment, send the adjusted video data to the light editing service.

[0346] S615. After receiving the adjusted video data, the light editing service converts the adjusted video data into a video json file.

[0347] S616. The light editing service sends the video json file to the voice assistant through the media processing middle platform 1.

[0348] S617. After receiving the video json file, the voice assistant displays the text "The duration of the video has been adjusted" and the cover of the video after the duration is adjusted in the voice assistant window.

[0349] Of course, if the judgment result of S605 is illegal during the specific implementation process, the text displayed at this time is "To ensure the final video effect, the maximum adjustment is up to t (for example, 1, n or 90) seconds, and it has been adjusted to t (for example, 1, n or 90) seconds for you" or "To ensure the final video effect, the minimum adjustment is 1 second, and it has been adjusted to 1 second for you".

[0350] It can be understood that in this way, the duration of the generated video can be efficiently adjusted, improving the user experience.

[0351] It should be understood that the magnitudes of the sequence numbers of the steps in the above embodiments do not mean the order of execution. The order of execution of each process should be determined according to its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.

[0352] The embodiment of the present application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program runs on an electronic device, the steps in the above various method embodiments can be implemented.

[0353] The embodiment of the present application also provides a computer program product. When the computer program product runs on an electronic device or a wireless router, the electronic device can implement the steps in the above various method embodiments.

[0354] When an integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, to implement all or part of the processes in the above-described embodiment methods of this application, a computer program can be used to instruct relevant hardware to complete the operations. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, the steps of the above-described method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in the form of source code, object code, executable file, or some intermediate form, etc. The computer-readable medium can at least include: any entity or device that can carry the computer program code to a first device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical 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 disc, etc. In some jurisdictions, according to legislation and patent practice, the computer-readable medium cannot be an electrical carrier signal and a telecommunication signal.

[0355] The embodiment of this application also provides a chip, which includes a processor. The processor is coupled to a memory, and the processor calls the computer program stored in the memory to implement the steps of any method embodiment of this application. The chip can be a single chip or a chip module composed of multiple chips.

[0356] In the above embodiments, the descriptions of each embodiment have their own focuses. For parts not detailed or recorded in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0357] Those of ordinary skill in the art can realize that the units and method steps of the examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. A professional technician can use different methods for each specific application to implement the described functions, but this implementation should not be considered to exceed the scope of this application.

[0358] The above embodiments are only used to illustrate the technical solutions of this application, rather than to limit them; although this application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included in the protection scope of this 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 a 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 second video having 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 the 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 a 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 the 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, wherein The obtaining the 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 a 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 a difference between the fifth duration and the first duration.

5. The method according to claim 3, characterized in that, The obtaining the duration change constraint condition includes: Calculating a first duration change constraint condition, the first duration change constraint condition being: a first minimum value of the duration change is 0, and a first maximum value of the duration change is a first percentage of an expected duration of the second video, the expected duration of the second video being determined by a 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 a 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 of the duration change constraint condition; 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.

8. The method according to any one of claims 3 to 7, characterized in that, The obtaining, according to the first duration of the first video and the duration change value, a calculated duration of the second video 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: Determine 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; The content of the first video is adjusted according to the calculated duration of the second video to obtain the second video.

10. The method according to claim 9, wherein The first video includes one or more sub-segments, each sub-segment corresponds to a parent segment, and each sub-segment is obtained by intercepting the corresponding parent segment; The minimum value of the first range is a preset minimum film duration, the maximum value of the first range is a 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.

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: Acquiring media material related to the first keyword from the electronic device; Obtain corresponding master clips from various media materials; According to the preset minimum film duration and maximum film duration, sub-segments are extracted 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.

12. The method according to claim 11, characterized in that, The first video includes a first number of sub-segments; The step of adjusting 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 value 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 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 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, wherein Each sub - segment in the first video corresponds to a parent segment, and each sub - segment is intercepted from the corresponding parent segment. The step 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 is caused to execute the method according to any one of claims 1 - 14.

16. A chip system, which is applied to an electronic device and includes one or more processors, characterized in that, The processor is used to call computer instructions to cause 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

  • 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, computer equipment and storage medium

    CN117082304A

  • Automated visual image editing system

    US7362946B1

Cited By

  • Method for adjusting video duration, electronic device, storage medium, and chip

    EP4753252A1

  • Method for adjusting video duration, electronic device, storage medium, and chip

    WO2025148733A1