A method and apparatus for video insertion

By calculating the insertion time of the auxiliary video, and based on the text component information and the main video playback duration, flexible and efficient video insertion is achieved, solving the problems of resource waste and low efficiency when changing auxiliary videos in existing technologies.

CN123145441APending Publication Date: 2026-11-20JD DIGITS HAIYI INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510654192.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-20
Publication Date
2026-11-20

AI Technical Summary

Technical Problem

Existing video insertion methods require re-insertion when the secondary video needs to be changed, which wastes resources and affects efficiency.

Method used

By acquiring information about the components of the text, calculating the playback duration of both text and non-text content, and accurately calculating the insertion time of the auxiliary video based on its location and the playback duration of the main video, flexible and efficient video insertion is achieved.

Benefits of technology

It avoids cumbersome video splitting and merging, saves resources and costs, and improves the efficiency and flexibility of video insertion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123145441A_ABST
    Figure CN123145441A_ABST
Patent Text Reader

Abstract

The application discloses a kind of video insertion method and device, it is related to computer technical field.The specific embodiment of the method includes: generating the main video corresponding to text, according to the text component element information of text and the playing time of main video, the playing time of each character is calculated;According to the positioning location corresponding to text in the auxiliary video to be inserted and text component element information, the playing time of non-character content contained by text before positioning location is calculated, and then according to the playing time of each character, and the number of characters contained by text before positioning location, the insertion time of auxiliary video is calculated;According to insertion time, insert and play auxiliary video in the video playing process of main video.This embodiment realizes flexible and efficient video insertion, carries out shot switching play according to insertion time, avoids the cumbersome segmentation of main video, video processing and merging, saves resources and cost, improves video insertion efficiency and flexibility.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and more particularly to a method and apparatus for video insertion. Background Technology

[0002] In digital human live streaming scenarios, to provide users with a more comprehensive product display, when the digital human broadcasts specific content, pre-inserted product introduction videos, such as detailed demonstration videos, will be played to achieve a better presentation of the products. Existing methods for inserting supplementary product introduction videos into the main video of a digital human live stream typically involve segmenting the main video at the points where the supplementary video needs to be inserted, then synthesizing the video segment by segment based on these segmentation points, and finally merging the individual video segments to obtain the final playback video.

[0003] In the process of realizing this invention, the inventors discovered the following problems in the prior art:

[0004] The existing method of inserting auxiliary videos by splitting the main video and then merging them segment by segment requires re-inserting the auxiliary video when it needs to be changed (content change or insertion point change). This wastes resources, increases unnecessary costs, and affects the efficiency of video insertion. Summary of the Invention

[0005] In view of this, embodiments of the present invention provide a method and apparatus for video insertion, which realizes flexible and efficient video insertion. Based on the text component information in the text of the main video, the insertion time of the auxiliary video in the main video is calculated in fine granularity by the insertion position of the auxiliary video and the playback duration of the main video. The camera switches and plays according to the insertion time, avoiding the cumbersome segmentation, video processing and merging of the main video, saving resources and costs, and improving the efficiency and flexibility of video insertion.

[0006] To achieve the aforementioned objective, according to one aspect of the present invention, a method for video insertion is provided, comprising:

[0007] Acquire text and identify the textual components of the text;

[0008] Generate the main video corresponding to the text, and based on the text component information and the playback duration of the main video, identify the playback duration of the text content, and then calculate the playback duration of each text.

[0009] Based on the location of the auxiliary video to be inserted in the text and the information of the text's constituent elements, the playback duration of the non-text content contained in the text before the location is calculated. Then, based on the playback duration of each text and the playback duration of the non-text content, the insertion time of the auxiliary video is calculated.

[0010] The auxiliary video is inserted and played during the playback of the main video according to the specified insertion time.

[0011] Optionally, identifying the text component information of the text includes: using a stack structure to convert the text into a file with structural tags; parsing the file with structural tags to obtain the text components contained in the text, the position of each text component in the text, and the intonation requirements of each text component when used for speech conversion, wherein the text components include characters and punctuation.

[0012] Optionally, based on the text component information and the playback duration of the main video, the playback duration of the text content is identified, including: identifying the silence duration corresponding to the silence requirement from the intonation requirement; calculating the punctuation duration occupied by punctuation in the text based on the intonation requirement and the timbre and speech rate characteristics of the performer corresponding to the text; and removing the silence duration and the punctuation duration from the playback duration of the main video to obtain the playback duration of the text content.

[0013] Optionally, based on the location of the auxiliary video to be inserted in the text and the text component information, the playback duration of the non-text content contained in the text before the location is calculated, including: querying the pre-silence duration corresponding to the silence requirement before the location from the intonation requirements of the text component information; querying the punctuation of the text before the location and recording it as the pre-punctuation; calculating the pre-punctuation duration based on the intonation requirements and the timbre and speech rate characteristics of the performer corresponding to the text; and summing the pre-silence duration and the pre-punctuation duration as the playback duration of the non-text content.

[0014] Optionally, before calculating the punctuation duration occupied by punctuation marks in the text or the duration of the preceding punctuation mark based on the intonation requirements and the timbre and speech rate characteristics of the performer corresponding to the text, the method further includes: collecting the timbre and speech rate characteristics of all performers; for each timbre and speech rate characteristic, obtaining the duration of various punctuation marks contained therein by analyzing the duration and content of the performance by the corresponding performer based on the text; establishing a correspondence between the timbre and speech rate characteristics and the duration of various punctuation marks, so as to query the punctuation duration or the duration of the preceding punctuation mark from the correspondence through the timbre and speech rate characteristics.

