Bullet screen generation method and device, electronic equipment and storage medium
By identifying people in video clips and obtaining their relevant knowledge data, and combining this with the video content to generate bullet comments, the problem of low correlation between bullet comments and video content in existing technologies has been solved, achieving more relevant and interesting bullet comment generation.
Patent Information
- Application Number
- CN202410935412.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-12
- Publication Date
- 2024-11-01
AI Technical Summary
The bullet comments generated in existing technologies have a low degree of relevance to the video content, resulting in insufficient user interactivity and appeal.
By identifying the people appearing in video clips and obtaining their relevant knowledge data, and combining this with the video content to generate bullet comments, a trained bullet comment generation model is used to automatically generate bullet comments.
The generated bullet comments are more closely related to the video plot, with rich and diverse content, increasing humor and fun, and improving user interaction and attention.
Smart Images

Figure CN118890529A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of video processing, and in particular to a bullet screen generation method, device, electronic device and storage medium. Background Art
[0002] With the development of the Internet, barrage (also known as real-time comments) has become an important part of user interaction and video content experience on modern video sharing platforms. However, when a video is just launched, the number of barrages is usually scarce because users have not yet fully watched and interacted with it. This situation may affect the user's viewing experience and reduce the interactivity and attractiveness of the video. In response to this, the prior art proposes a barrage automatic generation technology.
[0003] Existing automatic barrage generation technology mainly relies on preset templates or simple keyword matching. The barrage generated by this method not only has a single content, low interactivity and intelligence, and is difficult to meet the diverse needs of users, but also ignores the information of key characters in the video, making the generated barrage have a low correlation with the video content. Summary of the invention
[0004] The present application provides a bullet screen generation method, device, electronic device and storage medium to solve the technical problem that the generated bullet screen in the prior art has a low correlation with the video content.
[0005] In a first aspect, the present application provides a method for generating a bullet commentary, the method comprising:
[0006] Get the target video to be processed;
[0007] Segmenting the target video into multiple video segments;
[0008] For each of the video clips, identifying the characters appearing in the video clip, and obtaining relevant knowledge data of the characters;
[0009] According to the relevant knowledge data of the character and the video content of the video clip, a bullet comment corresponding to the video clip is generated.
[0010] In a possible implementation manner, dividing the target video into a plurality of video segments includes:
[0011] Determine a plurality of transition video frames in the target video;
[0012] The target video is segmented based on the multiple transition video frames to obtain multiple video segments.
[0013] In a possible implementation manner, the acquiring the relevant knowledge data of the character includes:
[0014] The constructed character knowledge base is searched according to the identity information of the character to obtain the relevant knowledge data of the character; the character knowledge base includes the identity information of the character and the corresponding relevant knowledge data.
[0015] In a possible implementation, the method further includes:
[0016] The barrage timestamp of the barrage is determined according to the frame timestamp of the frame in which the character appears, so as to play the barrage according to the barrage timestamp.
[0017] In a possible implementation, determining the timestamp of the bullet screen according to the frame timestamp of the frame in which the character appears includes:
[0018] Determine target continuous frames in the video clip, wherein the target continuous frames refer to a group of continuous video frames in the video clip in which the person appears;
[0019] In the case of having a group of the target continuous frames, determining an average value of the frame timestamps of each video frame in the target continuous frames as the barrage timestamp of the barrage;
[0020] In the case of two or more target continuous frames, an average value of the frame timestamps of each video frame in the longest target continuous frames is determined as the timestamp of the barrage;
[0021] When there are two or more groups of target continuous frames and the length of each group of target continuous frames is the same, the average value of the frame timestamp of each video frame in the first target continuous frame is determined as the barrage timestamp of the barrage.
[0022] In a possible implementation, generating a bullet comment corresponding to the video clip according to the relevant knowledge data of the character and the video content of the video clip includes:
[0023] Separating video images and audio data from the video clip;
[0024] The relevant knowledge data of the character, the video screen and the audio data of the video clip are input into a trained barrage generation model to obtain the barrage corresponding to the video clip output by the barrage generation model.
[0025] In a possible implementation, the method further includes:
[0026] Obtain the number of likes for the playback barrage within a set playback time period, where the playback barrage refers to the barrage played during the playback of the target video;
[0027] Determining a target barrage from the plurality of playback barrages according to the number of likes;
[0028] Constructing a training sample using the target bullet screen, the video clip corresponding to the target bullet screen, and relevant knowledge data of the character;
[0029] The barrage generation model is updated using the training samples.
[0030] In a second aspect, the present application provides a barrage generation device, the device comprising:
[0031] A video acquisition module is used to acquire the target video to be processed;
[0032] A video segmentation module, used for segmenting the target video into multiple video segments;
[0033] A character recognition module, for identifying, for each of the video clips, characters appearing in the video clips, and acquiring relevant knowledge data of the characters;
[0034] The bullet screen generation module is used to generate bullet screens corresponding to the video clips according to the relevant knowledge data of the characters and the video content of the video clips.
[0035] In a possible implementation, the video segmentation module includes:
[0036] A transition video frame detection unit, used to determine a plurality of transition video frames in the target video;
[0037] The video segmentation unit is used to segment the target video based on the multiple transition video frames to obtain multiple video segments.
[0038] In a possible implementation, the bullet screen generation module includes:
[0039] The character data query unit is used to search the constructed character knowledge base according to the identity information of the character to obtain the relevant knowledge data of the character; the character knowledge base includes the identity information of the character and the corresponding relevant knowledge data.
[0040] In a possible implementation, the device further includes:
[0041] The bullet screen timestamp determination module is used to determine the bullet screen timestamp of the bullet screen according to the frame timestamp of the frame in which the character appears, so as to play the bullet screen according to the bullet screen timestamp.
[0042] In a possible implementation, the bullet comment timestamp determination module includes:
[0043] A target continuous frame determination unit, used to determine target continuous frames in the video clip, wherein the target continuous frames refer to a group of video frames in which the character appears continuously in the video clip;
[0044] A bullet comment timestamp average value calculation unit, used for determining the average value of the frame timestamp of each video frame in the target continuous frames as the bullet comment timestamp of the bullet comment when there is a group of the target continuous frames;
[0045] A longest target continuous frame processing unit, used for determining an average value of frame timestamps of each video frame in the longest target continuous frame as the timestamp of the barrage when there are two or more sets of target continuous frames;
[0046] The first target continuous frame processing unit is used to determine the average value of the frame timestamp of each video frame in the first target continuous frame as the barrage timestamp of the barrage when there are two or more groups of target continuous frames and the length of each group of target continuous frames is the same.
[0047] In a possible implementation, the bullet screen generation module includes:
[0048] A video picture and audio data separation unit, used to separate the video picture and audio data from the video clip;
[0049] The barrage generation model input unit is used to input the relevant knowledge data of the character, the video image and audio data of the video clip into the trained barrage generation model to obtain the barrage corresponding to the video clip output by the barrage generation model.
[0050] In a possible implementation, the bullet screen generation module further includes:
[0051] A likes acquisition unit, used to acquire the likes of the playback barrage within a set playback time period, wherein the playback barrage refers to the barrage played during the playback of the target video;
[0052] A target barrage determining unit, configured to determine a target barrage from the plurality of playback barrages according to the number of likes;
[0053] A training sample construction unit, used to construct a training sample using the target bullet screen, the video clip corresponding to the target bullet screen, and relevant knowledge data of the character;
[0054] The bullet screen generation model updating unit is used to update the bullet screen generation model using the training samples.
[0055] In a third aspect, the present application provides an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus.
[0056] Memory, used to store computer programs;
[0057] The processor is used to implement any of the barrage generation methods described in the first aspect above when executing the program stored in the memory.
[0058] In a fourth aspect, the present application also provides a computer storage medium storing computer executable instructions, wherein the computer executable instructions are used to execute the barrage generation method described in any one of the above items of the present application.
[0059] The above technical solution provided by the embodiment of the present application has the following advantages over the prior art: the barrage generation method provided by the embodiment of the present application, by identifying the characters appearing in the video clip and obtaining their relevant knowledge data, combines the relevant knowledge data of the characters with the video content to jointly generate a barrage that matches the video clip. Since the video content participates in the generation of the barrage, the generated barrage is closer to the plot of the video and more relevant. At the same time, since the relevant knowledge data of the characters appearing in the video also participates in the generation of the barrage, on the one hand, it can provide rich and diverse, interesting barrage content, and on the other hand, it can generate barrages that are more closely associated with the actors in the video and are more likely to resonate with the audience. In summary, the barrage content generated by the barrage generation method provided by the embodiment of the present application is not only closely related to the plot, but also integrates the external knowledge of the characters appearing in the video, thereby enhancing the humor and fun of the barrage, and attracting more attention from the audience. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0061] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0062] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0063] Figure 1A flow chart of an embodiment of a method for generating a bullet screen provided in an embodiment of the present application.
[0064] Figure 2 A flowchart of another method for generating bullet screen provided in an embodiment of the present application.
[0065] Figure 3 A schematic diagram of a scenario for determining a bullet comment timestamp provided in an embodiment of the present application.
[0066] Figure 4 A flow chart of an embodiment of another method for generating barrage provided in an embodiment of the present application.
[0067] Figure 5 A block diagram of an embodiment of a barrage generation device provided in an embodiment of the present application.
[0068] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0069] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0070] The disclosure below provides many different embodiments or examples to implement different structures of the present invention. In order to simplify the disclosure of the present invention, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present invention. In addition, the present invention can repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.
[0071] In order to solve the technical problem that the barrage generated in the prior art has a low correlation with the video content, the present application provides a barrage generation method, device, electronic device and storage medium, which can automatically generate rich and interesting barrage content that is highly relevant to the video.
[0072] Figure 1 A flow chart of an embodiment of a method for generating a bullet screen provided in an embodiment of the present application.
[0073] like Figure 1 As shown, the process includes the following steps:
[0074] Step 101: Obtain a target video to be processed.
[0075] The target video to be processed refers to the video for which barrage needs to be generated, which can be a long video (such as a movie, a TV series), a short video (such as a micro-short series), etc., and the embodiment of the present application does not impose any restrictions on this.
[0076] The target video can be a video downloaded from a video website, for example, through the API interface of the video website or a third-party download tool, a video specified by a user is downloaded from the video website as the target video to be processed. The target video can also be a target video selected from a video library stored locally by the execution subject of the embodiment of the present application, for example, after the user completes the video creation, the method for generating bullet screens provided by the embodiment of the present application is triggered to generate bullet screens for it.
[0077] In addition, the target video may be format checked to ensure that the target video is in a video format supported and recognized by the execution subject of the embodiment of the present application.
[0078] Step 102: Segment the target video into multiple video segments.
[0079] Typically, the target video includes multiple content plots, and in actual applications, users expect that each content plot has a matching bullet comment, which can greatly enhance the audience's viewing experience and interactivity. Accordingly, in the technical solution of the embodiment of the present application, the target video is divided into multiple video clips, and a matching bullet comment is independently generated for each video clip, which can make the generated bullet comment more relevant to the video content.
[0080] In addition, processing video clips is much more efficient than processing the entire long video. Therefore, dividing the target video into multiple video clips for barrage generation can improve the convenience and flexibility of processing and analysis, thereby reducing the consumption of computing resources. In addition, using video clips as the processing granularity helps to locate and solve problems that arise in the barrage generation process. For example, when the barrage generated for a certain video clip does not meet user expectations, or the barrage generation process reports an error, the barrage can be regenerated only for the video clip without having to reprocess the entire target video.
[0081] Step 103: For each video clip, identify the characters appearing in the video clip, and obtain relevant knowledge data of the characters.
[0082] The above-mentioned identification of the characters appearing in the video clip refers to: identifying the identity information of the persons (i.e., actors) appearing in the video clip. In one embodiment, a trained face recognition model can be used to perform face recognition on each video frame in the video clip to obtain the identity information of the characters appearing therein. In addition, optionally, only the characters identified with a higher confidence level are retained. Here, the face recognition model outputs the character recognition result and the corresponding confidence level, which indicates the credibility of the character recognition result. The higher the confidence level, the higher the credibility of the character recognition result. Therefore, retaining only the characters identified with a higher confidence level helps to improve the accuracy of the character recognition results. Among them, a higher confidence level, for example, means that the confidence level reaches a preset threshold.
[0083] In another embodiment, a trained speaker recognition model may be used to recognize people appearing in a video clip. The speaker recognition model mainly recognizes the identity of a person through the audio of a video clip, and the specific recognition process will not be described in detail here.
[0084] Of course, in practical applications, the above-mentioned face recognition model and speaker recognition model may also be used simultaneously to recognize the characters appearing in the video clips, which is not limited in the present embodiment of the application.
[0085] The relevant knowledge data of the characters include the information of the actors. Here, in addition to the basic information such as the actor's name, gender, date of birth, etc., the actor's information may also include the actor's appearance description, emotional status, latest status, works he has appeared in, classic quotes and other information. Among them, the basic information can also be used to describe the actor's identity information, such as using the actor's name as the actor's identity information. Appearance description information is used to describe the actor's appearance characteristics, such as height, hair color, eye color and other information, which can be used by the executive subject of the embodiment of the present application to identify the characters in the video clip. Emotional status records the actor's emotional status, such as marital status, love status, etc., which is likely to enhance the audience's interest. The latest status includes the actor's recent dynamic or activity information, such as new work releases, awards, latest activities on social media, etc., which can be used to generate real-time interactive content. Acting works include a list of film and television works that the actor has appeared in, such as movies, TV series, variety shows, etc., and these work information can help the audience understand the actor's professional background. Role information refers to the roles and characteristics played by the actor in each work, including role names, personality traits, important plots, etc., which are of great reference value for barrage generation and audience interaction. Classic quotations can be classic lines or sentences said by actors in film and television works or in public. These quotations can be used to generate interesting barrages to enhance the audience's interactive experience.
[0086] It can be seen that by obtaining relevant knowledge data of the characters appearing in the video clips, richer contextual materials can be provided for the barrage, which helps to generate barrages that are more closely related to the video content, thereby helping the audience to enhance their understanding of the video content and interactive experience.
[0087] Step 104: For each video clip, generate a bullet comment corresponding to the video clip according to the relevant knowledge data of the character and the video content of the video clip.
[0088] The video content of the video clip includes the video image and audio data of the video clip. It can be understood by those skilled in the art that the video image and audio data are important components of the video content, and the video image and audio data can fully represent the video content, such as the storyline, story background, character dialogue, etc. Therefore, generating the barrage corresponding to the video clip according to the video content of the video clip can ensure that the generated barrage is closely related to the video content.
[0089] Furthermore, in the technical solution of the embodiment of the present application, the relevant knowledge data of the characters is also introduced into the barrage generation solution, which can further enhance the relevance of the barrage and the video content, and can also enhance the interest of the barrage content.
[0090] For example, in a video clip, an actor is performing an important scene, and an interactive barrage can be generated in combination with the actor's classic quotes. In this way, the barrage can not only enhance the audience's viewing experience, but also increase their understanding and resonance with the actor and his role. For another example, the barrage can be generated by quoting the actor's relevant experience or the plot in the work, or the emotional state and latest status of the actor can be combined to generate an emotional barrage. For example, when the character played by actor Bai xx has an intimate behavior with the heroine in the play, a barrage is generated based on the emotional state of actor Bai xx: "Bai xx's girlfriend: You wait for me." It can be understood by those skilled in the art that this barrage can easily make the audience think of the emotional state of actor Bai xx, producing an additional humorous effect.
[0091] It can be seen that in this way, barrage is not just a simple comment on the video content, but creates a more interactive and emotional viewing experience through deep semantic understanding and emotional expression.
[0092] The barrage generation method provided in the embodiment of the present application, by identifying the characters appearing in the video clip and obtaining their relevant knowledge data, combines the relevant knowledge data of the characters with the video content to jointly generate a barrage that matches the video clip. Since the video content participates in the generation of the barrage, the generated barrage is closer to the plot of the video and more relevant. At the same time, since the relevant knowledge data of the characters appearing in the video also participates in the generation of the barrage, on the one hand, it can provide rich and diverse, interesting barrage content, and on the other hand, it can generate barrages that are more closely associated with the actors in the video and are more likely to resonate with the audience. In summary, the barrage content generated by the barrage generation method provided in the embodiment of the present application is not only closely related to the plot, but also integrates the external knowledge of the characters appearing in the video, thereby enhancing the humor and fun of the barrage, and attracting more attention from the audience.
[0093] Figure 2 A flowchart of another method for generating bullet screen provided in an embodiment of the present application. Figure 2 The embodiment shown in Figure 1 Based on the embodiment shown, the following steps are included:
[0094] Step 201: Obtain a target video to be processed.
[0095] For a detailed description of step 201, please refer to the relevant description of step 101 above, which will not be repeated here.
[0096] Step 202: determining a plurality of transition video frames in a target video, and segmenting the target video based on the plurality of transition video frames to obtain a plurality of video segments.
[0097] Transition video frames refer to key frames of scene changes in a video, usually the switching points between different scenes or shots. These transition frames can be determined by the following steps:
[0098] Transition detection algorithm: Use video transition detection algorithms to identify multiple transition frames in a video. These algorithms can analyze content changes in video frames based on image processing technology, such as significant changes in color, brightness, texture and other features, to identify the moment of scene transition.
[0099] Edge detection: Determine scene transitions by detecting changes in edges in video frames. Scene transitions are usually accompanied by significant changes in the number and distribution of edges in video frames.
[0100] Optical flow analysis: Detect scene transitions by analyzing the optical flow changes between consecutive frames. Scene transitions usually result in significant changes in the optical flow field.
[0101] Through the transition detection algorithm, multiple transition frames in the video have been identified. The entire video file is segmented according to the identified transition frames to obtain multiple video clips. The specific process is as follows:
[0102] Determine the segmentation points: Based on the identified transition frames, the positions (timestamps) of these frames are determined as the segmentation points of the video.
[0103] Split video: At each split point, the video is cut from that point. In this way, the video segment between every two split points is a new video clip. The length of each video clip depends on the interval between two transition frames, usually ranging from a few seconds to tens of seconds.
[0104] After segmentation, the original target video is divided into multiple shorter video clips, each of which represents a continuous scene or shot segment in the video.
[0105] Step 203: for each video clip, identify the person appearing in the video clip, and search the constructed person knowledge base according to the person's identity information to obtain the person's related knowledge data; the person knowledge base includes the person's identity information and the corresponding related knowledge data.
[0106] The character knowledge base is a database system that collects and stores character information in detail, such as MySQL or MongoDB, including but not limited to the character's basic information, appearance characteristics, emotional state, latest developments, works performed, and classic quotes. This data system provides timely and accurate character information query services through regular updates and fast retrieval interfaces. Among them, the character's basic information includes the character's identity information, such as name, and other information can be used as the character's related knowledge data. It can be seen that the character knowledge base includes the character's identity information and the corresponding related knowledge data.
[0107] In one embodiment, the data source of the character knowledge base can be to automatically collect actor information from major film and television websites, encyclopedias and other channels using web crawler technology, including accessing public web pages, parsing web page content, and extracting relevant actor data. It can also be obtained through the actor's official website, social media account, etc. The latest public information can include official news releases, social media dynamics, personal introductions, and other public official materials. This application does not limit this.
[0108] At the same time, the data in the character knowledge base can also be updated at a fixed frequency, such as once every two weeks, to ensure the timeliness and accuracy of the data. The updated content includes but is not limited to new works, new emotional dynamics, recent public activities and other information. The character knowledge base can also be backed up regularly to prevent data loss.
[0109] Based on the above description, in the technical solution of the embodiment of the present application, the constructed character knowledge base is searched according to the identity information of the character to obtain the relevant knowledge data of the character.
[0110] Step 204: For each video clip, generate a bullet comment corresponding to the video clip according to the relevant knowledge data of the character and the video content of the video clip.
[0111] For a detailed description of step 204, please refer to the description of step 104 above, which will not be repeated here.
[0112] Step 205: For each video clip, determine the timestamp of the barrage according to the frame timestamp of the frame in which the character appears, so as to play the barrage according to the timestamp of the barrage.
[0113] The bullet screen timestamp refers to the specific time point when the bullet screen is displayed during video playback. The bullet screen timestamp ensures that the bullet screen can appear on the video screen at a specific moment and synchronize with the video content to enhance the audience's interactive experience and viewing effect.
[0114] In one embodiment, the specific implementation of determining the barrage timestamp of the barrage according to the frame timestamp of the frame in which the character appears includes: determining the target continuous frames in the video clip, the target continuous frames refer to a group of video frames in which the characters appear in the frames that are continuous in the video clip; in the case of having a group of target continuous frames, determining the average value of the frame timestamp of each video frame in the target continuous frames as the barrage timestamp of the barrage; in the case of having two or more groups of target continuous frames, determining the average value of the frame timestamp of each video frame in the longest target continuous frames as the barrage timestamp of the barrage; in the case of having two or more groups of target continuous frames and the length of each group of target continuous frames is the same, determining the average value of the frame timestamp of each video frame in the first target continuous frames as the barrage timestamp of the barrage.
[0115] For example, see Figure 3 , is a schematic diagram of the scenario for determining the timestamp of the bullet comment. This schematic diagram of the scenario includes the above three situations:
[0116] Case 1: Actor A exists in a single continuous segment, that is, the video segment has a set of target continuous frames (the video frames indicated by the arrow segments in the figure). Figure 3 As shown, the average value of the frame timestamps of the three video frames in the target continuous frames is determined as the barrage timestamp of the barrage.
[0117] Case 2: Actor A exists in two consecutive segments, that is, the video segment has two sets of target consecutive frames (the video frames indicated by the arrow segments in the figure), and the durations of the two sets of target consecutive frames are different. Figure 3 As shown, a group of target continuous frames is selected, and the average value of the frame timestamps of the six video frames in the group of target continuous frames is determined as the timestamp of the barrage.
[0118] Case 3: Actor A exists in multiple continuous segments, that is, there are two sets of target continuous frames in the video segment (the video frames indicated by the arrow segments in the figure), and the duration of the two sets of target continuous frames is the same. Figure 3 As shown, a first group of target continuous frames is selected, and the average value of the frame timestamps of six video frames in the group of target continuous frames is determined as the barrage timestamp of the barrage.
[0119] Figure 2 The process shown in Figure 1 On the basis of the shown process, by determining the barrage timestamp of the barrage according to the frame timestamp of the frame in which the character appears, and playing the barrage according to the barrage timestamp, it can be ensured that the barrage is precisely aligned with specific events in the video (such as the moment when the character appears), so that the barrage is synchronized with the video content, which can further enhance the user experience as well as the fun and sense of participation in watching the video, improve user satisfaction and stickiness, and thus promote the development of the platform and the improvement of user activity.
[0120] Figure 4 A flow chart of an embodiment of another method for generating barrage provided in an embodiment of the present application. Figure 4 The embodiment shown in Figure 1 Based on the embodiment shown, the following steps are included:
[0121] Step 301: Obtain a target video to be processed;
[0122] For a detailed description of step 301, please refer to the relevant description of step 101 above, which will not be repeated here.
[0123] Step 302: Segment the target video into multiple video segments;
[0124] For a detailed description of step 302, please refer to the relevant description of step 202, which will not be repeated here.
[0125] Step 303: for each video clip, identify the person appearing in the video clip, obtain the relevant knowledge data of the person, and separate the video image and audio data from the video clip.
[0126] Video images refer to the visual content in a video, i.e., a sequence of images. The smoothness of a video is usually measured in frames per second (fps). For example, 24fps means there are 24 consecutive images per second.
[0127] Audio data refers to the sound part of the video, including background music, dialogue, sound effects, etc. Audio data is usually stored in the form of waveform or spectrum.
[0128] The separation process can be achieved by video processing software or programming tools (such as FFmpeg). Specifically, the video file is loaded into the memory, each frame of the video is extracted and saved as a continuous image sequence or a single video file, and the audio part of the video is extracted and saved as an audio file (such as MP3 or WAV format).
[0129] As for how to specifically identify the person appearing in the video clip and obtain the relevant knowledge data of the person, please refer to the relevant description of the above step 203, which will not be repeated here.
[0130] Step 304: For each video clip, the character's relevant knowledge data, the video image and audio data of the video clip are input into the trained barrage generation model to obtain the barrage corresponding to the video clip output by the barrage generation model.
[0131] The barrage generation model is a pre-trained deep learning model that is specifically used to generate barrages. The model is trained with a large amount of video and corresponding barrage data to learn the relationship between video content and barrages. Since the barrage generation model relies on three modal data: video images, audio data, and character-related knowledge data, the model is also called a tri-modal barrage generation model.
[0132] In one embodiment, the training process of the tri-modal barrage generation model includes two stages: a pre-training stage and a fine-tuning stage.
[0133] In the pre-training phase, only the video encoder, audio encoder and large language model (LLM) are trained, and the training data used can be public video understanding data. The purpose of this phase is to enable the model to have video understanding capabilities;
[0134] In the fine-tuning stage, the text encoder participates in the training, the weights of the video encoder and audio encoder are locked and no longer updated, and the LLM is updated normally. The data used is the collected high-quality bullet comment pair data. A bullet comment pair includes a frame sequence, an audio segment, and the actor information. The purpose of this stage is to adapt the model to the bullet comment generation task while retaining the video comprehension ability.
[0135] In an optional implementation, the video encoder can use convolutional neural networks (CNN) or more advanced spatial temporal convolutional networks (ST-CNN) to capture the spatiotemporal information in the video frames. The audio encoder can use convolutional neural networks or recurrent neural networks (RNN) to extract features from the audio. The text encoder can use a Transformer structure to effectively process text information. The output features of the video encoder, audio encoder, and text encoder are fused and input into a large language model (LLM). LLM can be a Transformer-based model, such as the GPT series model.
[0136] In one embodiment, during the model fine-tuning stage, the bullet comment generation model may be updated in the following manner:
[0137] Get the number of likes for the playback barrage within the set playback time period, determine the target barrage from multiple playback barrages based on the number of likes, build training samples using the target barrage, the video clips corresponding to the target barrage, and the relevant knowledge data of the characters, and use the training samples to update the barrage generation model.
[0138] Among them, the played barrage refers to the barrage played during the playback of the target video. The played barrage can be posted by the audience or output by the barrage generation model. The purpose of the step of obtaining the number of likes for the played barrage within the set playback time period is to evaluate the audience's recognition of the barrage output by the barrage generation model. Furthermore, the purpose of screening out the target barrage from multiple barrages based on the number of likes is to select the barrage that the user likes and recognizes. The above-mentioned set playback time period is, for example, the last month, week, etc. The target barrage can be a barrage with a high number of likes. A high number of likes usually represents a high degree of user recognition, so these barrages are considered to be high-quality barrages. The above-mentioned high number of likes, for example, means that the number of likes exceeds a preset threshold, and the embodiments of the present application do not limit this.
[0139] By constructing training samples based on the video clips corresponding to the target barrage and the relevant knowledge data of the characters, and using the constructed training samples to update the barrage generation model, the model can better meet the user's preferences when generating barrages, thereby improving the quality and relevance of the barrages.
[0140] Figure 4 The process shown in Figure 1On the basis of the process shown, by separating the video images and audio data from the video clips, the relevant knowledge data of the characters, the video images and audio data of the video clips are input into the trained barrage generation model, and the barrage corresponding to the video clips output by the barrage generation model is obtained, which can improve the efficiency of barrage generation.
[0141] Figure 5 This is a block diagram of an embodiment of a bullet screen generation device provided in an embodiment of the present application. Figure 5 As shown, the device comprises:
[0142] The video acquisition module 51 is used to acquire the target video to be processed;
[0143] A video segmentation module 52, used to segment the target video into multiple video segments;
[0144] A character recognition module 53 is used to recognize the characters appearing in each video clip and obtain the relevant knowledge data of the characters;
[0145] The bullet screen generation module 54 is used to generate a bullet screen corresponding to the video clip according to the relevant knowledge data of the character and the video content of the video clip.
[0146] In a possible implementation, the video segmentation module 52 includes:
[0147] A transition video frame detection unit, used to determine a plurality of transition video frames in the target video;
[0148] The video segmentation unit is used to segment the target video based on the multiple transition video frames to obtain multiple video segments.
[0149] In a possible implementation, the person identification module 53 includes:
[0150] The character data query unit is used to search the constructed character knowledge base according to the identity information of the character to obtain the relevant knowledge data of the character; the character knowledge base includes the identity information of the character and the corresponding relevant knowledge data.
[0151] In a possible implementation, the device further includes:
[0152] The bullet screen timestamp determination module is used to determine the bullet screen timestamp of the bullet screen according to the frame timestamp of the frame in which the character appears, so as to play the bullet screen according to the bullet screen timestamp.
[0153] In a possible implementation, the bullet comment timestamp determination module includes:
[0154] A target continuous frame determination unit, used to determine target continuous frames in the video clip, wherein the target continuous frames refer to a group of video frames in which the character appears continuously in the video clip;
[0155] A bullet comment timestamp average value calculation unit, used for determining the average value of the frame timestamp of each video frame in the target continuous frames as the bullet comment timestamp of the bullet comment when there is a group of the target continuous frames;
[0156] A longest target continuous frame processing unit, used for determining an average value of frame timestamps of each video frame in the longest target continuous frame as the timestamp of the barrage when there are two or more sets of target continuous frames;
[0157] The first target continuous frame processing unit is used to determine the average value of the frame timestamp of each video frame in the first target continuous frame as the barrage timestamp of the barrage when there are two or more groups of target continuous frames and the length of each group of target continuous frames is the same.
[0158] In a possible implementation, the bullet screen generation module 54 includes:
[0159] A video picture and audio data separation unit, used to separate the video picture and audio data from the video clip;
[0160] The barrage generation model input unit is used to input the relevant knowledge data of the character, the video image and audio data of the video clip into the trained barrage generation model to obtain the barrage corresponding to the video clip output by the barrage generation model.
[0161] In a possible implementation, the bullet screen generation module 54 further includes:
[0162] A likes acquisition unit, used to acquire the likes of the playback barrage within a set playback time period, wherein the playback barrage refers to the barrage played during the playback of the target video;
[0163] A target barrage determining unit, configured to determine a target barrage from the plurality of playback barrages according to the number of likes;
[0164] A training sample construction unit, used to construct a training sample using the target bullet screen, the video clip corresponding to the target bullet screen, and relevant knowledge data of the character;
[0165] The bullet screen generation model updating unit is used to update the bullet screen generation model using the training samples.
[0166] like Figure 6As shown, an embodiment of the present application provides an electronic device, including a processor 111, a communication interface 112, a memory 113 and a communication bus 114, wherein the processor 111, the communication interface 112, and the memory 113 communicate with each other through the communication bus 114.
[0167] Memory 113, used for storing computer programs;
[0168] In one embodiment of the present application, the processor 111 is used to execute the program stored in the memory 113 to implement the bullet comment generation method provided by any of the above method embodiments, including:
[0169] Get the target video to be processed;
[0170] Segmenting the target video into multiple video segments;
[0171] For each of the video clips, identifying the characters appearing in the video clip, and obtaining relevant knowledge data of the characters;
[0172] According to the relevant knowledge data of the character and the video content of the video clip, a bullet comment corresponding to the video clip is generated.
[0173] An embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the barrage generation method provided in any of the aforementioned method embodiments are implemented.
[0174] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0175] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0176] It should be understood that the terms used herein are only for the purpose of describing specific example embodiments and are not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "one", "an" and "said" as used herein may also be meant to include plural forms. The terms "include", "comprise", "contain", and "have" are inclusive, and therefore specify the existence of stated features, steps, operations, elements and / or parts, but do not exclude the existence or addition of one or more other features, steps, operations, elements, parts, and / or combinations thereof. The method steps, processes, and operations described herein are not interpreted as necessarily requiring them to be performed in the specific order described or illustrated, unless the execution order is clearly indicated. It should also be understood that additional or alternative steps may be used.
[0177] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A method for generating a bullet comment, characterized in that: The method comprises: Get the target video to be processed; Segmenting the target video into multiple video segments; For each of the video clips, identifying the characters appearing in the video clip, and obtaining relevant knowledge data of the characters; According to the relevant knowledge data of the character and the video content of the video clip, a bullet comment corresponding to the video clip is generated.
2. The method according to claim 1, characterized in that The step of dividing the target video into a plurality of video segments comprises: Determine a plurality of transition video frames in the target video; The target video is segmented based on the multiple transition video frames to obtain multiple video segments.
3. The method according to claim 1, characterized in that The obtaining of the relevant knowledge data of the character includes: The constructed character knowledge base is searched according to the identity information of the character to obtain the relevant knowledge data of the character; the character knowledge base includes the identity information of the character and the corresponding relevant knowledge data.
4. The method according to claim 1, characterized in that: The method further comprises: The barrage timestamp of the barrage is determined according to the frame timestamp of the frame in which the character appears, so as to play the barrage according to the barrage timestamp.
5. The method according to claim 4, characterized in that Determining the timestamp of the bullet screen according to the frame timestamp of the frame in which the character appears includes: Determine target continuous frames in the video clip, wherein the target continuous frames refer to a group of continuous video frames in the video clip in which the person appears; In the case of having a group of the target continuous frames, determining an average value of the frame timestamps of each video frame in the target continuous frames as the barrage timestamp of the barrage; In the case of two or more target continuous frames, an average value of the frame timestamps of each video frame in the longest target continuous frames is determined as the timestamp of the barrage; When there are two or more groups of target continuous frames and the length of each group of target continuous frames is the same, the average value of the frame timestamp of each video frame in the first target continuous frame is determined as the barrage timestamp of the barrage.
6. The method according to claim 1, characterized in that The step of generating a bullet comment corresponding to the video clip according to the relevant knowledge data of the character and the video content of the video clip includes: Separating video images and audio data from the video clip; The relevant knowledge data of the character, the video screen and the audio data of the video clip are input into a trained barrage generation model to obtain the barrage corresponding to the video clip output by the barrage generation model.
7. The method according to claim 6, characterized in that The method further comprises: Obtain the number of likes for the playback barrage within a set playback time period, where the playback barrage refers to the barrage played during the playback of the target video; Determining a target barrage from the plurality of playback barrages according to the number of likes; Constructing a training sample using the target bullet screen, the video clip corresponding to the target bullet screen, and relevant knowledge data of the character; The barrage generation model is updated using the training samples.
8. A barrage generation device, characterized in that: The device comprises: A video acquisition module is used to acquire the target video to be processed; A video segmentation module, used for segmenting the target video into multiple video segments; A character recognition module, for identifying, for each of the video clips, characters appearing in the video clips, and acquiring relevant knowledge data of the characters; The barrage generation module is used to generate barrage corresponding to the video clip according to the relevant knowledge data of the character and the video content of the video clip.
9. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; The processor is used to implement the bullet screen generation method described in any one of claims 1 to 7 when executing the program stored in the memory.
10. A computer storage medium, characterized in that: Computer executable instructions are stored, and the computer executable instructions are used to execute the bullet screen generation method described in any one of claims 1 to 7 of the present application.
