Video subtitle generation methods, devices, media and electronic equipment
By determining the time range of audio events and adding event tags during video subtitle generation, and combining speech recognition and detection models, the problem of poor subtitle quality in existing technologies is solved, enabling users to effectively locate video events and understand the content.
Patent Information
- Application Number
- CN202310457969.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-25
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2043-04-25
AI Technical Summary
Existing automatic captioning technology only displays the text content output by the speech recognition model, and cannot effectively distinguish between events in speech segments and non-speech segments, resulting in poor captioning quality.
By determining the duration of events in the target audio and adding event tags as subtitles to video frames based on the event duration, combined with speech recognition and speech event detection models, the time range of events and sentences is adjusted to avoid overlap, similar events are merged, short events are deleted, and the subtitle display effect is improved.
This allows users to effectively locate events in the video and their corresponding times, improving their understanding of the video content and enhancing the subtitle display effect.
Smart Images

Figure CN116471442B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of electronic information technology, and more specifically, to a video subtitle generation method, apparatus, medium, and electronic device. Background Technology
[0002] To enhance the user's video viewing experience, subtitles need to be added. However, automatic subtitle technology simply displays the text content output by the speech recognition model. Summary of the Invention
[0003] This section is provided to briefly introduce the concepts, which will be described in detail in the Detailed Description section later. This section is not intended to identify key or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.
[0004] Firstly, this disclosure provides a method for generating video subtitles, including:
[0005] Obtain the target audio;
[0006] Determine the duration of events in the target audio, including events occurring in speech segments and events occurring in non-speech segments of the target audio;
[0007] Based on the duration of the event in the target audio, the event tag corresponding to the event is added as a subtitle to the video frame corresponding to the event duration, and the video is the video corresponding to the target audio.
[0008] Secondly, this disclosure provides a video subtitle generation apparatus, comprising:
[0009] The acquisition module is used to acquire the target audio.
[0010] A determining module is used to determine the duration of events in the target audio, wherein the events include events occurring in speech segments and events occurring in non-speech segments of the target audio;
[0011] The generation module is used to add the event tag corresponding to the event as a subtitle to the video frame corresponding to the event time range in the target audio, based on the event duration range of the event in the target audio.
[0012] Thirdly, this disclosure provides a computer-readable medium having a computer program stored thereon, which, when executed by a processing device, implements the steps of the method described in the first aspect.
[0013] Fourthly, this disclosure provides an electronic device, comprising:
[0014] A storage device having at least one computer program stored thereon;
[0015] At least one processing device is configured to execute the at least one computer program in the storage device to implement the steps of the method in the first aspect.
[0016] By using the above technical solution, the duration of an event in the target audio is determined. Then, based on the duration of the event in the target audio, the event tag corresponding to the event is added as a subtitle to the video frame corresponding to the event duration. This allows users to effectively locate the event that occurred in the video and its corresponding time based on the subtitles, thereby improving users' understanding of the video content based on the subtitle display.
[0017] Other features and advantages of this disclosure will be described in detail in the following detailed description section. Attached Figure Description
[0018] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and elements are not necessarily drawn to scale. In the drawings:
[0019] Figure 1 This is a flowchart illustrating a video subtitle generation method according to an exemplary embodiment of the present disclosure.
[0020] Figure 2 This is a schematic diagram illustrating the overlap between the pronunciation time range of a clause and the event time range of an event, according to an exemplary embodiment of this disclosure.
[0021] Figure 3 This is another flowchart illustrating a video subtitle generation method according to an exemplary embodiment of the present disclosure.
[0022] Figure 4 This is a block diagram illustrating a video subtitle generation apparatus according to an exemplary embodiment of the present disclosure.
[0023] Figure 5 This is a schematic diagram of the structure of an electronic device according to an exemplary embodiment of the present disclosure. Detailed Implementation
[0024] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0025] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.
[0026] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.
[0027] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.
[0028] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0029] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0030] All actions involving the acquisition of signals, information, or data in this disclosure are carried out in accordance with the relevant data protection laws and policies of the country where the location is situated, and with the authorization granted by the owner of the relevant device.
[0031] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.
[0032] For example, upon receiving a user's active request, a prompt message is sent to the user to explicitly inform them that the requested operation will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the software or hardware, such as the electronic device, application, server, or storage medium performing the operations of this disclosed technical solution, based on the prompt message.
[0033] As an optional but non-limiting implementation, in response to a user's active request, sending a prompt message to the user can be done via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0034] It is understood that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of this disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of this disclosure.
[0035] Meanwhile, it is understood that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and related provisions.
[0036] In automatic captioning technology, only the text content output by the speech recognition model is displayed, without showing the content corresponding to the audio event, especially for events without text content, such as "instrumental music," "applause," "door opening sound," and "explosion sound." Furthermore, for events with text content, conventional captioning uses the corresponding text output by the speech recognition model. For example, for a user's laughter, the speech recognition model can usually identify the text "hahaha," and therefore uses the identified text "hahaha" as the caption. Simply displaying the text content output by the speech recognition model makes it impossible for the user to effectively distinguish between the spoken content and the event content, resulting in poor captioning quality.
[0037] In view of this, the present disclosure provides a video subtitle generation method, apparatus, medium, and electronic device, which enables users to effectively locate events occurring in the video and the corresponding times of the events based on the subtitles in the video, thereby improving users' understanding of the video content based on the subtitle display.
[0038] The present disclosure will be further explained below with reference to the accompanying drawings.
[0039] Figure 1 This is a video subtitle generation method according to an exemplary embodiment of the present disclosure. This video subtitle generation method can be executed by an electronic device. (Refer to...) Figure 1 This includes the following steps:
[0040] Step 101: Obtain the target audio.
[0041] The target audio can be audio in one language, such as English or Chinese, and this embodiment does not limit the language; in addition, the target audio can also be audio in at least two languages.
[0042] Step 102: Determine the duration of events in the target audio, including events occurring in speech segments and events occurring in non-speech segments of the target audio.
[0043] In this context, a speech segment can be understood as a spoken segment, while a non-speech segment can be a non-spoken segment.
[0044] Among them, events can occur within a speech segment, such as a "laughter event"; events can also occur outside of a speech segment, such as an "applause event" or a "door opening / closing event".
[0045] Specifically, events occurring in the target audio can be determined based on sound features at different times within the target audio. Different events typically involve the generation of one or more corresponding sound features; for example, an "applause event" is accompanied by applause sounds, a "laughter event" by laughter sounds, and so on. For instance, an audio event library can be established, containing sound feature templates corresponding to different events. Sound features from different times within the target audio are collected and matched against the sound feature templates in the audio event library to obtain the events in the target audio and the duration of those events within the target audio.
[0046] The event time range is used to characterize the duration of the event in the target audio. For example, if a laughter event is detected in the target audio and lasts from T1 to T2, the event time range of the laughter event can be determined as [T1, T2], where [T1, T2] represents the time period from T1 to T2.
[0047] Step 103: Based on the duration of the event in the target audio, add the event tag corresponding to the event as a subtitle to the video frame corresponding to the event duration in the video. The video is the video corresponding to the target audio.
[0048] Different events have corresponding event tags. For example, the event tag for a laughter event could be "<laughter>". In some embodiments, a correspondence between different events and their corresponding event tags can be established in advance, and the event tag for each event can be determined based on this correspondence. Continuing with the above example, "<laughter>" is added to each video frame in the time interval [T1, T2] of the video.
[0049] By using the above method, the duration of an event in the target audio is determined. Then, based on the duration of the event in the target audio, the event tag corresponding to the event is added as a subtitle to the video frame corresponding to the event duration. This allows users to effectively locate the event that occurred in the video and its corresponding time based on the subtitles, thereby improving users' understanding of the video content based on the subtitle display.
[0050] Additionally, it is worth noting that in Figure 1 Based on the scheme shown, the above method can also determine the duration of pronunciation of each sentence in the target audio. Then, according to the duration of pronunciation of each sentence in the target audio, the text content corresponding to the sentence is added as subtitles to the video frames corresponding to that pronunciation duration, resulting in a video with complete subtitles. When playing the video with added subtitles, users can effectively distinguish between content-type subtitles and event-type subtitles, improving their understanding of the video based on subtitles. Here, the sentences are determined by a speech recognition model, the subtitles corresponding to the sentences are content-type subtitles, and the tag subtitles corresponding to the events are event-type subtitles. The specific implementation process for determining the duration of pronunciation of each sentence in the target audio can be referred to in the following related embodiments, which will not be elaborated upon here.
[0051] In some embodiments, the step of determining the duration of an event in the target audio can be implemented by: inputting the target audio into a speech recognition model to obtain a first recognition result; inputting the target audio into a speech event detection model to obtain a second recognition result; and determining the duration of an event in the target audio based on the first and second recognition results.
[0052] The speech recognition model is used to identify the text in the target audio and the time information corresponding to each character in the text. The time information of a character can be understood as the time information of the sound effect corresponding to that character in the audio. Therefore, the first recognition result is the text in the target audio identified by the speech recognition model and the time information corresponding to each character in the text. The text is then segmented into sentences, and by combining the time information corresponding to the target characters in the sentences, the duration of pronunciation of the sentences in the target audio can be obtained. Here, the target characters can be the first and last characters in the sentence.
[0053] Among them, the speech event detection model is used to identify events in the target audio and the time information of the events. Therefore, the second recognition result is the events in the target audio and the time information of the events identified by the speech event detection model. Based on the time information of the events, the duration of the event in the target audio can be obtained. The duration of the event in the target audio is the time range from the start time information of the event to the end time information of the event.
[0054] The model structure and training method of the speech recognition model and the speech event detection model can be referred to relevant technologies, and will not be elaborated here in this embodiment.
[0055] The above method utilizes speech recognition models and speech event detection models to determine the duration of an event in the target audio.
[0056] In some embodiments, the step of determining the duration of an event in the target audio based on the first recognition result and the second recognition result can be implemented as follows: determining the duration of a sentence segmentation result and the duration of pronunciation of each sentence segmentation result in the target audio based on the sentence segmentation model and the first recognition result; adjusting the duration of the event in the target audio for an event that matches a sentence in the second recognition result with the goal of eliminating the overlap between the pronunciation time range and the event time range, or adjusting the pronunciation time range corresponding to the sentence; and determining the duration of the event in the target audio based on the adjustment result.
[0057] The sentence segmentation model takes as input the text from the target audio in the first recognition result and outputs as a sentence segmentation result, which includes at least one sentence. By combining the time information corresponding to each character of each sentence in the sentence segmentation result and the text in the target audio in the first recognition result, the duration of pronunciation of each sentence in the target audio can be obtained. Specifically, the duration of pronunciation of that sentence in the target audio is defined as the time range from the time information corresponding to the first character of the sentence to the time information corresponding to the last character of the sentence.
[0058] In this case, if the time range of the event overlaps with the pronunciation time range of the clause, then the event and the clause are considered to be matched.
[0059] The specific implementation method for adjusting the duration of the event in the target audio or adjusting the pronunciation time range corresponding to the sentence can be referred to in the following embodiment, which will not be elaborated here.
[0060] Specifically, if the adjustment is made to the duration of the event in the target audio, the adjusted duration of the event is determined as the duration of the event in the target audio; if the adjustment is made to the pronunciation duration of the sentence, the duration of the event in the target audio is obtained based on the time information of the event occurrence in the second recognition result.
[0061] It's worth noting that in some scenarios, the time frame of an event may overlap with the pronunciation time frame of a sentence. This can lead to the addition of two different subtitles within the overlapping time frame, which can disrupt the user's viewing experience. Therefore, in such cases, it's necessary to adjust either the event's time frame or the sentence's pronunciation time frame to prevent overlap. This avoids the situation where adding two different subtitles simultaneously affects the user's video viewing experience and improves the subtitle display quality.
[0062] The following provides a detailed explanation of adjusting the time range of an event or the pronunciation time range of a clause.
[0063] For example, the steps described above regarding adjusting the duration of an event in the target audio, or adjusting the pronunciation time range corresponding to a sentence, for an event matching a sentence in the second recognition result, with the goal of eliminating the overlap between the pronunciation time range and the event time range, can be achieved as follows: For an event matching a sentence in the second recognition result, determine the pronunciation character set corresponding to the sound effect of the event in the target audio, and determine the overlap between the pronunciation time range of the sentence and the event time range; if the text content corresponding to the overlapping part of the sentence belongs to the pronunciation character set, delete the overlapping part determined in the pronunciation time range corresponding to the sentence; if the text content corresponding to the overlapping part of the sentence does not belong to the pronunciation character set, delete the overlapping part determined in the event time range corresponding to the event.
[0064] In this context, the overlapping part of the clause refers to the text recognized by the speech recognition model based on the sound features corresponding to the overlapping part.
[0065] The overlapping part here is understood as time.
[0066] Different sound effects correspond to different pronunciation character sets, which include characters corresponding to the sound effect. For example, the laughter sound effect can be represented by the characters "ha", "he", and "xi". Therefore, the pronunciation character set corresponding to the laughter sound effect can be ["ha", "he", "xi"].
[0067] Therefore, the above-mentioned determination of the pronunciation character set corresponding to the sound effect in the target audio for the event that matches the sentence in the second recognition result can be implemented in the following way: obtain the correspondence between different sound effects and the pronunciation character sets corresponding to different sound effects; for the event that matches the sentence in the second recognition result, determine the pronunciation character set corresponding to the sound effect in the target audio based on the correspondence.
[0068] Since the target audio can be audio in any language, there can be multiple correspondences for the same sound effect, and the languages of the characters in the pronunciation character sets in different correspondences are different.
[0069] Reference Figure 2 The time direction is shown in the figure. ST1 to ET1 is the pronunciation time range of the clause. ST1 is the start time of the pronunciation of the clause in the target audio, that is, the time information corresponding to the first character in the clause. ET1 is the end time of the pronunciation of the clause in the target audio, that is, the time information corresponding to the last character in the clause. ST2 to ET2 is the event time range of the event. ST2 is the start time of the event in the target audio. ET2 is the end time of the event in the target audio. DT is the overlapping part of the clause and the event, and the time range represented by the overlapping part is ST2 to ET1.
[0070] In cases where the text content corresponding to the overlapping portion of a sentence belongs to the phonetic character set, the effect of the overlapping portion representing the corresponding event in the video is consistent with the effect of the overlapping portion of the corresponding sentence in the video. This effect can be understood as the user's understanding of the video. Therefore, the overlapping portion determined within the pronunciation time range corresponding to the sentence can be deleted, and only the event tag corresponding to the event can be used as a subtitle added to the video frame of the corresponding overlapping portion, avoiding the use of conventional subtitles and improving the subtitle effect.
[0071] In cases where the text corresponding to the overlapping portion of a sentence does not belong to the phonetic character set, the effect of the overlapping portion representing the corresponding event in the video differs from the effect of the overlapping portion of the corresponding sentence. This inconsistency hinders user comprehension. For example, if the overlapping portion of the event is merely background noise, while the overlapping portion of the sentence is spoken content within the video, and the two contents are inconsistent, then clearly, the spoken content from the video should be displayed, not the event tag corresponding to the background noise. Therefore, the overlapping portion defined within the event's time frame can be deleted, and the text corresponding to that overlapping portion in the sentence can be displayed in the corresponding video frame. This improves the subtitle display and facilitates accurate user understanding of the video.
[0072] Following the previous formula Figure 2 For example, in the case of deleting the overlapping portion determined in the pronunciation time range corresponding to the clause, the event duration in the target audio determined according to the adjustment result is the time range from ST2 to ET2. Here, the adjustment result is equivalent to deleting the overlapping portion determined in the pronunciation time range corresponding to the clause.
[0073] In some embodiments, the duration of pronunciation of the clause in the target audio can also be determined based on the adjustment result, following the formula above. Figure 2 In the example where the overlapping portion determined in the pronunciation time range corresponding to the clause is deleted, the adjusted pronunciation time range is the pronunciation time range corresponding to the clause, and the adjusted pronunciation time range ST1 to ST2 is the time range. The adjustment result here is equivalent to deleting the overlapping portion determined in the pronunciation time range corresponding to the clause.
[0074] Following the previous formula Figure 2 For example, in the case of deleting the overlapping portion determined in the event time range corresponding to the event, the event time range in the target audio determined according to the adjustment result is the time range from ET1 to ET2. Here, the adjustment result is equivalent to deleting the overlapping portion determined in the event time range corresponding to the event.
[0075] Following the previous formula Figure 2 For example, in the case of deleting the overlapping part determined in the event time range corresponding to the event, according to the sentence segmentation model and the first recognition result, the pronunciation time range of the determined sentence in the target audio is the pronunciation time range of the sentence. The pronunciation time range of the sentence is the time range from ST1 to ET2. The adjustment result here is equivalent to deleting the overlapping part determined in the event time range corresponding to the event.
[0076] In some embodiments, the method may further include the following steps: merging the first target event and the second target event to obtain a merged event.
[0077] Among them, the first target event and the second target event are adjacent events in the target audio that occur at an interval less than the first duration threshold and belong to the same event type.
[0078] In the first target event and the second target event, the start time of the event within the time range corresponding to the earlier target event is the start time of the merged event, and the end time of the event within the time range corresponding to the later target event is the end time of the merged event. For example, if the first target event occurs before the second target event, the duration of the merged event in the target audio is the time range from the start time of the first target event to the end time of the second target event.
[0079] The event interval is the difference between the start time of the later target event and the end time of the earlier target event among two adjacent target events.
[0080] The first duration threshold can be set according to the actual situation, and this embodiment does not limit it.
[0081] As mentioned above, the event type of an event can be determined by the speech event detection model.
[0082] It is worth noting that subtitles need to be added to the video frames corresponding to the time range of the merged events, but it is no longer necessary to add subtitles to the video frames corresponding to the time range of the individual events participating in the merge.
[0083] In this way, when two events of the same type occur within a short interval, and no other types of events occur within that interval, and there are no corresponding sentences within that interval, in order to improve the subtitle display effect, these two events can be merged, and subtitles can be added to the video frames corresponding to the event time range based on the event time range of the merged event.
[0084] In some embodiments, the method may further include the following steps: deleting events whose time range is less than a second duration threshold, wherein the tag captions corresponding to the deleted events are not added to the video frames corresponding to the event time range.
[0085] The second duration threshold can be set according to the actual situation, and this embodiment does not limit it.
[0086] It is understandable that for some events with a very short time range, the number of corresponding video frames is small. Even if event tags corresponding to the event are added as subtitles in these video frames, the subtitles in these video frames will be quickly switched during the playback of the video, and the user will not actually see the subtitles clearly, thus affecting the user's viewing experience.
[0087] Therefore, deleting events with a time range shorter than the second duration threshold can prevent the display of subtitles that are quickly switched off, thus improving the user's video viewing experience.
[0088] Figure 3 This is another flowchart illustrating a video subtitle generation method according to an exemplary embodiment of the present disclosure. (Refer to...) Figure 3 First, the target audio is input into the speech recognition model and the speech event detection model respectively. The text output by the speech recognition model and the time information corresponding to each character in the text are obtained respectively. The event output by the speech event detection model and the event time range corresponding to the event are obtained.
[0089] Next, the text output by the speech recognition model is segmented according to the segmentation model to obtain the segmentation results. Then, the time information corresponding to each character in the text output by the speech recognition model is combined to obtain the duration of pronunciation of each segment in the target audio.
[0090] Next, the time range is adjusted for the matching clauses and events. For the implementation process of the adjustment, please refer to the relevant embodiments mentioned above. This embodiment will not be repeated here.
[0091] Next, if the interval between two adjacent events of the same type is less than the first duration threshold, the two events are merged. For the implementation process of merging, please refer to the relevant embodiments above. This embodiment will not be repeated here.
[0092] Next, for the remaining events, events with a time range shorter than the second duration threshold are deleted. The deletion process is detailed in the aforementioned embodiments and will not be repeated here. It is worth noting that the remaining events here include both merged events and events that were not merged.
[0093] Finally, based on the final determined event, according to the event duration in the target audio, the event tag corresponding to the event is added as a subtitle to the video frame corresponding to the event duration. Here, the final determined event is the event remaining after the above deletion steps. According to the pronunciation duration of each sentence after the time range adjustment, the text content corresponding to the sentence is added as a subtitle to the video frame corresponding to the pronunciation duration, generating a video with subtitles.
[0094] The above method can improve the display effect of video subtitles and make it easier for users to understand the video.
[0095] Figure 4 This is a block diagram illustrating a video subtitle generation apparatus according to an exemplary embodiment of the present disclosure. (Refer to...) Figure 4 The device 400 includes:
[0096] Acquisition module 401 is used to acquire the target audio;
[0097] The determining module 402 is used to determine the duration of events in the target audio, wherein the events include events occurring in speech segments and events occurring in non-speech segments of the target audio;
[0098] The generation module 403 is used to add the event tag corresponding to the event as a subtitle to the video frame corresponding to the event time range in the target audio, based on the event time range in which the event lasts. The video is the video corresponding to the target audio.
[0099] In some embodiments, the determining module 402 includes:
[0100] The first input submodule is used to input the target audio into the speech recognition model to obtain a first recognition result;
[0101] The second input submodule is used to input the target audio into the speech event detection model to obtain a second recognition result;
[0102] The determination submodule is used to determine the duration range of the events in the target audio based on the first recognition result and the second recognition result.
[0103] In some embodiments, the determining submodule includes:
[0104] The sentence segmentation unit is used to determine the sentence segmentation result and the duration of pronunciation of each sentence in the target audio based on the sentence segmentation model and the first recognition result;
[0105] The adjustment unit is configured to adjust the duration of the event in the target audio, or adjust the pronunciation time range corresponding to the sentence, for an event in the second recognition result that matches the sentence, with the goal of eliminating the overlap between the pronunciation time range and the event time range; and,
[0106] The duration of the event in the target audio is determined based on the adjustment results.
[0107] In some embodiments, the adjustment unit is specifically used for:
[0108] For the event that matches the sentence in the second recognition result, determine the set of pronunciation characters corresponding to the sound effect of the event in the target audio, and determine the overlapping part of the pronunciation time range of the sentence and the event time range of the event;
[0109] If the text content corresponding to the overlapping part of the sentence belongs to the pronunciation character set, delete the overlapping part determined in the pronunciation time range corresponding to the sentence;
[0110] If the text content corresponding to the overlapping part of the sentence does not belong to the pronunciation character set, delete the overlapping part determined within the event time range corresponding to the event.
[0111] In some embodiments, the device 400 further includes:
[0112] The merging module is used to merge the first target event and the second target event to obtain the merged event;
[0113] The first target event and the second target event are adjacent events in the target audio that occur at an interval less than a first duration threshold and belong to the same event type.
[0114] In some embodiments, the device 400 further includes:
[0115] The deletion module is used to delete events whose time range is less than a second duration threshold. The corresponding tag captions for the deleted events will not be added to the video frames corresponding to the event time range.
[0116] In some embodiments, the adjustment unit is specifically used for:
[0117] Obtain the correspondence between different sound effects and the corresponding character sets for each sound effect;
[0118] For the event that matches the sentence in the second recognition result, the set of pronunciation characters corresponding to the sound effect of the event in the target audio is determined according to the correspondence.
[0119] The implementation methods of each module or unit in the above-mentioned device 400 can be referred to the above-mentioned related embodiments, and will not be repeated here.
[0120] This disclosure also provides a computer-readable medium having a computer program stored thereon, which, when executed by a processing device, implements the steps of the above-described method.
[0121] This disclosure also provides an electronic device, including:
[0122] A storage device having at least one computer program stored thereon;
[0123] At least one processing device is configured to execute the at least one computer program in the storage device to implement the steps of the above method.
[0124] The following is for reference. Figure 5 The diagram illustrates a structural schematic of an electronic device 500 suitable for implementing embodiments of the present disclosure. The terminal devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 5 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0125] like Figure 5 As shown, the electronic device 500 may include a processing unit (e.g., a central processing unit, a graphics processor, etc.) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 into a random access memory (RAM) 503. The RAM 503 also stores various programs and data required for the operation of the electronic device 500. The processing unit 501, ROM 502, and RAM 503 are interconnected via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0126] Typically, the following devices can be connected to I / O interface 505: input devices 506 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 507 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 508 including, for example, magnetic tapes, hard disks, etc.; and communication devices 509. Communication device 509 allows electronic device 500 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 5 An electronic device 500 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.
[0127] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory 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 a communication device 509, or installed from a storage device 508, or installed from a ROM 502. When the computer program is executed by the processing device 501, it performs the functions defined in the methods of embodiments of this disclosure.
[0128] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. 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 disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this disclosure, 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. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, 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: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0129] In some implementations, electronic devices can communicate using any currently known or future-developed network protocol, such as HTTP (Hypertext Transfer Protocol), and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.
[0130] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0131] The aforementioned computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to: acquire target audio; determine the duration of an event in the target audio, the event including events occurring in speech segments and events occurring in non-speech segments of the target audio; and, based on the duration of the event in the target audio, add an event tag corresponding to the event as a subtitle to a video frame corresponding to that event duration, the video being a video corresponding to the target audio.
[0132] Computer program code for performing the operations of this disclosure can be written in one or more programming languages or a combination thereof, including but not limited to object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0133] 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 this disclosure. 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 the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can 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.
[0134] The modules described in the embodiments of this disclosure can be implemented in software or hardware. The names of the modules are not, in some cases, intended to limit the functionality of the module itself.
[0135] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.
[0136] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, 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 devices, magnetic storage devices, or any suitable combination of the foregoing.
[0137] According to one or more embodiments of this disclosure, Example 1 provides a video subtitle generation method, including:
[0138] Obtain the target audio;
[0139] Determine the duration of events in the target audio, including events occurring in speech segments and events occurring in non-speech segments of the target audio;
[0140] Based on the duration of the event in the target audio, the event tag corresponding to the event is added as a subtitle to the video frame corresponding to the event duration, and the video is the video corresponding to the target audio.
[0141] According to one or more embodiments of this disclosure, Example 2 provides the method of Example 1, wherein determining the duration of an event in the target audio within the target audio includes:
[0142] The target audio is input into the speech recognition model to obtain the first recognition result;
[0143] The target audio is input into the speech event detection model to obtain the second recognition result;
[0144] Based on the first identification result and the second identification result, the duration of the event in the target audio is determined.
[0145] According to one or more embodiments of this disclosure, Example 3 provides the method of Example 2, wherein determining the duration of an event in the target audio based on the first identification result and the second identification result includes:
[0146] Based on the sentence segmentation model and the first recognition result, the sentence segmentation result and the duration of pronunciation of each sentence in the sentence segmentation result in the target audio are determined;
[0147] For events in the second recognition result that match a sentence, the duration of the event in the target audio is adjusted with the goal of eliminating the overlap between the pronunciation time range and the event time range, or the pronunciation time range corresponding to the sentence is adjusted; and,
[0148] The duration of the event in the target audio is determined based on the adjustment results.
[0149] According to one or more embodiments of this disclosure, Example 4 provides the method of Example 3, wherein adjusting the duration of the event in the target audio, or adjusting the pronunciation time range corresponding to the sentence, for an event matching the sentence in the second recognition result, with the aim of eliminating the overlap between the pronunciation time range and the event time range, includes:
[0150] For the event that matches the sentence in the second recognition result, determine the set of pronunciation characters corresponding to the sound effect of the event in the target audio, and determine the overlapping part of the pronunciation time range of the sentence and the event time range of the event;
[0151] If the text content corresponding to the overlapping part of the sentence belongs to the pronunciation character set, delete the overlapping part determined in the pronunciation time range corresponding to the sentence;
[0152] If the text content corresponding to the overlapping part of the sentence does not belong to the pronunciation character set, delete the overlapping part determined within the event time range corresponding to the event.
[0153] According to one or more embodiments of this disclosure, Example 5 provides the method of Example 1, the method further comprising:
[0154] For the first target event and the second target event, the first target event and the second target event are merged to obtain the merged event;
[0155] The first target event and the second target event are adjacent events in the target audio that occur at an interval less than a first duration threshold and belong to the same event type.
[0156] According to one or more embodiments of this disclosure, Example 6 provides the method of Example 1, the method further comprising:
[0157] Delete events whose time range is less than the second duration threshold, wherein the tag captions corresponding to the deleted events will not be added to the video frames corresponding to the event time range.
[0158] According to one or more embodiments of this disclosure, Example 7 provides the method of Example 4, wherein determining the set of phonetic characters corresponding to the sound effects of an event in the target audio for an event that matches a sentence in the second recognition result includes:
[0159] Obtain the correspondence between different sound effects and the corresponding character sets for each sound effect;
[0160] For the event that matches the sentence in the second recognition result, the set of pronunciation characters corresponding to the sound effect of the event in the target audio is determined according to the correspondence.
[0161] According to one or more embodiments of this disclosure, Example 8 provides a video subtitle generation apparatus, including:
[0162] The acquisition module is used to acquire the target audio.
[0163] A determining module is used to determine the duration of events in the target audio, wherein the events include events occurring in speech segments and events occurring in non-speech segments of the target audio;
[0164] The generation module is used to add the event tag corresponding to the event as a subtitle to the video frame corresponding to the event time range in the target audio, based on the event duration range of the event in the target audio.
[0165] According to one or more embodiments of this disclosure, Example 9 provides the apparatus of Example 8, wherein the determining module includes:
[0166] The first input submodule is used to input the target audio into the speech recognition model to obtain a first recognition result;
[0167] The second input submodule is used to input the target audio into the speech event detection model to obtain a second recognition result;
[0168] The determination submodule is used to determine the duration range of the events in the target audio based on the first recognition result and the second recognition result.
[0169] According to one or more embodiments of this disclosure, Example 10 provides an apparatus of Example 9, wherein the determining submodule includes:
[0170] The sentence segmentation unit is used to determine the sentence segmentation result and the duration of pronunciation of each sentence in the target audio based on the sentence segmentation model and the first recognition result;
[0171] The adjustment unit is configured to adjust the duration of the event in the target audio, or adjust the pronunciation time range corresponding to the sentence, for an event in the second recognition result that matches the sentence, with the goal of eliminating the overlap between the pronunciation time range and the event time range; and,
[0172] The duration of the event in the target audio is determined based on the adjustment results.
[0173] According to one or more embodiments of this disclosure, Example 11 provides an apparatus of Example 10, wherein the adjustment unit is specifically used for:
[0174] For the event that matches the sentence in the second recognition result, determine the set of pronunciation characters corresponding to the sound effect of the event in the target audio, and determine the overlapping part of the pronunciation time range of the sentence and the event time range of the event;
[0175] If the text content corresponding to the overlapping part of the sentence belongs to the pronunciation character set, delete the overlapping part determined in the pronunciation time range corresponding to the sentence;
[0176] If the text content corresponding to the overlapping part of the sentence does not belong to the pronunciation character set, delete the overlapping part determined within the event time range corresponding to the event.
[0177] According to one or more embodiments of this disclosure, Example 12 provides an apparatus of Example 1, the apparatus further comprising:
[0178] The merging module is used to merge the first target event and the second target event to obtain the merged event;
[0179] The first target event and the second target event are adjacent events in the target audio that occur at an interval less than a first duration threshold and belong to the same event type.
[0180] According to one or more embodiments of this disclosure, Example 13 provides an apparatus of Example 1, the apparatus further comprising:
[0181] The deletion module is used to delete events whose time range is less than a second duration threshold. The corresponding tag captions for the deleted events will not be added to the video frames corresponding to the event time range.
[0182] According to one or more embodiments of this disclosure, Example 14 provides an apparatus of Example 11, wherein the adjustment unit is specifically used for:
[0183] Obtain the correspondence between different sound effects and the corresponding character sets for each sound effect;
[0184] For the event that matches the sentence in the second recognition result, the set of pronunciation characters corresponding to the sound effect of the event in the target audio is determined according to the correspondence.
[0185] According to one or more embodiments of the present disclosure, Example 15 provides a computer-readable medium having a computer program stored thereon that, when executed by a processing device, implements the steps of the method described in any one of Examples 1-7.
[0186] According to one or more embodiments of this disclosure, Example 16 provides an electronic device comprising:
[0187] A storage device having at least one computer program stored thereon;
[0188] At least one processing device is configured to execute the at least one computer program in the storage device to implement the steps of any one of the methods described in Examples 1-7.
[0189] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.
[0190] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.
[0191] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative forms of implementing the claims. Regarding the apparatus in the above embodiments, the specific manner in which the various modules perform their operations has been described in detail in the embodiments relating to the method, and will not be elaborated upon here.
Claims
1. A method for video caption generation, the method comprising: include: Obtain the target audio; Determine the duration of events in the target audio, including events occurring in speech segments and events occurring in non-speech segments of the target audio; Based on the duration of the event in the target audio, the event tag corresponding to the event is added as a subtitle to the video frames corresponding to that event duration, and the video is the video corresponding to the target audio; Determining the duration of an event in the target audio includes: determining the duration of a sentence segmentation result and the duration of each sentence segmentation result in the target audio based on the sentence segmentation model and the first recognition result; for an event matching a sentence in the second recognition result, determining the pronunciation character set corresponding to the sound effect of the event in the target audio, and determining the overlapping portion between the pronunciation time range of the sentence and the event time range; deleting the overlapping portion determined in the pronunciation time range corresponding to the sentence if the text content corresponding to the overlapping portion of the sentence belongs to the pronunciation character set; deleting the overlapping portion determined in the event time range corresponding to the event if the text content corresponding to the overlapping portion of the sentence does not belong to the pronunciation character set; and determining the duration of the event in the target audio based on the adjustment result.
2. The method of claim 1, wherein, Determining the duration of an event in the target audio within the target audio also includes: The target audio is input into the speech recognition model to obtain the first recognition result; The target audio is input into the speech event detection model to obtain the second recognition result.
3. The method of claim 1, wherein, The method further includes: For the first target event and the second target event, the first target event and the second target event are merged to obtain the merged event; The first target event and the second target event are adjacent events in the target audio that occur at an interval less than a first duration threshold and belong to the same event type.
4. The method of claim 1, wherein, The method further includes: Delete events whose time range is less than the second duration threshold, wherein the tag captions corresponding to the deleted events will not be added to the video frames corresponding to the event time range.
5. The method of claim 1, wherein, The step of determining the set of pronunciation characters corresponding to the sound effects of the event in the target audio for the event that matches the sentence in the second recognition result includes: Obtain the correspondence between different sound effects and the corresponding character sets for each sound effect; For the event that matches the sentence in the second recognition result, the set of pronunciation characters corresponding to the sound effect of the event in the target audio is determined according to the correspondence.
6. An apparatus for generating a video caption, the apparatus comprising: include: The acquisition module is used to acquire the target audio. A determining module is used to determine the duration of events in the target audio, wherein the events include events occurring in speech segments and events occurring in non-speech segments of the target audio; A generation module is used to add the event tag corresponding to the event as a subtitle to the video frame corresponding to the event time range in the target audio, based on the event time range in which the event lasts in the target audio. The video is a video corresponding to the target audio. The determining module is further configured to: determine the sentence segmentation result and the duration of pronunciation of each sentence in the target audio based on the sentence segmentation model and the first recognition result; for an event in the second recognition result that matches a sentence, determine the set of pronunciation characters corresponding to the sound effect of the event in the target audio, and determine the overlapping part between the pronunciation time range of the sentence and the event time range; if the text content corresponding to the overlapping part of the sentence belongs to the set of pronunciation characters, delete the overlapping part determined in the pronunciation time range corresponding to the sentence. If the text content corresponding to the overlapping part of the sentence does not belong to the pronunciation character set, delete the overlapping part determined in the event time range corresponding to the event. And based on the adjustment results, determine the duration of the event in the target audio.
7. A computer readable medium having stored thereon a computer program, characterized in that When the program is executed by the processing device, it implements the steps of the method described in any one of claims 1-5.
8. An electronic device, comprising: include: A storage device having at least one computer program stored thereon; At least one processing device is configured to execute the at least one computer program in the storage device to implement the steps of the method according to any one of claims 1-5.
Citation Information
Patent Citations
Data processing method and device and device for data processing
CN110990534A
Audio and video processing method and device, server and storage medium
CN115938383A