[0015] Optionally, inserting the auxiliary video into the playback of the main video according to the insertion time includes: determining the insertion position and corresponding scaling ratio of the auxiliary video in the playback screen of the main video according to a preset video switching method, and scaling the auxiliary video according to the scaling ratio; when the playback time of the main video reaches the insertion time, switching the playback of the scaled auxiliary video at the insertion position according to the video switching method.

[0016] Optionally, the text is used for digital human live streaming, and the performing subject is a virtual digital human with preset timbre and speech rate characteristics.

[0017] Optionally, in response to the failure to successfully insert and play the auxiliary video during the playback of the main video, the method further includes: determining the valid text region corresponding to the auxiliary video from the text; determining the valid duration of the auxiliary video based on the insertion time and the valid text region; and within the valid duration, inserting and playing the auxiliary video again during the playback of the main video according to a preset retry mechanism.

[0018] According to a second aspect of the present invention, an apparatus for video insertion is provided, comprising:

[0019] The text element recognition module is used to acquire text and identify the text component information of the text.

[0020] The text duration calculation module is used to generate the main video corresponding to the text, identify the playback duration of the text content based on the text component information and the playback duration of the main video, and then calculate the playback duration of each text.

[0021] Based on the location of the auxiliary video to be inserted in the text and the information of the text's constituent elements, the playback duration of the non-text content contained in the text before the location is calculated. Then, based on the playback duration of each text and the playback duration of the non-text content, the insertion time of the auxiliary video is calculated.

[0022] The auxiliary video insertion module is used to insert and play the auxiliary video during the playback of the main video according to the insertion time.

[0023] According to a third aspect of the present invention, an electronic device for video insertion is provided, comprising:

[0024] One or more processors;

[0025] Storage device for storing one or more programs.

[0026] When the one or more programs are executed by the one or more processors, the one or more processors implement the method provided in the first aspect of the embodiments of the present invention.

[0027] According to a fourth aspect of the present invention, a computer-readable medium is provided having a computer program stored thereon, which, when executed by a processor, implements the method provided in the first aspect of the present invention.

[0028] According to a fifth aspect of the present invention, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the method provided in the first aspect of the present invention.

[0029] One embodiment of the invention has the following advantages or beneficial effects: by acquiring text and identifying the text component information; generating a main video corresponding to the text; identifying the playback duration of the text content based on the text component information and the playback duration of the main video; and then calculating the playback duration of each text; based on the location of the auxiliary video to be inserted in the text and the text component information, calculating the playback duration of the non-text content contained in the text before the location; and then calculating the insertion time of the auxiliary video based on the playback duration of each text and the playback duration of the non-text content; and inserting the auxiliary video during the playback of the main video according to the insertion time, a flexible and efficient video insertion method is achieved. Based on the text component information in the main video, the insertion time of the auxiliary video in the main video is calculated in a fine-grained manner using the location of the auxiliary video and the playback duration of the main video, and the camera switches according to the insertion time, avoiding the cumbersome segmentation, video processing and merging of the main video, saving resources and costs, and improving the efficiency and flexibility of video insertion. Attached Figure Description

[0030] The accompanying drawings are provided to better understand the invention and are not intended to unduly limit the scope of the invention. Wherein:

[0031] Figure 1 This is a schematic diagram of the main flow of a video insertion method according to an embodiment of the present invention;

[0032] Figure 2 This is a schematic diagram of a text component identification method according to an embodiment of the present invention;

[0033] Figure 3 This is a schematic diagram of a method for determining the playback duration of each character according to an embodiment of the present invention;

[0034] Figure 4 This is a schematic diagram of a method for determining the insertion time of auxiliary video according to an embodiment of the present invention;

[0035] Figure 5 This is a schematic diagram of the overall process of the video insertion method according to an embodiment of the present invention;

[0036] Figure 6 This is a schematic diagram of the main modules of a video insertion device according to an embodiment of the present invention;

[0037] Figure 7 This is an exemplary system architecture diagram in which embodiments of the present invention can be applied;

[0038] Figure 8 This is a schematic diagram of the structure of a computer system suitable for implementing terminal devices or servers of the present invention. Detailed Implementation

[0039] It should be noted that the collection, updating, analysis, use, transmission, and storage of user personal information involved in the technical solution of this invention all comply with relevant laws and regulations, are used for legitimate and reasonable purposes, and are not shared, disclosed, or sold outside of these legitimate uses, and are subject to supervision and management by national regulatory authorities. Necessary measures should be taken to selectively block the use or access to personal information data to prevent unauthorized access to such personal information data, ensure that personnel authorized to access personal information data comply with relevant laws and regulations, and ensure the security of user personal information. Furthermore, once this user personal information data is no longer needed, the risk should be minimized by restricting or even prohibiting data collection and / or deleting the data.

[0040] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of the present invention, including various details to aid understanding. These details should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0041] The existing method of inserting auxiliary videos by splitting the main video and then merging them segment by segment requires re-inserting the auxiliary video when it needs to be changed (content changes or insertion point changes). This wastes resources, increases unnecessary costs, and affects video insertion efficiency, and cannot meet actual needs.

[0042] To address the aforementioned problems in existing technologies, this invention proposes a video insertion method. Based on the text corresponding to the main video, the information of its constituent text elements, and the playback duration of the main video, the playback duration of each text element is calculated. This, combined with the number of text elements and the playback duration of non-text content in the auxiliary video before its insertion position in the main video, determines the insertion time of the auxiliary video within the text. The auxiliary video is then played according to this insertion time, achieving a flexible and efficient video insertion method. By using the text constituent information in the main video's text, the insertion time of the auxiliary video within the main video is calculated in a fine-grained manner based on its insertion position and the main video's playback duration. Shot switching is performed according to the insertion time, avoiding the cumbersome segmentation, processing, and merging of the main video, saving resources and costs, and improving the efficiency and flexibility of video insertion.

