Video processing method, device, electronic device and storage medium
By obtaining and updating scene difference parameters of video frames and selecting key frames, the problem of low recall rate of key frames in the existing technology is solved, and the adaptability and recall rate of video frame extraction are improved.
Patent Information
- Application Number
- CN202311649244.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-04
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2043-12-04
AI Technical Summary
In existing video key frame extraction systems, the poor adaptive ability of the scene detection function results in a low key frame recall rate.
By obtaining the scene difference parameters between a video frame and its adjacent frames, storing these parameters into a predetermined sequence, and updating and selecting key frames based on these parameters until the key frame extraction end condition is reached.
It improves the scene recall rate in the key frame extraction process, enhances the adaptability to scene changes in video frames, and improves the accuracy of key frame extraction.
Smart Images

Figure CN117640988B
Abstract
Description
Technical Field
[0001] The present application relates to the field of video key frame determination, and in particular to a video processing method, device, electronic device and storage medium. Background Art
[0002] At present, all video audits require the use of a key frame extraction system, from which key frames are extracted for review by auditors. The key frame determination method currently used by the key frame extraction system is a scene detection function, which is used to determine the key frames of the video. However, due to the poor adaptability of the scene detection function, key frame extraction has a low scene recall rate. Summary of the invention
[0003] The embodiments of the present application provide a video processing method, device, electronic device and storage medium, which can improve the scene recall rate in the key frame extraction process.
[0004] In a first aspect, an embodiment of the present application provides a video processing method, including:
[0005] Get the video frame of the target video;
[0006] Based on each of the video frames and adjacent video frames of the video frame, determining a scene difference parameter corresponding to each of the video frames, wherein the scene difference parameter represents a scene difference between the video frame and adjacent video frames of the video frame;
[0007] storing the scene difference parameters of the video frames into a predetermined sequence, wherein the length of the predetermined sequence is less than the number of video frames of the target video;
[0008] According to the scene difference parameters stored in the predetermined sequence, video frames corresponding to the scene difference parameters satisfying the key frame condition are selected as key frames;
[0009] Based on the scene difference parameters not stored in the predetermined sequence, the scene difference parameters stored in the predetermined sequence are updated, and key frames are selected based on the updated scene difference parameters in the predetermined sequence and the key frame conditions until a key frame extraction end condition is met.
[0010] In a second aspect, an embodiment of the present application further provides a video processing device, including:
[0011] A video frame acquisition module, used to acquire video frames of a target video;
[0012] A scene difference parameter determination module, configured to determine a scene difference parameter corresponding to each of the video frames based on each of the video frames and adjacent video frames of the video frame, wherein the scene difference parameter represents a scene difference between the video frame and the adjacent video frames of the video frame;
[0013] A predetermined sequence determination module, used to store the scene difference parameters of the video frames into a predetermined sequence, wherein the length of the predetermined sequence is less than the number of video frames of the target video;
[0014] A key frame selection module, configured to select video frames corresponding to scene difference parameters satisfying key frame conditions as key frames according to the scene difference parameters stored in the predetermined sequence;
[0015] An updating module is used to update the scene difference parameters stored in the predetermined sequence based on the scene difference parameters not stored in the predetermined sequence, and to select key frames based on the updated scene difference parameters in the predetermined sequence and the key frame conditions until the key frame extraction end condition is met.
[0016] In a third aspect, an embodiment of the present application further provides an electronic device, comprising a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of any one of the video processing methods provided in the embodiments of the present application.
[0017] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, comprising a computer program. When the computer program is run on an electronic device, the computer program is used to enable the electronic device to execute the steps of any one of the video processing methods provided in the embodiments of the present application.
[0018] In a fifth aspect, an embodiment of the present application also provides a computer program product, comprising a computer program, wherein the computer program is stored in a computer-readable storage medium; when a processor of an electronic device reads the computer program from the computer-readable storage medium, the processor executes the computer program, so that the electronic device performs the steps of any one of the video processing methods provided in the embodiments of the present application.
[0019] By adopting the scheme of the application embodiment, the video frames of the target video can be obtained; based on each of the video frames and the adjacent video frames of the video frame, the scene difference parameters corresponding to each of the video frames are determined, and the scene difference parameters characterize the scene difference between the video frame and the adjacent video frames of the video frame; the scene difference parameters of the video frame are stored in a predetermined sequence, wherein the length of the predetermined sequence is less than the number of video frames of the target video; according to the scene difference parameters stored in the predetermined sequence, the video frames corresponding to the scene difference parameters that meet the key frame conditions are selected as key frames; based on the scene difference parameters not stored in the predetermined sequence, the scene difference parameters stored in the predetermined sequence are updated, and the key frames are selected based on the updated scene difference parameters in the predetermined sequence and the key frame conditions until the key frame extraction end condition is reached. By using the predetermined sequence and the scene difference parameters of each video frame, the video frames corresponding to the scene difference parameters that meet the key frame conditions in the predetermined sequence are selected as key frames, thereby improving the scene recall rate in the key frame extraction process. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0021] Figure 1 It is a schematic diagram of a system architecture of the application of the video processing method provided in the embodiment of the present application;
[0022] Figure 2 This is a schematic diagram of data interaction between a terminal and a server provided in an embodiment of the present application;
[0023] Figure 3 It is a schematic diagram of an embodiment of the video processing method provided in the embodiments of the present application;
[0024] Figure 4 A schematic diagram of a predetermined sequence of operations provided in an embodiment of the present application;
[0025] Figure 5 A schematic diagram of a specific embodiment of deduplication processing of key frames provided in an embodiment of the present application;
[0026] Figure 6 This is a schematic diagram of a specific embodiment of the process of removing low-quality key frames provided in an embodiment of the present application;
[0027] Figure 7This is a schematic diagram of another specific embodiment of the process of removing low-quality key frames provided in the embodiment of the present application;
[0028] Figure 8 A schematic diagram of a specific structure of a video key frame extraction system provided in an embodiment of the present application;
[0029] Fig. 9 is a schematic diagram of the structure of a video processing device provided in an embodiment of the present application;
[0030] Fig.10 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0031] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only 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 those skilled in the art without creative work are within the scope of protection of this application.
[0032] At the same time, in the description of the embodiments of the present application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more features. In the description of the embodiments of the present application, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.
[0033] Embodiments of the present application provide a video processing method, device, electronic device, and computer-readable storage medium.
[0034] The video processing method provided in the embodiment of the present application can be applied to the system architecture 100. Figure 1 ,like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0035] Users can use terminal devices 101 , 102 , 103 to interact with server 105 via network 104 to receive or send messages, etc.
[0036] The terminal devices 101, 102, 103 may be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture Eperts Group Audio Layer III, Moving Picture Experts Compression Standard Audio Layer 3), MP4 (Moving Picture Eperts Group Audio Layer IV, Moving Picture Experts Compression Standard Audio Layer 4) players, laptop computers and desktop computers, etc. The terminal may be a device including both receiving and transmitting hardware, that is, a device having receiving and transmitting hardware capable of performing two-way communication on a two-way communication link. The terminal and the server may perform two-way communication via a network.
[0037] The server 105 may be a server that provides various services, such as a background server that supports the pages displayed on the terminal devices 101, 102, and 103. The server may be an independent server, or a server network or server cluster composed of servers, including but not limited to a computer, a network host, a single network server, a plurality of network server sets, or a cloud server composed of a plurality of servers. The cloud server is composed of a large number of computers or network servers based on cloud computing.
[0038] It should be noted that the video processing method provided in the embodiment of the present application is executed by a server, and accordingly, the video processing device is arranged in the server.
[0039] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. According to the implementation requirements, there may be any number of terminal devices, networks and servers. The terminal devices 101, 102, 103 in the embodiment of the present application may specifically correspond to application systems in actual production.
[0040] like Figure 2 As shown, Figure 2 The diagram is a schematic diagram of data interaction between a terminal and a server. The terminal can receive a target video input by a user and send the target video to the server. The server decodes the target video through a decoder to obtain one or more video frames of the target video and frame attributes corresponding to each video frame. The server can select a video frame whose frame attributes are the target frame attributes as a key frame. The server can also calculate the scene difference of one or more video frames, store the scene difference parameters of the video frames in a predetermined sequence, select the video frames corresponding to the scene difference parameters that meet the key frame conditions in the predetermined sequence as key frames, and send all the acquired key frames to the terminal.
[0041] The following is a detailed description with reference to the accompanying drawings. In this embodiment, the execution subject is an electronic device that can obtain the target video. It should be noted that the description order of the following embodiments is not intended to limit the preferred order of the embodiments. Although the logical order is shown in the flow chart, in some cases, the steps shown or described may be performed in an order different from that shown in the accompanying drawings.
[0042] Please refer to Figure 3 The specific process of the video processing method can be as follows: Step 201 to Step 205, wherein:
[0043] Step 201: Obtain a video frame of a target video.
[0044] The target video refers to the video to be processed for which key frame selection is required. The target video can be captured by a video capture device or obtained from a storage space where videos are pre-stored. The video frame refers to an image at a certain time point in the target video.
[0045] In an embodiment of the present application, the target video includes several groups of scenes and transition effects between adjacent scenes. For example, the target video includes 3 groups of scenes, and the transition effects between adjacent scenes are mask transition and text transition in sequence.
[0046] In the embodiment of the present application, the video frame of the target video can be obtained by parsing the target video.
[0047] In this embodiment, further, a target video is acquired, the target video is parsed, and a video frame of the target video and a frame attribute of the video frame are obtained.
[0048] The frame attributes of the video frame include but are not limited to I frame (Intra-coded picture), P frame (Predictive-coded picture), B frame (Bidirectionally predicted picture), IDR frame (Instantaneous decoding refresh picture). Among them, I frame is a key frame, P frame is a difference frame, B frame is a bidirectional difference frame, and IDR frame is a special key frame.
[0049] In this embodiment, the video processing method further includes: based on the frame attributes of the video frame, selecting a video frame having a target frame attribute as a key frame.
[0050] Wherein, the target frame attribute indicates that the video frame is a key frame. The target frame attribute can be an I frame, and the target frame attribute can also be an IDR frame. Alternatively, the target frame attribute includes an I frame and an IDR frame. The target frame attribute can be adjusted according to actual conditions, and the embodiments of the present application do not limit it.
[0051] In this embodiment, the frame attribute of the current frame is read by the decoder, and if the frame attribute of the current frame is the target frame attribute, the video frame with the target frame attribute is selected as the key frame. If the frame attribute of the current frame is not the target frame attribute, the current frame is skipped.
[0052] In this embodiment, the video processing method further includes: if the video frame is the first frame of the target video, selecting the video frame as a key frame.
[0053] Among them, the first video frame of the target video is a key frame.
[0054] In an embodiment of the present application, the video frames of the target video can also be obtained by inputting the target video into a video processing chip, and determining multiple video frames in the target video based on the parameters of the video processing chip.
[0055] In this embodiment, the parameters of the video processing chip include but are not limited to the frame rate of the video frame and the resolution of the video frame.
[0056] It is understandable that the video frame for acquiring the target video may be adjusted according to actual conditions, and the embodiments of the present application do not impose any limitation thereto.
[0057] Step 202: Based on each of the video frames and its adjacent video frames, determine a scene difference parameter corresponding to each of the video frames, wherein the scene difference parameter represents a scene difference between the video frame and its adjacent video frames.
[0058] In the embodiment of the present application, the scene difference parameters include but are not limited to scene change values, pixel difference values, and average pixel difference values. The scene difference parameters can be adjusted according to actual conditions and are not limited in the embodiment of the present application.
[0059] In the embodiment of the present application, the adjacent video frame of the video frame can be the previous video frame of the current video frame, or the next video frame of the current video frame. The adjacent video frame can be adjusted according to actual conditions, and the embodiment of the present application does not limit it.
[0060] In the embodiment of the present application, the process of determining the scene difference parameter may be:
[0061] Based on the video encoder, generate a coded bit stream corresponding to the video frame of the target video;
[0062] The encoder generates scene difference parameters for use by a decoder receiving the encoded bit stream, so that the decoder can generate scene difference parameters according to adjacent video frames in a key frame in a video frame sequence and include the scene difference parameters in the key frame.
[0063] The encoded bit stream includes the color and position information of the pixels corresponding to the video frame.
[0064] In the embodiment of the present application, the step of determining the scene difference parameter may be:
[0065] Calculating an image parameter value of each of the video frames;
[0066] A scene difference parameter of the video frame is determined based on a difference between an image parameter value of the video frame and image parameter values of adjacent video frames of the video frame.
[0067] Among them, the image parameter value refers to the parameter value on the image corresponding to the video frame. The image parameter value includes but is not limited to the overall image parameter value and the image parameter value of the pixel point of the video frame. The overall image parameter value refers to a value used to measure the overall image parameter, and the image parameter value of the pixel point of the video frame refers to the parameter value corresponding to one or more pixel points on the image corresponding to the video frame. The image parameter value includes but is not limited to pixel value, brightness channel value, and chromaticity channel value. The pixel value refers to the value corresponding to each pixel on the image, the brightness channel value refers to the value of each pixel point on the image on the brightness channel, and the chromaticity channel value refers to the value of each pixel point on the image on the chromaticity channel. The image parameter value can be one or more. The specific content of the image parameter value can be adjusted according to the actual situation, and the embodiment of the present application is not limited.
[0068] In this embodiment, the difference between the image parameter value of the video frame and the image parameter value of the adjacent video frame of the video frame includes but is not limited to the difference between the two image parameter values and the absolute value of the difference between the two image parameter values. For example, according to the selected image parameter value, the image parameter value of each video frame is calculated, and according to the difference between the image parameter value of the video frame and the adjacent video frame of the video frame, the difference is used as the scene difference parameter of the video frame.
[0069] In the embodiment of the present application, the step of determining the scene difference parameter may also be:
[0070] Calculating an image parameter value of each of the video frames;
[0071] Based on the image parameter values of the video frames, calculating an image parameter difference value corresponding to each of the video frames, the image parameter difference value representing the image parameter difference between the video frame and an adjacent video frame of the video frame;
[0072] Based on the image parameter difference value of the video frame and the difference between the image parameter difference values of adjacent video frames of the video frame, a scene difference parameter of the video frame is determined.
[0073] In this example, the image parameter value refers to the parameter value on the image corresponding to the video frame. The image parameter value includes but is not limited to the overall image parameter value and the image parameter value of the pixel point of the video frame. The overall image parameter value refers to a value used to measure the overall image parameter, and the image parameter value of the pixel point of the video frame refers to the parameter value corresponding to one or more pixel points on the image corresponding to the video frame.
[0074] Further, in this example, the image parameter value of the video frame includes the image parameter value of the pixel point of the video frame, and the image parameter difference value corresponding to each video frame is calculated based on the image parameter value of the video frame, including:
[0075] Determine the total number of pixels having different image parameter values between the video frame and adjacent video frames of the video frame;
[0076] An image parameter difference value of the video frame is determined based on the image parameter value of the video frame, image parameter values of adjacent video frames of the video frame, and the total number of pixels.
[0077] Among them, the image parameter value includes but is not limited to pixel value, brightness channel value, and chromaticity channel value. Pixel value refers to the value corresponding to each pixel on the image, brightness channel value refers to the value of each pixel on the image on the brightness channel, and chromaticity channel value refers to the value of each pixel on the image on the chromaticity channel. The image parameter value can be one or more. The specific content of the image parameter value can be adjusted according to actual conditions, and the embodiments of the present application are not limited thereto.
[0078] Exemplarily, the image parameter difference value of the video frame is determined according to the following formula (1).
[0079]
[0080] Among them, diff cur is the image parameter difference value of the video frame cur, which is actually the average pixel difference. cur Refers to the brightness channel value of the video frame cur, I pre Refers to the brightness channel value of the video frame pre, I pre For I cur Adjacent video frames, It is used to calculate the absolute value sum of the difference between the brightness channel value of the video frame cur and the brightness channel value of the video frame pre, width is the width of the video frame, height is the height of the video frame, the value range of i is (0, width), the value range of j is (0, height), and nums is used for the video frame I cur The adjacent video frame I of the video frame pre The total number of pixels with different brightness channel values.
[0081] In this example, the difference between the image parameter difference value of the video frame and the image parameter difference values of adjacent video frames of the video frame includes but is not limited to determining the difference between the two image parameter difference values and determining the absolute value of the difference between the two image parameter difference values. For example, according to the selected image parameter value, the image parameter value of each video frame is calculated, and according to the difference between the image parameter values of the video frame and the adjacent video frame of the video frame, the difference is used as the image parameter difference value of the video frame, and according to the difference between the image parameter difference values of the video frame and the adjacent video frame of the video frame, the difference is used as the scene difference parameter of the video frame.
[0082] By comparing the difference between the image parameter difference values of each video frame and its adjacent video frames, the adaptability to scene changes in the video frames is improved, and video frames with large picture changes can be quickly extracted, thereby improving the scene recall rate in the key frame extraction process.
[0083] Step 203: Store the scene difference parameters of the video frames into a predetermined sequence, wherein the length of the predetermined sequence is less than the number of video frames of the target video.
[0084] In the embodiment of the present application, the predetermined sequence is a sequence storing scene difference parameters of video frames, and is used to determine key frames according to the scene difference parameters stored in the predetermined sequence. The length of the predetermined sequence can be adjusted according to actual conditions, but the length of the predetermined sequence is less than the number of video frames of the target video, and the embodiment of the present application does not limit it.
[0085] In the embodiment of the present application, the data form of the predetermined sequence can be a queue, and the queue follows the first-in-first-out principle, that is, one end of the queue enters data, and the other end is used to output data, and the data entered at one end is first out from the other end. The data form of the predetermined sequence can also be a stack, and the stack follows the last-in-first-out principle, that is, one end of the stack enters data, and the end can also be used to output data, and the data entered from the end can also be first out from the end. The data structure form of the predetermined sequence can be adjusted according to actual conditions, and the embodiment of the present application does not limit it.
[0086] By presetting a sequence and scene difference parameters of each video frame, video frames corresponding to scene difference parameters that meet key frame conditions in the pre-set sequence are selected as key frames, thereby improving the scene recall rate in the key frame extraction process.
[0087] Step 204: According to the scene difference parameters stored in the predetermined sequence, video frames corresponding to the scene difference parameters that meet the key frame conditions are selected as key frames.
[0088] In an embodiment of the present application, the above-mentioned key frame condition can be that the video frame corresponding to the maximum scene difference parameter in the predetermined sequence is the key frame. The above-mentioned key frame condition can also be that according to the size of the scene difference parameter, the video frames corresponding to the Top-k scene difference parameters in the predetermined sequence are key frames, where Top-k is the number of scene difference parameters. For example, according to the size of the scene difference parameter, the video frames corresponding to the 5 largest scene difference parameters in the predetermined sequence are key frames.
[0089] In an embodiment of the present application, when the key frame condition is that the video frame corresponding to the maximum scene difference parameter in the predetermined sequence is a key frame, according to the scene difference parameters stored in the predetermined sequence, the video frame corresponding to the scene difference parameter that meets the key frame condition is selected as the key frame, including:
[0090] Recording the maximum scene difference parameter stored in the predetermined sequence;
[0091] The video frame corresponding to the maximum scene difference parameter is selected as a key frame.
[0092] In an embodiment of the present application, when the key frame condition is to select video frames corresponding to the top-k scene difference parameters in a predetermined sequence as key frames according to the size of the scene difference parameters, the video frames corresponding to the scene difference parameters that meet the key frame condition are selected as key frames according to the scene difference parameters stored in the predetermined sequence, including:
[0093] According to the magnitude of the scene difference parameters, recording the magnitude order of the scene difference parameters stored in the predetermined sequence;
[0094] According to the size order of the scene difference parameters, video frames corresponding to the Top-k scene difference parameters are selected as key frames.
[0095] It is understandable that the key frame condition can be one condition or multiple conditions can be satisfied at the same time. The specific content can be adjusted according to the actual situation. For example, the key frame condition is the maximum value in the predetermined sequence, or the frame attribute is an intra-frame coding frame. This application embodiment does not limit this.
[0096] Step 205: based on the scene difference parameters not stored in the predetermined sequence, update the scene difference parameters stored in the predetermined sequence, and select key frames based on the updated scene difference parameters in the predetermined sequence and the key frame conditions until the key frame extraction end condition is met.
[0097] In the embodiment of the present application, the above-mentioned updating refers to selecting scene difference parameters from scene difference parameters not stored in the predetermined sequence, storing the selected scene difference parameters in the predetermined sequence, so as to update the scene difference parameters in the predetermined sequence.
[0098] In the embodiment of the present application, based on the scene difference parameters not stored in the predetermined sequence, updating the scene difference parameters stored in the predetermined sequence includes:
[0099] At least extracting scene difference parameters of key frames from the predetermined sequence;
[0100] A target scene difference parameter is selected from the scene difference parameters not stored in the predetermined sequence, and the target scene difference parameter is stored in the predetermined sequence to update the scene difference parameters stored in the predetermined sequence.
[0101] In this example, a video frame corresponding to a scene difference parameter that meets the key frame condition is selected as a key frame from a predetermined sequence. Only the scene difference parameters corresponding to the key frame can be taken out, or the scene difference parameters corresponding to the key frame and the scene difference parameters that need to be dequeued can be taken out at the same time.
[0102] For example, Figure 4 As shown, Figure 4 FIG. 1 is a schematic diagram of a predetermined sequence of operations. Figure 4 As shown, the predetermined sequence is a queue, the length of the queue is N, and scene is a scene difference parameter. In this schematic diagram, if the key frame condition is that the video frame corresponding to the maximum scene difference parameter in the predetermined sequence is a key frame. If sceneN is the maximum value in the queue, sceneN and scene1 are taken out from the predetermined sequence at the same time. If scene1 is the maximum value in the queue, only scene1 is taken out from the predetermined sequence. If sceneN is not the maximum value in the queue and scene1 is not the maximum value in the queue, then according to the maximum scene difference parameter of the recorded queue, the maximum scene difference parameter and scene1 are taken out from the predetermined sequence at the same time.
[0103] It is understandable that the purpose of video key frame extraction is to identify the scene changes of video frames in the target video and extract the video frames with rich information from each group of scenes as key frames. By pre-determining the sequence and the scene difference parameters of each video frame, the video frames corresponding to the scene difference parameters that meet the key frame conditions in the pre-determined sequence are selected as key frames, thereby improving the scene recall rate in the key frame extraction process.
[0104] By adopting the method of this embodiment, the video frames corresponding to the scene difference parameters that meet the key frame conditions in the predetermined sequence can be selected as key frames through the predetermined sequence and the scene difference parameters of each video frame, thereby improving the scene recall rate in the key frame extraction process.
[0105] The present application also provides a video processing method, which includes:
[0106] For all selected key frames, calculating the correlation between each key frame and an adjacent key frame of the key frame in at least one image feature dimension;
[0107] Deduplication processing is performed on the key frames according to at least one correlation corresponding to each key frame.
[0108] In the embodiment of the present application, the image feature dimension includes but is not limited to the pixel feature dimension, the brightness channel feature dimension, the chromaticity feature dimension, and the AI feature dimension. Among them, the pixel feature dimension refers to the dimension for extracting features from the image pixels. The brightness feature dimension refers to the dimension for extracting features from the brightness channel of the image. The chromaticity feature dimension refers to the dimension for extracting features from the chromaticity channel of the image. The AI feature dimension refers to the dimension for extracting features from the image through the AI model.
[0109] In this embodiment, the AI model includes but is not limited to a self-supervised learning AI model and a weakly supervised learning AI model. Among them, the self-supervised learning AI model is an AI model obtained by unsupervised learning training using the structure and features of the key frame itself, and the weakly supervised learning AI model is an AI model obtained by learning and training using the weakly labeled data of the key frame. For example, since the transition frame generally has the characteristics of radial blur, lens blur, and motion blur, video frames with characteristics such as radial blur, lens blur, and motion blur are used as negative samples, and normal video frames are used as positive samples to train the AI model. The video frame to be judged is input into the trained AI model, and the binary classification label of the video frame is output by the AI model. According to the label, it can be determined whether the video frame is a transition frame. The specific content of the AI model can be adjusted according to the actual situation, and the embodiment of the present application is not limited.
[0110] In the embodiment of the present application, one image feature dimension may be selected, or multiple image feature dimensions may be selected.
[0111] Exemplarily, only the pixel feature dimension is selected, and the correlation between each key frame and the adjacent key frame of the key frame in the pixel feature dimension is calculated, and the key frame is deduplicated according to the correlation of the pixel feature dimension. If the correlation of the pixel feature dimension of the key frame is less than the preset correlation, the key frame is deleted.
[0112] Exemplarily, the pixel feature dimension and the brightness channel feature dimension are selected at the same time, and the correlation between each key frame and the adjacent key frame of the key frame in the pixel feature dimension and the correlation in the brightness channel feature dimension are calculated, and the key frame is deduplicated according to the correlation in the pixel feature dimension and the correlation in the brightness channel feature dimension. If the correlation in the pixel feature dimension of the key frame is less than the preset first correlation, and the correlation in the brightness channel feature dimension is less than the preset second correlation, the key frame is deleted, otherwise, the key frame is retained.
[0113] In the embodiment of the present application, the sub-dimensions in the image feature dimension can be further determined. For example, when the image feature dimension is the brightness feature dimension, the sub-dimensions of the brightness feature dimension may include a histogram and a normal graph. The sub-dimensions can be adjusted according to actual conditions, and the embodiment of the present application does not limit them.
[0114] In the embodiment of the present application, the correlation refers to a correlation measurement value between a key frame and its adjacent key frames in one or more image feature dimensions, and one or more sub-dimensions of the image feature dimensions.
[0115] In an embodiment of the present application, the correlation can be determined by calculating the correlation between a key frame and an adjacent key frame of the key frame, and using the determined correlation coefficient as the correlation. For example, the brightness channel of the key frame and the brightness channel of the adjacent key frame of the key frame are calculated, and based on the brightness channels of the two video frames, the brightness channel histogram corresponding to the area with different brightness values is determined, and the brightness channel histogram is used as the histogram of the key frame. The Pearson correlation coefficient of the brightness channel histogram of the key frame and the brightness channel histogram of the adjacent key frame of the key frame is calculated, and the obtained Pearson correlation coefficient is used as a correlation corresponding to the key frame.
[0116] In the embodiment of the present application, the correlation can also be determined by calculating the difference between the key frame and the adjacent key frame of the key frame, and using the determined difference as the correlation. For example, based on the AI model, the first AI feature of the key frame and the second AI feature of the adjacent key frame of the key frame are determined, the distance difference between the first AI feature and the second AI feature is calculated, and the obtained distance difference value is used as a correlation corresponding to the key frame.
[0117] In the embodiment of the present application, for all selected key frames, the correlation between each key frame and its adjacent key frame in at least one image feature dimension is calculated; and the key frames are deduplicated according to at least one correlation corresponding to each key frame. Deduplication can be effectively filtered out by using the correlation of multiple image feature dimensions.
[0118] Combination Figure 5 , Figure 5 This is a specific embodiment of deduplication processing of key frames in this application, combined with Figure 5 , the steps of this application are explained.
[0119] like Figure 5 As shown, in Figure 5 In the illustrated embodiment, the image feature dimensions are brightness feature dimensions, chromaticity feature dimensions, and AI feature dimensions. First, the brightness channel of the key frame and the brightness channel of the adjacent key frame of the key frame are calculated, and the brightness channel histogram corresponding to the area with different brightness values is determined according to the brightness channels of the two video frames, and the brightness channel histogram is used as the histogram of the key frame. The Pearson correlation coefficient of the brightness channel histogram of the key frame and the brightness channel histogram of the adjacent key frame of the key frame is calculated, and the obtained Pearson correlation coefficient is used as the first correlation corresponding to the key frame. If the first correlation is greater than the preset first correlation coefficient, the key frame is filtered.
[0120] Otherwise, the chroma channel of the key frame and the chroma channel of the adjacent key frame of the key frame are calculated, and the chroma channel histogram corresponding to the area with different chroma values is determined according to the chroma channels of the two video frames, and the chroma channel histogram is used as the histogram of the key frame. The Pearson correlation coefficient of the chroma channel histogram of the key frame and the chroma channel histogram of the adjacent key frame of the key frame is calculated, and the obtained Pearson correlation coefficient is used as the second correlation corresponding to the key frame. If the second correlation is greater than the preset second correlation coefficient, the key frame is filtered.
[0121] Otherwise, based on the AI model, determine the first AI feature of the key frame and the second AI feature of the adjacent key frame of the key frame, calculate the Hamming distance between the first AI feature and the second AI feature, and if the obtained Hamming distance is greater than the preset distance, the key frame is a candidate key frame, otherwise, filter the key frame.
[0122] The present application also provides a video processing method, which includes:
[0123] For all selected key frames, calculating a quality parameter of each key frame in at least one image feature dimension;
[0124] According to at least one of the quality parameters corresponding to each of the key frames, the key frames are subjected to low-quality processing.
[0125] In the embodiment of the present application, the image feature dimension includes but is not limited to the pixel feature dimension, the brightness channel feature dimension, the chromaticity feature dimension, and the AI feature dimension. Among them, the pixel feature dimension refers to the dimension for extracting features from the image pixels. The brightness feature dimension refers to the dimension for extracting features from the brightness channel of the image. The chromaticity feature dimension refers to the dimension for extracting features from the chromaticity channel of the image. The AI feature dimension refers to the dimension for extracting features from the image through the AI model.
[0126] In the embodiment of the present application, one image feature dimension may be selected, or multiple image feature dimensions may be selected.
[0127] Exemplarily, only the pixel feature dimension is selected, the quality parameter of the key frame in the pixel feature dimension is calculated, and the key frame is degraded according to the quality parameter of the pixel feature dimension. If the quality parameter of the key frame in the pixel feature dimension is less than the preset pixel quality value, the key frame is deleted.
[0128] Exemplarily, the pixel feature dimension and the brightness channel feature dimension are selected at the same time, the quality parameter of the key frame in the pixel feature dimension and the quality parameter of the brightness channel feature dimension are calculated, and the key frame is processed to remove low quality according to the quality parameter of the pixel feature dimension and the quality parameter of the brightness channel feature dimension. If the quality parameter of the pixel feature dimension of the key frame is less than the preset first quality parameter, and the quality parameter of the brightness channel feature dimension is less than the preset second quality parameter, the key frame is deleted, otherwise, the key frame is retained.
[0129] In the embodiment of the present application, the quality parameter refers to the quality measurement value of the key frame in one or more image feature dimensions. For example, when the image feature dimension is the brightness feature dimension, the quality parameter may include but is not limited to the minimum value of the key frame in the brightness channel, the maximum value of the key frame in the brightness channel, the 10th percentile brightness value of the key frame in the brightness channel, and the 90th percentile brightness value of the key frame in the brightness channel. The specific content of the image feature dimension and the quality parameter on the image feature dimension can be adjusted according to the actual situation, and the embodiment of the present application does not limit it.
[0130] In the embodiment of the present application, for all selected key frames, the quality parameter of each key frame in at least one image feature dimension is calculated; and the key frame is subjected to low-quality processing according to at least one quality parameter corresponding to each key frame. The low-quality processing is performed by using the quality parameters of multiple image feature dimensions, which can effectively filter out low-quality video frames.
[0131] Combination Figure 6 , Figure 6 This is a specific embodiment of the present application for removing low-quality key frames, combined with Figure 6 , the steps of this application are explained.
[0132] like Figure 6 As shown, in Figure 6 In the embodiment shown, the image feature dimension is a brightness feature dimension, and the quality parameters on the image feature dimension include the minimum value of the key frame on the brightness channel, the maximum value of the key frame on the brightness channel, the 10th percentile brightness value of the key frame on the brightness channel, and the 90th percentile brightness value of the key frame on the brightness channel. First, calculate the minimum value of the key frame on the brightness channel, the maximum value of the key frame on the brightness channel, the 10th percentile brightness value of the key frame on the brightness channel, and the 90th percentile brightness value of the key frame on the brightness channel. Determine the size of the maximum value of the key frame on the brightness channel and the preset quality threshold. If the maximum value of the key frame on the brightness channel is less than the preset quality threshold, filter the key frame.
[0133] Otherwise, the minimum value of the key frame on the brightness channel and the preset quality threshold are determined. If the minimum value of the key frame on the brightness channel is greater than the preset quality threshold, the key frame is filtered.
[0134] Otherwise, calculate the difference between the 10th percentile brightness value of the key frame on the brightness channel and the 90th percentile brightness value of the key frame on the brightness channel, and determine the relationship between the difference and the preset quality threshold. If the difference is greater than the preset quality threshold, the key frame is a candidate key frame, otherwise, filter the key frame.
[0135] Combination Figure 7 , Figure 7 Another specific embodiment of the present application for removing low-quality key frames is to combine Figure 7 , the steps of this application are explained.
[0136] like Figure 7 As shown, in Figure 7 In the embodiment shown, the image feature dimension is the AI feature dimension. Figure 7 As shown, specifically, the AI model determines whether the key frame is a transition frame. If not, the key frame is a candidate key frame, otherwise, the key frame is filtered.
[0137] Further, combined with Figure 8 , Figure 8 FIG. 1 is a schematic diagram of a video key frame extraction system according to an embodiment of the present application. Figure 8 As shown, the video key frame extraction system includes a preliminary screening subsystem, a duplicate removal subsystem, and a low-quality removal subsystem. The preliminary screening subsystem, the duplicate removal subsystem, and the low-quality removal subsystem are pipelined.
[0138] Among them, the preliminary screening subsystem is used to execute the above-mentioned video processing method to select the content of the key frame from the video frame of the target video. For example, based on the preliminary screening subsystem, the video frame of the target video is obtained; based on each of the video frames and the adjacent video frames of the video frame, the scene difference parameter corresponding to each of the video frames is determined, and the scene difference parameter characterizes the scene difference between the video frame and the adjacent video frame of the video frame; the scene difference parameter of the video frame is stored in a predetermined sequence, wherein the length of the predetermined sequence is less than the number of video frames of the target video; according to the scene difference parameters stored in the predetermined sequence, the video frame corresponding to the scene difference parameter that meets the key frame condition is selected as the key frame; based on the scene difference parameters not stored in the predetermined sequence, the scene difference parameters stored in the predetermined sequence are updated, and the key frame is selected based on the updated scene difference parameters in the predetermined sequence and the key frame condition until the key frame extraction end condition is reached.
[0139] The deduplication subsystem is used to perform deduplication of the key frames determined in the primary screening system in the above-mentioned video processing method. For example, based on the deduplication subsystem, for all selected key frames, the correlation between each key frame and the adjacent key frames of the key frame in at least one image feature dimension is calculated; and the key frames are deduplicated according to at least one of the correlations corresponding to each of the key frames.
[0140] The low-quality removal subsystem is used to perform low-quality removal processing on the key frames determined in the deduplication subsystem in the above-mentioned video processing method. For example, based on the low-quality removal subsystem, for all selected key frames, the quality parameter of each key frame in at least one image feature dimension is calculated; and according to at least one of the quality parameters corresponding to each key frame, the key frame is subjected to low-quality removal processing.
[0141] In the embodiment of the present application, it is understood that the deduplication subsystem and the low-quality removal subsystem can be combined into one subsystem, namely the filtering system. The filtering system is used to perform deduplication filtering and low-quality removal filtering on the key frames determined by the primary screening subsystem.
[0142] In the embodiment of the present application, the frames that pass through the three subsystems in sequence are key frames. For example, the total number of video frames is N, the total number of frames that pass through the primary screening system is N1, the total number of frames that pass through the deduplication subsystem is N2, and the total number of frames that pass through the low-quality removal subsystem is N3, and the quantitative relationship is N≥N1≥N2≥N3.
[0143] In the embodiment of the present application, the processing contents of the primary screening subsystem, the de-weighting subsystem and the low-proton removal system, and the arrangement order of the de-weighting subsystem and the low-proton removal system can be adjusted according to actual conditions, and the embodiment of the present application does not impose specific restrictions.
[0144] By adopting the above-mentioned video key frame extraction system, the video key frame extraction system can adaptively detect scenes, improve scene recall capabilities, and reduce duplicate frames and invalid frames.
[0145] The embodiment of the present application further provides a video processing method, which is a video retrieval method. The video retrieval method can perform further video retrieval based on the key frames obtained by the above-mentioned video processing method. The video retrieval method includes:
[0146] Determine a key frame to be retrieved, wherein the key frame is a key frame obtained by processing based on the above video processing method;
[0147] At least one video associated with the key frame is obtained, and the obtained video is used as a retrieval result.
[0148] In an embodiment of the present application, the key frames in the video to be retrieved can be determined by the above-mentioned video processing method. For example, the video frames of the video to be retrieved are obtained; based on each video frame and the adjacent video frames of the video frame, the scene difference parameters corresponding to each video frame are determined; the scene difference parameters of the video frame are stored in a predetermined sequence; according to the scene difference parameters stored in the predetermined sequence, the video frames corresponding to the scene difference parameters that meet the key frame conditions are selected as key frames; based on the scene difference parameters not stored in the predetermined sequence, the scene difference parameters stored in the predetermined sequence are updated, and the key frames are selected based on the scene difference parameters in the updated predetermined sequence and the key frame conditions, until the key frame extraction end condition is met.
[0149] In the embodiment of the present application, one key frame to be retrieved may be determined, or multiple key frames to be retrieved may be determined. For example, all key frames in the video to be retrieved are determined, and one key frame is selected from all key frames as the target key frame, or a preset number of key frames are selected from all key frames as the target key frames. The number of key frames in the video to be retrieved may be adjusted according to actual conditions, and the embodiment of the present application does not impose any limitation thereto.
[0150] In an embodiment of the present application, at least one video associated with the attributes of the key frame is obtained according to the attributes of the key frame. The attributes of the key frame include, but are not limited to, the scene type of the key frame and the unique hash value of the key frame. For example, according to the scene type to which the key frame belongs, a video consistent with the scene type is obtained. For another example, the key frame is encoded, and a unique hash value corresponding to the encoding result is determined, and according to the unique hash value, a video associated with the unique hash value is obtained. The attributes of the key frame can be adjusted according to actual conditions, and the embodiment of the present application does not limit it.
[0151] By determining the key frame to be retrieved and obtaining at least one video associated with the key frame to be retrieved as a retrieval result, the time for video retrieval is reduced and the efficiency of video retrieval is improved. At the same time, the accuracy of video retrieval is improved by matching the videos associated with the key frame through the attributes of the key frame.
[0152] This embodiment further provides a video processing device, which can be integrated into an electronic device, such as a computer device. The computer device can be a terminal, a server, or other device, and this embodiment has no limitation on this.
[0153] For example, Fig. 9 As shown, the video processing device may include:
[0154] The video frame acquisition module 301 is used to acquire the video frame of the target video.
[0155] The scene difference parameter determination module 302 is used to determine a scene difference parameter corresponding to each video frame based on each video frame and its adjacent video frame, wherein the scene difference parameter represents the scene difference between the video frame and its adjacent video frame.
[0156] The predetermined sequence determination module 303 is configured to store the scene difference parameters of the video frames into a predetermined sequence, wherein the length of the predetermined sequence is less than the number of video frames of the target video.
[0157] The key frame selection module 304 is used to select video frames corresponding to scene difference parameters that meet key frame conditions as key frames according to the scene difference parameters stored in the predetermined sequence.
[0158] The updating module 305 is used to update the scene difference parameters stored in the predetermined sequence based on the scene difference parameters not stored in the predetermined sequence, and select key frames based on the updated scene difference parameters in the predetermined sequence and the key frame conditions until the key frame extraction end condition is met.
[0159] Optionally, in the device of the embodiment of the present application, in the updating module 305, updating the scene difference parameters stored in the predetermined sequence based on the scene difference parameters not stored in the predetermined sequence includes:
[0160] The extracting unit is used to extract the scene difference parameters of the key frames from at least the predetermined sequence.
[0161] The updating unit is used to select a target scene difference parameter from the scene difference parameters not stored in the predetermined sequence, store the target scene difference parameter in the predetermined sequence, and update the scene difference parameters stored in the predetermined sequence.
[0162] Optionally, in the device of the embodiment of the present application, the video frame acquisition module 301 includes:
[0163] The target video acquisition module is used to acquire the target video.
[0164] The frame attribute determination module is used to parse the target video to obtain the video frame of the target video and the frame attributes of the video frame.
[0165] The device further comprises:
[0166] The key frame selection module is used to select a video frame having a target frame attribute as a key frame based on the frame attribute of the video frame.
[0167] Optionally, in the device of the embodiment of the present application, the scene difference parameter determination module 302 determines the scene difference parameter corresponding to each of the video frames, including:
[0168] The image parameter value determination unit is used to calculate the image parameter value of each of the video frames.
[0169] The image parameter difference value determining unit is used to calculate the image parameter difference value corresponding to each of the video frames based on the image parameter value of the video frame, wherein the image parameter difference value represents the image parameter difference between the video frame and an adjacent video frame of the video frame.
[0170] The scene difference parameter determining unit is used to determine the scene difference parameter of the video frame based on the image parameter difference value of the video frame and the difference between the image parameter difference values of adjacent video frames of the video frame.
[0171] Optionally, in the device of the embodiment of the present application, the image parameter value of the video frame includes the image parameter value of the pixel point of the video frame, and in the image parameter difference value determination unit, the image parameter difference value corresponding to each video frame is calculated based on the image parameter value of the video frame, including:
[0172] The total number of pixels determining subunit is used to determine the total number of pixels having different image parameter values between the video frame and adjacent video frames of the video frame.
[0173] The image parameter difference value determining subunit is used to determine the image parameter difference value of the video frame based on the image parameter value of the video frame, the image parameter values of adjacent video frames of the video frame, and the total number of pixels.
[0174] Optionally, in the device of the embodiment of the present application, in the key frame selection module 304, the step of selecting, according to the scene difference parameters stored in the predetermined sequence, a video frame corresponding to a scene difference parameter satisfying a key frame condition as a key frame includes:
[0175] The maximum scene difference parameter stored in the predetermined sequence is recorded.
[0176] The video frame corresponding to the maximum scene difference parameter is selected as a key frame.
[0177] Optionally, in the device of the embodiment of the present application, the video processing device further includes:
[0178] The correlation determination module is used to calculate the correlation between each key frame and its adjacent key frame in at least one image feature dimension for all selected key frames.
[0179] The deduplication module is used to perform deduplication processing on the key frames according to at least one correlation corresponding to each key frame.
[0180] Optionally, in the device of the embodiment of the present application, the video processing device further includes:
[0181] The quality parameter determination module is used to calculate the quality parameter of each of the selected key frames in at least one image feature dimension.
[0182] The low-quality processing module is used to perform low-quality processing on the key frames according to at least one quality parameter corresponding to each key frame.
[0183] According to the scheme of the embodiment of the application, the video frame of the target video can be obtained through the video frame acquisition module; the scene difference parameter determination module determines the scene difference parameter corresponding to each video frame based on each video frame and the adjacent video frames of the video frame, and the scene difference parameter represents the scene difference between the video frame and the adjacent video frames of the video frame; the scene difference parameter of the video frame is stored in a predetermined sequence through a predetermined sequence determination module, wherein the length of the predetermined sequence is less than the number of video frames of the target video; the key frame selection module selects the video frame corresponding to the scene difference parameter that meets the key frame condition as the key frame according to the scene difference parameter stored in the predetermined sequence; the updating module updates the scene difference parameter stored in the predetermined sequence based on the scene difference parameter that is not stored in the predetermined sequence, and performs key frame selection based on the updated scene difference parameter in the predetermined sequence and the key frame condition until the key frame extraction end condition is reached. The video frame corresponding to the scene difference parameter that meets the key frame condition in the predetermined sequence is selected as the key frame through the predetermined sequence and the scene difference parameter of each video frame, thereby improving the scene recall rate in the key frame extraction process.
[0184] Accordingly, an embodiment of the present application further provides an electronic device, which may be a terminal, and the terminal may be a smart phone, a tablet computer, a laptop computer, a touch screen, a game console, a personal computer (PC, Personal Computer), a personal digital assistant (Personal Digital Assistant, PDA) and other terminal devices. Alternatively, the electronic device may be a server.
[0185] like Fig.10 As shown, Fig.10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device 400 includes a processor 401 having one or more processing cores, a memory 402 having one or more computer-readable storage media, and a computer program stored in the memory 402 and executable on the processor. The processor 401 is electrically connected to the memory 402. Those skilled in the art will appreciate that the electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown, or combine certain components, or arrange components differently.
[0186] The processor 401 is the control center of the electronic device 400, and uses various interfaces and lines to connect various parts of the entire electronic device 400, and executes various functions and processes data of the electronic device 400 by running or loading software programs and / or units stored in the memory 402, and calling data stored in the memory 402. The processor 401 can be a processor CPU, a graphics processor GPU, a network processor (Network Processor, NP), etc., and can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application.
[0187] In the embodiment of the present application, the processor 401 in the electronic device 400 will load instructions corresponding to the processes of one or more application programs into the memory 402 according to the following steps, and the processor 401 will run the application programs stored in the memory 402 to implement various functions, such as:
[0188] Get the video frame of the target video;
[0189] Based on each of the video frames and adjacent video frames of the video frame, determining a scene difference parameter corresponding to each of the video frames, wherein the scene difference parameter represents a scene difference between the video frame and the adjacent video frames of the video frame;
[0190] storing the scene difference parameters of the video frames into a predetermined sequence, wherein the length of the predetermined sequence is less than the number of video frames of the target video;
[0191] According to the scene difference parameters stored in the predetermined sequence, video frames corresponding to the scene difference parameters satisfying the key frame condition are selected as key frames;
[0192] Based on the scene difference parameters not stored in the predetermined sequence, the scene difference parameters stored in the predetermined sequence are updated, and key frames are selected based on the updated scene difference parameters in the predetermined sequence and the key frame conditions until a key frame extraction end condition is met.
[0193] Furthermore, various functions implemented by running the application stored in the memory 402 can also be found in the description of the aforementioned embodiments, which will not be repeated here.
[0194] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0195] Optional, such as Fig.10 As shown, the electronic device 400 further includes: a touch screen 403, a radio frequency circuit 404, an audio circuit 405, an input unit 406, and a power supply 407. The processor 401 is electrically connected to the touch screen 403, the radio frequency circuit 404, the audio circuit 405, the input unit 406, and the power supply 407, respectively. Those skilled in the art can understand that Fig.10 The electronic device structure shown in the figure does not constitute a limitation of the electronic device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0196] The touch display screen 403 can be used to display a graphical user interface and receive operation instructions generated by the user acting on the graphical user interface. The touch display screen 403 may include a display panel and a touch panel. Among them, the display panel may be used to display information input by the user or information provided to the user and various graphical user interfaces of the electronic device, and these graphical user interfaces may be composed of graphics, text, icons, videos and any combination thereof. Optionally, the display panel may be configured in the form of a liquid crystal display (LCD, Liquid Crystal Display), an organic light-emitting diode (OLED, Organic Light-Emitting Diode) and the like. The touch panel may be used to collect the user's touch operation on or near it (such as the user using any suitable object or attachment such as a finger, a stylus, etc. on the touch panel or near the touch panel), and generate corresponding operation instructions, and the operation instructions execute corresponding programs. Optionally, the touch panel may include two parts, a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into the touch point coordinates, and then sends it to the processor 401, and can receive the command sent by the processor 401 and execute it. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it is transmitted to the processor 401 to determine the type of touch event, and then the processor 401 provides a corresponding visual output on the display panel according to the type of touch event. In an embodiment of the present application, the touch panel and the display panel can be integrated into the touch display screen 403 to realize the input and output functions. However, in some embodiments, the touch panel and the touch panel can be used as two independent components to realize the input and output functions. That is, the touch display screen 403 can also be used as a part of the input unit 406 to realize the input function.
[0197] The radio frequency circuit 404 may be used to send and receive radio frequency signals, so as to establish wireless communication with a network device or other electronic devices through wireless communication, and to send and receive signals with the network device or other electronic devices.
[0198] The audio circuit 405 can be used to provide an audio interface between the user and the electronic device through a speaker and a microphone. The audio circuit 405 can transmit the electrical signal converted from the received audio data to the speaker, which is converted into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 405 and converted into audio data, and then the audio data is output to the processor 401 for processing, and then sent to another electronic device through the radio frequency circuit 404, or the audio data is output to the memory 402 for further processing. The audio circuit 405 may also include an earplug jack to provide communication between an external headset and an electronic device.
[0199] The input unit 406 may be configured to receive input target video and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function controls.
[0200] The power supply 407 is used to supply power to various components of the electronic device 400. Optionally, the power supply 407 can be logically connected to the processor 401 through a power management system, so that the power management system can manage charging, discharging, and power consumption. The power supply 407 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0201] although Fig.10 Not shown, the electronic device 400 may also include a camera, a sensor, a wireless fidelity module, a Bluetooth module, etc., which will not be described in detail here.
[0202] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0203] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0204] To this end, an embodiment of the present application provides a computer-readable storage medium, which includes a computer program. When the computer program is run on an electronic device, the computer program is used to enable the electronic device to perform any video processing method provided in the embodiment of the present application. For example, the computer program can perform the following steps of the video processing method:
[0205] Get the video frame of the target video;
[0206] Based on each of the video frames and adjacent video frames of the video frame, determining a scene difference parameter corresponding to each of the video frames, wherein the scene difference parameter represents a scene difference between the video frame and adjacent video frames of the video frame;
[0207] storing the scene difference parameters of the video frames into a predetermined sequence, wherein the length of the predetermined sequence is less than the number of video frames of the target video;
[0208] According to the scene difference parameters stored in the predetermined sequence, video frames corresponding to the scene difference parameters satisfying the key frame condition are selected as key frames;
[0209] Based on the scene difference parameters not stored in the predetermined sequence, the scene difference parameters stored in the predetermined sequence are updated, and key frames are selected based on the updated scene difference parameters in the predetermined sequence and the key frame conditions until a key frame extraction end condition is met.
[0210] Furthermore, for the detailed steps of the above method steps, reference can be made to the description in the above embodiments, which will not be repeated here.
[0211] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0212] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0213] Since the computer program stored in the computer-readable storage medium can execute any one of the video processing methods provided in the embodiments of the present application, the beneficial effects that can be achieved by any one of the video processing methods provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0214] According to one aspect of the present application, a computer program product or a computer program is also provided, which includes computer instructions, and the computer program is stored in a computer-readable storage medium; when a processor of an electronic device reads the computer program from the computer-readable storage medium, the processor executes the computer program, so that the electronic device executes the methods provided in various optional implementations of the above embodiments.
[0215] In the above-mentioned video processing device, computer-readable storage medium, electronic device, and computer program product embodiments, the description of each embodiment has its own emphasis. For parts not described in detail in a certain embodiment, reference can be made to the relevant description of other embodiments. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process and beneficial effects of the above-mentioned video processing device, computer-readable storage medium, computer program product, electronic device and its corresponding units can refer to the description of the video processing method in the above embodiment, and will not be repeated here.
[0216] The above is a detailed introduction to a video processing method, device, electronic device, computer-readable storage medium and computer program product provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A video processing method, characterized in that: include: Get the video frame of the target video; Calculating an image parameter value of each video frame based on each video frame and adjacent video frames of the video frame; Based on the image parameter values of the video frames, calculating an image parameter difference value corresponding to each of the video frames, the image parameter difference value representing the image parameter difference between the video frame and an adjacent video frame of the video frame; Determine a scene difference parameter of the video frame based on the image parameter difference value of the video frame and the difference between the image parameter difference values of adjacent video frames of the video frame, wherein the scene difference parameter represents the scene difference between the video frame and the adjacent video frames of the video frame; storing the scene difference parameters of the video frames into a predetermined sequence, wherein the length of the predetermined sequence is less than the number of video frames of the target video; According to the scene difference parameters stored in the predetermined sequence, a video frame corresponding to the scene difference parameters satisfying a key frame condition is selected as a key frame, wherein the key frame condition includes a maximum scene difference parameter, and by recording the maximum scene difference parameter stored in the predetermined sequence, a video frame corresponding to the maximum scene difference parameter is selected as a key frame; At least extracting scene difference parameters of key frames from the predetermined sequence; Target scene difference parameters are selected from scene difference parameters not stored in the predetermined sequence, the target scene difference parameters are stored in the predetermined sequence to update the scene difference parameters stored in the predetermined sequence, and key frame selection is performed based on the updated scene difference parameters in the predetermined sequence and the key frame condition until a key frame extraction end condition is reached.
2. The video processing method according to claim 1, characterized in that: The step of obtaining a video frame of a target video includes: Get the target video; Parsing the target video to obtain a video frame of the target video and a frame attribute of the video frame; The method further comprises: Based on the frame attributes of the video frame, a video frame having the target frame attributes is selected as a key frame.
3. The video processing method according to claim 1, characterized in that: The image parameter values of the video frames include image parameter values of pixels of the video frames, and calculating the image parameter difference value corresponding to each of the video frames based on the image parameter values of the video frames includes: Determine the total number of pixels having different image parameter values between the video frame and adjacent video frames of the video frame; An image parameter difference value of the video frame is determined based on the image parameter value of the video frame, image parameter values of adjacent video frames of the video frame, and the total number of pixels.
4. The video processing method according to any one of claims 1 to 3, characterized in that: The method further comprises: For all selected key frames, calculating the correlation between each key frame and an adjacent key frame of the key frame in at least one image feature dimension; Deduplication processing is performed on the key frames according to at least one correlation corresponding to each key frame.
5. The video processing method according to any one of claims 1 to 3, characterized in that: The method further comprises: For all selected key frames, calculating a quality parameter of each key frame in at least one image feature dimension; According to at least one of the quality parameters corresponding to each of the key frames, the key frames are subjected to low-quality processing.
6. A video processing device, characterized in that: include: A video frame acquisition module, used to acquire video frames of a target video; A scene difference parameter determination module is used to calculate the image parameter value of each video frame based on each video frame and its adjacent video frames; calculate the image parameter difference value corresponding to each video frame based on the image parameter value of the video frame, the image parameter difference value representing the image parameter difference between the video frame and its adjacent video frames; determine the scene difference parameter of the video frame based on the difference between the image parameter difference value of the video frame and the image parameter difference values of its adjacent video frames, the scene difference parameter representing the scene difference between the video frame and its adjacent video frames; A predetermined sequence determination module, used to store the scene difference parameters of the video frames into a predetermined sequence, wherein the length of the predetermined sequence is less than the number of video frames of the target video; A key frame selection module, configured to select a video frame corresponding to a scene difference parameter satisfying a key frame condition as a key frame according to the scene difference parameter stored in the predetermined sequence, wherein the key frame condition includes a maximum scene difference parameter, and by recording the maximum scene difference parameter stored in the predetermined sequence, the video frame corresponding to the maximum scene difference parameter is selected as a key frame; An updating module is used to extract scene difference parameters of key frames from at least the predetermined sequence; select target scene difference parameters from scene difference parameters not stored in the predetermined sequence, store the target scene difference parameters in the predetermined sequence to update the scene difference parameters stored in the predetermined sequence, and perform key frame selection based on the updated scene difference parameters in the predetermined sequence and the key frame condition until a key frame extraction end condition is reached.
7. An electronic device, characterized in that: The invention comprises a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the video processing method according to any one of claims 1 to 5.
8. A storage medium, characterized in that: The invention comprises a computer program, and when the computer program is run on an electronic device, the computer program is used to enable the electronic device to execute the steps of the video processing method according to any one of claims 1 to 5.
