Method for cropping live video and device for cropping live video
Through the cutting-merge-adjustment method, the problems of low and poor cropping efficiency and poor results of live videos in the prior art are solved, and higher cropping accuracy and efficiency are achieved.
Patent Information
- Application Number
- CN202111582827.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-22
- Publication Date
- 2025-06-20
- Estimated Expiration
- 2041-12-22
AI Technical Summary
The existing automatic video cropping method results in a large number of redundant frames when the live broadcast lens is frequently switched, reducing the video segmentation and recognition effect, and affecting the user's viewing experience.
The clipping method of cut-merge-adjustment is used to initially crop the original live video, determine the similarity of adjacent sub-videos, and combine the video based on the similarity, determine the live start and end frames, and finally re-clipping.
It improves the accuracy of cropping, reduces the amount of cropping operations, improves the efficiency of cropping, and enhances the user's viewing experience.
Smart Images

Figure CN114266779B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of video processing, and particularly to a method for cropping a live video, a device for cropping a live video, a processor, a computer-readable storage medium, and a computer program product. Background Art
[0002] With the continuous development of communication technologies, the smooth transmission of audio-visual information has gradually become the mainstream of people's lives, followed by the rise of live teaching classes. In order to ensure the good performance of hardware devices and the integrity of the picture and sound effects during the live broadcast, a push stream test will be carried out before the live broadcast starts; after the live broadcast ends, in order to prevent students from not having enough time to check their homework, the live broadcast will also wait for a long time before ending. However, for live video viewing, the above-mentioned live broadcast content will reduce the efficiency of the viewed video.
[0003] To solve the above technical problems, technicians can crop the viewed video to provide a better video viewing experience for viewers. In the prior art, technicians mainly crop the viewed video manually. However, the manual cropping method has problems such as high labor costs and low video cropping efficiency. Therefore, technicians crop the viewed video by an automatic cropping method.
[0004] The existing automatic video cropping method is based on image segmentation and recognition. For example, the video is cropped by a key frame extraction method based on content recognition. However, in the actual application process, if the live camera switches frequently, a large number of redundant frames will appear during the cropping process, resulting in a large number of similar pictures or similar video content in the cropped video, thus greatly reducing the video segmentation and recognition effect and the user's viewing experience. Summary of the Invention
[0005] In order to overcome the above technical problems existing in the prior art, the embodiments of the present invention provide a method for cropping a live video and a device for cropping a live video. By adopting a cropping method of cutting-merging-adjusting for the live video, the cropping position of the original live video can be accurately determined, the cropping accuracy can be improved, and at the same time, the cropping operation amount can be reduced and the cropping efficiency can be improved.
[0006] To achieve the above object, an embodiment of the present invention provides a method for cropping a live video, and the cropping method includes: performing a preliminary cropping operation on the original live video to obtain a plurality of sub-videos; determining the similarity of adjacent sub-videos; performing a video merging operation on the plurality of sub-videos based on the similarity to obtain a merged video; determining a live start sub-video and a live end sub-video based on the merged video; determining a live start frame based on the live start sub-video, and determining a live end frame based on the live end sub-video; performing a re-cropping operation on the original live video based on the live start frame and the live end frame.
[0007] Preferably, the performing a preliminary cropping operation on the original live video to obtain a plurality of sub-videos includes: obtaining a preset cropping length; obtaining a start time and a stop time of the live broadcast; optimizing the preset cropping length based on the start time and the stop time to obtain an optimized cropping length; performing a preliminary cropping operation on the original live video based on the optimized cropping length to obtain a plurality of sub-videos.
[0008] Preferably, the optimizing the preset cropping length based on the start time and the stop time to obtain an optimized cropping length includes: obtaining a preset time radiation length; determining a start radiation time range based on the start time and the preset time radiation length, and determining a stop radiation time range based on the stop time and the preset time radiation length; obtaining a preset non-linear time segmentation algorithm; performing a time segmentation operation on the start radiation time range based on the preset non-linear time segmentation algorithm to obtain a first cropping length; performing the time segmentation operation on the stop radiation time range based on the preset non-linear time segmentation algorithm to obtain a second cropping length; generating an optimized cropping length based on the preset cropping length, the first cropping length, and the second cropping length.
[0009] Preferably, the performing a time segmentation operation on the start radiation time range based on the preset non-linear time segmentation algorithm to obtain a first cropping length includes: determining a length growth trend; starting from the start time, performing a front and back time segmentation operation on the start radiation time range based on the length growth trend to obtain a first cropping length; the performing the time segmentation operation on the stop radiation time range based on the preset time segmentation algorithm to obtain a second cropping length includes: starting from the stop time, performing the front and back time segmentation operation on the stop radiation time range based on the length growth trend to obtain a second cropping length.
[0010] Preferably, the determination of the similarity between adjacent sub-videos includes: extracting adjacent frame images of the adjacent sub-videos, where the adjacent frame images include image A and image B; determining similarity evaluation information of the adjacent frame images, where the similarity evaluation information includes first similarity information S1 and second similarity information S2; obtaining preset similarity weight information, where the preset similarity weight information includes first weight a and second weight b; generating the similarity S of the adjacent sub-videos based on the first similarity information S1, the second similarity information S2, the first weight a, and the second weight b, and the similarity S of the adjacent sub-videos is characterized as: S = aS1 + bS2.
[0011] Preferably, the first similarity information S1 is the contour similarity S1(A,B), the second similarity information S2 is the color similarity S2(A,B), the first weight a is the preset contour weight, the second weight b is the preset color weight, and the contour similarity S1(A,B) is characterized as: where m and n are the width and height of the image respectively, and k = m * n; the color similarity S2(A,B) is characterized as: where H A and H B are the normalized histograms of image A and image B respectively.
[0012] Preferably, the performing a video merging operation on the multiple sub-videos based on the similarity to obtain a merged video includes: obtaining a preset similarity threshold; sequentially determining whether the similarity between each two adjacent sub-videos is greater than or equal to the preset similarity threshold; if so, merging the corresponding adjacent sub-videos; and obtaining the merged video based on all the merged adjacent sub-videos and the unmerged sub-videos among the multiple sub-videos.
[0013] Preferably, the determining the live start frame based on the live start sub-video and the determining the live end frame based on the live end sub-video include: respectively obtaining the key frames of the live start sub-video and the live end sub-video; using the key frame of the live start sub-video as the live start frame; and using the key frame of the live end sub-video as the live end frame.
[0014] Preferably, obtaining the key frame of the live start sub-video or obtaining the key frame of the live end sub-video includes: S511) Using the live start sub-video or the live end sub-video as the target video, obtaining the first frame image and the second frame image of the target video, and using the first frame image as the initial key frame image; S512) Calculating the difference between the second frame image and the initial key frame image based on a preset comparison algorithm; S513) Determining whether the difference is greater than a preset difference threshold; S514) When the difference is less than or equal to the preset difference threshold, using the next frame image of the second frame image as the new second frame image, and jumping to step S512); S515) When the difference is greater than the preset difference threshold, using the second frame image as the new initial key frame image, and using the next frame image of the second frame image as the new second frame image, and jumping to step S512); S516) After determining that all frame images of the target video have been compared, using the finally obtained initial key frame image as the key frame of the target video.
[0015] Preferably, calculating the difference between the second frame image and the initial key frame image based on a preset comparison algorithm includes: calculating the difference D(I j between the second frame image I i and the initial key frame image I i , I j ) based on the Euclidean distance algorithm, and the difference is characterized as where H ik and H jk respectively represent the pixel histograms of the initial key frame image and the second frame image.
[0016] Correspondingly, an embodiment of the present invention further provides a live video cropping device, where the cropping device includes: a preliminary cropping unit for performing a preliminary cropping operation on an original live video to obtain a plurality of sub-videos; a first determination unit for determining the similarity of adjacent sub-videos; a merging unit for performing a video merging operation on the plurality of sub-videos based on the similarity to obtain a merged video; a second determination unit for determining a live start sub-video and a live end sub-video based on the merged video; a third determination unit for determining a live start frame based on the live start sub-video and determining a live end frame based on the live end sub-video; and a re-cropping unit for performing a re-cropping operation on the original live video based on the live start frame and the live end frame.
[0017] Preferably, the preliminary clipping unit includes: a first acquisition module for acquiring a preset clipping length; a second acquisition module for acquiring the start time and end time of the live broadcast; an optimization module for optimizing the preset clipping length based on the start time and end time of the live broadcast to obtain an optimized clipping length; and a preliminary clipping module for performing a preliminary clipping operation on the original live video based on the optimized clipping length to obtain a plurality of sub-videos.
[0018] Preferably, the optimization module is specifically configured to: acquire a preset time radiation length; determine a start broadcast radiation time range based on the start time of the live broadcast and the preset time radiation length, and determine an end broadcast radiation time range based on the end time of the live broadcast and the preset time radiation length; acquire a preset non-linear time segmentation algorithm; perform a time segmentation operation on the start broadcast radiation time range based on the preset non-linear time segmentation algorithm to obtain a first clipping length; perform the time segmentation operation on the end broadcast radiation time range based on the preset non-linear time segmentation algorithm to obtain a second clipping length; and generate an optimized clipping length based on the preset clipping length, the first clipping length, and the second clipping length.
[0019] Preferably, the performing a time segmentation operation on the start broadcast radiation time range based on the preset non-linear time segmentation algorithm to obtain a first clipping length includes: determining a length growth trend; starting from the start time of the live broadcast, performing a front and back time segmentation operation on the start broadcast radiation time range based on the length growth trend to obtain a first clipping length; and the performing the time segmentation operation on the end broadcast radiation time range based on the preset time segmentation algorithm to obtain a second clipping length includes: starting from the end time of the live broadcast, performing the front and back time segmentation operation on the end broadcast radiation time range based on the length growth trend to obtain a second clipping length.
[0020] Preferably, the first determination unit includes: an extraction module for extracting adjacent frame images of adjacent sub-videos, the adjacent frame images including an A image and a B image; a first determination module for determining similarity evaluation information of the adjacent frame images, the similarity evaluation information including first similarity information S1 and second similarity information S2; a weight acquisition module for acquiring similarity weight information, the preset similarity weight information including a first weight a and a second weight b; and a second determination module for generating a similarity S of the adjacent sub-videos based on the first similarity information S1, the second similarity information S2, the first weight a, and the second weight b, the similarity S of the adjacent sub-videos being represented as: S = aS1 + bS2.
[0021] Preferably, the first similarity information S1 is the contour similarity S1(A,B), the second similarity information S2 is the color similarity S2(A,B), the first weight a is a preset contour weight, the second weight b is a preset color weight, and the contour similarity S1(A,B) is characterized as: where m and n are the width and height of the image respectively, and k = m * n; the color similarity S2(A,B) is characterized as: where H A and H B are the normalized histograms of the A image and the B image respectively.
[0022] Preferably, the merging unit includes: a threshold obtaining module for obtaining a preset similarity threshold; a judgment module for sequentially judging whether the similarity between every two adjacent sub-videos is greater than or equal to the preset similarity threshold; a first merging module for merging the corresponding adjacent sub-videos when the judgment module judges that the similarity between two adjacent sub-videos is greater than or equal to the preset similarity threshold; and a second merging module for performing a video merging operation on all the adjacent sub-videos merged by the first merging module and the unmerged sub-videos among the multiple sub-videos to obtain the merged video.
[0023] Preferably, the third determining unit includes: a key frame obtaining module for respectively obtaining the key frames of the live start sub-video and the live end sub-video; a first key frame determining module for taking the key frame of the live start sub-video as the live start frame; and a second key frame determining module for taking the key frame of the live end sub-video as the live end frame.
[0024] Preferably, obtaining the key frame of the live start sub-video or obtaining the key frame of the live end sub-video includes: S511) Using the live start sub-video or the live end sub-video as the target video, obtaining the first frame image and the second frame image of the target video, and using the first frame image as the initial key frame image; S512) Calculating the difference between the second frame image and the initial key frame image based on a preset comparison algorithm; S513) Judging whether the difference is greater than a preset difference threshold; S514) When the difference is less than or equal to the preset difference threshold, using the next frame image of the second frame image as the new second frame image, and jumping to step S512); S515) When the difference is greater than the preset difference threshold, using the second frame image as the new initial key frame image, and using the next frame image of the second frame image as the new second frame image, and jumping to step S512); S516) After determining that all frame images of the target video have been compared, using the finally obtained initial key frame image as the key frame of the target video.
[0025] Preferably, calculating the difference between the second frame image and the initial key frame image based on a preset comparison algorithm includes: calculating the difference D(I j between the second frame image I i and the initial key frame image I i according to the Euclidean distance algorithm, where the difference is characterized as j ) and is characterized as where H ik and H jk respectively represent the pixel histograms of the initial key frame image and the second frame image.
[0026] On the other hand, an embodiment of the present invention further provides a processor, which is configured to execute the live video cropping method provided by the embodiment of the present invention.
[0027] On the other hand, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the live video cropping method provided by the embodiment of the present invention is implemented.
[0028] On the other hand, an embodiment of the present invention further provides a computer program product, including a computer program, and when the computer program is executed by a processor, the live video cropping method provided by the embodiment of the present invention is implemented.
[0029] Through the technical solution provided by the present invention, the present invention has at least the following technical effects:
[0030] By improving the traditional video cropping method, the original live video is first cropped into multiple sub-videos, and then merged and adjusted based on the multiple sub-videos, so as to achieve precise cropping of the original live video, while reducing the computational amount in the cropping process, and greatly improving the cropping accuracy and cropping efficiency.
[0031] Other features and advantages of the embodiments of the present invention will be described in detail in the following specific implementation manners. Description of the Drawings
[0032] The drawings are used to provide a further understanding of the embodiments of the present invention, and constitute a part of the specification. Together with the following specific implementation manners, they are used to explain the embodiments of the present invention, but do not constitute a limitation to the embodiments of the present invention. In the drawings:
[0033] Figure 1 is a specific implementation flowchart of the cropping method of the live video provided by the embodiment of the present invention;
[0034] Figure 2 is a specific implementation flowchart of the preliminary cropping of the original live video in the cropping method of the live video provided by the embodiment of the present invention;
[0035] Figure 3 is a schematic diagram of performing non-linear time cropping in the cropping method of the live video provided by the embodiment of the present invention;
[0036] Figure 4 is a schematic diagram of the cropping length before optimization and the cropping length after optimization in the cropping method of the live video provided by the embodiment of the present invention;
[0037] Figure 5 is a specific implementation flowchart of performing video merging operation on multiple sub-videos in the cropping method of the live video provided by the embodiment of the present invention;
[0038] Figure 6 is a specific implementation flowchart of obtaining key frames in the cropping method of the live video provided by the embodiment of the present invention;
[0039] Figure 7 is a schematic structural diagram of the cropping device of the live video provided by the embodiment of the present invention. Specific Embodiment
[0040] The following details the specific implementation manners of the embodiments of the present invention with reference to the drawings. It should be understood that the specific implementation manners described herein are only used to illustrate and explain the embodiments of the present invention, and are not used to limit the embodiments of the present invention.
[0041] In the embodiments of the present invention, the terms "system" and "network" can be used interchangeably. "Multiple" means two or more. In view of this, in the embodiments of the present invention, "multiple" can also be understood as "at least two". "And / or" describes the association relationship of associated objects and indicates that there can be three relationships. For example, A and / or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the character " / ", unless otherwise specified, generally represents an "or" relationship between the associated objects before and after. In addition, it should be understood that in the description of the embodiments of the present invention, words such as "first" and "second" are only used for the purpose of distinguishing descriptions, and cannot be understood as indicating or implying relative importance, nor can they be understood as indicating or implying order.
[0042] Please refer to Figure 1 , the embodiments of the present invention provide a method for cropping live video, and the cropping method includes:
[0043] S10) Perform a preliminary cropping operation on the original live video to obtain multiple sub-videos;
[0044] S20) Determine the similarity of adjacent sub-videos;
[0045] S30) Perform a video merging operation on the multiple sub-videos based on the similarity to obtain a merged video;
[0046] S40) Determine the live start sub-video and the live end sub-video based on the merged video;
[0047] S50) Determine the live start frame based on the live start sub-video, and determine the live end frame based on the live end sub-video;
[0048] S60) Perform a re-cropping operation on the original live video based on the live start frame and the live end frame.
[0049] In a possible implementation manner, after obtaining the original live video, first perform a preliminary cropping operation. For example, the original live video can be cropped into multiple sub-videos at a preset time interval, and then determine the similarity of adjacent sub-videos. For example, an existing video similarity algorithm can be used to determine the similarity of two adjacent videos, and a video merging operation is performed on the multiple sub-videos according to the determined similarity. For example, adjacent videos with a similarity greater than a certain value are merged to obtain a merged video. At this time, determine the live start sub-video and the live end sub-video according to the above merged video.
[0050] According to the disclosure in the background art, for existing live videos, in order to ensure the stability and reliability during the live broadcast, push stream operations before the live broadcast or video continuation operations after the live broadcast are often performed. Therefore, in the overlapping areas before, during, and after the live broadcast, there will be significant changes in the video content and audio content. Based on this, the live start sub-video and the live end sub-video can be determined in the merged video above. For example, the second video segment in the merged video can be used as the live start sub-video, and the second-to-last video segment can be used as the live end sub-video. At this time, the live start frame is determined based on the above live start sub-video, and the live end frame is determined based on the live end sub-video. For example, the key frames in the live start sub-video are extracted as the live start frame, and the key frames in the live end sub-video are extracted as the live end frame. Then, the original live video is re-cropped based on the above live start frame and live end frame, thereby obtaining a video segment that retains the precise live video content.
[0051] In the embodiments of the present invention, by analyzing the actual live content of the live video and according to the content change situation of the live video during the live broadcast, a method based on cropping-merging-adjusting is adopted to determine the precise cropping position of the live video and perform the corresponding cropping operation, so as to accurately retain the key live content segments in the original live video, greatly improving the accuracy of video cropping. At the same time, manual cropping is no longer required, reducing the workload and improving the work efficiency.
[0052] However, during the initial cropping of the original live video, if the entire original live video is simply cropped with a fixed length, the content before and after the live broadcast may be cropped into the same video segment. At this time, it is impossible to accurately evaluate the content before and after the live broadcast, reducing the accuracy of the final video cropping.
[0053] To solve the above technical problems, please refer to Figure 2 In the embodiments of the present invention, the step of performing an initial cropping operation on the original live video to obtain multiple sub-videos includes:
[0054] S11) Obtain a preset cropping length;
[0055] S12) Obtain the start time and stop time of the live broadcast;
[0056] S13) Optimize the preset cropping length based on the start time and stop time of the live broadcast to obtain an optimized cropping length;
[0057] S14) Perform an initial cropping operation on the original live video based on the optimized cropping length to obtain multiple sub-videos.
[0058] Since video live streaming often announces or records the start time and end time of the live stream in advance, the cropping of the original live video can be optimized based on the above start time and end time. In one possible implementation, during the process of cropping the original live video, first obtain the preset cropping length, then obtain the start time and end time. At this time, optimize the preset cropping length based on the above start time and end time to obtain the optimized cropping length. For example, first perform a preliminary crop on the overall timeline of the original live video according to the preset cropping length and obtain multiple preset cropping lengths. The multiple preset cropping lengths together constitute the overall timeline of the entire original live video. Then, further optimize the preset cropping length where the start time and end time are located. For example, use a second cropping length to further crop the preset cropping length where the start time and end time are located, where the second cropping length is less than the preset cropping length, so as to obtain a more refined cropping length. That is, at this time, the more refined cropping length and the preset cropping lengths that have not been cropped twice together constitute the overall timeline of the original live video. At this time, perform a preliminary cropping operation on the original live video based on the optimized cropping length, thereby obtaining a corresponding number of sub-videos.
[0059] In the embodiments of the present invention, by optimizing the preliminary cropping of the original live video based on the start time and end time of the live stream, it can be ensured that the cropped video segments can distinguish as much as possible before and after the live stream, maximize the retention of the live content of the actual live stream, and at the same time improve the accuracy of video cropping.
[0060] However, in the actual application process, the above optimized cropping method may result in the appearance of a large number of small video segments, which will greatly increase the workload of actual image processing and reduce the efficiency of live video cropping. For those skilled in the art, it can be known that the actual start time and actual end time of the live stream must be very close to the recorded or announced start time and end time. Therefore, a non-linear cropping optimization method can be adopted to further reduce the large number of invalid video segments generated during the optimization process on the basis of meeting the optimization of the preliminary cropping of the original live video.
[0061] In an embodiment of the present invention, optimizing the preset clip length based on the start time and the stop time to obtain an optimized clip length includes: obtaining a preset time radiation length; determining a start radiation time range based on the start time and the preset time radiation length, and determining a stop radiation time range based on the stop time and the preset time radiation length; obtaining a preset non-linear time segmentation algorithm; performing a time segmentation operation on the start radiation time range based on the preset non-linear time segmentation algorithm to obtain a first clip length; performing the time segmentation operation on the stop radiation time range based on the preset non-linear time segmentation algorithm to obtain a second clip length; and generating an optimized clip length based on the preset clip length, the first clip length, and the second clip length.
[0062] Further, in an embodiment of the present invention, performing a time segmentation operation on the start radiation time range based on the preset non-linear time segmentation algorithm to obtain a first clip length includes: determining a length growth trend; starting from the start time, performing a front and back time segmentation operation on the start radiation time range based on the length growth trend to obtain a first clip length; performing the time segmentation operation on the stop radiation time range based on the preset time segmentation algorithm to obtain a second clip length includes: starting from the stop time, performing the front and back time segmentation operation on the stop radiation time range based on the length growth trend to obtain a second clip length.
[0063] In a possible implementation manner, during the process of optimizing the above preset clip length, first obtain a preset time radiation length. For example, the preset time radiation length is the deviation range between the actual start time of the live broadcast determined by the technician according to actual experience and the notified start time of the live broadcast. Then, according to the above start time and the preset time radiation length, the start radiation time range can be determined. For example, in an embodiment, the preset time radiation length is 10s, the preset clip length is 2s. If the start time is the 85th second of the original live video, then take the 10s before and after the 85th second as the initially determined start radiation time range. To maintain consistency with the clipping effect of the preset clip length and avoid the appearance of fragmented video segments, round the initially determined start radiation time range according to the pre-clipping of the original live video by the preset clip length, and obtain the above start radiation time range as the time range from the 74th second to the 96th second.
[0064] Based on the same principle, the range of the stop broadcast radiation time can be determined according to the stop broadcast time and the above-mentioned preset time radiation length. At this time, a preset non-linear time segmentation algorithm is obtained. For example, the preset non-linear time segmentation algorithm is an algorithm that takes the determined time point as the starting point and performs time segmentation operations at non-linear step lengths before and after the determined time point. During the process of performing non-linear segmentation, first, the length growth trend is determined, and then, taking the determined time point (such as the start broadcast time) as the starting point, according to this length growth trend, time segmentation operations are performed on the start broadcast radiation time range before and after, so as to obtain the first cropping length. For example, in one embodiment, a certain video segment is 12 s long, the 6th s is determined as the determined time point, and the length growth trend is that the initial value is 1 s and then increases by 1 s in sequence. After performing non-linear segmentation on the above video segment, the 0-3 s can be obtained as the first segment, the 3-5 s as the second segment, the 5-6 s as the third segment, the 6-7 s as the fourth segment, the 7-9 s as the fifth segment, and the 9-12 s as the sixth segment. Please refer to Figure 3 , which is a schematic diagram of performing non-linear time cropping provided by an embodiment of the present invention.
[0065] At this time, based on the above non-linear time segmentation algorithm, time segmentation operations are performed on the start broadcast radiation time range to obtain the first cropping length, and based on the above non-linear time segmentation algorithm, time segmentation operations are performed on the stop broadcast radiation time range to obtain the second cropping length. At this time, the optimized cropping length can be generated according to the above preset cropping length, the first cropping length, and the second cropping length. Please refer to Figure 4 , which is a schematic diagram of the cropping length before optimization and the cropping length after optimization provided by an embodiment of the present invention.
[0066] In the embodiment of the present invention, by optimizing the preliminary cropping method of the original live video, the invalid sub-video segments generated during the cropping process can be effectively reduced, thereby reducing the calculation amount and improving the cropping efficiency; at the same time, according to the optimization process of the start broadcast time and the stop broadcast time, the cropping accuracy can be effectively increased.
[0067] In the embodiment of the present invention, the determination of the similarity of adjacent sub-videos includes: extracting adjacent frame images of adjacent sub-videos, where the adjacent frame images include image A and image B; determining the similarity evaluation information of the adjacent frame images, where the similarity evaluation information includes the first similarity information S1 and the second similarity information S2; obtaining the preset similarity weight information, where the preset similarity weight information includes the first weight a and the second weight b; generating the similarity S of adjacent sub-videos based on the first similarity information S1, the second similarity information S2, the first weight a, and the second weight b, and the similarity S of adjacent sub-videos is characterized as: S = aS1 + bS2.
[0068] Further, the first similarity information S1 is the contour similarity S1(A, B), the second similarity information S2 is the color similarity S2(A, B), the first weight a is a preset contour weight, and the second weight b is a preset color weight. In the embodiments of the present invention, the contour similarity S1(A, B) is characterized as: Where m and n are the width and height of the image respectively, and k = m * n; the color similarity S2(A, B) is characterized as: Where H A and H B are the normalized histograms of the A image and the B image respectively.
[0069] In a possible implementation manner, in the process of determining the similarity between adjacent sub-videos, first, adjacent frame images are extracted from the adjacent sub-videos. For example, the last frame image can be extracted from the previous sub-video of the adjacent sub-videos as the A image, and the first frame image can be extracted from the subsequent sub-video as the B image. Then, the first similarity information S1 and the second similarity information S2 of the adjacent frame images are determined. In the embodiments of the present invention, the logical exclusive OR method can be used to capture the differences between binary images. As a preferred embodiment, for example, the first similarity information S1 is the contour similarity S1(A, B), and it can be calculated and determined based on the following formula: Where and B r represent the binary images of the A image and the B image respectively, m and n are the width and height of the image respectively, and k = m * n; the second similarity information S2 is the color similarity S2(A, B), and it can be calculated and determined based on the following formula: Where H A and H B are the normalized histograms of the A image and the B image respectively. At this time, the similarity weight information is further obtained. For example, the first weight a is a preset contour weight, and the second weight b is a preset color weight. Since the video frames of the live video are often moving images, the preset contour weight a can be taken as 0.6, and the preset color weight b can be taken as 0.4. And the similarity S of the adjacent sub-videos is further calculated. For example, the similarity S of the adjacent sub-videos is characterized as S = aS1(A, B) + bS2(A, B).
[0070] It should be noted that those skilled in the art can think based on the above disclosure that the above first similarity information S1 and second similarity information S2 can also be increased, decreased, or modified according to actual needs, and the similarity of adjacent sub-videos can be calculated using the corresponding weight information to achieve a more accurate calculation effect. Therefore, they should all fall within the protection scope of the present invention. The above embodiments should not be regarded as a limitation on the type or quantity of the similarity information in the embodiments of the present invention, and will not be elaborated here too much.
[0071] In the embodiments of the present invention, by comprehensively analyzing and determining the similarity of adjacent sub-videos based on contour features and color features, the calculation accuracy of the similarity of adjacent videos can be effectively improved, and the merging accuracy in the subsequent video merging process and the cropping accuracy in the video cropping process can be improved.
[0072] Please refer to Figure 5 , in the embodiments of the present invention, the video merging operation is performed on the multiple sub-videos based on the similarity to obtain a merged video, including:
[0073] S31) Obtain a preset similarity threshold;
[0074] S32) Sequentially determine whether the similarity between each two adjacent sub-videos is greater than or equal to the preset similarity threshold;
[0075] S33) If so, merge the corresponding adjacent sub-videos;
[0076] S34) Obtain the merged video based on all the merged adjacent sub-videos and the unmerged sub-videos among the multiple sub-videos.
[0077] In the embodiments of the present invention, by merging sub-videos that meet the similarity requirements, videos with large differences, such as videos before and after a live broadcast, can be effectively split out, facilitating subsequent video analysis and cropping, and improving the cropping accuracy of the video.
[0078] However, in the actual application process, if the merged sub-videos are directly used as the cropped videos of the original live video, since there may still be a situation where the content before the live broadcast and the content after the live broadcast are in the same sub-video in the merged sub-videos (although the proportion is already small), the video cropping is still not accurate enough to meet the needs of users.
[0079] In the embodiments of the present invention, determining the live start frame based on the live start sub-video and determining the live end frame based on the live end sub-video includes: respectively obtaining the key frames of the live start sub-video and the key frames of the live end sub-video; using the key frames of the live start sub-video as the live start frame; using the key frames of the live end sub-video as the live end frame.
[0080] In a possible implementation, after obtaining the merged video, determine the live start sub-video and the live end sub-video according to the merged video. For example, in the above-mentioned merged video, the first sub-video with a large difference from the previous sub-video (such as the second sub-video in the merged video) is used as the live start sub-video, and the last sub-video with a large difference is used as the live end sub-video. At this time, further obtain key frames in the live start sub-video and the live end sub-video. For example, existing video key frame extraction methods can be used to obtain the key frames in the live start sub-video and the live end sub-video respectively, and the key frames in the live start sub-video are used as the live start frames respectively, and the key frames in the above-mentioned live end sub-video are used as the live end frames. In the subsequent video cropping process, corresponding video cropping operations can be performed according to the above-mentioned live start frames and live end frames, so as to improve the cropping accuracy to the frame level and greatly improve the cropping accuracy of the live video.
[0081] In the embodiments of the present invention, by adopting a live video cropping method based on key frames, the cropping accuracy of the live video can be accurately determined for each frame, thereby greatly improving the cropping accuracy of the live video and improving the user experience.
[0082] However, when the general video key frame acquisition method is applied to the field of live video, it may not be able to accurately determine the video key frames that can distinguish before and after the live broadcast. Therefore, in order to achieve an accurate key frame acquisition effect in the field of live video, the video key frame acquisition method is further optimized in combination with the playback characteristics of the live video.
[0083] Please refer to Figure 6 , in the embodiments of the present invention, obtaining the key frames of the live start sub-video or obtaining the key frames of the live end sub-video includes:
[0084] S511) Take the live start sub-video or the live end sub-video as the target video, obtain the first frame image and the second frame image of the target video, and take the first frame image as the initial key frame image;
[0085] S512) Calculate the difference between the second frame image and the initial key frame image based on a preset comparison algorithm;
[0086] S513) Determine whether the difference is greater than a preset difference threshold;
[0087] S514) When the difference is less than or equal to the preset difference threshold, take the next frame image of the second frame image as the new second frame image, and jump to step S512);
[0088] S515) When the difference is greater than the preset difference threshold, use the second frame image as the new initial key frame image, and use the next frame image of the second frame image as the new second frame image, then jump to step S512);
[0089] S516) After determining that the comparison of all frame images of the target video is completed, use the finally obtained initial key frame image as the key frame.
[0090] Further, in the embodiment of the present invention, calculating the difference between the second frame image and the initial key frame image based on the preset comparison algorithm includes: calculating the difference D(I j between the second frame image I i and the initial key frame image I i according to the Euclidean distance algorithm, where the difference is characterized as j ) where H ik and H jk respectively represent the pixel histograms of the initial key frame image and the second frame image.
[0091] In a possible implementation manner, considering the strong picture switching characteristics of the live video before and after the live broadcast, during the process of determining the key frames of the live start sub-video or the live end sub-video, use the above-mentioned live start sub-video or the live end sub-video as the target video, then obtain the first frame image and the second frame image in the above-mentioned target video, and first use the first frame image as the initial key frame image, and then calculate the difference between the second frame image and the initial key frame image based on the preset comparison algorithm. For example, in the embodiment of the present invention, the difference D(I j between the second frame image I i and the initial key frame image I i can be calculated according to the Euclidean distance algorithm, and the difference is characterized as j ) where H ik and H jk respectively represent the pixel histograms of the initial key frame image and the second frame image. For example, H ik represents the number of pixel points in the k-th gray level area of the i-th frame image.
[0092] Then, it is determined whether the calculated difference is greater than a preset difference threshold, for example, the preset difference threshold may be a difference threshold predetermined by a technician based on experience. If the calculated difference is less than or equal to the difference threshold, the next frame image of the second frame image is used as the new second frame image, for example, in an embodiment of the present invention, the third frame image is used as the new second frame image, and the process jumps to step S512 to continue the comparison operation. In another embodiment, after comparison, it is determined that the difference between the initial key frame image and the second frame image is greater than the preset difference threshold, and therefore the second frame image is used as the new initial key frame image, and the process jumps to step S512 to continue subsequent comparisons until all frame images in the target video are compared, and the final obtained initial key frame image is used as the key frame of the target video, that is, the key frame of the live start sub-video or the live end sub-video is determined.
[0093] In the embodiment of the present invention, by adopting the Euclidean distance algorithm, the differences of each frame image in the sub-video are compared in turn, and finally the key frame image with obvious differences is determined, thereby achieving accurate determination at the frame level. In the subsequent video cropping process, the cropping position is accurately determined to each frame of the entire video, which greatly improves the cropping accuracy of the live video and meets the actual needs of users.
[0094] The live video cropping device provided by an embodiment of the present invention is described below with reference to the accompanying drawings.
[0095] See also Figure 7 Based on the same inventive concept, an embodiment of the present invention provides a live video cropping device, the cropping device comprising: a preliminary cropping unit, used to perform a preliminary cropping operation on an original live video to obtain a plurality of sub-videos; a first determining unit, used to determine the similarity of adjacent sub-videos; a merging unit, used to perform a video merging operation on the plurality of sub-videos based on the similarity to obtain a merged video; a second determining unit, used to determine a live start sub-video and a live end sub-video based on the merged video; a third determining unit, used to determine a live start frame based on the live start sub-video, and to determine a live end frame based on the live end sub-video; and a re-cropping unit, used to perform a re-cropping operation on the original live video based on the live start frame and the live end frame.
[0096] In an embodiment of the present invention, the preliminary cropping unit includes: a first acquisition module, used to obtain a preset cropping length; a second acquisition module, used to obtain a start time and a stop time; an optimization module, used to optimize the preset cropping length based on the start time and the stop time to obtain an optimized cropping length; a preliminary cropping module, used to perform a preliminary cropping operation on the original live video based on the optimized cropping length to obtain multiple sub-videos.
[0097] Preferably, the optimization module is specifically configured to: obtain a preset time radiation length; determine a start broadcast radiation time range based on the start broadcast time and the preset time radiation length, and determine an end broadcast radiation time range based on the end broadcast time and the preset time radiation length; obtain a preset non-linear time segmentation algorithm; perform a time segmentation operation on the start broadcast radiation time range based on the preset non-linear time segmentation algorithm to obtain a first clipping length; perform the time segmentation operation on the end broadcast radiation time range based on the preset non-linear time segmentation algorithm to obtain a second clipping length; generate an optimized clipping length based on the preset clipping length, the first clipping length, and the second clipping length.
[0098] Preferably, the performing a time segmentation operation on the start broadcast radiation time range based on the preset non-linear time segmentation algorithm to obtain a first clipping length includes: determining a length growth trend; starting from the start broadcast time, performing a front and back time segmentation operation on the start broadcast radiation time range based on the length growth trend to obtain a first clipping length; the performing the time segmentation operation on the end broadcast radiation time range based on the preset time segmentation algorithm to obtain a second clipping length includes: starting from the end broadcast time, performing the front and back time segmentation operation on the end broadcast radiation time range based on the length growth trend to obtain a second clipping length.
[0099] Preferably, the first determination unit includes: an extraction module for extracting adjacent frame images of adjacent sub-videos, the adjacent frame images including an A image and a B image; a first determination module for determining similarity evaluation information of the adjacent frame images, the similarity evaluation information including first similarity information S1 and second similarity information S2; a weight acquisition module for acquiring similarity weight information, the preset similarity weight information including a first weight a and a second weight b; a second determination module for generating a similarity S of the adjacent sub-videos based on the first similarity information S1, the second similarity information S2, the first weight a, and the second weight b, the similarity S of the adjacent sub-videos being characterized as: S = aS1 + bS2.
[0100] Preferably, the first similarity information S1 is a contour similarity S1(A, B), the second similarity information S2 is a color similarity S2(A, B), the first weight a is a preset contour weight, the second weight b is a preset color weight, and the contour similarity S1(A, B) is characterized as: where m and n are the width and height of the image respectively, and k = m * n; the color similarity S2(A, B) is characterized as: where H Aand H B are the normalized histograms of the A image and the B image respectively.
[0101] Preferably, the merging unit includes: a threshold obtaining module for obtaining a preset similarity threshold; a judgment module for sequentially judging whether the similarity between every two adjacent sub-videos is greater than or equal to the preset similarity threshold; a first merging module for merging corresponding adjacent sub-videos when the judgment module judges that the similarity between two adjacent sub-videos is greater than or equal to the preset similarity threshold; and a second merging module for performing a video merging operation on all the adjacent sub-videos merged by the first merging module and the unmerged sub-videos among the multiple sub-videos to obtain the merged video.
[0102] Preferably, the third determining unit includes: a key frame obtaining module for respectively obtaining the key frames of the live start sub-video and the live end sub-video; a first key frame determining module for taking the key frame of the live start sub-video as the live start frame; and a second key frame determining module for taking the key frame of the live end sub-video as the live end frame.
[0103] Preferably, obtaining the key frame of the live start sub-video or obtaining the key frame of the live end sub-video includes: S511) taking the live start sub-video or the live end sub-video as the target video, obtaining the first frame image and the second frame image of the target video, and taking the first frame image as the initial key frame image; S512) calculating the difference between the second frame image and the initial key frame image based on a preset comparison algorithm; S513) judging whether the difference is greater than a preset difference threshold; S514) when the difference is less than or equal to the preset difference threshold, taking the next frame image of the second frame image as the new second frame image, and jumping to step S512); S515) when the difference is greater than the preset difference threshold, taking the second frame image as the new initial key frame image and taking the next frame image of the second frame image as the new second frame image, and jumping to step S512); S516) after determining that all the frame images of the target video have been compared, taking the finally obtained initial key frame image as the key frame of the target video.
[0104] Preferably, calculating the difference between the second frame image and the initial key frame image based on a preset comparison algorithm includes: calculating the difference D(I j and the initial key frame image I i ), and the difference is characterized as i , I j ), where H where, Hik and H jk are respectively characterized as the pixel histograms of the initial key-frame image and the second frame image.
[0105] Furthermore, an embodiment of the present invention also provides a processor, which is configured to execute the method for cropping a live video according to the embodiment of the present invention.
[0106] Furthermore, an embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the method for cropping a live video according to the embodiment of the present invention is implemented.
[0107] Furthermore, an embodiment of the present invention also provides a computer program product, including a computer program, and when the computer program is executed by a processor, the method for cropping a live video according to the embodiment of the present invention is implemented.
[0108] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0109] The present application is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or block in the flowchart and / or block diagram, and the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate means for implementing the functions specified in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.
[0110] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured article including an instruction device, and the instruction device implements the functions specified in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.
[0111] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus, causing a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, so that the instructions executed on the computer or other programmable apparatus provide steps for implementing the functions specified in one process Figure 1 one process or a plurality of processes and / or boxes Figure 1 steps for implementing the functions specified in one box or a plurality of boxes.
[0112] In a typical configuration, a computing device includes one or more processors (CPUs), an input / output interface, a network interface, and memory.
[0113] The memory may include non-permanent memory in the computer-readable medium, in the form of random access memory (RAM) and / or non-volatile memory such as read-only memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
[0114] Computer-readable media includes both permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette tapes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory media such as modulated data signals and carrier waves.
[0115] It should also be noted that the term "comprising", "including" or any other variation thereof is intended to cover non-exclusive inclusion, so that a process, method, commodity or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, commodity or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, commodity or device comprising the element.
[0116] The above are only the embodiments of the present application and are not intended to limit the present application. For those skilled in the art, various changes and modifications can be made to the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the scope of the claims of the present application.
[0117] In the technical solution of the present application, the acquisition, storage, use, processing, etc. of data all comply with the relevant provisions of national laws and regulations.
Claims
1. A method for cropping live video, characterized in that, The described clipping method includes: Performing a preliminary clipping operation on the original live video to obtain multiple sub-videos; Determining the similarity between adjacent sub-videos; Performing a video merging operation on the multiple sub-videos based on the similarity to obtain a merged video, including: obtaining a preset similarity threshold; sequentially determining whether the similarity between each two adjacent sub-videos is greater than or equal to the preset similarity threshold; if so, merging the corresponding adjacent sub-videos; obtaining the merged video based on all the merged adjacent sub-videos and the unmerged sub-videos among the multiple sub-videos; Determining a live start sub-video and a live end sub-video based on the merged video; Determining a live start frame based on the live start sub-video and a live end frame based on the live end sub-video; Performing a re-clipping operation on the original live video based on the live start frame and the live end frame.
2. The cropping method according to claim 1, characterized in that, The performing a preliminary clipping operation on the original live video to obtain multiple sub-videos includes: Obtaining a preset clipping length; Obtaining a start broadcast time and a stop broadcast time; Optimizing the preset clipping length based on the start broadcast time and the stop broadcast time to obtain an optimized clipping length; Performing a preliminary clipping operation on the original live video based on the optimized clipping length to obtain multiple sub-videos.
3. The cropping method according to claim 2, characterized in that, The optimizing the preset clipping length based on the start broadcast time and the stop broadcast time to obtain an optimized clipping length includes: Obtaining a preset time radiation length; Determining a start broadcast radiation time range based on the start broadcast time and the preset time radiation length, and determining a stop broadcast radiation time range based on the stop broadcast time and the preset time radiation length; Obtaining a preset non-linear time segmentation algorithm; Performing a time segmentation operation on the start broadcast radiation time range based on the preset non-linear time segmentation algorithm to obtain a first clipping length; Performing the time segmentation operation on the stop broadcast radiation time range based on the preset non-linear time segmentation algorithm to obtain a second clipping length; Generating an optimized clipping length based on the preset clipping length, the first clipping length, and the second clipping length.
4. The cropping method according to claim 3, characterized in that, The performing a time segmentation operation on the start broadcast radiation time range based on the preset non-linear time segmentation algorithm to obtain a first clipping length includes: Determining a length growth trend; Taking the start broadcast time as a starting point and performing a front and back time segmentation operation on the start broadcast radiation time range based on the length growth trend to obtain a first clipping length; The performing the time segmentation operation on the stop broadcast radiation time range based on the preset time segmentation algorithm to obtain a second clipping length includes: Taking the stop broadcast time as a starting point and performing the front and back time segmentation operation on the stop broadcast radiation time range based on the length growth trend to obtain a second clipping length.
5. The cropping method according to claim 1, characterized in that, The determining the similarity between adjacent sub-videos includes: Extracting adjacent frame images of adjacent sub-videos, where the adjacent frame images include an A image and a B image; Determining similarity evaluation information of the adjacent frame images, where the similarity evaluation information includes first similarity information S1 and second similarity information S2; Obtain preset similarity weight information, where the preset similarity weight information includes a first weight a and a second weight b; Generate the similarity S of adjacent sub-videos based on the first similarity information S1, the second similarity information S2, the first weight a, and the second weight b. The similarity S of adjacent sub-videos is characterized as: S = aS1 + bS2.
6. The cropping method according to claim 5, characterized in that, The first similarity information S1 is the contour similarity S1(A, B), the second similarity information S2 is the color similarity S2(A, B), the first weight a is the preset contour weight, and the second weight b is the preset color weight. The contour similarity S1(A,B) is characterized as follows: Among them, m and n are the width and height of the image respectively, and k = m * n; The color similarity S2(A, B) is characterized as follows: Among them, H A and H B are respectively the normalized histograms of the A image and the B image.
7. The cutting method according to claim 1, characterized in that The determining the live start frame based on the live start sub-video and determining the live end frame based on the live end sub-video includes: Obtain the key frames of the live start sub-video and the key frames of the live end sub-video respectively; Use the key frame of the live start sub-video as the live start frame; Use the key frame of the live end sub-video as the live end frame.
8. The cutting method according to claim 7, characterized in that The obtaining the key frame of the live start sub-video or obtaining the key frame of the live end sub-video includes: S511) Use the live start sub-video or the live end sub-video as the target video, obtain the first frame image and the second frame image of the target video, and use the first frame image as the initial key frame image; S512) Calculate the difference between the second frame image and the initial key frame image based on a preset comparison algorithm; S513) Determine whether the difference is greater than a preset difference threshold; S514) When the difference is less than or equal to the preset difference threshold, use the next frame image of the second frame image as the new second frame image, and jump to step S512); S515) When the difference is greater than the preset difference threshold, use the second frame image as the new initial key frame image, and use the next frame image of the second frame image as the new second frame image, and jump to step S512); S516) After determining that the comparison of all frame images of the target video is completed, use the finally obtained initial key frame image as the key frame of the target video.
9. The cutting method according to claim 8, characterized in that The calculating the difference between the second frame image and the initial key frame image based on a preset comparison algorithm includes: Calculate the second frame image I based on the Euclidean distance algorithm j and the initial key frame image I i The difference D(I i , I j ), the difference is characterized as Among them, H ik and H jk respectively represent the pixel histograms of the initial key-frame image and the second frame image.
10. A cutting device for live video, characterized in that The cropping device includes: A preliminary cropping unit for performing a preliminary cropping operation on the original live video to obtain a plurality of sub-videos; A first determination unit for determining the similarity of adjacent sub-videos; The merging unit is used to perform a video merging operation on the multiple sub-videos based on the similarity to obtain a merged video, and includes: a threshold obtaining module for obtaining a preset similarity threshold; a judging module for sequentially judging whether the similarity between every two adjacent sub-videos is greater than or equal to the preset similarity threshold; a first merging module for merging corresponding adjacent sub-videos when the judging module judges that the similarity between two adjacent sub-videos is greater than or equal to the preset similarity threshold; a second merging module for performing a video merging operation on all the merged adjacent sub-videos by the first merging module and the unmerged sub-videos among the multiple sub-videos to obtain the merged video; The second determining unit is used to determine a live start sub-video and a live end sub-video based on the merged video; The third determining unit is used to determine a live start frame based on the live start sub-video and determine a live end frame based on the live end sub-video; The re-clipping unit is used to perform a re-clipping operation on the original live video based on the live start frame and the live end frame.
11. The cutting device according to claim 10, characterized in that The preliminary clipping unit includes: A first obtaining module for obtaining a preset clipping length; A second obtaining module for obtaining a start broadcast time and a stop broadcast time; An optimization module for optimizing the preset clipping length based on the start broadcast time and the stop broadcast time to obtain an optimized clipping length; A preliminary clipping module for performing a preliminary clipping operation on the original live video based on the optimized clipping length to obtain multiple sub-videos.
12. The cutting device according to claim 11, characterized in that The optimization module is specifically used for: Obtaining a preset time radiation length; Determining a start broadcast radiation time range based on the start broadcast time and the preset time radiation length, and determining a stop broadcast radiation time range based on the stop broadcast time and the preset time radiation length; Obtaining a preset non-linear time segmentation algorithm; Performing a time segmentation operation on the start broadcast radiation time range based on the preset non-linear time segmentation algorithm to obtain a first clipping length; Performing the time segmentation operation on the stop broadcast radiation time range based on the preset non-linear time segmentation algorithm to obtain a second clipping length; Generating an optimized clipping length based on the preset clipping length, the first clipping length, and the second clipping length.
13. The cutting device according to claim 12, wherein The performing a time segmentation operation on the start broadcast radiation time range based on the preset non-linear time segmentation algorithm to obtain a first clipping length includes: Determining a length growth trend; Taking the start broadcast time as a starting point, performing a front and back time segmentation operation on the start broadcast radiation time range based on the length growth trend to obtain a first clipping length; The performing the time segmentation operation on the stop broadcast radiation time range based on the preset time segmentation algorithm to obtain a second clipping length includes: Taking the stop broadcast time as a starting point, performing the front and back time segmentation operation on the stop broadcast radiation time range based on the length growth trend to obtain a second clipping length.
14. The cutting device according to claim 10, wherein The first determining unit includes: An extraction module for extracting adjacent frame images of adjacent sub-videos, where the adjacent frame images include an A image and a B image; A first determination module, configured to determine similarity evaluation information of the adjacent frame images, where the similarity evaluation information includes first similarity information S1 and second similarity information S2; A weight acquisition module, configured to acquire preset similarity weight information, where the preset similarity weight information includes a first weight a and a second weight b; A second determination module, configured to generate a similarity S of adjacent sub-videos based on the first similarity information S1, the second similarity information S2, the first weight a, and the second weight b, where the similarity S of the adjacent sub-videos is characterized as: S = aS1 + bS2.
15. The cutting device according to claim 14, wherein The first similarity information S1 is a contour similarity S1(A, B), the second similarity information S2 is a color similarity S2(A, B), the first weight a is a preset contour weight, and the second weight b is a preset color weight. The contour similarity S1(A,B) is characterized as follows: Among them, m and n are the width and height of the image respectively, and k = m * n; The color similarity S2(A, B) is characterized as: Among them, H A and H B are the normalized histograms of the A image and the B image respectively.
16. The cutting device according to claim 10, wherein The third determination unit includes: A key frame acquisition module, configured to acquire key frames of the live start sub-video and key frames of the live end sub-video respectively; A first key frame determination module, configured to use the key frame of the live start sub-video as the live start frame; A second key frame determination module, configured to use the key frame of the live end sub-video as the live end frame.
17. The cutting device according to claim 16, wherein The acquiring of the key frame of the live start sub-video or the acquiring of the key frame of the live end sub-video includes: S511) Using the live start sub-video or the live end sub-video as a target video, acquiring a first frame image and a second frame image of the target video, and using the first frame image as an initial key frame image; S512) Calculating a difference between the second frame image and the initial key frame image based on a preset comparison algorithm; S513) Determining whether the difference is greater than a preset difference threshold; S514) When the difference is less than or equal to the preset difference threshold, using the next frame image of the second frame image as a new second frame image, and jumping to step S512); S515) When the difference is greater than the preset difference threshold, using the second frame image as a new initial key frame image, and using the next frame image of the second frame image as a new second frame image, and jumping to step S512); S516) After determining that the comparison of all frame images of the target video is completed, using the finally obtained initial key frame image as the key frame of the target video.
18. The cutting device according to claim 17, wherein The calculating of the difference between the second frame image and the initial key frame image based on a preset comparison algorithm includes: Calculate the difference D(I j between the second frame image I i and the initial key frame image I i ,I j ) based on the Euclidean distance algorithm, where the difference is characterized as Among them, H ik and H jk respectively represent the pixel histograms of the initial key-frame image and the second frame image.
19. A processor, wherein Configured to execute the live video cropping method according to any one of claims 1-9.
20. A computer-readable storage medium having a computer program stored thereon, whereinWhen the program is executed by a processor, it implements the live video cropping method according to any one of claims 1-9.
21. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the live video cropping method according to any one of claims 1-9.
Citation Information
Patent Citations
Video boundary detection method
CN108010044A
Video segmentation method and device
CN108182421A