[0043] Figure 1 This is a schematic diagram of the main flow of a video insertion method according to an embodiment of the present invention, as shown below. Figure 1 As shown, the video insertion method of this embodiment includes the following steps S101 to S104.

[0044] Step S101: Obtain the text and identify the text component information of the text.

[0045] Specifically, for promotional videos, video production requires determining the video content in advance based on the promotional task and writing corresponding scripts to guide performers in their acting, thereby achieving the promotional goal. In specific business areas, the text can also be visualized as a script to guide performers in vividly portraying the characters according to the lines, tone, and other information. Of course, with the development of intelligent technology, the performers in videos may also be virtual characters. In this case, the video producer needs to integrate the text (script) into the virtual characters to create the video.

[0046] Furthermore, before retrieving the text upon which the video performance or production is based, a text element template containing different element types (symbols, text, etc.) can be created based on the inherent format of the text used for video performance or production. This template includes the encoding of various commonly used characters and punctuation marks. The retrieved text is then encoded, and the encoded text is matched with the text element template. The matched element types, as well as the position of each element type within the text, are used as the text component information of the text.

[0047] Understandably, the text in this embodiment of the invention refers to the main text, that is, the source of the audio in the video. If there are also annotations in the text, although the annotations are text, they are not the main text, and the annotations usually have annotation markers. This invention identifies the annotations by the annotation markers and marks them as annotations, not main text.

[0048] According to one embodiment of the present invention, the text is used for digital human live streaming.

[0049] Specifically, based on the text obtained above, promotional videos are generated and targeted to email addresses and social media accounts of a fixed group of people, or are scheduled to be released on video platforms watched by the general public. The embodiments of the present invention mainly take the digital human live streaming scenario with strong rules as an example. The performing subject (performer) of the text is a virtual digital human, and the virtual digital human performs the role of the text according to the agreed rules.

[0050] Step S102: Generate the main video corresponding to the text. Based on the text component information and the playback duration of the main video, identify the playback duration of the text content and then calculate the playback duration of each text.

[0051] Specifically, a corresponding video is first generated based on the text. In this embodiment of the invention, the video generated based on the text serves as the main video, which corresponds to the promotional video in the promotional business scenario. Then, based on the position of the main text content in the text's constituent element information obtained from the above matching, and combined with the space occupied by all constituent elements of the text (e.g., the total space occupied by all constituent elements of the text is 3 pages and 15 lines), the proportion of the main text content is calculated. Based on this proportion, the playback duration of the main video is divided proportionally to obtain the playback duration of the main text content. Finally, based on the encoding result of the above text encoding, the number of characters contained in the main text content is queried, and the quotient of the playback duration of the main text content and the number of characters is calculated, which is the playback duration for each character.

[0052] Step S103: Based on the location of the auxiliary video to be inserted in the text and the information of the text components, calculate the playback duration of the non-text content contained in the text before the location. Then, based on the playback duration of each text and the playback duration of the non-text content, calculate the insertion time of the auxiliary video.

[0053] Specifically, to enrich the main video and provide viewers with a better viewing experience, various auxiliary videos are often interspersed within it, such as product appearance videos, product detail videos, or product function videos. The insertion of auxiliary videos mentioned in this invention generally refers to a method where, while the main video is playing, the camera view uses an inserted auxiliary video to cover the main video's playback screen. For example, when a virtual human is live-streaming a product introduction, the platform switches the live stream of the virtual human to an auxiliary video of the actual product. When the auxiliary video has sound, it is set to a mute mode, and the audio playback still uses the main video's audio; only the live stream screen is switched. The auxiliary video can be played full-screen with the main video's audio as background sound, or it can be played in an area of ​​the screen that does not obscure the virtual human, allowing the virtual human introduction and the actual product demonstration to proceed simultaneously, enabling viewers to fully understand the real product and improving their viewing experience. Of course, if the content of the auxiliary video's audio playback meets the requirements of the live stream, after switching to the auxiliary video of the actual product, the main video is paused, and the audio-enabled auxiliary video directly replaces the main video for playback.

[0054] For each auxiliary video, after obtaining the auxiliary video to be inserted, based on the content of the auxiliary video, find the text content that semantically matches it from the text, and take the position of the first character of the text content as the positioning position; further, based on the preset dwell time corresponding to various punctuation marks, query the dwell time of various punctuation marks before the positioning position, and sum the query dwell times to obtain the playback time occupied by non-text content; then calculate the product of the playback time of each character calculated above and the number of characters contained in the text before the positioning position to obtain the playback time of the text content before the positioning position, and sum the playback time occupied by non-text content and the playback time of text content to obtain the insertion time of the auxiliary video.

[0055] Step S104: Insert and play the auxiliary video during the playback of the main video according to the insertion time.

[0056] Specifically, based on the insertion time of the auxiliary video calculated above, a timed pusher is configured in the playback system. The playback of the main video triggers the start of the timed pusher. The timed pusher listens to the playback time of the main video. When the playback time of the main video reaches the insertion time, the timed pusher pushes the auxiliary video to the playback platform, thus realizing the insertion and switching of the auxiliary video.

[0057] According to one embodiment of the present invention, inserting the auxiliary video into the playback of the main video according to the insertion time includes: determining the insertion position and corresponding scaling ratio of the auxiliary video in the playback screen of the main video according to a preset video switching method, and scaling the auxiliary video according to the scaling ratio; when the playback time of the main video reaches the insertion time, switching the playback of the scaled auxiliary video at the insertion position according to the video switching method.

[0058] Specifically, in this embodiment of the invention, the auxiliary video is mainly replaced by insertion playback instead of conventional video merging processing. Insertion playback specifically refers to switching to play a pre-generated auxiliary video during the playback of the main video, thus creating an effect of inserting the auxiliary video into the main video for playback.

