Method for adjusting video duration, electronic device, chip system and storage medium
By receiving voice information through a voice assistant to generate and adjust video duration, the problem of automatically generated video durations not meeting user expectations has been solved, enabling simple and quick adjustment of video duration and improving user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HONOR DEVICE CO LTD
- Filing Date
- 2024-03-18
- Publication Date
- 2026-07-07
AI Technical Summary
In existing technologies, the length of automatically generated videos does not meet expectations, leading to cumbersome video editing operations and a poor user experience.
The system receives user voice information through a voice assistant, generates and adjusts video duration, and uses semantic information to generate computer program instructions to automatically adjust the video duration to meet user needs.
The process of adjusting video length has been simplified, improving the user experience and making video length adjustment more convenient, faster, and more efficient.
Smart Images

Figure CN120711226B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of terminal equipment technology, and in particular to a method for adjusting video duration, electronic equipment, chip system, and storage medium. Background Technology
[0002] Many electronic devices are equipped with cameras, allowing users to take photos and videos. These devices also have communication capabilities, enabling users to download images or videos from the internet or receive images or videos sent by other electronic devices. Users can edit the images and / or videos stored on their electronic devices to create a single video from selected images and / or videos.
[0003] Currently, users can select one or more media assets (images and videos) in the gallery app, and then the gallery app will automatically generate a video based on the selected media assets. However, the length of this automatically generated video often does not meet the user's expectations. Users need to re-edit the video using the video editing functions provided by their electronic devices (such as video splitting and merging), making the process of obtaining the video cumbersome, inefficient, and resulting in a poor user experience. Summary of the Invention
[0004] This application provides a method, electronic device, chip system, and storage medium for adjusting video duration, which can efficiently adjust the duration of generated videos and improve user experience.
[0005] To achieve the above objectives, the first aspect of this application adopts the following technical solution:
[0006] The first aspect of this application provides a method for adjusting video duration, including:
[0007] Receive first voice information, the first voice information carrying a first keyword;
[0008] In response to the first voice information, the cover of the first video is displayed on the first interface. 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 the first duration.
[0009] Received second voice message;
[0010] The second voice information is converted into the first semantic information;
[0011] A first instruction is generated based on the first semantic information, wherein the first instruction is a computer program executable instruction.
[0012] In response to the first instruction, the cover of the second video is displayed on the first interface. The duration of the second video is the second duration. The second video contains part or all of the content of the first video.
[0013] In this application, a first video is automatically generated based on media materials related to keywords in the user's voice information (i.e., the user's natural language) on an electronic device. The video generation method is simple and quick. If the user is not satisfied with the length of the generated first video, the user can also adjust the length of the generated first video through voice information. The electronic device generates semantic information based on the voice information used to adjust the length of the first video, and then generates computer program executable instructions based on the semantic information. The electronic device can automatically adjust the length of the first video according to the computer program executable instructions to obtain a second video. Of course, the second video is an adjustment based on the first video, so the second video contains part or all of the content of the first video. It can be understood that the method of adjusting the video length is also relatively simple, quick and efficient, thus improving the user experience.
[0014] As one implementation of the first aspect, generating the first instruction based on the first semantic information includes:
[0015] Determine whether the first semantic information belongs to a first semantic category, wherein the first semantic category is one of at least two preset semantic categories;
[0016] If the first semantic information is the first semantic category, then a first instruction corresponding to the first semantic category and an adjustment duration indicated by the first instruction are generated.
[0017] In this application, multiple semantic categories can be set, and the first semantic information can be determined in turn to determine whether it belongs to any of the multiple semantic categories. When it is determined that the first semantic information belongs to one of the multiple semantic categories, an instruction corresponding to the semantic category and an adjustment duration indicated by the instruction can be generated.
[0018] As another implementation of the first aspect, the method further includes:
[0019] If the first semantic information is not the first semantic category, then it is determined whether the first semantic information is a second semantic category, wherein the second semantic category is one of the preset at least two semantic categories and is different from the first semantic category.
[0020] In this application, it is possible to determine in sequence whether the first semantic information belongs to multiple preset semantic categories. When it is determined that the first semantic information does not belong to the current semantic category, it is possible to continue to determine whether the first semantic information belongs to the next semantic category, thereby determining the semantic category corresponding to the first semantic information.
[0021] As one implementation of the first aspect, the first semantic category is: adjustment; determining whether the first semantic information belongs to the first semantic category includes:
[0022] Determine whether the adjustment field in the first semantic information is an extension;
[0023] If the first semantic information is the first semantic category, then generating a first instruction corresponding to the first semantic category includes:
[0024] If the adjustment field in the first semantic information is extension, then a first instruction is generated, and the first instruction is an adjustment instruction;
[0025] The minimum value between m times the first duration and the maximum allowed duration of the first video is taken as the adjustment duration corresponding to the adjustment instruction, where m is a number greater than 1 and less than 2.
[0026] In this application, if the semantic category is "adjustment" and the adjustment field is "extension," it typically indicates that the user's natural language explicitly specifies the extension time. In this case, a certain percentage extension can be set. When generating the first video, its duration is usually related to the media material used to generate it. Therefore, when adjusting the duration of the first video, it cannot be extended indefinitely; that is, the first video has a maximum allowed duration (this maximum allowed duration is related to the duration of the media material used to generate the first video and the preset maximum duration). The minimum value between m times the first duration and the maximum allowed duration of the first video can be taken as the adjustment duration.
[0027] In practical applications, a maximum video duration may be set to 90 seconds, and the maximum duration that the media material used to generate the first video can be is t. Typically, the minimum of 90 seconds and t is the maximum allowed duration.
[0028] As another implementation of the first aspect of this application, after determining whether the adjustment field in the first semantic information is an extension, the method further includes:
[0029] If the adjustment field in the first semantic information is not an extension, then determine whether the adjustment field in the first semantic information is a shortening;
[0030] If the first semantic information is the first semantic category, then generating a first instruction corresponding to the first semantic category includes:
[0031] If the adjustment field in the first semantic information is shortening, then a first instruction is generated, and the first instruction is an adjustment instruction;
[0032] The maximum value between n times the first duration and the minimum allowed duration of the first video is taken as the adjustment duration corresponding to the adjustment instruction, where n is a number greater than 0 and less than 1.
[0033] In this application, a minimum video length may be set to 1 second, thus allowing a minimum duration of 1 second. When shortening the duration of the first video, it cannot be shortened indefinitely; a minimum of 1 second is still required.
[0034] As another implementation of the first aspect of this application, the first semantic category is: not less than; the determination of whether the first semantic information is the first semantic category includes:
[0035] Determine whether the "not less than" field in the first semantic information is empty;
[0036] If the first semantic information is the first semantic category, then generating a first instruction corresponding to the first semantic category includes:
[0037] If the "not less than" field in the first semantic information is not empty, then a first instruction is generated, and the first instruction is a "not less than" instruction;
[0038] The value corresponding to the "not less than" field is used as the adjustment duration corresponding to the "not less than" instruction.
[0039] As another implementation of the first aspect of this application, the first semantic category is: not greater than; the determination of whether the first semantic information is the first semantic category includes:
[0040] Determine whether the "not greater than" field in the first semantic information is empty;
[0041] If the first semantic information is the first semantic category, then generating a first instruction corresponding to the first semantic category includes:
[0042] If the "not greater than" field in the first semantic information is not empty, then a first instruction is generated, and the first instruction is a "not greater than" instruction;
[0043] The value corresponding to the "not greater than" field is used as the adjustment duration corresponding to the "not greater than" instruction.
[0044] In this application, the values corresponding to the "not greater than" and "not less than" fields can be used as the adjustment duration corresponding to the instruction.
[0045] As another implementation of the first aspect, the first semantic category is: a range interval, and the step of determining whether the first semantic information belongs to the first semantic category includes:
[0046] Determine whether the minimum value in the range interval field of the first semantic information is less than the first duration, and whether the maximum value in the range interval field is greater than the first duration;
[0047] If the first semantic information is the first semantic category, then generating a first instruction corresponding to the first semantic category includes:
[0048] If the minimum value in the range interval field of the first semantic information is less than the first duration and the maximum value in the range interval field is greater than the first duration, then a first instruction is generated, and the first instruction is an adjustment instruction.
[0049] The maximum value between the minimum allowed duration of the first video and the minimum value in the range interval field is taken as the minimum value of the adjustment instruction;
[0050] The minimum value between the maximum allowed duration of the first video and the maximum value in the range interval field is taken as the maximum value of the adjustment instruction;
[0051] The average of the minimum value and the maximum value is used as the adjustment duration corresponding to the adjustment instruction.
[0052] In this application, by comparing the relationship between the minimum value, maximum value, and first duration in the range interval field of the first semantic information, and determining that the user's natural language is not illegal, the maximum value is re-determined based on the minimum value among the maximum values in the range interval field and the allowed maximum duration; the minimum value is re-determined based on the maximum value in the range interval field and the allowed minimum duration; and the average of the re-determined maximum and minimum values is used as the adjustment duration, so that the adjusted duration as much as possible meets the range between the allowed minimum and maximum durations, and also as much as possible meets the range interval specified by the user.
[0053] As another implementation of the first aspect, the first semantic category is: adjusted to, wherein determining whether the first semantic information belongs to the first semantic category includes:
[0054] Determine whether the value corresponding to the "adjust to" field in the first semantic information is greater than the minimum allowed duration of the first video, less than the maximum allowed duration of the first video, and not equal to the first duration;
[0055] If the first semantic information is the first semantic category, then generating a first instruction corresponding to the first semantic category includes:
[0056] If the value corresponding to the "adjust to" field in the first semantic information is greater than the minimum allowed duration of the first video, less than the maximum allowed duration of the first video, and not equal to the first duration, then a first instruction is generated, and the first instruction is an adjustment instruction.
[0057] The value corresponding to the adjusted field is used as the adjustment duration corresponding to the adjustment instruction.
[0058] In this application, when the first semantic category is "adjusted to", the relationship between the time corresponding to the "adjusted to" field, the minimum allowed duration, the maximum allowed duration, and the first duration is used to determine that the user's natural language is not an illegal language (an unenforceable language instruction), and then the subsequent video adjustment process is carried out to avoid the adjusted video duration not meeting the user's needs.
[0059] As another implementation of the first aspect, the first semantic category is: addition, and the determination of whether the first semantic information belongs to the first semantic category includes:
[0060] Determine whether the value corresponding to the added field in the first semantic information is greater than 0;
[0061] If the first semantic information is the first semantic category, then generating a first instruction corresponding to the first semantic category includes:
[0062] If the value corresponding to the added field in the first semantic information is greater than 0, then a first instruction is generated, which is an add instruction;
[0063] The value corresponding to the added field is used as the adjustment duration corresponding to the added instruction.
[0064] As another implementation of the first aspect, the first semantic category is: reduction, and the determination of whether the first semantic information belongs to the first semantic category includes:
[0065] Determine whether the value corresponding to the decrease field in the first semantic information is greater than 0;
[0066] If the first semantic information is the first semantic category, then generating a first instruction corresponding to the first semantic category includes:
[0067] If the value corresponding to the reduction field in the first semantic information is greater than 0, then a first instruction is generated, and the first instruction is a reduction instruction;
[0068] The value corresponding to the reduction field is used as the adjustment duration corresponding to the reduction instruction.
[0069] As another implementation of the first aspect of this application, before the cover of the second video is displayed on the first interface, the method further includes:
[0070] Based on the first instruction, the calculation duration of the second video is obtained; based on the calculation duration of the second video, the content of the first video is adjusted to obtain the second video.
[0071] In this application, the user's first instruction may be of several types, such as extending t1 seconds, shortening t1 seconds, adjusting to t2 seconds, adjusting to above t3 seconds, or adjusting to below t3 seconds. Therefore, based on the first instruction, the calculated duration of the second video is obtained, and then adjustments are made.
[0072] As another implementation of the first aspect of this application, the calculation duration of the second video is obtained according to the first instruction, including:
[0073] The expected change duration between the second video and the first video is obtained according to the first instruction, and the expected change duration is determined by the adjustment duration corresponding to the first instruction.
[0074] Obtain the constraints for duration changes;
[0075] Based on the expected duration of change and the constraints on duration change, the duration change value is obtained;
[0076] The calculated duration of the second video is obtained based on the first video's duration and duration change value.
[0077] In this application, since the first video is automatically generated, its first duration is related to the content and quantity of media materials corresponding to the user's first voice information. That is, when the video is generated based on the media materials obtained from the first voice information, the first duration is a relatively reasonable duration. Therefore, in order to ensure the final product's effect, some duration variation constraints are set. The duration cannot change too much or too little compared to the first video's duration. Thus, duration variation constraints are set to make the second video's duration more reasonable and the final product's effect better.
[0078] As another implementation of the first aspect of this application, obtaining the expected duration of change between the second video and the first video according to the first instruction includes:
[0079] When the first instruction is an increment or decrement instruction, the expected change duration is the adjustment duration;
[0080] When the first instruction is an adjustment instruction, the expected change duration is the difference between the adjustment duration and the first duration;
[0081] When the first instruction is not greater than or not less than the instruction, the expected change duration is the difference between the adjustment duration and the first duration.
[0082] In this application, the first instruction may be of several types, such as extending t1 seconds, shortening t1 seconds, adjusting to t2 seconds, adjusting to above t3 seconds, or adjusting to below t3 seconds. Regardless of the type, it is necessary to obtain the expected change in duration between the second video and the first video, i.e., the adjusted duration expected by the user. Subsequently, based on this adjusted duration expected by the user, the calculated duration of the second video is obtained.
[0083] As another implementation of the first aspect of this application, the constraints for obtaining the duration variation include:
[0084] Calculate the first duration change constraint. The first duration change constraint is: the first minimum value of duration change is 0, the first maximum value of duration change is the first percentage of the expected duration of the second video, and the expected duration of the second video is determined by the duration indicated in the first instruction.
[0085] Obtain the second duration variation constraint, which sets the second maximum and second minimum values for duration variation;
[0086] Based on the first duration variation constraint and / or the second duration variation constraint, the duration variation constraint is obtained.
[0087] In this application, for the sake of the final product effect, the duration of the new video and the duration of the original video are controlled within a certain percentage of the expected duration of the new video. Of course, the user's expected duration may be relatively outrageous, so a second duration change constraint is also set to ensure the final product effect of the second video through upper and lower limits.
[0088] As another implementation of the first aspect of this application, the duration variation constraints are obtained based on the first duration variation constraint and / or the second duration variation constraint, including:
[0089] When the first maximum value is less than the second minimum value, the time duration change constraint is: the time duration change value is the second minimum value;
[0090] When the first maximum value is greater than the second maximum value, the duration change constraint becomes the second duration change constraint.
[0091] 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 is that the minimum duration change is the second minimum value and the maximum duration change is the first maximum value.
[0092] In this application, the intersection of two constraints is taken as the final duration change constraint. However, in practical applications, the two constraints may not have an intersection. For example, when a certain percentage of the expected duration is less than the lower limit of another constraint, the maximum and minimum values of the duration change range are set to the lower limit value to ensure that the duration of each adjustment is not too small, nor too large.
[0093] As another implementation of the first aspect of this application, the duration change value is obtained based on the expected duration change and the duration change constraint, including:
[0094] When the expected duration of change is within the range of the duration change constraint, the duration change value is the expected duration of change.
[0095] When the expected duration of change is less than the minimum value of the duration change constraint, the duration change value is the minimum value of the duration change constraint.
[0096] When the expected duration of change exceeds the maximum value of the duration change constraint, the duration change value is the maximum value of the duration change constraint.
[0097] As another implementation of the first aspect of this application, the calculated duration of the second video is obtained based on the first duration and duration change value of the first video, including:
[0098] 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.
[0099] 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.
[0100] As another implementation of the first aspect of this application, before adjusting the content of the first video according to the calculation duration of the second video to obtain the second video, the method further includes:
[0101] Determine if the calculation duration of the second video is within the first range;
[0102] If the calculation duration of the second video is less than the minimum value of the first range, then the calculation duration of the second video is updated to the minimum value of the first range.
[0103] If the calculation duration of the second video is greater than the maximum value of the first range, then the calculation duration of the second video is updated to the maximum value of the first range.
[0104] The content of the first video is adjusted based on the calculation duration of the second video to obtain the second video.
[0105] In this application, the calculated duration of the second video may still be unreasonable. Therefore, in this embodiment, the duration of the second video also needs to be constrained by a first range to ensure the final finished product. This ensures that the final second video is within this first range as much as possible.
[0106] As another implementation of the first aspect of this application, the first video includes one or more sub-segments, each sub-segment corresponding to a parent segment, and each sub-segment is extracted from the corresponding parent segment;
[0107] The minimum value of the first range is the preset minimum total length of the video, and the maximum value of the first range is the minimum value between the first value and the preset maximum total length of the video. The first value is the sum of the lengths of the parent segment to which each sub-segment in the first video belongs.
[0108] As another implementation of the first aspect of this application, before the cover of the first video is displayed on the first interface, the method further includes:
[0109] Obtain media materials related to the primary keyword from electronic devices;
[0110] Obtain the corresponding master segments from various media materials;
[0111] Based on the preset minimum and maximum video lengths, sub-segments are extracted from each of the obtained parent segments to generate the first video. The length of the first video is greater than or equal to the minimum video length and greater than or equal to the maximum video length.
[0112] As another implementation of the first aspect of this application, the first video includes a first number of sub-segments;
[0113] Based on the calculated duration of the second video, the content of the first video is adjusted to obtain the second video, which includes:
[0114] The first difference is obtained based on the calculated duration of the second video and the first duration;
[0115] Based on the first difference and the first quantity, the theoretical average change duration of each sub-segment in the first video is obtained;
[0116] For the first sub-segment, determine whether the theoretical duration of the first sub-segment is within the sub-segment duration range. 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. The difference of the previous sub-segment is the difference between the theoretical duration of the previous sub-segment and the actual duration of the previous sub-segment.
[0117] 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;
[0118] 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;
[0119] 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;
[0120] The difference between the theoretical duration and the actual duration of the first sub-segment is obtained.
[0121] After obtaining the actual duration of each sub-segment in the first video, the actual duration of each sub-segment is used as the duration of each sub-segment in the first video to obtain the second video. The second duration of the second video is the sum of the actual durations of each sub-segment.
[0122] In this application, the final effect of the second video is ensured by averaging the duration of each sub-segment in the first video. In order to make the duration of the second video as accurate as possible, if there is a difference between the actual duration and the theoretical duration of a certain sub-segment, the difference is rolled to the next segment so that the next segment compensates for the difference, thereby making the final duration of the second video closer to the calculated duration of the second video.
[0123] As another implementation of the first aspect of this application, each sub-segment in the first video corresponds to a parent segment, and each sub-segment is extracted from the corresponding parent segment. Using the actual duration of each sub-segment as the duration of each sub-segment in the first video includes:
[0124] For the first sub-segment, adjust the start time and / or end time of the first sub-segment in the first parent segment to obtain the first sub-segment with adjusted duration. The first parent segment is the parent segment in which the first sub-segment is located. The difference between the end time and start time of the adjusted first sub-segment is the actual duration of the first sub-segment.
[0125] As another implementation of the first aspect of this application, when the first instruction is to adjust the duration of the first video to a duration of six or less, before obtaining the calculated duration of the second video according to the first instruction, the method further includes:
[0126] It is determined that the first duration is greater than the sixth duration;
[0127] When the first instruction is to adjust the duration of the first video to a duration of six or more, before obtaining the calculated duration of the second video according to the first instruction, the method further includes:
[0128] It is determined that the first duration is less than the sixth duration.
[0129] In this application, the duration of the first video may already meet the expected duration corresponding to the user's voice command. In this case, the duration of the first video will not be adjusted. If the duration of the first video does not meet the expected duration corresponding to the user's voice command, the duration of the first video will be adjusted to obtain the second video.
[0130] In a second aspect, an electronic device is provided, including a processor for calling a computer program stored in a memory to implement the method of any one of the first aspects of this application.
[0131] Thirdly, a chip is provided, including a processor coupled to a memory, the processor executing a computer program stored in the memory to cause an electronic device to implement the method of any of the first aspects of this application.
[0132] Fourthly, a computer-readable storage medium is provided, which stores a computer program that, when computer instructions are executed on an electronic device, causes the electronic device to implement the method of any one of the first aspects of this application.
[0133] Fifthly, embodiments of this application provide a computer program product that, when run on a device, causes the electronic device to execute the method of any one of the first aspects of this application.
[0134] It is understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here. Attached Figure Description
[0135] Figure 1 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application;
[0136] Figure 2 A schematic diagram of an interface for generating video via a voice assistant, provided as an embodiment of this application;
[0137] Figure 3 A schematic diagram of an interface for adjusting video duration via a voice assistant, provided as an embodiment of this application;
[0138] Figure 4 This application provides another schematic diagram of an interface for adjusting video duration via a voice assistant, as shown in the embodiments of the present application.
[0139] Figure 5 This application provides another schematic diagram of an interface for adjusting video duration via a voice assistant, as shown in the embodiments of the present application.
[0140] Figure 6 Another schematic diagram of an interface for adjusting video duration via a voice assistant provided in this application embodiment;
[0141] Figure 7 A flowchart illustrating the generation of executable computer program instructions based on semantic information, provided for an embodiment of this application;
[0142] Figure 8 A flowchart illustrating the generation of executable computer program instructions based on semantic information, provided for an embodiment of this application;
[0143] Figure 9 This application provides a schematic diagram of a process for shortening or extending the original video by t1 seconds, as an embodiment of the present application.
[0144] Figure 10 This application provides a schematic diagram of a process for adjusting the original video to approximately t2 seconds, as shown in the embodiments of this application.
[0145] Figure 11 This application provides a schematic diagram of a process for adjusting the original video to a value greater than or less than t3 seconds, as an embodiment of the present application.
[0146] Figure 12 A flowchart illustrating a process for calculating the new duration of each segment based on the duration of a new video, provided as an embodiment of this application;
[0147] Figure 13 A timing diagram for generating video via a voice assistant, provided as an embodiment of this application;
[0148] Figure 14 This is a timing diagram for adjusting video duration via a voice assistant, provided as an embodiment of this application. Detailed Implementation
[0149] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limiting purposes, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details.
[0150] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.
[0151] It should also be understood that in the embodiments of this application, "one or more" refers to one, two, or more; "and / or" describes the relationship between the associated objects, indicating that three relationships can exist; for example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following associated objects have an "or" relationship.
[0152] Furthermore, in the description of this application and the appended claims, the terms "first," "second," "third," "fourth," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0153] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0154] This application provides a method for adjusting video duration, which can be applied to electronic devices such as tablets, mobile phones, wearable devices, laptops, ultra-mobile personal computers (UMPCs), netbooks, and personal digital assistants (PDAs). This application does not limit the specific type of electronic device.
[0155] Figure 1A 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, antenna 1, antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, a sensor module 180, buttons 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer sensor 180E, a distance sensor 180F, a proximity 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.
[0156] It is understood that the structures illustrated in the embodiments of this application do 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 illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0157] Processor 110 may include one or more processing units, such as an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processing unit (NPU). Different processing units may be independent devices or integrated into one or more processors. For example, processor 110 is used to execute the video frame playback method in the embodiments of this application.
[0158] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0159] Internal memory 121 can be used to store computer executable program code, including instructions. Processor 110 executes various functional applications and data processing of electronic device 100 by running the instructions stored in internal memory 121. Internal memory 121 may include a program storage area and a data storage area. The program storage area may store the operating system and at least one application program required for a function (such as image playback). Touch sensor 180K, also called a "touch panel," can be disposed on display screen 194. Touch sensor 180K and display screen 194 together form a touch screen, also called a "touch screen." Touch sensor 180K is used to detect touch operations applied to or near it. Touch sensor can transmit the detected touch operation to application processor to determine the type of touch event. Visual output related to the touch operation can be provided through display screen 194. In other embodiments, touch sensor 180K may also be disposed on the surface of electronic device 100, in a different location than display screen 194.
[0160] The electronic device 100 implements display functions through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information. For example, in this embodiment, the process of rendering YUV data can be implemented using a GPU.
[0161] Display screen 194 is used to display images, videos, etc. 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 minimized display, a microLED, a micro-OLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, electronic device 100 may include one or N displays 194, where N is a positive integer greater than 1. For example, in the embodiments of this application... Figure 2 or Figure 3 All interfaces shown are displayed on the monitor.
[0162] This application does not specifically limit the structure of the execution entity of the method for adjusting video duration. As long as communication can be performed according to the method for adjusting video duration provided by this application by running code that records the method for adjusting video duration according to this application. For example, the execution entity of the method for adjusting video duration provided by this application can be a functional module in an electronic device that can call and execute programs, or a communication device applied in an electronic device, such as a chip.
[0163] Currently, many electronic devices are equipped with cameras, allowing users to take photos and videos. These devices also have communication capabilities, enabling users to download images or videos from the internet or receive images or videos sent by other electronic devices. Users can edit images and / or videos stored on their electronic devices to create entirely new videos from selected images and / or videos.
[0164] As a scenario example, a user selects 3 videos and 3 pictures in the gallery app, and the gallery app automatically generates a brand new video based on the selected 3 videos and 3 pictures.
[0165] However, in practice, the length of the generated videos may not meet user expectations. For example, some social media apps allow videos up to 15 seconds long, but videos generated through photo galleries may be 18 seconds long; some product showcase videos require a minimum length of 45 seconds, but videos generated through photo galleries are only 42 seconds long. In these cases, users may need to re-edit the generated videos to meet their expectations.
[0166] Furthermore, statistics from a large number of users show that the number of times the photo library app was used to generate videos over several consecutive months was 180,319, 225,494, 198,392, 314,070, and 262,916, averaging approximately 250,000 times per month. Correspondingly, the number of times users re-edited the videos generated through the photo library app, thus changing the video length, was 107,844, 137,843, 127,113, 192,141, and 162,929, averaging approximately 150,000 times per month. This equates to approximately 60% of videos undergoing secondary length adjustments.
[0167] Furthermore, the actual investigation revealed that some users did not adjust the video length a second time, not because the initial video length met their expectations, but because the process of adjusting the length a second time was too cumbersome and resulted in a poor user experience.
[0168] In view of this, embodiments of this application provide a method for adjusting video duration. After generating a video (referred to as the original video), a new video with altered duration can be obtained by adding or shortening a certain duration based on the original video according to user instructions. Alternatively, a new video of a specified duration can be generated based on the original video according to user instructions, or a new video of a specified duration or less can be obtained based on the original video according to user instructions.
[0169] To make it easier to distinguish, the video before the duration adjustment will be referred to as the original video (which can be called the first video), and the video after the duration adjustment will be referred to as the new video (which can be called the second video). The duration of the first video will be referred to as the first duration, and the duration of the second video will be referred to as the second duration.
[0170] In this embodiment, the user command can be a voice command. Therefore, this embodiment can use a voice assistant provided by an electronic device or other applications with voice functions to call the video editing application. The video editing application can be called by voice command to generate a video (denoted as the original video). The video editing application can also be called by voice command to perform a secondary duration adjustment on the generated original video to obtain a new video.
[0171] The following is a schematic diagram of a scenario illustrating the method for adjusting video duration provided in this application embodiment, using the voice assistant of an electronic device as an example to call a video editing application.
[0172] Reference Figure 2 This is a schematic diagram of the interface for generating video via a voice assistant provided in an embodiment of this application;
[0173] Reference Figure 2 As shown in (a), the user speaks "yoyo" within the voice detection range of the electronic device to activate its voice assistant. After detecting the "yoyo" voice, the electronic device responds with the voice message "I'm listening, please speak," and simultaneously displays... Figure 2 The interface shown in (a) is shown in the image. Figure 2 In the interface shown in (a), a voice assistant window 21 is displayed, which includes the text message "I'm listening, please speak." The purpose of this voice response and text message is to notify the user that the voice assistant has been activated and to prompt the user to speak a voice command. In practical applications, other voice response content and text message content can be set as needed to achieve the same reminder effect.
[0174] The user responds with the voice message "I'm listening, please speak" and / or the text message "I'm listening, please speak," and within the voice detection range of the electronic device, speaks the voice command "Generate a video of the child." After detecting the voice command "Generate a video of the child," the electronic device displays the user's voice message "Generate a video of the child" in the voice assistant window 21. It then generates a video based on images and videos of the child stored on the electronic device. The materials used to generate the video can be images and / or videos from a photo library application. After successfully generating the video, the device outputs the voice message "A video of your child has been generated for you," and simultaneously displays the text message "A video of your child has been generated for you" and the video's cover image in the voice assistant window. The cover image displays a playback control 22 and the video duration "00:30," indicating that the generated video is 30 seconds long. In practical applications, the user can click the playback control 22 to trigger the electronic device to play the video; this application will not provide an illustrated example.
[0175] In practical implementation, after the electronic device detects the voice command "Generate a video of the child," it can also recognize "children" in the images and / or videos stored on the electronic device. When multiple different "children" are recognized, multiple child options, such as "son" and "daughter," can be displayed in the voice assistant window. The user can choose to generate a video based on images and videos related to the recognized "son," images and videos related to the recognized "daughter," or images and videos related to all recognized children (e.g., "son" and "daughter"). As an example, when the user says "daughter," the electronic device detects this voice command and displays the text "Ask you for selected materials related to daughters" and materials related to "daughter" selected from the electronic device in the voice assistant window. The user can then say "Generate video," and the electronic device will detect this voice command and generate a video based on the materials related to "daughter." This application will not provide further illustrations.
[0176] In this example, the voice information given by the user to instruct the generation of a video corresponds to the first voice information. This voice assistant window can serve as an example of a first interface for displaying the cover of the generated video. Of course, the keywords "child" or "daughter" in this example can be used as examples of first keywords for retrieving media materials.
[0177] If a user is not satisfied with the video length, they can continue to speak to edit the video and regenerate a video of a different length.
[0178] As an example of adjusting the length of the original video, refer to Figure 3 As shown, on the electronic device display Figure 2 In the interface shown in (b), the user speaks "Shorten by 4 seconds" within the voice monitoring range of the electronic device. After the electronic device detects the voice "Shorten by 4 seconds", it displays the user's voice information "Shorten by 4 seconds" in the voice assistant window 21 and adjusts the original video duration. After successfully adjusting the original video duration, it issues the voice message "Video duration adjusted". At the same time, it displays the text "Video duration adjusted" and the cover of the new video in the voice assistant window. The cover also displays the playback control 23 and the video duration "00:26". The video duration "00:26" indicates that the duration of the generated new video is 26 seconds.
[0179] In practical applications, users can also click the play control 23 to trigger the electronic device to play the new video; this application will not use illustrations to illustrate this further.
[0180] As an example of adjusting the length of the original video, refer to Figure 4 As shown, on the electronic device display Figure 2In the interface shown in (b), the user speaks "Adjust to 35 seconds" within the voice monitoring range of the electronic device. After the electronic device detects the voice "Adjust to 35 seconds", it displays the user's voice information "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 issues the voice message "Video duration adjusted". At the same time, it displays the text "Video duration adjusted" and the cover of the new video in the voice assistant window. The cover also displays the playback control 24 and the video duration "00:35". The video duration "00:35" indicates that the duration of the generated new video is 35 seconds.
[0181] In practical applications, users can also click the play control 24 to trigger the electronic device to play the new video; this application will not use illustrations to illustrate this further.
[0182] As an example of adjusting the length of the original video, refer to Figure 5 As shown, on the electronic device display Figure 2 In the interface shown in (b), the user speaks "Adjust to more than 33 seconds" within the voice monitoring range of the electronic device. After the electronic device detects the voice "Adjust to more than 33 seconds", it displays the user's voice information "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 issues the voice message "Video duration adjusted". At the same time, it displays the text "Video duration adjusted" and the cover of the new video in the voice assistant window. The cover also displays the playback control 25 and the video duration "00:35". The video duration "00:35" indicates that the duration of the generated new video is 35 seconds.
[0183] In practical applications, users can also click the play control 25 to trigger the electronic device to play the new video; this application will not use illustrations to illustrate this further.
[0184] As an example of adjusting the length of the original video, refer to Figure 6 As shown, on the electronic device display Figure 2In the interface shown in (b), the user speaks "Adjust to more than 30 minutes" within the voice monitoring range of the electronic device. After detecting the voice "Adjust to more than 30 minutes," the electronic device displays the user's voice information "Adjust to more than 30 minutes" in the voice assistant window 21 and adjusts the original video duration. In practical applications, the electronic device's ability to adjust the video is limited. For example, the duration of the new video after adjustment is at least 1 second and at most 90 seconds. Therefore, if the electronic device determines that it cannot adjust the video duration according to the user's instructions, it can calculate the adjustable video duration. After calculating the adjustable video duration (e.g., 90 seconds), it issues a voice reminder, "To ensure the final product's quality, the maximum adjustment is 90 seconds. It has been adjusted to 90 seconds for you." At the same time, the voice assistant window displays the text "To ensure the final product's quality, the maximum adjustment is 90 seconds. It has been adjusted to 90 seconds for you," as well as the cover of the new video. The cover also displays the playback control 26 and the video duration "00:90," indicating that the generated new video has a duration of 90 seconds.
[0185] In practical applications, users can also click the play control 26 to trigger the electronic device to play the new video; this application will not use illustrations to illustrate this further.
[0186] In the example above, the voice message given by the user to instruct on adjusting the video duration corresponds to the second voice message. The generated new video is also displayed in the voice assistant window.
[0187] The above embodiments all use user commands in the form of voice to trigger the electronic device to adjust the duration of the original video. As another embodiment of this application, the user command can also be a command generated by the user through adjustment method options and duration options provided on the interface. For example, adjustment method options can be set to "extend duration," "shorten duration," "adjust to duration," "adjust to more than duration," and "adjust to less than duration," etc. Each adjustment method option corresponds to a different duration option. For example, the duration option can be from 1 second to 90 seconds. This method does not require the participation of a voice assistant, but it does require setting up the adjustment interface. Subsequent embodiments of this application will all be described using user commands in the form of voice as examples.
[0188] In this embodiment of the application, after detecting the user's voice information, the electronic device converts the voice information into instructions executable by the electronic device before determining the corresponding adjustment method to be executed based on these instructions. For example, the voice information is first converted into semantic information for video duration adjustment (e.g., first semantic information); then the semantic information for video duration adjustment is used to generate executable instructions (e.g., first instructions).
[0189] Below are some user-defined natural language expressions used to adjust video length:
[0190] Make the video longer, make the video bigger, make the video bigger, make the video longer;
[0191] Shorten the video, reduce the video size, reduce the video size further, shorten the video;
[0192] The video should be longer, the video should be larger, the video is a bit short, the video is too short;
[0193] Shorter video, shorter video, video is a bit long, video is too long;
[0194] Add t seconds to the video, increase the video size by t seconds;
[0195] Decrease the video by t seconds; reduce the video size by t seconds.
[0196] Adjust the video to below t seconds, or adjust the video to above t seconds;
[0197] Adjust the video to a length no greater than t seconds and adjust the video to a length no less than t seconds.
[0198] Set the video to between t1 and t2 seconds;
[0199] Adjust to t seconds.
[0200] The user natural language examples listed above for adjusting video duration are for illustrative purposes only. In practical applications, more user natural language examples can be added. Below is a set of instructions for semantic information used to adjust video duration: "command":"com.hihonor.intent.utilities.media.modify.time" / / Indicates the intent to adjust video duration;
[0201] "sessionId":"xxxx" / / Session ID, which can be used to find the last completed video corresponding to the session ID as the original video whose duration needs to be adjusted;
[0202] "json_content":"xxxx" / / Extended field;
[0203] "cover":"xxxx" / / Extended field;
[0204] "currentTime":"xxxx" / / The duration of the last completed video under this session ID (i.e., the duration of the original video whose duration is to be adjusted);
[0205] "minAdjustTime":"xxxx" / / The minimum length that the last completed video under this session ID can be adjusted to;
[0206] "maxAdjustTime":"xxxx" / / The maximum adjustable duration of the last completed video under this session ID;
[0207] "parameters":"{ / / The following fields are preset semantic categories. In practical applications, a user's natural language message for adjusting video duration will yield semantic information for one category;
[0208] "vagueModify":"longer","shorter" / / The semantic category is adjustment. When the corresponding value is "longer", it means to lengthen; when the corresponding value is "shorter", it means to shorten.
[0209] "moreThan":"xxx" / / Semantic category: not less than, when the corresponding value is t, it means not less than t seconds;
[0210] "lessThan":"xxx" / / Semantic category: not greater than, when the corresponding value is t, it means not greater than t seconds;
[0211] "between":"{
[0212] "min":"xxx" / / ;
[0213] "max":"xxx";
[0214] / / The semantic category is: range interval. When the value corresponding to min is t1 and the value corresponding to max is t2, it means that the adjustment is between t1 and t2.
[0215] "equal":"xxxx" / / Semantic category: Adjust to, when the corresponding value is t, it means adjust to t seconds;
[0216] "add":"xxxx" / / Semantic category: increase; when the corresponding value is t, it means increase by t seconds.
[0217] "minus":"xxxx" / / Semantic category: decrease, when the corresponding value is t, it means decrease by t seconds. Of course, in practical applications, more semantic categories can be added according to the actual situation. The above semantic categories can all be used as examples of the first semantic category, and can also be used as examples of the second semantic category.
[0218] In this embodiment, the semantic information for adjusting video duration can be obtained by parsing the user's natural language used to adjust the video duration. For example, keywords in the user's natural language can be identified using a language model, and then semantic information corresponding to the user's natural language can be generated based on the keywords.
[0219] As an example, if the user's natural language is: "Make the video bigger", and the recognized keyword is "make bigger", then the "parameters" in the generated semantic information will be: "vagueModify":"longer";
[0220] The user's natural language is: "Shorten the video". The recognized keyword is "shorten". The generated semantic information "parameters" is: "vagueModify": "shorter".
[0221] The user's natural language is: "The video is too short". The recognized keyword is "too short". The generated semantic information "parameters" is: "vagueModify":"longer".
[0222] The user's natural language is: "Add 5 more seconds". The recognized keywords are "add" and "5 seconds". The generated semantic information "parameters" is: "add":"5".
[0223] The user's natural language is: "adjust to less than 30 seconds". The recognized keywords are "30 seconds" and "less than". The generated semantic information "parameters" is: "lessThan":"30".
[0224] The user's natural language is: "Adjust to no less than 30 seconds". The recognized keywords are "no less than" and "30 seconds". Then the "parameters" in the generated semantic information is: "moreThan":"30".
[0225] The user's natural language expression is: "adjust to between 30 and 40 seconds". The identified keywords are "30 to 40 seconds" and "between". Therefore, the "parameters" in the generated semantic information is: "between":"{
[0226] "min":"30" / / ;
[0227] "max":"40";
[0228] }";
[0229] If the user's natural language is: "adjusted to 35 seconds", then the recognized keyword is "for 35 seconds", and the "parameters" in the generated semantic information is: "equal":"35".
[0230] The above only lists some of the processes by which users generate semantic information from natural language. In practical applications, there may be other processes by which users generate different semantic information from natural language.
[0231] In addition, the semantic information in the above example only includes the semantic categories in "parameters". In actual applications, other fields may also be included, such as: "command":"com.hihonor.intent.utilities.media.modify.time", "sessionId":"xxxx", "currentTime":"xxxx", "minAdjustTime":"xxxx", and "maxAdjustTime":"xxxx".
[0232] `minAdjustTime` is typically the minimum adjustable duration of the video; `maxAdjustTime` is typically the maximum adjustable duration of the video. For example, you can set the minimum adjustable duration of any video to 1 second, meaning videos shorter than 1 second are not supported. Alternatively, you can set the maximum adjustable duration of any video to 90 seconds, meaning videos longer than 90 seconds are not supported. Correspondingly, during a secondary adjustment, the adjusted video cannot be shorter than 1 second or longer than 90 seconds. The 1-second and 90-second values are for illustrative purposes only.
[0233] The semantic information above can be translated into five types of instructions that a computer program can execute.
[0234] As an example, the adjustment instruction VIDBO_MODIFY_TIME_TYPE_ABSOLUTB indicates adjustment to t seconds, extension or shortening, and adjustment to a range; typically, the semantic categories "vagueModify", "equal", and "between" can generate the executable instructions for this computer program.
[0235] The instruction VIDBO_MODIFY_TIME_TYPE_ADD indicates an increment of t seconds; typically, the "add" semantic category generates the executable instructions for this computer program.
[0236] The instruction VIDBO_MODIFY_TIME_TYPE_MINUS indicates a reduction of t seconds; typically, the "minus" semantic category generates the executable instructions for this computer program.
[0237] The instruction VIDBO_MODIFY_TIME_TYPE_MORE_THAN, which is not less than, indicates that the time is adjusted to more than t seconds. Usually, the "moreThan" semantic category can generate the executable instructions for this computer program.
[0238] The instruction VIDBO_MODIFY_TIME_TYPE_LESS_THAN, which is not greater than t seconds, indicates that the time should be adjusted to less than t seconds. Usually, the "lessThan" semantic category can generate the executable instructions for this computer program.
[0239] The following is through Figure 7 and Figure 8 Describes the process of generating computer-executable instructions from semantic information.
[0240] A1, determine whether the value corresponding to minAdjustTime is less than or equal to 0.
[0241] In this application, minAdjustTime represents the minimum adjustable time. This value may be used in subsequent calculations. If this value is less than or equal to 0, it may affect subsequent calculations.
[0242] A2. If the value corresponding to minAdjustTime is less than or equal to 0, the output parameter is abnormal.
[0243] A3. If the value corresponding to minAdjustTime is greater than 0, then determine whether the value corresponding to maxAdjustTime is less than or equal to the value corresponding to minAdjustTime.
[0244] In this embodiment of the application, the size relationship between the two may be used in subsequent calculations. If minAdjustTime is greater than maxAdjustTime, it will affect subsequent calculations.
[0245] A4. If the value corresponding to maxAdjustTime is less than or equal to the value corresponding to minAdjustTime, then the output parameter is abnormal.
[0246] A5. If the value corresponding to maxAdjustTime is greater than the value corresponding to minAdjustTime, then is the value corresponding to currentTime greater than or equal to the value corresponding to minAdjustTime, and is the value corresponding to currentTime less than or equal to the value corresponding to maxAdjustTime?
[0247] In this embodiment of the application, theoretically, the value corresponding to currentTime is greater than or equal to the value corresponding to minAdjustTime, and less than or equal to the value corresponding to maxAdjustTime. Similarly, if this condition is not met, it will also affect the subsequent calculation.
[0248] A6. If the value corresponding to currentTime is less than the value corresponding to minAdjustTime, or greater than the value corresponding to maxAdjustTime, then the output parameter is abnormal.
[0249] A7. If the value corresponding to currentTime is greater than or equal to the value corresponding to minAdjustTime, and less than or equal to the value corresponding to maxAdjustTime, then check whether the parameter in vacuumModify is empty.
[0250] After this step, it is explained that the relationship between the values corresponding to minAdjustTime, maxAdjustTime, and currentTime is reasonable, and relevant computer program executable instructions can be generated for the semantic categories in the parameters of the semantic information.
[0251] In practical applications, since multiple semantic categories are defined in parameters, but only one semantic category is obtained from the user's natural language, we can sequentially check whether the values corresponding to the multiple semantic categories defined in parameters are empty. If empty, we continue to check the next semantic category until we find a non-empty semantic category. Finally, we obtain the corresponding computer-executable instructions based on the value corresponding to the non-empty semantic category.
[0252] The following describes the process of sequentially determining whether the values corresponding to the multiple semantic categories defined in parameters are empty, and generating computer-executable instructions if they are not empty.
[0253] The order of the semantic categories in the example below is just an example. In actual applications, the order of judging whether a semantic category is empty can be set to other orders depending on the situation.
[0254] A8. If the value corresponding to vacuumModify is not empty, then determine whether the value corresponding to vacuumModify is "longer";
[0255] A9. If the value corresponding to vacuumModify is “longer”, then the instruction “VIDBO_MODIFY_TIME_TYPE_ABSOLUTB” is generated, and the execution time is obtained: min(currentTime*1.2, maxAdjustTime).
[0256] In this application, if the user's natural language expression is "enlarge the video," the semantic category is `vagueModify`, and the corresponding value is "longer." Typically, when the user's intention to adjust the video duration doesn't explicitly specify how much to adjust or to what value, it can be set to adjust the original video duration by 20%, i.e., increasing it to `currentTime * 1.2`. Since the video duration itself is limited by `maxAdjustTime`, the execution duration can be the minimum of `currentTime * 1.2` and `maxAdjustTime`. Of course, 1.2 is just one example of `m`; in practical applications, it can be any number greater than 1 and less than 2.
[0257] A10. If the value corresponding to vacuumModify is not "longer", then determine whether the value corresponding to vacuumModify is "shorter".
[0258] A11. If the value corresponding to vacuumModify is not "shorter", then the output parameters are abnormal.
[0259] In this application, if the value corresponding to vacuumModify is neither longer nor shorter, it can be determined that the value corresponding to vacuumModify is abnormal, and therefore, the output parameter is abnormal.
[0260] A12, if the value corresponding to vacuumModify is "shorter", then the instruction "VIDBO_MODIFY_TIME_TYPE_ABSOLUTB" is generated, and the execution time is obtained: max(currentTime*0.8, minAdjustTime).
[0261] In this application, as mentioned earlier, if the user's intention to adjust the video duration does not explicitly specify the amount to be adjusted or the desired duration, the adjustment can be set to 20% of the original video duration, i.e., reducing it to currentTime*0.8. Since the video duration itself is limited by minAdjustTime, the execution duration can be the maximum of currentTime*0.8 and minAdjustTime. Of course, 0.8 is merely an example of n; it can actually be a number greater than 0 and less than 1.
[0262] A13. If the value corresponding to vacuumModify is empty, then check if the value corresponding to morethan is empty.
[0263] A14 If the value corresponding to morethan is not empty, the instruction "VIDBO_MODIFY_TIME_TYPE_MORE_THAN" is generated, and the execution duration: the parameter corresponding to morethan is obtained.
[0264] In this application, if the user's natural language is to adjust the video to be longer than 30 seconds, the semantic category is not less than, which means not less than 30 seconds, and the execution duration can be set to 30 seconds.
[0265] A15. If the value corresponding to morethan is empty, then check if the value corresponding to lessThan is empty.
[0266] A16, if the value corresponding to lessThan is not empty, then the instruction "VIDBO_MODIFY_TIME_TYPE_LESS_THAN" is generated, and the execution duration: the parameter corresponding to lessThan is obtained.
[0267] In this application, if the user's natural language is to adjust the video to less than 30 seconds, the semantic category is "not greater than", which means not greater than 30 seconds, and the execution duration can be set to 30 seconds.
[0268] A17. If the value corresponding to lessThan is empty, then check whether the value corresponding to between is empty.
[0269] A18. If the value corresponding to between is not empty, then determine whether the value corresponding to min in between is greater than the value corresponding to max.
[0270] In this application, if the user's natural language is: "Adjust the video to between 30 and 35 seconds," then min is 30 and max is 35. By setting min and max, some abnormal user natural language can be filtered out.
[0271] As an example, if a user's natural language is: "Adjust the video to between 35 seconds and 30 seconds", then min is 35 seconds and max is 30 seconds. Obviously, the video adjustment method corresponding to the user's natural language cannot be achieved. Therefore, the parameter is abnormal.
[0272] A19. If the value corresponding to min is greater than the value corresponding to max, the output parameter is abnormal.
[0273] A20. If the value corresponding to min is not greater than the value corresponding to max, then determine whether the value corresponding to currentTime is greater than or equal to the value corresponding to min, and less than or equal to the value corresponding to max.
[0274] In this application, if the original video length is 30 seconds and the user's natural language is: adjust the video to between 25 and 35 seconds, since the original video length itself meets the adjustment requirement corresponding to the user's natural language, there is no need to adjust the video length again in this case, and therefore, the output parameter is abnormal.
[0275] A21. If the value corresponding to currentTime is greater than or equal to the value corresponding to min, and less than or equal to the value corresponding to max, then the output parameters are abnormal.
[0276] A22. If the value corresponding to currentTime is less than the value corresponding to min, or greater than the value corresponding to max, then the target minimum and target maximum values are determined. The target minimum value is: max(minAdjustTime, the parameter corresponding to min); the target maximum value is: min(maxAdjustTime, the parameter corresponding to max).
[0277] In this application, the minimum and maximum values of the executable target need to be re-determined based on the min and max, as well as minAdjustTime and maxAdjustTime in the semantic information.
[0278] As an example, if the original video length is 30 seconds, and the user's natural language is: adjust the video to between 20 and 25 seconds, then minAdjustTime is 1, maxAdjustTime is 90, min is 20, max is 25, the redefined target min is the maximum value between min and minAdjustTime, which is 20 seconds; the redefined target max is the minimum value between max and maxAdjustTime, which is 25 seconds.
[0279] As another example, if the original video length is 80 seconds, and the user's natural language is: "Adjust the video to between 85 and 95 seconds," then minAdjustTime is 1, maxAdjustTime is 90, min is 85, and max is 95. The redefined target min is the maximum value between min and minAdjustTime, which is 85 seconds; the redefined target max is the minimum value between max and maxAdjustTime, which is 90 seconds. This method ensures that the minimum and maximum target values are within a reasonable range.
[0280] A23 generates the instruction "VIDBO_MODIFY_TIME_TYPE_ABSOLUTB" and obtains the execution time: the average of the target minimum and target maximum values.
[0281] In this application, the target minimum value and the target maximum value are determined, and the average of the target minimum value and the target maximum value can also be used as the execution time.
[0282] A24. If the value corresponding to between is empty, then check if the value corresponding to equal is empty.
[0283] A25. If the value corresponding to equal is not empty, then determine whether the value corresponding to equal is less than the value corresponding to minAdjustTime, or the value corresponding to equal is greater than the value corresponding to maxAdjustTime, or the value corresponding to equal is equal to the value corresponding to currentTime.
[0284] In this application, the user's natural language is: adjust to 30 seconds, then the corresponding semantic category is: equal. However, the value of equal cannot be equal to the original video duration, otherwise no adjustment is needed. The value of equal needs to be between minAdjustTime and maxAdjustTime, otherwise, it cannot be adjusted according to the user's intention.
[0285] A26. If the value corresponding to equal is less than the value corresponding to minAdjustTime, or the value corresponding to equal is greater than the value corresponding to maxAdjustTime, or the value corresponding to equal is equal to the value corresponding to currentTime, then the output parameter is abnormal.
[0286] A27. If the value corresponding to equal is not less than the value corresponding to minAdjustTime, not greater than the value corresponding to maxAdjustTime, and not equal to the value corresponding to currentTime, then the instruction "VIDBO_MODIFY_TIME_TYPE_ABSOLUTB" is generated, and the execution duration: the value corresponding to equal is obtained.
[0287] A28. If the value corresponding to equal is empty, check if the value corresponding to add is empty.
[0288] A29. If the value corresponding to add is not empty, then determine whether the value corresponding to add is less than or equal to 0.
[0289] A30, if the value corresponding to add is less than or equal to 0, the output parameter is abnormal;
[0290] This application requires the identification of illegal user natural language, for example, adding -5 seconds.
[0291] A31, if the value corresponding to add is greater than 0, then the instruction "VIDBO_MODIFY_TIME_TYPE_ADD" is generated, and the execution time is the value corresponding to add.
[0292] A32, if the value corresponding to add is empty, then check if the value corresponding to minus is empty.
[0293] A33. If the value corresponding to minus is not empty, then determine whether the value corresponding to minus is less than or equal to 0.
[0294] This application also needs to identify illegal user natural language such as "decrease by 5 seconds".
[0295] A34, if the value corresponding to minus is less than or equal to 0, the output parameter is abnormal;
[0296] A35, if the value corresponding to minus is greater than 0, then the instruction "VIDBO_MODIFY_TIME_TYPE_MINUS" is generated, and the execution time is the value corresponding to minus.
[0297] A36. If the value corresponding to minus is empty, the output parameter is abnormal.
[0298] In this application, if the value corresponding to each semantic category in the semantic information is empty, then there is no need to adjust the video duration, and the parameter anomaly needs to be output.
[0299] The execution duration (i.e., adjustment duration) in the above example is the duration determined when generating executable instructions for a computer program based on semantic information, and is matched with the executable instructions of the computer program.
[0300] The five types of computer program executable instructions mentioned above are further divided into three categories.
[0301] Type 1: Shorten (or lengthen) t1 seconds:
[0302] VIDBO_MODIFY_TIME_TYPE_ADD indicates an increase of t1 seconds;
[0303] VIDBO_MODIFY_TIME_TYPE_MINUS indicates a reduction of t1 seconds. Here, t1 is the execution duration determined in the above embodiment to match these two instructions.
[0304] Type 2: Adjust to t2 seconds;
[0305] VIDBO_MODIFY_TIME_TYPE_ABSOLUTB indicates that the time is adjusted to t2 seconds. Here, t2 is the execution duration determined in the above embodiment to match this instruction.
[0306] Type 3: Adjusted to t3 seconds or more:
[0307] VIDBO_MODIFY_TIME_TYPE_MORE_THAN indicates that the time is adjusted to be greater than t3 seconds;
[0308] VIDBO_MODIFY_TIME_TYPE_LESS_THAN indicates that the time should be adjusted to less than t3 seconds. Here, t3 is the execution duration determined in the above embodiment to match these two instructions.
[0309] In subsequent embodiments of this application, all numbers are described in seconds. In practical applications, other time units may also be used.
[0310] The following describes the duration adjustment method for Type 1 (shortening (or extending) t1 seconds).
[0311] In this embodiment of the application, when generating a new video with a different duration based on the original video, it is not to reselect materials and regenerate a completely new video, but to adjust the duration of each segment that makes up the original video based on the original video, thereby generating a new video based on each segment with the adjusted duration.
[0312] When the executable instruction obtained by the user from the computer program in natural language is of type one: extend or shorten the duration t1 (a defined execution duration), the user's expected duration of the new video is the original video duration plus or minus t1. For example, when the duration t1 is extended, the expected duration of the new video is the original video duration plus t1; when the duration t1 is shortened, the expected duration of the new video is the original video duration minus t1. For ease of description, the expected duration of the new video in this embodiment is denoted as dnewtotaltime.
[0313] To ensure the final quality of the new video, the duration of the new video is limited to within 30% of the expected duration of the original video. In other words, the variation in duration must be less than or equal to dnewtotaltime * 30%. This prevents excessive variations in duration compared to the original video, which could negatively impact the final quality of the new video.
[0314] As an example, if the original video length is 30 seconds and the extension time t1 is 10 seconds, the expected length of the new video dnewtotaltime is 40 seconds. Therefore, the error in duration must be less than or equal to dnewtotaltime * 30%. That is, the adjusted duration must be less than or equal to 12 seconds. The determined new video length, compared to the original video length, should be between 0 and 12 seconds, and the determined new video length should be between 30 and 42 seconds.
[0315] Furthermore, to further ensure the final quality of the new video, the change in the length of the new video compared to the original video cannot be unlimited in terms of size or duration. Therefore, this embodiment of the application also stipulates that the change in the length of the new video compared to the original video must be at least 3 seconds and at most 6 seconds. That is, the range of duration variation is [3, 6].
[0316] Combining the two constraints above—the maximum value of the error duration change and the range of capability duration change—it is determined that when the original video duration is 30 seconds and the extension duration t1 is 10 seconds, the capability duration change is 6 seconds, and the determined new video duration is 36 seconds.
[0317] The following describes in detail the specific implementation process of this duration adjustment method.
[0318] In this application, the duration of the extension or shortening is constrained by the above two constraints on the deviation of extension or shortening, thereby determining the specific change duration; then, the duration of the new video can be obtained based on the duration of the original video and the change duration.
[0319] The following is through Figure 9 A flowchart illustrating the process corresponding to the duration adjustment method for description type one.
[0320] S101, based on the original video duration oldtotaltime and t1 in the user instruction, calculate the maximum value of the error duration change dnewtotaltime*k1.
[0321] When the instruction is to extend the time, the maximum change in error duration is (oldtotaltime+t1)*k1%; when the instruction is to shorten the time, the maximum change in error duration is (oldtotaltime-t1)*k1%.
[0322] S102, determine the duration variation range based on the relationship between dnewtotaltime*k1% and the capability duration variation interval [a1,b1].
[0323] In this embodiment, there are two duration ranges: one is the error duration range: 0 to dnewtotaltime*k1%; the other is the capability duration range [a1,b1].
[0324] When determining the final duration range, the intersection of the two duration ranges mentioned above can be calculated; however, in practical applications, the two duration ranges may not intersect. For example, when dnewtotaltime*30% is less than a1 seconds, the duration range has only one value, which is a1 seconds. Based on the above principle, we obtain:
[0325] If dnewtotaltime*k1% is less than a1 seconds, then the duration variation range is determined to be a1 seconds.
[0326] If dnewtotaltime*k1% is greater than b1 seconds, then the duration change is determined to be from a1 to b1 seconds.
[0327] If dnewtotaltime*k1% is within the capability duration variation range [a1,b1], then the duration variation range is determined to be from a1 to dnewtotaltime*k1.
[0328] S103, determine the duration change value Δt based on the relationship between t1 and the duration change range.
[0329] If t1 is within the range of time variation, then the time variation value Δt is t1;
[0330] If t1 is less than the minimum value of the time variation range, then the time variation value Δt is the minimum value of the time variation range;
[0331] If t1 is greater than the maximum value of the time variation range, then the time variation value Δt is the maximum value of the time variation range;
[0332] S104. Based on the original video duration and the duration change value, obtain the new video duration newtotaltime.
[0333] Similarly, when the instruction is to extend, newtotaltime = oldtotaltime + Δt. When the instruction is to shorten, newtotaltime = oldtotaltime - Δt.
[0334] In the above example, the 30% k1% in the error duration variation is just one example. In practical applications, it can be set to other values, such as 25%, 35%, etc. The a1 and b1 in the capability duration variation range are also just examples. In practical 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, please refer to the multiple examples in Table 1.
[0335] Table 1 shows the process of obtaining the new video duration.
[0336]
[0337] In practical applications, the maximum value of the error duration change (oldtotaltime) can also be calculated as oldtotaltime * 30% based on the original video duration (oldtotaltime). Refer to Table 2 for the process of obtaining the new video duration using oldtotaltime * 30% as the maximum value of the error duration change.
[0338] Table 2 shows the process of obtaining the new video duration using oldtotaltime*30% as the maximum value of the error change duration.
[0339]
[0340] In the example above, the target constraint is obtained by first taking the intersection of the two constraints (in S102, the duration change range is determined based on the relationship between dnewtotaltime*k1% and the capability duration change interval [a1,b1]). Then, the duration change value Δt is obtained based on t1 and the target constraint. Finally, the new video duration newtotaltime is obtained based on the original video duration and the duration change value.
[0341] In practical applications, one can first obtain the intermediate change value based on t1 and one of the constraints, then obtain the duration change value based on the intermediate time change value and another constraint, and finally obtain the new video duration based on the duration change value and the original video duration.
[0342] As an example, the first constraint is that the error duration varies from 0 to dnewtotaltime*k1%. The second constraint is that the capability duration varies within the range of [a1, b1].
[0343] S1011, based on the original video duration oldtotaltime and t1 in the user command, calculate the maximum value of the error duration change dnewtotaltime*k1.
[0344] S1021, based on t1 and the error duration variation range from 0 to dnewtotaltime*k1%, the intermediate time variation value Δt1 is obtained.
[0345] If t1 is within the range of 0 to dnewtotaltime*k1%, then the intermediate time change value Δt1 is t1;
[0346] If t1 is greater than dnewtotaltime*k1%, then the intermediate time change value Δt1 is dnewtotaltime*k1%.
[0347] S1031, based on the intermediate duration change value Δt1 and the capacity duration change interval [a1,b1], the duration change value Δt is obtained.
[0348] If Δt1 is within the range of [a1, b1] of the ability duration variation, then the duration variation value Δt is Δt1;
[0349] If Δt1 is less than the minimum value a1 of the time variation range, then the time variation value Δt is the minimum value a1 of the time variation range.
[0350] If Δt1 is greater than the maximum value b1 of the time variation range, then the time variation value Δt is the maximum value b1 of the time variation range.
[0351] S1041, based on the original video duration and the duration change value Δt, obtain the new video duration newtotaltime.
[0352] Of course, in this example, oldtotaltime * 30% could also be used as the maximum value for the error change duration. Further examples will not be provided.
[0353] The following describes the duration adjustment method for Type 2 (adjusted to t2 seconds).
[0354] In this embodiment of the application, when generating a new video with a different duration based on the original video, it does not reselect materials and regenerate a completely new video. Instead, it adjusts the duration of each segment that makes up the original video based on the original video, thereby generating a new video based on each segment with the adjusted duration, so that the duration of the generated new video is as close as possible to t2.
[0355] To ensure the final quality of the new video, the duration variation between the new and original videos is set to be within 15% of the user-defined duration t2. In other words, the variation in duration must be less than or equal to t2 * 15%. This prevents excessive variation in duration from affecting the final quality of the new video.
[0356] As an example, when the duration t2 is 30 seconds, if the error duration change is less than or equal to 4.5 seconds, the duration change of the new video will be between 25.5 seconds and 34.5 seconds. When the duration t2 is 32 seconds, if the error duration change is less than or equal to 4.8 seconds, the duration change of the new video will be between 25.2 seconds and 34.8 seconds.
[0357] Furthermore, to further ensure the final quality of the new video, the change in the length of the new video compared to the original video cannot be unlimited in terms of size or duration. Therefore, this embodiment of the application also stipulates that the change in the length of the new video compared to the original video must be at least 3 seconds and at most 10 seconds. That is, the range of duration variation is [3, 10].
[0358] In this application, the duration of the change is constrained by the two duration change constraints mentioned above, thereby determining the specific duration of the change; then, the duration of the new video can be obtained based on the duration of the original video and the duration of the change.
[0359] The following describes in detail the specific implementation process of this duration adjustment method.
[0360] The following is through Figure 10The flowchart illustrates the duration adjustment method corresponding to description type two.
[0361] S201, calculate the maximum value of the error duration change t2*k2% based on the duration t2 carried by the user instruction.
[0362] S202, determine the range of duration variation based on the relationship between t2*k2% and the capability duration variation interval [a2,b2].
[0363] If t2*k2% is less than a2 seconds, then the duration variation range is determined to be a2 seconds.
[0364] If t2*k2% is greater than b2 seconds, then the duration change is determined to be from a2 to b2 seconds.
[0365] If t2*k2% is within the range of capability duration variation [a2, b2], then the duration variation range is determined to be from a2 to t2*k2%.
[0366] S203, based on the relationship between the absolute value of the difference between t2 and the original video duration oldtotaltime and the range of duration variation, determine the duration change value Δt.
[0367] If |t2-oldtotaltime| is within the range of time variation, then the time variation value Δt is |t2-oldtotaltime|.
[0368] If |t2-oldtotaltime| is less than the minimum value of the time variation range, then the time variation value Δt is the minimum value of the time variation range.
[0369] If |t2-oldtotaltime| is greater than the maximum value of the time variation range, then the time variation value Δt is the maximum value of the time variation range.
[0370] S204. Based on the original video duration and the duration change value, obtain the new video duration newtotaltime.
[0371] When t2-oldtotaltime is greater than 0, newtotaltime = oldtotaltime + Δt.
[0372] When t2-oldtotaltime is less than 0, newtotaltime = oldtotaltime - Δt.
[0373] In the above example, the 15% k2% in the error duration variation is just one example. In practical applications, it can be set to other values, such as 20%, 25%, 30%, 35%, etc. Similarly, a2 and b2 in the capability duration variation range are also just examples. In practical 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 Table 3 for the calculation of the new video duration.
[0374] Table 3 shows the process for calculating the duration of the new video.
[0375]
[0376] In practical applications, the maximum duration change (oldtotaltime) can also be calculated by multiplying oldtotaltime by 15% based on the original video's duration (oldtotaltime). Referring to Table 4, the process of obtaining the new video duration using oldtotaltime*15% as the maximum error duration change is illustrated.
[0377] Table 4 shows the process of calculating the new video duration using oldtotaltime*15% as the maximum error variation duration.
[0378]
[0379] In this example, we can first obtain the intermediate time change value based on |t2-oldtotaltime| and one of the constraints, then obtain the duration change value based on the intermediate time change value and another constraint, and finally obtain the new video duration based on the duration change value and the original video duration. I will not give examples of each of these steps.
[0380] The following describes the duration adjustment method for Type 3 (adjusted to t3 seconds or more).
[0381] In this embodiment of the application, when generating a new video with a different duration based on the original video, it is not to reselect materials and regenerate a completely new video, but to adjust the duration of each segment that makes up the original video based on the original video, so as to generate a new video based on each segment after the duration is adjusted, so that the duration of the generated new video is as close as possible to t3.
[0382] To ensure the final quality of the new video, the duration of the new video is limited to within 30% of the duration t3 specified in the user command. In other words, the variation in duration must be less than or equal to t3 * 30%. This prevents excessive variation in duration from affecting the final quality of the new video.
[0383] As an example, when the duration t3 is 30 seconds, if the error duration change is less than or equal to 9 seconds, the duration change of the new video will be between 21 seconds and 39 seconds.
[0384] Furthermore, to further ensure the final quality of the new video, the change in the length of the new video compared to the original video cannot be unlimited in terms of size or duration. Therefore, this embodiment of the application also stipulates that the change in the length of the new video compared to the original video must be at least 5 seconds and at most 15 seconds. That is, the range of duration variation is [5, 15].
[0385] In this application, the duration of the change is constrained by the two duration change constraints mentioned above, thereby determining the specific duration of the change; then, the duration of the new video can be obtained based on the duration of the original video and the duration of the change.
[0386] The following is through Figure 11 The flowchart illustrates the duration adjustment method corresponding to description type three.
[0387] S301, calculate the maximum value of the error duration change t3*k3 based on the duration t3 carried by the user instruction.
[0388] S302, determine whether the original video duration meets the user's instruction.
[0389] In this embodiment of the application, user voice can correspond to user commands.
[0390] As an example, if the user's voice says "adjust to more than 45 seconds", then the user's instruction is greater than 45 seconds; if the user's voice says "adjust to less than 45 seconds", then the user's instruction is less than 45 seconds.
[0391] If the original video is 30 seconds long and the user instruction is for more than 45 seconds, then the original video length does not meet the user instruction and a new video needs to be generated.
[0392] If the original video is 30 seconds long and the user's instruction is less than 45 seconds, then the original video's length meets the user's instruction. In this case, there is no need to generate a new video.
[0393] S303, if the duration of the original video meets the user's instructions, then end and return information indicating that the original video meets the requirements.
[0394] S304, if the original video duration does not meet the user's instructions, then the duration variation range is determined based on the relationship between t3*k3% and the capability duration variation range [a3,b3].
[0395] If t3*k3% is less than a3 seconds, then the duration variation range is determined to be a3 seconds.
[0396] If t3*k3% is greater than b3 seconds, then the duration change is determined to be from a3 to b3 seconds.
[0397] If t3*k3% is within the range of capability duration variation [a3, b3], then the duration variation range is determined to be from a3 to t3*k3%.
[0398] S305, based on the relationship between the absolute value of the difference between t3 and the original video duration oldtotaltime and the range of duration variation, determine the duration change value Δt.
[0399] If |t3-oldtotaltime| is within the range of time variation, then the time variation value Δt is |t3-oldtotaltime|.
[0400] If |t3-oldtotaltime| is less than the minimum value of the time variation range, then the time variation value Δt is the minimum value of the time variation range.
[0401] If |t3-oldtotaltime| is greater than the maximum value of the time variation range, then the time variation value Δt is the maximum value of the time variation range.
[0402] S306, based on the original video duration and the duration change value, obtain the new video duration newtotaltime.
[0403] When t3-oldtotaltime is greater than 0, newtotaltime = oldtotaltime + Δt.
[0404] When t3-oldtotaltime is less than 0, newtotaltime = oldtotaltime - Δt.
[0405] In the above examples, k3% in the error duration variation is just one example. In practical applications, it can be set to other values, such as 25%, 35%, etc. a3 and b3 in the capability duration variation range are also just examples. In practical 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 examples in Table 5.
[0406] Table 5 shows the process of obtaining the new video duration.
[0407]
[0408] In practical applications, the maximum duration change (oldtotaltime) can also be calculated by multiplying oldtotaltime by 30% based on the original video's duration. Refer to Table 6 for the process of obtaining the new video duration using oldtotaltime*30% as the maximum error duration change.
[0409] Table 6 shows the process of obtaining the new video duration by using oldtotaltime*30% as the maximum value of the error change duration.
[0410]
[0411] In this example, we can first obtain the intermediate time change value based on |t3-oldtotaltime| and one of the constraints, then obtain the duration change value based on the intermediate time change value and another constraint, and finally obtain the new video duration based on the duration change value and the original video duration. I will not give examples of each of these steps.
[0412] Based on the three strategies described above, it can be understood that regardless of the strategy, the duration of the new video (newtotaltime) needs to be calculated based on the user's voice information and the original video's duration. This duration can be recorded as the calculated duration of the new video.
[0413] In calculating the duration of the new video, `newtotaltime`, the expected change in duration between the new and original videos needs to be obtained first based on the user's voice information, such as `t1`, `|t2-oldtotaltime|`, and `|t3-oldtotaltime|`. Then, the duration change constraints are obtained (i.e., the duration change range determined by the two constraints in the example above). Next, the duration change value `Δt` is obtained based on the expected change in duration and the duration change constraints. Finally, the calculated duration of the new video is obtained based on the duration of the original video and the duration change value `Δt`. Here, `t1` is denoted as the third duration, `t2` as the fourth duration, and `t3` as the fifth duration.
[0414] Of course, the range of error duration variation can be denoted as the first duration variation constraint, the first minimum value of the first duration variation constraint is 0, and the first percentage of the user's expected duration of the new video (e.g., dnewtotaltime, t2, and t3) of the first duration variation constraint (e.g., 15%, 30%, etc. in the example above); the capability duration variation interval can be denoted as the second duration variation constraint, and the second maximum and second minimum values in the second duration variation constraint are preset, such as the maximum and minimum values in any capability variation interval in the example above.
[0415] As mentioned earlier, the duration of the new video can be obtained according to the method described in the above embodiments. The following is a further explanation... Figure 12 Describe how to adjust the duration of individual segments in the original video based on the length of the new video.
[0416] 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 used to generate the original video. [1, min(n, 90)] can be denoted as the first range.
[0417] In this embodiment, when generating the original video, the media material is sliced to obtain multiple highlight segments. A portion of each or some highlight segments is then extracted to generate the original video. n is the sum of the durations of the multiple highlight segments. Here, min(n, 90) can also be understood as maxadjustTime (the maximum allowed duration) in the above scheme. That is, when the original video is obtained, maxadjustTime is obtained. minadjustTime (the minimum allowed duration) can be a preset value (e.g., 1 second).
[0418] As an example, six media clips were selected when generating the original video. These clips were original images and / or original videos that the voice assistant searched from the image library based on keywords in the user's voice, matching those keywords. Analysis of the media clips yielded highlight segments corresponding to each clip, with durations of 2 seconds, 23 seconds, 4 seconds, 8 seconds, 23 seconds, and 1 second, respectively. When generating the original video, the first five highlight segments were used, and segments of 1 second, 11.5 seconds, 2 seconds, 4 seconds, and 11.5 seconds were selected from these segments to form the original video. Therefore, the original video's duration is 30 seconds. Here, n represents either the total duration of the six highlight segments (61 seconds) or the total duration of the five highlight segments used to generate the original video (60 seconds). The segments of 1 second, 11.5 seconds, 2 seconds, 4 seconds, and 11.5 seconds selected from the first five highlight segments can also be considered sub-segments. Each sub-segment has a corresponding highlight segment, and each sub-segment is extracted from its corresponding highlight segment. Of course, images can also have corresponding highlight segments; for example, a video clip of a certain length can be generated based on the content of an image, and that video clip is also a highlight segment.
[0419] In practical applications, the value of n can be set according to the situation. Of course, when generating the original video, it can also be set that part or all of each highlight segment needs to be extracted to generate the original video; this application embodiment does not impose any restrictions on this.
[0420] In addition, the 1 and 90 in [1, min(n, 90)] are just examples; in actual applications, they can be set to other values.
[0421] S402, if the duration of the new video is less than 1 second, issue a prompt message to confirm that the duration of the new video is 1 second, and then execute S404.
[0422] S403, if the new video duration is greater than min(n, 90), then determine the new video duration as min(n, 90) and execute S404.
[0423] For example, when min(n, 90) is 90, the original video is adjusted to a new video length of 90 seconds to obtain the new video; when min(n, 90) is n, the original video is adjusted to a new video length of n seconds to obtain the new video.
[0424] S404, if the new video duration is within [1, min(n, 90)], then based on the new video duration, the original video duration, and the number of segments in the original video (which can be denoted as the first number), the theoretical average change duration of each segment is obtained.
[0425] For example, the theoretical average change time of each segment is equal to the difference between the new total time and the original total time (denoted as the first difference) divided by the number of segments m in the original video.
[0426] That is, Averagetime=(newtotaltime-oldtotaltime) / m.
[0427] For each segment in the original video, execute S405 and subsequent steps to determine the new duration of each segment.
[0428] S405, for each segment (which can also be referred to 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 in which the sub-segment is located), the theoretical average change duration Averagetime, and the difference of the previous segment is within the set segment duration range.
[0429] That is, determine whether (oldfragmenttimei+Averagetimei+difference(i-1)) is within the fragment duration interval.
[0430] The difference for 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, the theoretical average variation duration Averagetime, and the difference of the previous sub-segment.
[0431] In practical applications, the maximum duration for video clips is 12 seconds; for image clips, the maximum duration is 7 seconds; and the minimum duration for both video and image clips is 0.5 seconds. Furthermore, the duration difference between the first clip and the previous clip is zero.
[0432] The video clip duration range is [0.5, 12], or [0.5, 7]. Of course, 0.5, 7, and 12 in this example are just examples; in practical applications, other values can be used. For ease of description, the clip duration range is [a4, b4].
[0433] S406, if the sum of the original duration of the segment, the theoretical average change duration, and the difference of the previous segment is within the set segment duration interval, then the new duration of the segment is determined to be the sum of the original duration, the theoretical average change duration, and the difference of the previous segment, and the difference of this segment is determined to be 0.
[0434] That is, when (oldfragmenttimei+Averagetimei+difference(i-1)) is within [a4, b4], newfragmenttimei=oldfragmenttimei+Averagetimei+difference(i-1).
[0435] S407 If the sum of the original duration of the segment, the theoretical average change duration, and the difference of the previous segment is less than the lower limit of the segment duration interval, then the new duration of the segment is determined as the lower limit of the segment duration interval, and the difference of the segment is calculated as the sum of the original duration of the segment, the theoretical average change duration, and the difference of the previous segment minus the determined new duration of the segment.
[0436] That is, when (oldfragmenttimei+Averagetimei+difference(i-1)) is less than a4, newfragmenttimei=a4, difference i=oldfragmenttimei+Averagetimei+difference(i-1)-newfragmenttimei.
[0437] S408, if the sum of the original duration of the segment, the theoretical average change duration, and the difference of the previous segment is greater than the upper limit of the segment duration interval, then the new duration of the segment is determined as the upper limit of the segment duration interval, and the difference of the current segment is calculated as the sum of the original duration of the segment, the theoretical average change duration, and the difference of the previous segment minus the determined new duration of the segment.
[0438] That is, when (oldfragmenttimei+Averagetimei+difference(i-1)) is greater than b4, newfragmenttimei=b4, difference i=oldfragmenttimei+Averagetimei+difference(i-1)-newfragmenttimei.
[0439] In this way, after obtaining the new duration of each segment, the content of each segment is adjusted according to the new duration, and a new video is generated based on the adjusted content of each segment.
[0440] The following two examples illustrate the process of generating a new video based on segments of the original video after calculating the duration of the new video.
[0441] Table 7: The original video is 30 seconds long, the new video is 35 seconds long, and the original video has 5 segments. Therefore, the theoretical average increase in duration for each segment is 1 second.
[0442] Table 7 shows the process of calculating the new duration for each segment.
[0443]
[0444] When calculating the new duration of segment 1, the original duration of the segment plus the theoretical average increase in duration plus the difference from the previous segment equals 2; it is determined that 2 is within the upper and lower limits; therefore, the new duration is 2, and the difference equals the original duration of the segment plus the theoretical average increase in duration plus the difference from the previous segment minus the determined new duration, which equals 0.
[0445] When calculating the new duration of segment 2, the original duration of the segment plus the theoretical average increase in duration plus the difference from the previous segment equals 12.5. It is determined that 12.5 is not within the upper and lower limits and is greater than the upper limit of 12. Therefore, the new duration is 12, and the difference equals the original duration of the segment plus the theoretical average increase in duration plus the difference from the previous segment minus the determined new duration of the segment, which equals 0.5.
[0446] When calculating the new duration of segment 3, the original duration of the segment plus the theoretical average increase in duration plus the difference from the previous segment equals 3.5; it is determined that 3.5 is within the upper and lower limits; therefore, the new duration is 3.5, and the difference equals the original duration of the segment plus the theoretical average increase in duration plus the difference from the previous segment minus the determined new duration of the segment equals 0.
[0447] When calculating the new duration of segment 4, the original duration of the segment plus the theoretical average increase in duration plus the difference from the previous segment equals 5; it is determined that 5 is within the upper and lower limits; therefore, the new duration is 5, and the difference equals the original duration of the segment plus the theoretical average increase in duration plus the difference from the previous segment minus the determined new duration of the segment equals 0.
[0448] When calculating the new duration of segment 5, the original duration of the segment plus the theoretical average increase in duration plus the difference from the previous segment equals 12.5. It is determined that 12.5 is not within the upper and lower limits and is greater than the upper limit of 12. Therefore, the new duration is 12, and the difference equals the original duration of the segment plus the theoretical average increase in duration plus the difference from the previous segment minus the determined new duration, which equals 0.5.
[0449] Therefore, the original length of the video composed of the above 5 segments is 30 seconds. According to the corresponding strategy, the new video length is calculated to be 35 seconds. The final length of the new video is 34.5 seconds, with a difference of 0.5 seconds.
[0450] Table 8: The original video is 30 seconds long, the new video is 25 seconds long, and the original video has 5 segments. Therefore, the theoretical average reduction in duration for each segment is -1 second.
[0451] Table 8 shows the process of calculating the new duration for each segment.
[0452]
[0453] When the average increase in duration is negative, it indicates that the original video duration has been shortened.
[0454] When calculating the new duration of segment 1, the original duration of the segment plus the theoretical average increase in duration plus the difference from the previous segment equals 0; it is determined that 0 is not within the upper and lower limits and is less than 0.5; therefore, the new duration of the segment is 0.5, and the difference equals the original duration of the segment plus the theoretical average increase in duration plus the difference from the previous segment minus the determined new duration, which equals -0.5.
[0455] When calculating the new duration of segment 2, the original duration of the segment plus the theoretical average increase in duration plus the difference from the previous segment equals 10; it is determined that 10 is within the upper and lower limits; therefore, the new duration is 10, and the difference equals the original duration of the segment plus the theoretical average increase in duration plus the difference from the previous segment minus the determined new duration, which equals 0.
[0456] When calculating the new duration of segment 3, the original duration of the segment plus the theoretical average increase in duration plus the difference from the previous segment equals 1; it is determined that 1 is within the upper and lower limits; therefore, the new duration is 1, and the difference equals the original duration of the segment plus the theoretical average increase in duration plus the difference from the previous segment minus the determined new duration, which equals 0.
[0457] When calculating the new duration of segment 4, the original duration of the segment plus the theoretical average increase in duration plus the difference from the previous segment equals 3; it is determined that 3 is within the upper and lower limits; therefore, the new duration is 3, and the difference equals the original duration of the segment plus the theoretical average increase in duration plus the difference from the previous segment minus the determined new duration, which equals 0.
[0458] When calculating the new duration of segment 5, the original duration of the segment plus the theoretical average increase in duration plus the difference from the previous segment equals 10.5; it is determined that 10.5 is within the upper and lower limits; therefore, the new duration is 10.5, and the difference equals the original duration of the segment minus the theoretical average increase in duration + the difference from the previous segment minus the determined new duration, which equals 0.
[0459] Therefore, the original length of the video composed of the above 5 segments is 30 seconds. When the length of the new video calculated according to the corresponding strategy is 25 seconds, the final length of the new video is 25 seconds, with a difference of 0 seconds.
[0460] By using the cyclical rolling difference method described above, the duration of each segment can be balanced, making the final video length closer to the calculated new video length.
[0461] The process of obtaining the new video described above illustrates that both the new and original videos are based on the same media material. However, since highlight segments (referred to as parent segments) need to be extracted from the media material before video generation, both the new and original videos are generated from the same highlight segments. The difference lies in the method of generation: the original video is generated by extracting a portion or all of the segments (which can also be referred to as sub-segments) from each highlight segment; the new video is generated by extending or shortening the duration of these sub-segments based on their positions within the corresponding highlight segments. Of course, the content and duration of some sub-segments may remain unchanged in both the new and old videos. Based on the above description, the new video contains some or all of the content from the original video, and the content of the second video is related to the content of the first video.
[0462] To better understand the execution process of the steps in the flowchart above, let's first look at... Figure 13 This is a sequence diagram describing the generation of a video related to a child after an electronic device detects the user's request to "generate a video of the child." This sequence diagram corresponds to... Figure 2 (b) in the middle.
[0463] S501, the voice assistant detected the user's voice.
[0464] In this embodiment of the application, the user's voice can be "generate a video of the child".
[0465] In S502, the voice assistant obtains video generation instructions based on the voice information corresponding to the user's voice.
[0466] In this embodiment, after detecting the user's voice, the voice assistant can first generate text information based on the user's voice, and then retrieve the keywords "generate," "child," and "video" from the text information to obtain a video generation instruction. The voice assistant can determine the material type "image" and "video" based on the keyword "video," and can also determine the content identifier "child" based on the keyword "child." The material type and content identifier are carried in the video generation instruction.
[0467] Of course, in practical applications, after the voice assistant generates text information based on the user's voice, it can display the text "Generate video of the child" in the voice assistant window.
[0468] S503, the voice assistant sends video generation commands to the media processing platform 1.
[0469] S504, after receiving the video generation instruction, the media processing platform 1 collects media materials related to the instruction from the electronic device.
[0470] As an example, the video generation instruction carries the material types "image" and "video," as well as the content identifier "child." Media processing platform 1 determines that the materials to be searched are images and videos based on the material types "image" and "video"; and determines that the search content identifier is images and videos with the identifier "child."
[0471] Of course, in practical applications, you can set first-level content tags and second-level content tags for videos and pictures. The second-level content tags for the first-level content tag "child" can include "daughter" and "son".
[0472] In addition, the maximum number of media clips that can be set in the electronic device each time a video is generated (e.g., 30 clips) can be set, meaning that the maximum number of media clips collected when generating a video is 30.
[0473] S505, Media Processing Platform 1 sends the searched media materials and themes (content identifier itself or themes determined based on the content identifier) to the Light Editing Service.
[0474] As an example, the topic can be either the content identifier "children" or the topic "children" determined by the content identifier "children". Of course, this is just one example of how to determine the topic.
[0475] Lightweight editing services can be an example of video editing applications.
[0476] S506, after receiving media materials and themes, the light editing service obtains the configuration file.
[0477] In this embodiment, the configuration file defines the nodes in the finished video module that need to be created, and the video can be generated subsequently through the nodes in the finished video module.
[0478] As an example, the nodes in the configuration file include: template retrieval node, theme matching node, template parsing node, music parsing node, music loading node, special effects node, cover generation node, duration adjustment node, etc.
[0479] The template acquisition node is used to acquire template materials; the theme matching node is used to find templates that match the theme from the template materials; the template parsing node is used to parse templates that match the theme; the music parsing node is used to parse the rhythm points in the template; the music loading node is used to match the rhythm points in the music with the rhythm points in the template; the special effects node is used to generate special effects; the cover generation node is used to generate video covers; and the duration adjustment node is used to calculate the duration of the new video and adjust the duration of each segment in the original video during the secondary editing process to obtain the new video.
[0480] It is understandable that these nodes have a specific processing order.
[0481] S507, the lightweight editing service creates block modules (and their individual nodes) based on configuration files.
[0482] In this step, you can temporarily omit the duration adjustment node and create it when you need to adjust the video duration. Of course, in practical applications, you can also configure the configuration file not to include the duration adjustment node.
[0483] S508, the light editing service sends media materials and themes to the finished product module after it is created.
[0484] S509, after receiving the media materials and theme, the finished product module sends the media materials to the media processing platform 2.
[0485] In this embodiment, media processing platform 1 and media processing platform 2 can be two media processing platforms or different functional modules within the same media processing platform.
[0486] S510, after receiving media materials, media processing platform 2 extracts highlight segments from them.
[0487] In this application, the highlight clip can be a more exciting scene clip extracted from media material by the media processing platform 2. When extracting, multiple conditions can be used as reference standards, such as composition ratio, proportion of people, etc.
[0488] One or more highlight clips can be extracted from each media material, or highlight clips can be extracted from a portion of the media material. This application does not impose any limitations on this.
[0489] S511, the media processing platform 2 sends the captured highlight clips to the final film module.
[0490] S512, after receiving the highlight clip, the video model is obtained through various nodes.
[0491] Corresponding to each created node: the template retrieval node retrieves template materials; the theme matching node searches for templates that match the theme from the template materials; the template parsing node parses the templates that match the theme; the music parsing node parses the rhythm points in the template; the music loading node matches the rhythm points in the music with the rhythm points in the template; the effects node is used to generate effects; and the cover generation node is used to generate the video cover. After processing by the above nodes, new video data is obtained.
[0492] This process is just an example. In practical applications, different nodes can be set, or more or fewer nodes. Regardless of the type of nodes used, the video processing module can obtain video data by passing through these nodes.
[0493] Additionally, when generating the original video, within the preset minimum and maximum video length range, if the total duration of the highlight segments exceeds 90 seconds, a sub-segment (also called a sub-segment) needs to be extracted from each highlight segment to generate the original video. Similarly, if the total duration of the highlight segments is less than 1 second, the original video needs to be generated based on each highlight segment. The duration of each highlight segment is extended during the original video generation process to make the resulting original video as close to 1 second as possible. When the total duration of the highlight segments is greater than or equal to 1 second and less than or equal to 90 seconds, the original video can be directly generated from each highlight segment.
[0494] S513, the finished product module sends video data to the light editing service.
[0495] S514, after receiving video data, the light editing service converts the video data into a video JSON file.
[0496] In this application, the video data is quite large and contains a lot of information. The video data can be converted into a smaller JSON file for easier transmission.
[0497] S515, the light editing service sends video JSON files to the media processing platform 1.
[0498] S516, after receiving the video JSON file, the media processing platform 1 sends the video JSON file to the voice assistant.
[0499] S517: After receiving the video JSON file, the voice assistant displays the text "A video for your child has been generated" and a video cover in the voice assistant window.
[0500] In another embodiment of this application, the following is further included between step S504 and step S505:
[0501] S518, after collecting media materials related to the command, the media processing platform 1 sends a confirmation request to the voice assistant, which includes multiple material options.
[0502] In this embodiment of the application, when the electronic device detects the voice "generate a video of the child", it can also identify the "child" in the pictures and / or videos stored by the electronic device. When multiple different "children" are identified, a confirmation request can be sent to the voice assistant. For example, when "son" and "daughter" are identified, the returned confirmation request carries the "son" material option and the "daughter" material option.
[0503] S519, the voice assistant displays a confirmation message.
[0504] When the voice assistant receives material options, it displays multiple child options as confirmation information, such as "son", material options, and "daughter" material options.
[0505] This confirmation message indicates to the user that they can choose to generate a video based on images and videos related to the identified "son," or based on images and videos related to the identified "daughter," or based on images and videos related to all identified children (e.g., "son" and "daughter").
[0506] S520, the voice assistant receives the user's voice.
[0507] The user's voice can be "daughter".
[0508] S521, the voice assistant sends a confirmation command to the media processing platform 1.
[0509] As an example, when a user says "daughter," the voice assistant detects the voice and sends a confirmation command to the media processing center, which includes the word "daughter."
[0510] S505, after receiving the confirmation instruction, the media processing platform 1 sends materials related to the confirmation instruction "daughter" to the light editing service.
[0511] The following is through Figure 14 Description in user's Figure 13 If the length of the generated video is unsatisfactory, adjust the timing diagram of the video length. This timing diagram corresponds to... Figures 3 to 6Any interface in, or the corresponding Figures 9 to 11 Any one of the examples in the list.
[0512] S601, the user sends a voice message.
[0513] In this embodiment of the application, the user's voice can be voice information corresponding to any of the three types mentioned above.
[0514] As an example, the voice message could be "adjust to 35 seconds", "extend by 5 seconds", "adjust to less than 30 seconds", etc.
[0515] S602, the voice assistant determines semantic information based on the voice information corresponding to the user's voice.
[0516] In this embodiment, after the voice assistant detects the user's voice, it can first generate text information based on the user's voice, and then extract keywords from the text information to determine semantic information based on the keywords.
[0517] The adjustment strategy types in this application include three types, which can be referred to in detail in the above embodiments for type one, type two and type three.
[0518] In addition, in practical applications, after generating text information based on the user's voice in S602, the text information can also be displayed in the voice assistant window.
[0519] S603, the voice assistant sends semantic information to the media processing platform 1.
[0520] S604 After receiving semantic information, the media processing platform 1 generates computer-executable instructions and execution time based on the semantic information.
[0521] The execution process of S604 can be referred to Figure 7 and Figure 8 As shown.
[0522] S605, Media Processing Platform 1 sends computer-executable instructions and execution time to the Light Editing Service.
[0523] S606, after receiving the computer-executable instruction and execution duration, the light editing service checks the legality of the computer-executable instruction and execution duration.
[0524] This step requires following... Figure 9 , Figure 10 or Figure 11 As shown, the duration of the new video is calculated based on the adjustment strategy type and execution duration determined by the computer-executable instructions. Then, execution... Figure 12 S401 in the code is used to determine the legality of the computer's executable instructions and execution time.
[0525] As an example, if the calculated new video duration is within the range of [1, min(n, 90)], it means that the computer-executable instructions and execution duration are valid; if the calculated new video duration is not within the range of [1, min(n, 90)], it means that the computer-executable instructions and execution duration are invalid.
[0526] S607, if the computer's executable instructions and execution duration are invalid, the Light Editing Service sends an invalid instruction message to the Media Processing Platform 1.
[0527] Of course, in step S604, if the output parameters are abnormal, the media processing platform 1 can also send a message to the voice assistant that the command is invalid.
[0528] S608, after receiving the message that the command is invalid, the media processing platform 1 sends the message to the voice assistant that the command is invalid.
[0529] When a voice assistant receives an invalid command, it can display corresponding text information, for example, Figure 6 The message "To ensure the best final product quality, the maximum length should be 90 seconds; this has been adjusted to 90 seconds for you" or "To ensure the best final product quality, the minimum length should be 1 second; this has been adjusted to 1 second for you" can be displayed. Of course, the text information and the new video's cover image can also be displayed after the actual new video is received; this application does not restrict this.
[0530] Regardless of whether the instruction is legal or not, the Light Editing service requires the execution of step 608 and subsequent steps to perform a second editing process, which is the process of generating a new video.
[0531] S609, the light editing service retrieves the video JSON file from the last finished video and obtains the video data from the video JSON file.
[0532] The video JSON file records the media footage from the previous final cut (e.g., the highlight clips used in the previous cut), configuration information (e.g., the selected templates, effects, etc.), and the duration of the highlight clips that make up each segment of the original video, as well as the duration of each segment in the original video. Of course, the video data also carries the above information after it is obtained.
[0533] S610, the Light Editing service creates an adjustment duration node in the finished product module.
[0534] S611, the light editing service sends video data and the calculated new video duration to the duration adjustment node in the finished product module.
[0535] S612, adjust the duration node by executing S404 to S408, and obtain the new duration of each segment in the original video.
[0536] S613, Adjust duration node adjusts the content of each segment in the original video data according to the new duration of each segment calculated.
[0537] In this embodiment, if the original duration of segment 1 is 1 second and needs to be adjusted to 2 seconds, and the duration of the highlight segment to which segment 1 is located is 5 seconds, and segment 1 is the 2nd to 3rd second of the highlight segment, then the new duration of segment 1 can be set to 2 seconds. The adjusted segment 1 will then be the 2nd to 4th second, or the 1st to 3rd second, or the 1.5th to 3.5th second of the highlight segment.
[0538] As another example, if the original duration of segment 1 is 1 second and needs to be adjusted to 2 seconds, and the duration of the highlight segment containing segment 1 is 1 second, then segment 1 is the 0th to 1st second of the highlight segment. In this case, the new duration of segment 1 can be set to 2 seconds, making the adjusted segment 1 the 0th to 1st second of the highlight segment, only the playback speed is slowed down to make the playback duration of segment 1 2 seconds. Alternatively, the new duration of segment 1 can be set to the 1-second duration of the highlight segment containing segment 1, with -1 second used as the difference to roll over to the next segment. This application does not limit the specific implementation method.
[0539] S614, after adjusting the content of each segment, restores the original video's configuration information, such as templates and effects, in the video data after adjusting the segment content.
[0540] S615, after restoring the original video configuration information in the video data after adjusting the segment content, the duration adjustment node sends the adjusted video data to the light editing service.
[0541] S616: After receiving the adjusted video data, the light editing service converts the adjusted video data into a video JSON file.
[0542] S617, the light editing service sends video JSON files to the voice assistant through the media processing platform 1.
[0543] In the S618, after the voice assistant receives the video JSON file, it displays the text "Video duration has been adjusted" and the cover of the video after the duration has been adjusted in the voice assistant window.
[0544] Of course, if the judgment result of S605 is invalid during the specific implementation process, the text displayed at this time will be "To ensure the quality of the final product, the maximum adjustment is t (e.g., 1, n or 90) seconds, and it has been adjusted to t (e.g., 1, n or 90) seconds for you" or "To ensure the quality of the final product, the minimum adjustment is 1 second, and it has been adjusted to 1 second for you".
[0545] Understandably, this method allows for efficient adjustment of the generated video length, improving the user experience.
[0546] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0547] This application also provides a computer-readable storage medium storing a computer program that, when run on an electronic device, can implement the steps in the above-described method embodiments.
[0548] This application also provides a computer program product that, when run on an electronic device or a wireless router, enables the electronic device to perform the steps described in the various method embodiments above.
[0549] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include at least: any entity or device capable of carrying the computer program code to the first device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electrical carrier signals or telecommunication signals.
[0550] This application also provides a chip, which includes a processor coupled to a memory. The processor calls a 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.
[0551] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0552] Those skilled in the art will recognize that the units and method steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0553] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A method for adjusting video duration, characterized in that, include: Receive first voice information, the first voice information carrying a first keyword; In response to the first voice information, the cover of the first video is displayed on the first interface. 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 the first duration. Received second voice message; The second voice information is converted into the first semantic information; A first instruction is generated based on the first semantic information, wherein the first instruction is a computer program executable instruction. In response to the first instruction, the cover of the second video is displayed on the first interface. The duration of the second video is the second duration. The second video contains part or all of the content of the first video. The method further includes the following steps before the cover of the second video is displayed on the first interface: If the first semantic information is a first semantic category, the adjustment duration indicated by the first instruction is generated; The expected change duration between the second video and the first video is obtained according to the first instruction, and the expected change duration is determined by the adjustment duration corresponding to the first instruction. Obtain the constraints for duration changes; The duration change value is obtained based on the expected duration change and the duration change constraint. The calculated duration of the second video is obtained based on the first duration of the first video and the duration change value. The content of the first video is adjusted based on the calculated duration of the second video to obtain the second video.
2. The method as described in claim 1, characterized in that, The step of generating the first instruction based on the first semantic information includes: Determine whether the first semantic information belongs to a first semantic category, wherein the first semantic category is one of at least two preset semantic categories; If the first semantic information is the first semantic category, then a first instruction corresponding to the first semantic category and an adjustment duration indicated by the first instruction are generated.
3. The method as described in claim 2, characterized in that, The method further includes: If the first semantic information is not the first semantic category, then it is determined whether the first semantic information is a second semantic category, wherein the second semantic category is one of the preset at least two semantic categories and is different from the first semantic category.
4. The method as described in claim 2, characterized in that, The first semantic category is: adjustment; determining whether the first semantic information belongs to the first semantic category includes: Determine whether the adjustment field in the first semantic information is an extension; If the first semantic information is the first semantic category, then generating a first instruction corresponding to the first semantic category includes: If the adjustment field in the first semantic information is extension, then a first instruction is generated, and the first instruction is an adjustment instruction; The minimum value between m times the first duration and the maximum allowed duration of the first video is taken as the adjustment duration corresponding to the adjustment instruction, where m is a number greater than 1 and less than 2.
5. The method as described in claim 4, characterized in that, After determining whether the adjustment field in the first semantic information is an extension, the method further includes: If the adjustment field in the first semantic information is not an extension, then determine whether the adjustment field in the first semantic information is a shortening; If the first semantic information is the first semantic category, then generating a first instruction corresponding to the first semantic category includes: If the adjustment field in the first semantic information is shortening, then a first instruction is generated, and the first instruction is an adjustment instruction; The maximum value between n times the first duration and the minimum allowed duration of the first video is taken as the adjustment duration corresponding to the adjustment instruction, where n is a number greater than 0 and less than 1.
6. The method as described in claim 4, characterized in that, The first semantic category is: not less than; the determination of whether the first semantic information belongs to the first semantic category includes: Determine whether the "not less than" field in the first semantic information is empty; If the first semantic information is the first semantic category, then generating a first instruction corresponding to the first semantic category includes: If the "not less than" field in the first semantic information is not empty, then a first instruction is generated, and the first instruction is a "not less than" instruction; The value corresponding to the "not less than" field is used as the adjustment duration corresponding to the "not less than" instruction.
7. The method as described in claim 4, characterized in that, The first semantic category is: not greater than; the determination of whether the first semantic information belongs to the first semantic category includes: Determine whether the "not greater than" field in the first semantic information is empty; If the first semantic information is the first semantic category, then generating a first instruction corresponding to the first semantic category includes: If the "not greater than" field in the first semantic information is not empty, then a first instruction is generated, and the first instruction is a "not greater than" instruction; The value corresponding to the "not greater than" field is used as the adjustment duration corresponding to the "not greater than" instruction.
8. The method as described in claim 4, characterized in that, The first semantic category is: range interval, and determining whether the first semantic information belongs to the first semantic category includes: Determine whether the minimum value in the range interval field of the first semantic information is less than the first duration, and whether the maximum value in the range interval field is greater than the first duration; If the first semantic information is the first semantic category, then generating a first instruction corresponding to the first semantic category includes: If the minimum value in the range interval field of the first semantic information is less than the first duration and the maximum value in the range interval field is greater than the first duration, then a first instruction is generated, and the first instruction is an adjustment instruction. The maximum value between the minimum allowed duration of the first video and the minimum value in the range interval field is taken as the minimum value of the adjustment instruction; The minimum value between the maximum allowed duration of the first video and the maximum value in the range interval field is taken as the maximum value of the adjustment instruction; The average of the minimum value and the maximum value is used as the adjustment duration corresponding to the adjustment instruction.
9. The method as described in claim 4, characterized in that, The first semantic category is: adjusted to, and the determination of whether the first semantic information belongs to the first semantic category includes: Determine whether the value corresponding to the "adjust to" field in the first semantic information is greater than the minimum allowed duration of the first video, less than the maximum allowed duration of the first video, and not equal to the first duration; If the first semantic information is the first semantic category, then generating a first instruction corresponding to the first semantic category includes: If the value corresponding to the "adjust to" field in the first semantic information is greater than the minimum allowed duration of the first video, less than the maximum allowed duration of the first video, and not equal to the first duration, then a first instruction is generated, and the first instruction is an adjustment instruction. The value corresponding to the adjusted field is used as the adjustment duration corresponding to the adjustment instruction.
10. The method as described in claim 4, characterized in that, The first semantic category is: increase, and determining whether the first semantic information belongs to the first semantic category includes: Determine whether the value corresponding to the added field in the first semantic information is greater than 0; If the first semantic information is the first semantic category, then generating a first instruction corresponding to the first semantic category includes: If the value corresponding to the added field in the first semantic information is greater than 0, then a first instruction is generated, which is an add instruction; The value corresponding to the added field is used as the adjustment duration corresponding to the added instruction.
11. The method as described in claim 4, characterized in that, The first semantic category is: reduction, and determining whether the first semantic information belongs to the first semantic category includes: Determine whether the value corresponding to the decrease field in the first semantic information is greater than 0; If the first semantic information is the first semantic category, then generating a first instruction corresponding to the first semantic category includes: If the value corresponding to the reduction field in the first semantic information is greater than 0, then a first instruction is generated, and the first instruction is a reduction instruction; The value corresponding to the reduction field is used as the adjustment duration corresponding to the reduction instruction.
12. The method as described in claim 1, characterized in that, The step of obtaining the expected change duration between the second video and the first video according to the first instruction includes: When the first instruction is an increase instruction or a decrease instruction, the expected change duration is the adjustment duration; When the first instruction is an adjustment instruction, the expected change duration is the difference between the adjustment duration and the first duration; When the first instruction is not greater than or not less than the instruction, the expected change duration is the difference between the adjustment duration and the first duration.
13. An electronic device, characterized in that, The device includes 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 a computer program that, when executed by the one or more processors, causes the electronic device to perform the method as described in any one of claims 1-12.
14. A chip system applied to an electronic device, the chip system comprising one or more processors, characterized in that, The processor is configured to invoke computer instructions to cause the electronic device to perform the method as described in any one of claims 1-12.
15. A computer-readable storage medium comprising a computer program, characterized in that, When the computer program is run on an electronic device, it causes the electronic device to perform the method as described in any one of claims 1-12.