Video processing method and device
By analyzing the color data changes of video frames and automatically detecting the video segmentation points, the problems of low video segmentation efficiency and low accuracy in the prior art are solved, and efficient and accurate video segmentation is achieved.
Patent Information
- Application Number
- CN202410168286.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-06
- Publication Date
- 2025-08-08
AI Technical Summary
In the prior art, video segmentation is low efficiency and low accuracy, mainly due to the reliance on manual screening of lens changing frames, which has the problem of labor-consuming and strong subjectivity.
By analyzing the color data changes of video frames, using preset thresholds to automatically detect video segmentation points, and using color data-driven intelligent scene lens segmentation technology to reduce manual screening workload and improve segmentation efficiency and accuracy.
It realizes efficient automation and accuracy of video segmentation, reduces manual screening workload, and improves segmentation efficiency and accuracy.
Smart Images

Figure CN120451847A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to the field of computer and network communication technology, and more particularly, to a video processing method and device. Background Art
[0002] In the field of video editing, users often have the demand to split and crop videos. One of the more common scenarios is to split a complete video into multiple small segments based on the degree of change of the shots in the current video, while the shots in each small segment after segmentation are relatively stable.
[0003] In the existing technology, the common method for video segmentation is to search for frames with shot changes in the entire video during the editing process. This method is labor-intensive and subjective, and also has technical problems such as low efficiency and low accuracy. Summary of the Invention
[0004] The embodiments of the present disclosure provide a video processing method and device to overcome the problems of low efficiency and accuracy in video segmentation.
[0005] In a first aspect, an embodiment of the present disclosure provides a video processing method, including:
[0006] Determining color data corresponding to video frames in the video to be segmented according to the video to be segmented;
[0007] Obtaining a segmentation position corresponding to the video to be segmented based on color data corresponding to video frames in the video to be segmented, wherein a change in color data corresponding to adjacent video frames at the segmentation position is greater than a preset threshold;
[0008] The video to be segmented is segmented according to the segmentation positions to obtain at least two video segments, and the video frames at the start and end positions of two adjacent video segments are adjacent in the video to be segmented.
[0009] In a second aspect, an embodiment of the present disclosure provides a video processing device, including:
[0010] a determining unit, configured to determine color data corresponding to video frames in the video to be segmented based on the video to be segmented;
[0011] A first processing unit is configured to obtain a segmentation position corresponding to the video to be segmented based on color data corresponding to video frames in the video to be segmented, wherein a change in color data corresponding to adjacent video frames at the segmentation position is greater than a preset threshold;
[0012] The second processing unit is configured to segment the video to be segmented according to the segmentation positions to obtain at least two video segments, wherein the video frames at the start and end positions of two adjacent video segments are adjacent in the video to be segmented.
[0013] In a third aspect, an embodiment of the present disclosure provides an electronic device, including: a processor and a memory;
[0014] The memory stores computer-executable instructions;
[0015] The processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the video processing method described in the first aspect and various possible designs of the first aspect.
[0016] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, in which computer execution instructions are stored. When a processor executes the computer execution instructions, the video processing method described in the first aspect and various possible designs of the first aspect is implemented.
[0017] In a fifth aspect, an embodiment of the present disclosure provides a computer program product, including a computer program, which, when executed by a processor, implements the video processing method described in the first aspect and various possible designs of the first aspect.
[0018] The video processing method and device provided in this embodiment determine the color data corresponding to the video frames in the video to be segmented, and then determine the segmentation position corresponding to the video to be segmented based on the color data corresponding to the video frames in the video to be segmented. The change in the color data corresponding to the adjacent video frames at the segmentation position is greater than a preset threshold. The video to be segmented is then segmented based on the segmentation position to obtain at least two video segments, where the video frames at the start and end positions of the two adjacent video segments are adjacent in the video to be segmented. In this technical solution, when the lens changes, the color data between the two frames of the image differs significantly. That is, the change in the color data of the video frames can be used to determine the video frame corresponding to the segmentation point, thereby reducing the workload of manual screening and improving segmentation efficiency and accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0020] Figure 1A thread diagram of a video processing method provided by an embodiment of the present disclosure;
[0021] Figure 2 Schematic diagram of the video processing method provided in the embodiment of the present disclosure Figure 1 ;
[0022] Figure 3 Schematic diagram of the video processing method provided in the embodiment of the present disclosure Figure 2 ;
[0023] Figure 4 Schematic diagram of the video processing method provided in the embodiment of the present disclosure Figure 3 ;
[0024] Figure 5 A schematic diagram of the structure of a video processing device provided in an embodiment of the present disclosure;
[0025] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0026] To make the objectives, technical solutions, and advantages of the embodiments of the present disclosure more clear, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present disclosure without making any creative efforts shall fall within the scope of protection of the present disclosure.
[0027] In the field of video editing, users often need to split and crop videos. One common scenario is to split a complete video into multiple small segments based on the degree of change in the current video shots. The shots in each segment after segmentation are relatively stable, thus achieving the purpose of video segmentation and cropping.
[0028] In the existing technology, the common method for video segmentation is to search for frames with shot changes in the entire video during the editing process. This method is labor-intensive and subjective, and also has technical problems such as low efficiency and low accuracy.
[0029] To address this time-consuming and labor-intensive manual process, the inventors devised a technical solution: a color-data-driven intelligent scene shot segmentation solution. This solution analyzes and decodes the color data corresponding to each video frame, automatically detecting soft and hard cuts in the video. Specifically, in actual situations, the color data of the video frame corresponding to a segmentation point differs significantly from the color data of the previous frame.
[0030] Compared to traditional manual screening, this solution offers greater accuracy and efficiency. This not only significantly reduces the workload of manual screening but also improves the efficiency and quality of video editing. Furthermore, compared to typical video processing, only color data needs to be determined, meaning analysis is performed using partially decoded data rather than fully decoded video, resulting in faster performance.
[0031] Figure 1 A thread diagram of a video processing method provided by an embodiment of the present disclosure, such as Figure 1 As shown, the flowchart includes: a decoding thread and an inference thread.
[0032] In the decoding thread, the video is decoded to obtain the red-green-blue (RGB) data corresponding to each video frame. The RGB data corresponding to all video frames are then downsampled and cached. When the video is segmented, the inference thread is started, the RGB data in the data cache is input into the segmentation model, and all segmentation points in the video are output. The video is then segmented based on each segmentation point.
[0033] The segmentation process may include calling back the segmentation point to the upper layer, and having the upper layer perform segmentation. The downsampling process may include using a graphics processing unit (GPU) to implement the downsampling process.
[0034] It should be understood that the color data may be RGB data or Luminance-Chrominance (YUV) data. The embodiments of the present disclosure are described using RGB data, and the implementation principle of YUV data is similar.
[0035] The video processing method according to the embodiments of the present disclosure is executed by an electronic device, which may be a mobile phone, a computer, a tablet, a server, and the like.
[0036] The following is a specific implementation process of the video processing method, device, and electronic device involved in the embodiments of the present disclosure. Some examples are only for illustrative purposes and are not limiting.
[0037] Figure 2 Schematic diagram of the video processing method provided in the embodiment of the present disclosure Figure 1 .like Figure 2 As shown, the video processing method includes:
[0038] Step 21: determining color data corresponding to video frames in the video to be segmented according to the video to be segmented;
[0039] In this step, after obtaining the video to be segmented, the color data in the video frames of the video to be segmented are extracted to obtain the color data corresponding to the video frames in the video to be segmented.
[0040] The video to be segmented may be obtained by: obtaining it from an image acquisition device (eg, a camera), obtaining it from a preset physical space (eg, a computer, a USB flash drive), or downloading it from a network terminal, etc.
[0041] Optionally, step 21 may include the following implementation steps:
[0042] Step 1: Perform frame processing on the video to be segmented to obtain the video frames of the video to be segmented;
[0043] In this implementation, the video to be segmented is converted into frame images, which can be achieved using video processing software or programming libraries. The general steps include opening the video file, reading each video frame and decoding it into image data, and then saving each image as a frame (i.e., video frame).
[0044] Step 2: Extract the color data of the video frame to be segmented.
[0045] In this implementation, after decoding the video frame, the RGB channel information is extracted. Typically, the RGB data of each pixel is stored in a certain format (such as 24-bit representation) in the frame image. By reading the corresponding color channel value of each pixel, the complete RGB data of the video frame can be obtained.
[0046] It should be understood that the embodiments of the present disclosure do not limit the number of video frames obtained by decoding.
[0047] Step 22: Obtain the segmentation position corresponding to the video to be segmented according to the color data corresponding to the video frame in the video to be segmented;
[0048] The variation of color data corresponding to adjacent video frames at the segmentation position is greater than a preset threshold.
[0049] That is, when the amount of change in the color data corresponding to two adjacent video frames is large, it is considered that a shot cut occurs between the two adjacent video frames.
[0050] In this step, the color data corresponding to each video frame in the video to be segmented obtained above is processed to obtain segmentation positions for segmenting the video to be segmented.
[0051] In this implementation, the RGB data corresponding to two adjacent video frames can describe whether the camera has rotated. This is because when the camera rotates, the scene captured by the image acquisition device (e.g., a camera) changes, resulting in different image content in consecutive frames. For example, when the camera rotates, the position of objects in adjacent frames may shift, and the color distribution may also change.
[0052] By comparing the RGB data between the two frames, these changes can be detected to determine whether the camera has rotated. In other words, the trained segmentation model can detect such changes based on the RGB data to obtain the segmentation position corresponding to the video to be segmented.
[0053] Optionally, one implementation of step 22 may be: inputting color data corresponding to video frames in the video to be segmented into a pre-trained segmentation model to obtain segmentation positions corresponding to the video to be segmented;
[0054] The segmentation model is trained based on the color data and the segmentation positions corresponding to the color data.
[0055] In a possible implementation, after obtaining the color data in the video to be segmented, it is directly input into the segmentation model, and the segmentation position of the video to be segmented can be output.
[0056] Step 23: Segment the video to be segmented according to the segmentation position to obtain at least two video segments.
[0057] The video frames at the start and end positions of the two adjacent video segments are adjacent in the video to be segmented, that is, the end video frame of the first video segment and the beginning video frame of the second video segment of the two adjacent video segments are two consecutive frames in the video to be segmented.
[0058] In this step, the video to be segmented is divided into several video segments based on the segmentation positions.
[0059] Optionally, when the segmentation position is at least one segmentation point, each segmentation point corresponds to the first video frame in the video to be segmented.
[0060] Then, step 23 may be: dividing the video to be divided into at least two video segments according to at least one segmentation point.
[0061] In a possible implementation, the video to be segmented can be divided into 100 video frames. At this time, the segmentation model outputs three segmentation points, namely: the 16th video frame, the 50th video frame, and the 70th video frame. Then the video to be segmented can be divided into 4 video segments, namely the video segments corresponding to the 1st to 15th frames, the video segments corresponding to the 16th to 49th frames, the video segments corresponding to the 50th to 69th frames, and the video segments corresponding to the 70th to 100th frames.
[0062] The video processing method provided in this embodiment determines the color data corresponding to the video frames in the video to be segmented, and then determines the segmentation position corresponding to the video to be segmented based on the color data corresponding to the video frames in the video to be segmented. The video to be segmented is then segmented based on the segmentation position and the amount of change in the color data corresponding to adjacent video frames at the segmentation position is greater than a preset threshold, resulting in at least two video segments. The video frames at the start and end positions of the two adjacent video segments are adjacent in the video to be segmented. In this technical solution, when the camera changes, the color data between the two frames of the image differs significantly. That is, the change in the color data of the video frames can be used to determine the video frame corresponding to the segmentation point, thereby reducing the workload of manual screening and improving segmentation efficiency and accuracy.
[0063] Based on the above embodiments, Figure 3 Schematic diagram of the video processing method provided in the embodiment of the present disclosure Figure 2 .like Figure 3 As shown, the video processing method further includes:
[0064] Step 31: Obtain multiple sets of color data and the segmentation position corresponding to each set of color data;
[0065] In this step, multiple groups of color data and the segmentation positions corresponding to each group of color data can be obtained from some previous experiments and / or some data actually collected and stored in the physical space.
[0066] In a possible implementation, taking a set of color data as an example, it may include: 50 color data, wherein the 5th color data and the 36th color data are marked as the color data of the corresponding points in the segmentation position.
[0067] Step 32: According to the multiple sets of color data and the segmentation positions corresponding to each set of color data, a preset network model is trained to obtain a segmentation model.
[0068] In this step, the preset network model is trained using the multiple sets of color data obtained above and the segmentation positions corresponding to each set of color data, and the parameters in the network model are continuously adjusted until the loss function of the network model tends to converge, that is, the training results are close to or consistent with the actual segmentation positions.
[0069] For example, the network model can be any of the following (the following are examples):
[0070] BP neural network: BP neural network is a neural network learning algorithm. It is a hierarchical neural network composed of an input layer, an intermediate layer, and an output layer. The intermediate layer can be expanded to multiple layers. In order to reduce the error between the desired output and the actual output, the connection weights are corrected layer by layer from the output layer through each intermediate layer and back to the input layer. This process is repeated until the global error of the network tends to a given minimum value, that is, the learning process is completed.
[0071] Radial Basis Function Neural Network: RBF (Radial Basis Function, RBF) neural network is a neural network proposed in the late 1980s. It is a three-layer feedforward network with a single hidden layer.
[0072] Perceptron neural network: A perceptron neural network is a neural network with a single layer of computational neurons, and the transfer function of the network is a linear threshold unit;
[0073] Linear neural network: A linear neural network is a relatively simple neural network consisting of one or more linear neurons. It uses a linear function as the transfer function, so the output can be any value.
[0074] Convolutional Neural Networks (CNN): In convolutional neural networks, the convolution kernel is a very important part of the convolutional neural network. Each convolution kernel can learn a feature of the image, and finally a feature map is obtained by full connection.
[0075] Therefore, in this embodiment, the CNN model can be preferably used as a training model for the segmentation model.
[0076] The disclosed embodiments provide a video processing method that obtains multiple sets of color data and the segmentation positions corresponding to each set of color data. This method then trains a pre-set network model based on the multiple sets of color data and the corresponding segmentation positions, thereby generating a segmentation model. This technical solution trains the segmentation model based on the multiple sets of color data and the corresponding segmentation positions, providing an accurate basis for outputting the corresponding segmentation positions when a motion vector is subsequently input.
[0077] Based on the above embodiments, Figure 4 Schematic diagram of the video processing method provided in the embodiment of the present disclosure Figure 3 .like Figure 4 As shown, after step 21, the video processing method further includes:
[0078] Step 41: downsample the color data corresponding to the video frames in the video to be segmented to obtain downsampled color data;
[0079] In this step, since the color data corresponding to the video frames obtained above has a large amount of data or contains some unstable information that may affect the accuracy, the color data corresponding to all video frames may be downsampled.
[0080] Optionally, a GPU is used to implement downsampling processing of color data corresponding to all video frames.
[0081] As a possible implementation, the RGB data of all video frames can be loaded into the GPU memory, and the RGB data of each video frame can be downsampled using a GPU-accelerated image processing algorithm. This can be done by using pixel mean, maximum, or other filters to reduce the resolution of the image. The downsampled RGB data is then saved to the GPU memory or main memory for subsequent processing or output.
[0082] Step 42: Input the downsampled color data into the segmentation model to obtain the segmentation position corresponding to the video to be segmented.
[0083] In this step, the obtained color data after downsampling is input into the segmentation model, so that the segmentation model outputs the segmentation position corresponding to the video to be segmented, which can be at least one segmentation point determined in the above embodiment.
[0084] The disclosed embodiments provide a video processing method that downsamples the color data corresponding to video frames in a video to be segmented, obtaining the downsampled color data. This downsampled color data is then input into a segmentation model to obtain the segmentation positions corresponding to the video to be segmented. This technical solution reduces the density of the color data by downsampling the color data corresponding to the video frames, thereby reducing the amount of data, lowering computational complexity, and increasing the speed of obtaining the segmentation positions while ensuring the accuracy of the segmentation positions.
[0085] Based on the above method embodiment, Figure 5 A schematic diagram of the structure of a video processing device provided in an embodiment of the present disclosure is shown in FIG. Figure 5 As shown, the video processing device includes:
[0086] A determination unit 51 is configured to determine color data corresponding to video frames in the video to be segmented based on the video to be segmented;
[0087] The first processing unit 52 is configured to obtain a segmentation position corresponding to the video to be segmented based on color data corresponding to video frames in the video to be segmented, where a change in color data corresponding to adjacent video frames at the segmentation position is greater than a preset threshold;
[0088] The second processing unit 53 is configured to segment the video to be segmented according to the segmentation positions to obtain at least two video segments, wherein the video frames at the start and end positions of two adjacent video segments are adjacent in the video to be segmented.
[0089] According to one or more embodiments of the present disclosure, the first processing unit 52 is configured to:
[0090] The color data corresponding to the video frames in the video to be segmented are input into a pre-trained segmentation model to obtain the segmentation positions corresponding to the video to be segmented. The segmentation model is trained based on the color data and the segmentation positions corresponding to the color data.
[0091] According to one or more embodiments of the present disclosure, the determining unit 51 is configured to:
[0092] Perform frame processing on the video to be segmented to obtain video frames of the video to be segmented;
[0093] Extract the color data of the video frame to be segmented.
[0094] According to one or more embodiments of the present disclosure, after determining color data corresponding to video frames in the video to be segmented, the first processing unit 52 is further configured to:
[0095] Downsampling is performed on the color data corresponding to the video frames in the video to be segmented to obtain color data after downsampling.
[0096] According to one or more embodiments of the present disclosure, the first processing unit 52 is further configured to:
[0097] The downsampled color data is input into the segmentation model to obtain the segmentation position corresponding to the video to be segmented.
[0098] According to one or more embodiments of the present disclosure, the segmentation position is at least one segmentation point, and each segmentation point corresponds to a first video frame in the video to be segmented;
[0099] Accordingly, the second processing unit 53 is configured to:
[0100] The video to be segmented is segmented according to the at least one first video frame to obtain at least two video segments.
[0101] The video processing device provided in the embodiment of the present disclosure has technical solutions and technical effects similar to those in the above-mentioned embodiment, and will not be described in detail here.
[0102] In order to implement the above embodiment, the embodiment of the present disclosure further provides an electronic device. Figure 6 This is a schematic diagram of the structure of the electronic device provided in the embodiment of the present disclosure, with reference to Figure 6 , the electronic device may be a terminal device.
[0103] Among them, the terminal equipment may include but is not limited to mobile terminals such as mobile phones, laptops, digital broadcast receivers, personal digital assistants (PDAs), tablet computers (Portable Android Devices, PADs), portable multimedia players (PMPs), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., as well as fixed terminals such as digital TVs, desktop computers, etc. Figure 6 The electronic device shown is only an example and should not limit the functions and scope of use of the embodiments of the present disclosure.
[0104] like Figure 6 As shown, the electronic device may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 61, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 62 or a program loaded from a storage device 68 into a random access memory (RAM) 63. Various programs and data required for the operation of the electronic device are also stored in the RAM 63. The processing device 61, ROM 62, and RAM 63 are connected to each other via a bus 64. An input / output (I / O) interface 65 is also connected to the bus 64.
[0105] Typically, the following devices may be connected to the I / O interface 65: an input device 66 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 67 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 68 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 69. The communication device 69 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although Figure 6 The electronic device is shown with various devices, but it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed instead.
[0106] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network via the communication device 69, or installed from the storage device 68, or installed from the ROM 62. When the computer program is executed by the processing device 61, the above-mentioned functions defined in the method of the embodiment of the present disclosure are performed.
[0107] It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, device, or component. In the present disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof.
[0108] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0109] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device executes the method shown in the above embodiment.
[0110] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0111] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0112] The units involved in the embodiments described in this disclosure may be implemented in software or hardware. In some cases, the name of a unit does not limit the unit itself. For example, the first acquisition unit may also be described as a "unit for acquiring at least two Internet Protocol addresses."
[0113] The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, and without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.
[0114] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0115] In a first aspect, according to one or more embodiments of the present disclosure, a video processing method is provided, including:
[0116] Determining color data corresponding to video frames in the video to be segmented according to the video to be segmented;
[0117] Obtaining a segmentation position corresponding to the video to be segmented based on color data corresponding to video frames in the video to be segmented, wherein a change in color data corresponding to adjacent video frames at the segmentation position is greater than a preset threshold;
[0118] The video to be segmented is segmented according to the segmentation positions to obtain at least two video segments, and the video frames at the start and end positions of two adjacent video segments are adjacent in the video to be segmented.
[0119] According to one or more embodiments of the present disclosure, obtaining the segmentation position corresponding to the video to be segmented based on the color data corresponding to the video frame in the video to be segmented includes:
[0120] The color data corresponding to the video frames in the video to be segmented are input into a pre-trained segmentation model to obtain the segmentation positions corresponding to the video to be segmented. The segmentation model is trained based on the color data and the segmentation positions corresponding to the color data.
[0121] According to one or more embodiments of the present disclosure, determining color data corresponding to video frames in the video to be segmented according to the video to be segmented includes:
[0122] Performing frame processing on the video to be segmented to obtain video frames of the video to be segmented;
[0123] Extract color data of the video frame of the video to be segmented.
[0124] According to one or more embodiments of the present disclosure, after determining color data corresponding to video frames in the video to be segmented based on the video to be segmented, the method further includes:
[0125] Downsampling is performed on the color data corresponding to the video frames in the video to be segmented to obtain color data after downsampling.
[0126] According to one or more embodiments of the present disclosure, the method further includes:
[0127] The color data after downsampling is input into the segmentation model to obtain the segmentation position corresponding to the video to be segmented.
[0128] According to one or more embodiments of the present disclosure, the segmentation position is at least one segmentation point, and each segmentation point corresponds to the first video frame in the video to be segmented;
[0129] Accordingly, the video to be segmented is segmented according to the segmentation position to obtain at least two video segments, including:
[0130] The video to be segmented is segmented according to at least one first video frame to obtain the at least two video segments.
[0131] In a second aspect, according to one or more embodiments of the present disclosure, a video processing device is provided, including:
[0132] a determining unit, configured to determine color data corresponding to video frames in the video to be segmented based on the video to be segmented;
[0133] A first processing unit is configured to obtain a segmentation position corresponding to the video to be segmented based on color data corresponding to video frames in the video to be segmented, wherein a change in color data corresponding to adjacent video frames at the segmentation position is greater than a preset threshold;
[0134] The second processing unit is configured to segment the video to be segmented according to the segmentation positions to obtain at least two video segments, wherein the video frames at the start and end positions of two adjacent video segments are adjacent in the video to be segmented.
[0135] According to one or more embodiments of the present disclosure, the first processing unit is configured to:
[0136] The color data corresponding to the video frames in the video to be segmented are input into a pre-trained segmentation model to obtain the segmentation positions corresponding to the video to be segmented. The segmentation model is trained based on the color data and the segmentation positions corresponding to the color data.
[0137] According to one or more embodiments of the present disclosure, the determining unit is configured to:
[0138] Performing frame processing on the video to be segmented to obtain video frames of the video to be segmented;
[0139] Extract color data of the video frame of the video to be segmented.
[0140] According to one or more embodiments of the present disclosure, after determining color data corresponding to video frames in the video to be segmented based on the video to be segmented, the first processing unit is further configured to:
[0141] Downsampling is performed on the color data corresponding to the video frames in the video to be segmented to obtain color data after downsampling.
[0142] According to one or more embodiments of the present disclosure, the first processing unit is further configured to:
[0143] The color data after downsampling is input into the segmentation model to obtain the segmentation position corresponding to the video to be segmented.
[0144] According to one or more embodiments of the present disclosure, the segmentation position is at least one segmentation point, and each segmentation point corresponds to the first video frame in the video to be segmented;
[0145] Accordingly, the second processing unit is configured to:
[0146] The video to be segmented is segmented according to at least one first video frame to obtain the at least two video segments.
[0147] In a third aspect, according to one or more embodiments of the present disclosure, there is provided an electronic device, comprising: at least one processor and a memory;
[0148] The memory stores computer-executable instructions;
[0149] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the video processing method described in the first aspect and various possible designs of the first aspect.
[0150] In a fourth aspect, according to one or more embodiments of the present disclosure, a computer-readable storage medium is provided, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the video processing method described in the first aspect and various possible designs of the first aspect is implemented.
[0151] In a fifth aspect, according to one or more embodiments of the present disclosure, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the video processing method described in the first aspect and various possible designs of the first aspect is implemented.
[0152] The above description is merely a preferred embodiment of the present disclosure and an illustration of the technical principles employed. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by the specific combination of the above-mentioned technical features, but also includes other technical solutions formed by any combination of the above-mentioned technical features or their equivalents without departing from the above-mentioned disclosed concepts. For example, a technical solution formed by replacing the above-mentioned features with (but not limited to) technical features with similar functions disclosed in this disclosure.
[0153] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details have been included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0154] Although the subject matter has been described in language specific to structural features and / or methodological logical acts, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are merely example forms of implementing the claims.
Claims
1. A video processing method, characterized in that: include: Determining color data corresponding to video frames in the video to be segmented according to the video to be segmented; Obtaining a segmentation position corresponding to the video to be segmented based on color data corresponding to video frames in the video to be segmented, wherein a change in color data corresponding to adjacent video frames at the segmentation position is greater than a preset threshold; The video to be segmented is segmented according to the segmentation positions to obtain at least two video segments, and the video frames at the start and end positions of two adjacent video segments are adjacent in the video to be segmented.
2. The method according to claim 1, characterized in that The step of obtaining a segmentation position corresponding to the video to be segmented according to color data corresponding to a video frame in the video to be segmented includes: The color data corresponding to the video frames in the video to be segmented are input into a pre-trained segmentation model to obtain the segmentation positions corresponding to the video to be segmented. The segmentation model is trained based on the color data and the segmentation positions corresponding to the color data.
3. The method according to claim 1 or 2, characterized in that The step of determining color data corresponding to video frames in the video to be segmented according to the video to be segmented includes: Performing frame processing on the video to be segmented to obtain video frames of the video to be segmented; Extract color data of the video frame of the video to be segmented.
4. The method according to claim 2, characterized in that After determining color data corresponding to video frames in the video to be segmented according to the video to be segmented, the method further includes: Downsampling is performed on the color data corresponding to the video frames in the video to be segmented to obtain color data after downsampling.
5. The method according to claim 4, characterized in that The method further comprises: The color data after downsampling is input into the segmentation model to obtain the segmentation position corresponding to the video to be segmented.
6. The method according to claim 1 or 2, characterized in that The segmentation position is at least one segmentation point, and each segmentation point corresponds to the first video frame in the video to be segmented; Accordingly, the video to be segmented is segmented according to the segmentation position to obtain at least two video segments, including: The video to be segmented is segmented according to at least one first video frame to obtain the at least two video segments.
7. A video processing device, characterized in that: include: a determining unit, configured to determine color data corresponding to video frames in the video to be segmented based on the video to be segmented; A first processing unit is configured to obtain a segmentation position corresponding to the video to be segmented based on color data corresponding to video frames in the video to be segmented, wherein a change in color data corresponding to adjacent video frames at the segmentation position is greater than a preset threshold; The second processing unit is configured to segment the video to be segmented according to the segmentation positions to obtain at least two video segments, wherein the video frames at the start and end positions of two adjacent video segments are adjacent in the video to be segmented.
8. An electronic device, characterized in that: include: processor and memory; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the video processing method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions. When a processor executes the computer-executable instructions, the video processing method according to any one of claims 1 to 6 is implemented.
10. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the video processing method according to any one of claims 1 to 6 is implemented.