[0059] To accommodate different playback requirements, this invention predefines several video switching methods: a first switching method, a second switching method, a third switching method, and a fourth switching method. The first switching method pauses both the main video's visuals and audio, while the secondary video plays in full-screen mode. The second switching method pauses both the main video's visuals and audio, while the secondary video occupies a portion of the playback screen. The third switching method allows both the main video's visuals and audio to play normally, while the secondary video is muted, occupying a portion of the playback screen for silent playback. The fourth switching method uses the main video's audio as background noise, mutes the secondary video, and plays the secondary video in full-screen mode.

[0060] Before inserting a video, the platform selects the appropriate video transition method from a set of predefined options. If the transition method is the first or fourth method, the secondary video plays in full screen, and the insertion position is accordingly full-screen. If the transition method is the second or third method, non-critical areas are identified from the main video's playback screen, such as blank spaces without physical objects, avoiding virtual avatars and other spaces containing product names, and these non-critical areas are used as insertion positions. Based on the insertion position and the original size of the secondary video, the scaling ratio for subsequent playback transitions is determined, and the secondary video is scaled accordingly.

[0061] When the playback time of the main video reaches the insertion time of the auxiliary video, the main video and auxiliary video are configured according to the video switching method, such as whether the main video is paused or the auxiliary video is muted. Finally, the scaled auxiliary video is switched and played at the determined insertion position. This embodiment of the invention provides a method for determining the insertion position of the auxiliary video within the main video based on various video switching methods, and then adaptively scaling the auxiliary video. This allows for direct switching and playback of the scaled auxiliary video at the insertion position according to the video switching method, meeting diverse switching playback needs and making it suitable for more application scenarios.

[0062] According to another embodiment of the present invention, in response to the failure to successfully insert and play the auxiliary video during the playback of the main video, the method further includes: determining a valid text region corresponding to the auxiliary video from the text; determining a valid duration of the auxiliary video based on the insertion time and the valid text region; and within the valid duration, inserting and playing the auxiliary video again during the playback of the main video according to a preset retry mechanism.

[0063] Specifically, to improve the reliability of video insertion and playback, this embodiment of the invention inserts auxiliary videos as much as possible. Based on the matching results of the text semantics and the video content of the auxiliary videos, the effective text area corresponding to the auxiliary video can be determined from the text. For example, if the second paragraph of the main text describes the specific appearance of a product, and there is a corresponding auxiliary video demonstrating the detailed appearance of the product, then the second paragraph is the effective text area of ​​the auxiliary video.

[0064] Furthermore, the playback duration of the text content within the effective text area is calculated by multiplying the number of characters in the effective text area by the playback duration of each character calculated above. Then, based on the punctuation marks contained in the effective text area and the corresponding dwell times of the various preset punctuation marks, the playback duration of the non-text content within the effective text area is calculated. Finally, the playback durations of the text content and the non-text content within the effective text area are added together, and the insertion time is added to obtain the insertion endpoint. Considering the viewer's experience, the insertion endpoint is pre-specified based on the difference between the insertion endpoint and the insertion time to obtain the final insertion time. Using the insertion time as the starting point and the final insertion time as the ending point, the effective duration of the supplementary video is obtained.

[0065] Based on the aforementioned effective duration, if the auxiliary video is not successfully inserted during the playback of the main video, the auxiliary video will be attempted to be inserted again within the effective duration of the main video playback, according to the number of retries and waiting time in the preset retry mechanism, in order to improve the success rate of inserting the auxiliary video.

[0066] This invention achieves flexible insertion of auxiliary videos by calculating the insertion time of the auxiliary video within the main video with fine-grained precision. When other auxiliary videos also need to be inserted into the main video, the method of this invention determines their corresponding insertion time, and determines the insertion position and scaling ratio of the auxiliary video within the main video according to the video switching method. Then, according to the video switching method, the scaled auxiliary video is switched and played at the insertion position. Correspondingly, if the position of the auxiliary video to be inserted within the text is adjusted, the corresponding insertion time and position are recalculated based on the adjusted position, and the main video is switched and played according to the newly calculated insertion time and position, greatly improving the flexibility and efficiency of auxiliary video insertion.

[0067] This invention also provides another method for identifying text component information, including: using a stack structure to convert the text into a file with structural tags; parsing the file with structural tags to obtain the text components contained in the text, the position of each text component in the text, and the intonation requirements of each text component when used for speech conversion, wherein the text components include characters and punctuation.

[0068] Specifically, the accuracy of identifying text components directly determines the accuracy of subsequent insertion time calculations. To ensure the accuracy of text components, a file format with structured tags is used to parse the text. First, the text is converted into a file with structured tags, such as an XML file. Specific format conversion can be performed using dedicated conversion tools. In this embodiment, a stack structure is used for tag pairing to obtain a standard XML file with structured tags.

[0069] Furthermore, the XML file with structured tags is parsed, and all the tags contained therein are summarized and categorized according to their type. The text tags within the main body of the text are then parsed to obtain the text components such as characters and punctuation marks, as well as the positional information of each component within the text. Additionally, considering that the text in this embodiment is primarily used to guide performers in vividly interpreting the lines and tone of the text, it inevitably includes annotations specifying intonation and tone requirements for interpreting the main body of the text (e.g., silence requirements, emphasis requirements, and specific pronunciation rules). For XML files, these intonation and tone requirements are typically marked using Text-to-Speech (TTS) tags. Therefore, by parsing the TTS tags, the intonation requirements for each text component when converting it to speech are identified.

[0070] Figure 2This is a schematic diagram of the text component identification method according to an embodiment of the present invention. Taking the replacement and update of auxiliary videos in a digital human live streaming scenario as an example, the text is visualized as a script. The script used to generate the main video is obtained and first converted into an XML file with structured tags. Then, the XML is parsed to identify the TTS tags and body text tags contained therein. The body text tags typically include text and punctuation marks, while TTS tags can be further divided into silence tags, emphasis tags, regular pronunciation tags, and other tags. Furthermore, in this embodiment of the invention, the updated auxiliary video is used to replace the corresponding auxiliary video already synthesized in the main video, i.e., the previous version of the auxiliary video. Therefore, it is also necessary to parse and identify the tags of the previous version of the auxiliary video in the main video corresponding to the auxiliary video to be inserted, parse the tags of the previous version of the auxiliary video in the main video corresponding to the auxiliary video to be inserted, and then use the position of the parsed previous version of the auxiliary video as the positioning position of the auxiliary video to be inserted.

[0071] This invention also provides another method for identifying the playback duration of text content in a text, including: identifying the silence duration corresponding to the silence requirement from the intonation requirement; calculating the punctuation duration occupied by punctuation marks in the text based on the intonation requirement and the timbre and speech rate characteristics of the performer corresponding to the text; and removing the silence duration and the punctuation duration from the playback duration of the main video to obtain the playback duration of the text content.

[0072] Specifically, the playback duration of the text content is also a factor affecting the accuracy of calculating the insertion time of the auxiliary video. It directly affects the accuracy of calculating the playback duration of each character, and thus the accuracy of the insertion time. Based on the characteristic that silence and punctuation account for a relatively low proportion in text, this invention provides a more accurate and efficient method for identifying the playback duration of text content from the perspective of analyzing and calculating the duration of silence and punctuation.

[0073] Based on the aforementioned information about the text components, the silence requirements obtained from parsing TTS tags and their positions within the text are used to calculate the required silence duration. Then, considering the non-silence requirements (such as emphasis and pronunciation) in the intonation requirements, combined with the timbre and speaking speed characteristics of the performer, the duration of each punctuation mark in the text is determined; for example, a comma occupies 100ms, and an exclamation mark occupies 1s. If the main video playback duration is set to h, the silence duration of each silence requirement to s, and the duration of each punctuation mark to m, then the playback duration of the text content = hsm.

[0074] According to one embodiment of the present invention, before calculating the punctuation duration occupied by punctuation marks in the text based on the intonation requirements and the timbre and speech rate characteristics of the performer corresponding to the text, the method further includes: collecting the timbre and speech rate characteristics of all performers; for each timbre and speech rate characteristic, obtaining the duration occupied by various punctuation marks contained therein by analyzing the duration and content of the performance by the corresponding performer based on the text; establishing a correspondence between the timbre and speech rate characteristics and the duration occupied by various punctuation marks, so as to query and obtain the punctuation duration from the correspondence through the timbre and speech rate characteristics.

[0075] Specifically, to improve efficiency and considering the limited number of performers, before calculating the duration of punctuation marks in the text based on intonation requirements and the timbre and speech rate characteristics of the performers corresponding to the text, we can first collect the timbre and speech rate characteristics of all performers, as well as historical video recordings of the corresponding historical texts. By identifying the textual components of the historical text and combining them with the duration of the historical video recordings, we can calculate the duration of punctuation marks in the various body texts within the historical text in a fine-grained manner. Furthermore, using timbre and speech rate characteristics as keys and the duration of punctuation marks in the various body texts as corresponding values, we can establish a correspondence between timbre and speech rate characteristics and the duration of various punctuation marks. Based on this correspondence, we can quickly find the duration of the corresponding punctuation marks by using the timbre and speech rate characteristics of the performers, avoiding redundant calculations.

[0076] Figure 3 This is a schematic diagram illustrating the method for determining the playback duration of each character in an embodiment of the present invention. Taking the replacement and update of an already synthesized auxiliary video in a digital human live-streaming scenario as an example, firstly, the auxiliary video corresponding to the auxiliary video to be inserted, parsed from the text component information, is removed to avoid interference. Next, the playback duration of the main video is calculated, and the corresponding silence duration is determined based on the number and position of silence requirements in the text component information, and this silence duration is removed from the main video's playback duration. Finally, based on the timbre and speech rate characteristics of the performer corresponding to the text, as well as the intonation requirements in the text component information, the punctuation duration in the text is calculated, and then the punctuation duration is removed from the remaining duration after removing the silence duration to obtain the playback duration of the main text content. Then, based on the number of characters in the main text content, the playback duration of each character is calculated. The playback duration of each character in this embodiment of the present invention is essentially an average playback duration.

[0077] This invention also provides another method for calculating the playback duration of non-textual content contained in the text before the positioning position, comprising: querying the pre-silence duration corresponding to the silence requirement before the positioning position from the intonation requirements of the text component information; querying the punctuation of the text before the positioning position and recording it as the pre-punctuation; calculating the pre-punctuation duration based on the intonation requirements and the timbre and speech rate characteristics of the performer corresponding to the text; and summing the pre-silence duration and the pre-punctuation duration as the playback duration of the non-textual content.

[0078] Specifically, after determining the location of the supplementary video within the text, all silence requirements preceding that location are retrieved from the intonation requirements of the text components identified above. Based on the specific location of these silence requirements, the silence duration for each requirement is calculated, thus forming the pre-silence duration. Similarly, all punctuation marks preceding the location are retrieved and recorded as pre-punctuation marks. Based on the intonation requirements corresponding to these punctuation marks, combined with the performer's timbre and speaking speed characteristics, the duration of these pre-punctuation marks is calculated, forming the pre-punctuation mark duration. Finally, the pre-silence duration and the pre-punctuation mark duration are summed to obtain the playback time for non-textual content.

[0079] According to one embodiment of the present invention, the performing subject is a virtual digital human, which has preset timbre and speech rate characteristics.

[0080] Specifically, in the digital human live streaming scenario, the corresponding performer is a virtual digital human, which can be configured with various timbre and speech rate features for selection. Based on the intonation requirements of each text component in the text component information during speech conversion, the most matching timbre and speech rate features are selected. Then, based on the selected timbre and speech rate features, the duration of each punctuation mark and the duration of each preceding punctuation mark are determined according to the method described above.

[0081] According to another embodiment of the present invention, before calculating the duration of the preceding punctuation mark based on the intonation requirements and the timbre and speech rate characteristics of the performer corresponding to the text, the method further includes: collecting the timbre and speech rate characteristics of all performers; for each timbre and speech rate characteristic, obtaining the duration of various punctuation marks contained therein by analyzing the duration and content of the performance by the corresponding performer based on the text; establishing a correspondence between the timbre and speech rate characteristics and the duration of various punctuation marks, so as to query and obtain the duration of the preceding punctuation mark from the correspondence through the timbre and speech rate characteristics.

[0082] Specifically, similar to the method for calculating punctuation duration described above, to improve efficiency, before calculating the duration of preceding punctuation based on intonation requirements and the timbre and speech rate characteristics of the performer corresponding to the text, historical video recordings of all virtual digital humans performing historical texts under all preset timbre and speech rate characteristics can be collected. By identifying the textual components of the historical text and combining the duration of the historical video recordings, the duration of punctuation marks in the various body texts contained in the historical text can be calculated in a fine-grained manner. Furthermore, using timbre and speech rate characteristics as keys and the duration of punctuation marks in the various body texts as corresponding values, a correspondence between timbre and speech rate characteristics and the duration of various punctuation marks can be established. Based on this correspondence, the duration of the corresponding punctuation mark can be quickly found using the timbre and speech rate characteristics selected for the virtual digital human, avoiding redundant calculations.

[0083] Figure 4 This is a schematic diagram illustrating the method for determining the insertion time of auxiliary video according to an embodiment of the present invention. The method for calculating the insertion time of auxiliary video provided above is based on the playback duration of non-text content and the playback duration of text content. This diagram provides another method for determining the insertion duration with slightly different calculation dimensions, which is based on the silence duration before the positioning position and the duration of the main text (text and punctuation) before the positioning position.

[0084] Specifically, based on the determined or parsed location of the supplementary video, the silence requirement before the insertion position is retrieved from the intonation requirements of the text's constituent elements, and the corresponding pre-silence duration is calculated. All characters and punctuation marks before the location are retrieved, and the retrieved punctuation marks are recorded as pre-punctuation marks. Based on the calculated playback duration of each character and the number of characters before the location, the playback duration of the text content before the location is calculated. Then, based on the intonation requirements and the timbre and speech rate characteristics of the performer corresponding to the text, the pre-punctuation mark duration is calculated. Finally, the pre-silence duration, the pre-punctuation mark duration, and the playback duration of the text content before the location are summed to obtain the insertion time of the supplementary video.

[0085] Figure 5 This is a schematic diagram of the overall flow of the video insertion method according to an embodiment of the present invention. First, the text of the user-generated main video is obtained. Then, through format conversion and text parsing, the text component information is obtained. Based on the text component information and the playback duration of the main video generated from the text, the playback duration of each character is calculated. Finally, based on the location of the auxiliary video within the text, the text component information, and the playback duration of each character, the insertion time of the auxiliary video is calculated.

[0086] This invention, based on the text corresponding to the main video, the information of its constituent elements, and the playback duration of the main video, calculates the playback duration of each character. Combining this with the number of characters and the playback duration of non-text content before the location of the auxiliary video to be inserted, the insertion time of the auxiliary video within the text is determined. The auxiliary video is then played according to this insertion time, achieving a flexible and efficient video insertion method. By using the text constituent element information of the main video, the insertion time of the auxiliary video within the main video is calculated in fine detail using the location of the auxiliary video and the playback duration of the main video. Shot switching is performed according to the insertion time, avoiding the cumbersome segmentation, processing, and merging of the main video, saving resources and costs, and improving the efficiency and flexibility of video insertion.

[0087] Figure 6 This is a schematic diagram of the main modules of a video insertion device according to an embodiment of the present invention. Figure 6 As shown, the video insertion device 600 mainly includes a text element recognition module 601, a text duration calculation module 602, an insertion time calculation module 603, and an auxiliary video insertion module 604.

[0088] The text element recognition module 601 is used to acquire text and recognize the text component information of the text;

[0089] The text duration calculation module 602 is used to generate the main video corresponding to the text, identify the playback duration of the text content based on the text component information and the playback duration of the main video, and then calculate the playback duration of each text.

[0090] The insertion time calculation module 603 is used to calculate the playback duration of the non-text content contained in the text before the positioning position of the auxiliary video to be inserted in the text and the text component information, and then calculate the insertion time of the auxiliary video based on the playback duration of each text and the playback duration of the non-text content.

[0091] The auxiliary video insertion module 604 is used to insert and play the auxiliary video during the playback of the main video according to the insertion time.

[0092] According to an embodiment of the present invention, the text element recognition module 601 is further configured to: convert the text into a file with structural tags using a stack structure; parse the file with structural tags to obtain the text components contained in the text, the position of each text component in the text, and the intonation requirements of each text component when used for speech conversion, wherein the text components include characters and punctuation.

[0093] According to another embodiment of the present invention, the text duration calculation module 602 is further configured to: identify the silence duration corresponding to the silence requirement from the intonation requirement; calculate the punctuation duration occupied by the punctuation in the text based on the intonation requirement and the timbre and speech rate characteristics of the performing subject corresponding to the text; and remove the silence duration and the punctuation duration from the playback duration of the main video to obtain the playback duration of the text content.

[0094] According to another embodiment of the present invention, the insertion time calculation module 603 is further configured to: query the duration of the silence before the positioning position corresponding to the intonation requirement from the intonation requirement of the text component information; query the punctuation mark of the text before the positioning position and record it as the punctuation mark before the positioning position; calculate the duration of the punctuation mark before the positioning position according to the intonation requirement and the timbre and speech rate characteristics of the performer corresponding to the text; and sum the duration of the silence before the positioning position and the duration of the punctuation mark before the positioning position as the playback duration occupied by the non-text content.

[0095] According to another embodiment of the present invention, the video insertion device 600 further includes a data preparation module (not shown in the figure), configured to: collect the timbre and speech rate characteristics of all performers before calculating the punctuation duration occupied by punctuation marks in the text or the duration of the preceding punctuation mark based on the intonation requirements and the timbre and speech rate characteristics of the performer corresponding to the text; for each timbre and speech rate characteristic, obtain the duration of various punctuation marks contained therein by analyzing the duration and content of the performance by the corresponding performer based on the text; establish a correspondence between the timbre and speech rate characteristics and the duration of various punctuation marks, so as to query and obtain the punctuation duration or the duration of the preceding punctuation mark from the correspondence through the timbre and speech rate characteristics.

[0096] According to another embodiment of the present invention, the auxiliary video insertion module 604 is further configured to: determine the insertion position and corresponding scaling ratio of the auxiliary video in the playback screen of the main video according to a preset video switching method, and scale the auxiliary video according to the scaling ratio; when the playback time of the main video reaches the insertion time, switch the playback of the scaled auxiliary video at the insertion position according to the video switching method.

[0097] According to another embodiment of the present invention, the text is used for digital human live streaming, the performing subject is a virtual digital human, and the virtual digital human has preset timbre and speech rate characteristics.

[0098] According to another embodiment of the present invention, in response to the failure to successfully insert and play the auxiliary video during the playback of the main video, the video insertion device 600 further includes a retry mechanism module (not shown in the figure), configured to: determine the valid text area corresponding to the auxiliary video from the text; determine the valid duration of the auxiliary video based on the insertion time and the valid text area; and within the valid duration, insert and play the auxiliary video again during the playback of the main video according to a preset retry mechanism.

[0099] Figure 7 This is an exemplary system architecture diagram in which embodiments of the present invention can be applied.

[0100] like Figure 7 As shown, system architecture 700 may include terminal devices 701, 702, and 703, a network 704, and a server 705. Network 704 serves as the medium for providing communication links between terminal devices 701, 702, and 703 and server 705. Network 704 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.

[0101] Users can use terminal devices 701, 702, and 703 to interact with server 705 via network 704 to receive or send messages, etc. Various communication client applications, such as video insertion applications, can be installed on terminal devices 701, 702, and 703 (for example only).

[0102] Terminal devices 701, 702, and 703 can be various electronic devices with displays and web browsing capabilities, including but not limited to smartphones, tablets, laptops, and desktop computers.

[0103] Server 705 can be a server providing various services, such as a background management server supporting video insertion by users using terminal devices 701, 702, and 703 (for example only). The background management server can acquire text and identify its text component information; generate a main video corresponding to the text; identify the playback duration of the text content based on the text component information and the playback duration of the main video; calculate the playback duration of each text element; calculate the playback duration of the non-text content contained in the text before the specified location based on the location of the auxiliary video to be inserted in the text and the text component information; calculate the insertion time of the auxiliary video based on the playback duration of each text element and the playback duration of the non-text content; insert and play the auxiliary video during the playback of the main video according to the insertion time; and feed back the processing results (e.g., insertion results – for example only) to the terminal device.

[0104] It should be noted that the video insertion method provided in this embodiment of the invention is generally executed by server 705, and correspondingly, the video insertion device is generally located in server 705.

[0105] It should be understood that Figure 7 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.

[0106] The following is for reference. Figure 8 , Figure 8 This is a schematic diagram of the structure of a computer system suitable for implementing terminal devices or servers of the present invention. Figure 8 The terminal device or server shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of the present invention.

[0107] like Figure 8 As shown, the computer system 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 802 or programs loaded from storage section 808 into random access memory (RAM) 803. The RAM 803 also stores various programs and data required for the operation of the system 800. The CPU 801, ROM 802, and RAM 803 are interconnected via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0108] The following components are connected to I / O interface 805: an input section 806 including a keyboard, mouse, etc.; an output section 807 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN card, modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to I / O interface 805 as needed. A removable medium 811, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 810 as needed so that computer programs read from it can be installed into storage section 808 as needed.

[0109] In particular, according to the embodiments disclosed in this invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 809, and / or installed from removable medium 811. When the computer program is executed by central processing unit (CPU) 801, it performs the functions defined above in the system of this invention.

[0110] It should be noted that the computer-readable medium shown in this invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0111] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0112] The units described in the embodiments of the present invention can be implemented in software or hardware. The described units can also be housed in a processor; for example, a processor can be described as including: a text element recognition module, a text duration calculation module, an insertion time calculation module, and an auxiliary video insertion module.

[0113] In some cases, the names of these modules do not constitute a limitation on the module itself. For example, a text element recognition module can also be described as "a module for acquiring text and recognizing the text component information of the text".

[0114] On the other hand, the present invention also provides a computer-readable medium, which may be included in the device described in the embodiments; or it may exist independently and not assembled into the device. The computer-readable medium carries one or more programs, which, when executed by the device, cause the device to include: acquiring text and identifying text component information of the text; generating a main video corresponding to the text, identifying the playback duration of text content in the text based on the text component information and the playback duration of the main video, and then calculating the playback duration of each text; calculating the playback duration of non-text content contained in the text before the positioning position based on the positioning position of an auxiliary video to be inserted in the text and the text component information, and then calculating the insertion time of the auxiliary video based on the playback duration of each text and the playback duration of the non-text content; and inserting and playing the auxiliary video during the playback of the main video according to the insertion time.

[0115] The technical solution of the present invention has the following advantages or beneficial effects: by acquiring text and identifying the text component information; generating a main video corresponding to the text, identifying the playback duration of the text content in the text based on the text component information and the playback duration of the main video, and then calculating the playback duration of each text; calculating the playback duration of the non-text content contained in the text before the positioning position based on the positioning position of the auxiliary video to be inserted in the text and the text component information, and then calculating the insertion time of the auxiliary video based on the playback duration of each text and the playback duration of the non-text content; and inserting the auxiliary video during the playback of the main video according to the insertion time, the technical solution realizes a flexible and efficient video insertion method. Based on the text component information in the text of the main video, the insertion time of the auxiliary video in the main video is calculated in fine granularity by the positioning position of the auxiliary video and the playback duration of the main video, and the camera switching playback is performed according to the insertion time. This avoids the cumbersome segmentation, video processing and merging of the main video, saves resources and costs, and improves the efficiency and flexibility of video insertion.

[0116] The specific embodiments described herein do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A method for video insertion, characterized in that, include: Acquire text and identify the textual components of the text; Generate the main video corresponding to the text, and based on the text component information and the playback duration of the main video, identify the playback duration of the text content, and then calculate the playback duration of each text. Based on the location of the auxiliary video to be inserted in the text and the information of the text's constituent elements, the playback duration of the non-text content contained in the text before the location is calculated. Then, based on the playback duration of each text and the playback duration of the non-text content, the insertion time of the auxiliary video is calculated. The auxiliary video is inserted and played during the playback of the main video according to the specified insertion time.

2. The method according to claim 1, characterized in that, Identify the text component information of the text, including: Using a stack structure, the text is converted into a file with structured tags; The document with structural tags is parsed to obtain the text components contained in the text, the position of each text component in the text, and the intonation requirements of each text component when used for speech conversion. The text components include characters and punctuation.

3. The method according to claim 2, characterized in that, Based on the text component information and the playback duration of the main video, the playback duration of the text content is identified, including: Identify the silence duration corresponding to the silence requirement from the tone requirements; Based on the intonation requirements and the timbre and speech rate characteristics of the performer corresponding to the text, calculate the punctuation duration in the text; The playback duration of the text content is obtained by subtracting the silence duration and the punctuation duration from the playback duration of the main video.

4. The method according to claim 2, characterized in that, Based on the location of the supplementary video to be inserted within the text and the text's component information, calculate the playback duration of the non-text content contained in the text before the specified location, including: Query the duration of the silence preceding the location from the intonation requirements of the text component information; Query the punctuation marks in the text before the specified location and record them as the preceding punctuation marks. Calculate the duration of the preceding punctuation marks based on the intonation requirements and the timbre and speech rate characteristics of the performer corresponding to the text. The sum of the duration of the initial silence and the duration of the initial punctuation mark is taken as the playback duration of the non-text content.

5. The method according to claim 3 or 4, characterized in that, Before calculating the punctuation duration of the punctuation marks in the text or the duration of the preceding punctuation mark based on the intonation requirements and the timbre and speech rate characteristics of the performer corresponding to the text, the method further includes: Collect the timbre and speech rate characteristics of all performers; For each timbre and speech rate feature, the duration of various punctuation marks is obtained by analyzing the duration and content of the corresponding performance based on the text. Establish a correspondence between timbre and speech rate features and the duration of various punctuation marks, so as to query the duration of the punctuation mark or the duration of the preceding punctuation mark from the correspondence using timbre and speech rate features.

6. The method according to claim 1, characterized in that, According to the insertion time, the auxiliary video is inserted and played during the playback of the main video, including: According to the preset video switching method, determine the insertion position and corresponding scaling ratio of the auxiliary video in the playback screen of the main video, and scale the auxiliary video according to the scaling ratio; When the playback time of the main video reaches the insertion time, the scaled auxiliary video is switched to play at the insertion position according to the video switching method.

7. The method according to any one of claims 1 or 3 to 5, characterized in that, The text is used for digital human live streaming, and the performing subject is a virtual digital human with preset timbre and speech rate characteristics.

8. The method according to claim 1, characterized in that, In response to the failure to successfully insert and play the secondary video during the playback of the main video, the method further includes: The effective text region corresponding to the auxiliary video is determined from the text, and the effective duration of the auxiliary video is determined based on the insertion time and the effective text region; Within the specified effective duration, the auxiliary video is inserted and played again during the playback of the main video according to the preset retry mechanism.

9. A device for video insertion, characterized in that, include: The text element recognition module is used to acquire text and identify the text component information of the text. The text duration calculation module is used to generate the main video corresponding to the text, identify the playback duration of the text content based on the text component information and the playback duration of the main video, and then calculate the playback duration of each text. The insertion time calculation module is used to calculate the playback duration of the non-text content contained in the text before the location position of the auxiliary video to be inserted in the text and the text component information, and then calculate the insertion time of the auxiliary video based on the playback duration of each text and the playback duration of the non-text content. The auxiliary video insertion module is used to insert and play the auxiliary video during the playback of the main video according to the insertion time.

10. A mobile electronic device terminal, characterized in that, include: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-8.

11. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-8.

12. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1-8.