Video processing method and device, equipment and storage medium
By dividing the video into frames per second and reusing storage addresses or storing pixel differences, the problem of insufficient storage space reduction after video compression is solved, resulting in significant storage space savings.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- TENCENT TECHNOLOGY (SHENZHEN) CO LTD
- Filing Date
- 2024-12-04
- Publication Date
- 2026-06-05
AI Technical Summary
Existing technologies still require storing large amounts of data separately after video compression, failing to effectively reduce storage space.
The video is divided into frames per second. The same video frame is reused at the storage address of its first occurrence, or the pixel difference between the first and nth video frames of each video segment is stored, where n is greater than 1 and less than or equal to N.
It effectively reduces video storage space, saving a significant amount of storage space.
Smart Images

Figure CN122160559A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of audio and video technology, and in particular to video processing methods, apparatus, devices and storage media. Background Technology
[0002] With the gradual expansion of network infrastructure and the widespread adoption of various smart terminals, people are able to watch higher-definition and richer videos. Videos that are shot or produced need to be saved, and saving videos requires a significant amount of storage space.
[0003] To save video storage space, the most common method is video compression. Video compression specifically uses different encoding and compression algorithms to reduce the size of video files by utilizing redundant information in the video, while maintaining acceptable video quality.
[0004] However, even after video compression, each video still requires separate storage of a large amount of data. How to reduce the storage space of videos is an urgent problem to be solved. Summary of the Invention
[0005] This application provides a video processing method, apparatus, device, and storage medium that can effectively reduce video storage space.
[0006] Firstly, a video processing method is provided, including:
[0007] The first video is divided into segments per second to obtain multiple video segments;
[0008] Based on the frame rate per second of the first video, each video segment is divided into frames to obtain multiple video frames. The multiple video frames include N video frames corresponding to each video segment, where N is equal to the frame rate per second.
[0009] The plurality of video frames may be stored according to a first method or a second method. The first method includes storing the plurality of video frames sequentially, with the same video frame reusing the storage address of the first video frame it appears in. The second method includes storing the first video frame of each video segment and the pixel difference between the first video frame and the nth video frame in each video segment sequentially, where n is greater than 1 and less than or equal to N.
[0010] Secondly, a video processing method is provided, including:
[0011] Receive multiple video frames and the identifier of the first video corresponding to the multiple video frames. The multiple video frames are obtained by dividing the first video into segments per second, and then dividing each video segment into frames according to the frame rate of the first video per second. The multiple video frames include N video frames corresponding to each video segment, where N is equal to the frame rate per second.
[0012] The storage method of the plurality of video frames is obtained. The plurality of video frames are stored according to a first method or a second method. The first method includes: storing the plurality of video frames sequentially, and reusing the storage address of the first video frame when the same video frame appears. The second method includes: when storing the N video frames corresponding to each video segment, storing the first video frame of each video segment and the pixel difference between the first video frame and the nth video frame sequentially, where n is greater than 1 and less than or equal to N.
[0013] Based on the storage method of the multiple video frames, the multiple video frames are obtained, and the multiple video frames are encoded and synthesized to obtain the first video.
[0014] Thirdly, a video processing apparatus is provided, comprising:
[0015] The processing module is used to segment the first video into multiple video segments by dividing it into segments per second.
[0016] The processing module is further configured to: divide each video segment into frames according to the frame rate per second of the first video to obtain multiple video frames, wherein the multiple video frames include N video frames corresponding to each video segment, and N is equal to the frame rate per second;
[0017] A storage module is configured to store the plurality of video frames according to a first method or a second method. The first method includes storing the plurality of video frames sequentially, with identical video frames reusing the storage address of the first video frame they appear in. The second method includes storing the first video frame of each video segment and the pixel difference between the first video frame and the nth video frame when storing the N video frames corresponding to each video segment, wherein n is greater than 1 and less than or equal to N.
[0018] In one embodiment, the processing module is further configured to:
[0019] Before dividing each video segment into frames based on the first video's frame rate per second, the metadata of the first video is obtained. The metadata includes the first video's frame rate per second or the first video's video frame separator, which is preset based on the first video's frame rate per second.
[0020] In one embodiment, the processing module is specifically used for:
[0021] If the metadata includes the number of frames per second of the first video, each video segment is divided into frames according to the number of frames per second of the first video.
[0022] If the metadata includes the video frame separator of the first video, then each video segment is segmented according to the video frame separator of the first video.
[0023] In one embodiment, the storage module is used for:
[0024] For each of the plurality of video frames, obtain the hash value of the video frame;
[0025] Add a mapping relationship between the identifier of the video frame and the hash value of the video frame to the first mapping table;
[0026] If the hash value of the video frame is not found in the second mapping table between hash values and storage addresses of video frames, then a storage address is allocated to the video frame, the mapping relationship between the hash value of the video frame and the storage address of the video frame is added to the second mapping table, and the video frame is stored according to the storage address.
[0027] If the hash value of the video frame is found in the second mapping table, the video frame is not stored.
[0028] In one embodiment, the storage module is specifically used to: calculate the hash value of the video frame using a secure hash algorithm.
[0029] In one embodiment, the storage module is used for:
[0030] For each video segment, which corresponds to N video frames, obtain the first video frame from the N video frames.
[0031] Calculate the pixel difference between each video frame from the second video frame to the Nth video frame and the first video frame in sequence;
[0032] Allocate N storage addresses, and according to the N storage addresses, store the first video frame and the pixel difference between the nth video frame and the first video frame in sequence.
[0033] Fourthly, a video processing apparatus is provided, comprising:
[0034] The receiving module is used to receive multiple video frames and the identifier of the first video corresponding to the multiple video frames. The multiple video frames are obtained by dividing the first video into segments per second, and then dividing each video segment into frames according to the frame rate of the first video per second. The multiple video frames include N video frames corresponding to each video segment, where N is equal to the frame rate per second.
[0035] The acquisition module is used to acquire the storage method of the plurality of video frames. The plurality of video frames are stored according to a first method or a second method. The first method includes: storing the plurality of video frames sequentially, and reusing the storage address of the first video frame when the same video frame appears. The second method includes: when storing N video frames corresponding to each video segment, storing the first video frame of each video segment and the pixel difference between the first video frame and the nth video frame sequentially, where n is greater than 1 and less than or equal to N.
[0036] The processing module is used to acquire the multiple video frames based on the storage method of the multiple video frames, and to encode and synthesize the multiple video frames to obtain the first video.
[0037] In one embodiment, the processing module is used to:
[0038] If the storage method of the plurality of video frames is the first method, according to the identifier of the first video, a first mapping table and a second mapping table corresponding to the first video are obtained. The first mapping table is the mapping relationship between the identifier of the video frame and the hash value of the video frame, and the second mapping table is the mapping relationship between the hash value of the video frame and the storage address of the video frame.
[0039] Each video frame among the plurality of video frames is obtained according to the first mapping table and the second mapping table.
[0040] In one embodiment, the processing module is specifically used for:
[0041] For each of the plurality of video frames, the hash value of the video frame is looked up from the first mapping table based on the identifier of the video frame;
[0042] The storage address of the video frame is looked up from the second mapping table based on the hash value of the video frame;
[0043] The video frame is obtained based on its storage address.
[0044] In one embodiment, the processing module is used to:
[0045] If the storage method of the multiple video frames is the second method, the storage address of each video segment after the first video is segmented is obtained according to the identifier of the first video. The storage address of each video segment includes the storage addresses of the N video frames corresponding to each video segment.
[0046] For each video segment with N video frames, based on the storage addresses of the N video frames, obtain the first video frame among the N video frames and the pixel difference between the nth video frame and the first video frame;
[0047] The second to Nth video frames are synthesized sequentially based on the pixel differences between the first video frame and the nth video frame and the first video frame.
[0048] Fifthly, a video processing apparatus is provided, comprising: a processor and a memory for storing a computer program, the processor for calling and running the computer program stored in the memory to perform the methods of the first or second aspect.
[0049] In a sixth aspect, a computer-readable storage medium is provided for storing a computer program that causes a computer to perform the methods described in the first or second aspect.
[0050] In a seventh aspect, a computer program product is provided, including computer program instructions that cause a computer to perform the methods as described in the first or second aspect.
[0051] In summary, this embodiment of the application first segments the first video per second to obtain multiple video segments, and then divides each video segment into frames according to the number of frames per second (N) of the first video to obtain multiple video frames. These multiple video frames include N video frames corresponding to each video segment, and each video frame corresponds to a still image. During storage, identical video frames reuse the storage address of the first video frame they appear in, meaning that identical video frames are stored only once. At the video frame level, many videos contain completely identical frame images, thus effectively reducing video storage space. Alternatively, when storing the N video frames corresponding to each video segment, the first video frame of each video segment and the pixel difference between the nth video frame and the first video frame can be stored sequentially, where n is greater than 1 and less than or equal to N. This also effectively reduces video storage space. Attached Figure Description
[0052] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0053] Figure 1 This is a schematic block diagram of a video encoding and decoding system according to an embodiment of this application;
[0054] Figure 2 This is a schematic diagram illustrating an application scenario of the video processing method provided in the embodiments of this application;
[0055] Figure 3 A flowchart illustrating a video processing method provided in an embodiment of this application;
[0056] Figure 4 A flowchart illustrating a video processing method provided in an embodiment of this application;
[0057] Figure 5 A flowchart illustrating a video processing method provided in an embodiment of this application;
[0058] Figure 6 A flowchart illustrating a video processing method provided in an embodiment of this application;
[0059] Figure 7 This is a schematic diagram of the structure of a video processing apparatus provided in an embodiment of this application;
[0060] Figure 8 This is a schematic diagram of another video processing apparatus provided in an embodiment of this application;
[0061] Figure 9 This is a schematic block diagram of the electronic device 30 provided in the embodiments of this application. Detailed Implementation
[0062] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0063] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or server that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or devices.
[0064] The solution provided in this application relates to video encoding and decoding technologies. Video encoding is a method of converting a file in an original video format into a file in another video format through video compression technology; the converted data can be called a bitstream. Video decoding is the reverse process of video encoding. The solution in this application can be combined with audio video coding standards (AVS), such as H.264 / Advanced Video Coding (AVC), H.265 / High Efficiency Video Coding (HEVC), H.266 / Versatile Video Coding (VVC), and other video coding standards.
[0065] To facilitate understanding, let's first combine... Figure 1 The video encoding and decoding system involved in the embodiments of this application will be described.
[0066] Figure 1 This is a schematic block diagram of a video encoding and decoding system according to an embodiment of this application. Figure 1 As shown, the video encoding / decoding system 100 includes an encoding device 110 and a decoding device 120. The encoding device encodes (can be understood as compressing) video data to generate a bitstream and transmits the bitstream to the decoding device. The decoding device decodes the bitstream generated by the encoding device to obtain the decoded video data.
[0067] The encoding device 110 in this application embodiment is a device with video encoding function, and the decoding device 120 is a device with video decoding function. The encoding device 110 and the decoding device 120 include, for example, smartphones, desktop computers, mobile computing devices, laptops (e.g., laptop computers), tablet computers, set-top boxes, televisions, cameras, display devices, digital media players, video game consoles, in-vehicle computers, etc.
[0068] In some embodiments, the encoding device 110 can transmit the encoded video data (such as a bitstream) to the decoding device 120 via a network. The network can be an intranet, the Internet, Global System for Mobile communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G network, Bluetooth, Wi-Fi, voice communication network, or other wireless or wired networks.
[0069] In some embodiments, the encoding device 110 includes a video encoder 112 and an output interface 113. The output interface 113 may include a modulator / demodulator (modem) and / or a transmitter. Optionally, the encoding device 110 may also include a video source 111. The video source 111 may include at least one of a video acquisition device (e.g., a camera), a video archive, a video input interface, and a computer graphics system, wherein the video input interface is used to receive video data from a video content provider, and the computer graphics system is used to generate the video data.
[0070] Video encoder 112 encodes video data from video source 111 to generate a bitstream. The video data may include one or more pictures or a sequence of pictures. The bitstream contains the encoded information of the pictures or the sequence of pictures in the form of a bitstream.
[0071] The video encoder 112 transmits the encoded video data directly to the decoding device 120 via the output interface 113. Optionally, the encoded video data can also be stored on a storage medium or a storage server for later retrieval by the decoding device 120.
[0072] In some embodiments, the decoding device 120 includes an input interface 121 and a video decoder 122. Optionally, the decoding device 120 may also include a display device 123. The input interface 121 includes a receiver and / or a modem. The input interface 121 can receive encoded video data via a channel.
[0073] The video decoder 122 decodes the encoded video data to obtain decoded video data and transmits the decoded video data to the display device 123. The display device 123 displays the decoded video data. The display device 123 can be integrated with the decoding device 120 or external to the decoding device 120. The display device 123 may include various display devices, such as liquid crystal displays (LCDs), plasma displays, organic light-emitting diode displays (OLEDs), or other types of display devices.
[0074] Below, through Figure 2 The application scenarios of the embodiments of this application will be introduced.
[0075] Figure 2 This is a schematic diagram illustrating an application scenario of the video processing method provided in the embodiments of this application, such as... Figure 2 As shown, terminal device 21 can communicate with server 11. Server 11 can be any independent physical server, or a cloud server providing basic cloud services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, and big data and artificial intelligence platforms. It can also be a server cluster or distributed system composed of multiple physical servers. This application embodiment does not limit this. Server 11 may include an encoding module for video encoding. The encoding module may include hardware devices / software code for compressing analog audio and video signals into encoded data (encoded files).
[0076] Terminal devices refer to a class of devices that possess rich human-computer interaction methods, have internet access capabilities, typically run various operating systems, and have strong processing capabilities. Terminal devices can be smartphones, living room TVs, tablets, in-vehicle terminals, game consoles such as handheld game consoles, etc., but are not limited to these. Terminal device 21 may include a decoding module for video decoding, which may include hardware devices / software code for converting encoded data (or encoded files) into analog audio and video signals.
[0077] like Figure 2 As shown, terminal device 21 can send a video playback request to server 11. In response to the video playback request, server 11 can send a video stream to terminal device 21. Optionally, server 11 can generate the video stream as an encoding device, or receive and save the video stream from an encoding device. After receiving the video stream, terminal device 21 can decode and display it.
[0078] In this embodiment, the terminal device 21 can be a device with basic video playback capabilities, such as a smartphone, tablet computer, desktop computer, and smart TV. Optionally, a video playback client (or video player) is installed and running on the terminal device 21, and the video playback client can be an application running on the terminal device 21.
[0079] It should be understood that Figure 2 An exemplary terminal device and a server are shown, but in practice, other numbers of terminal devices and servers may be included, and this application does not limit this.
[0080] In related technologies, video compression is used to reduce the size of video files in order to save video storage space. However, after video compression, each video still needs to store a large amount of data separately, and the storage space reduction achieved by video compression is limited.
[0081] To address this issue, embodiments of this application provide a video processing method, apparatus, device, and storage medium. By dividing the video into frames according to the number of frames per second (fps), multiple video frames are obtained, each corresponding to a still image. During storage, identical video frames reuse the storage address of the first video frame they appear in, meaning that identical video frames are stored only once. At the video frame level, many videos contain completely identical frame images, thus effectively reducing video storage space. Alternatively, when storing N video frames corresponding to each video segment, the first video frame of each segment and the pixel difference between the nth and first video frames are stored sequentially, which also effectively reduces video storage space.
[0082] The technical solutions of the embodiments of this application will be described in detail below:
[0083] Figure 3 This is a flowchart illustrating a video processing method provided in an embodiment of this application. This method can be executed by any electronic device with data processing capabilities, such as a server. Figure 3 As shown, the method may include:
[0084] S101. Divide the first video into segments per second to obtain multiple video segments.
[0085] Specifically, when storing the first video, the first video is first divided into segments according to the second, resulting in multiple video segments. For example, if the first video is a 35-second video, it is divided into 35 video segments according to the second.
[0086] S102. Based on the frame rate per second of the first video, divide each video segment into frames to obtain multiple video frames. The multiple video frames include N video frames corresponding to each video segment, where N is equal to the frame rate per second.
[0087] Specifically, the frame rate of a video can be 30fps or 60fps. In the field of image processing, frame rate usually refers to the number of frames in an animation or video. Frame rate (fps) is a measure of the amount of information used to store and display dynamic video. Frame rate is also known as the number of frames transmitted per second.
[0088] Each video segment is 1 second long. Based on the frame rate of the first video, each video segment is divided into frames. For example, if the frame rate of the first video is N, then each video segment can be divided into N video frames. After framing, a 1-second video corresponds to N video frames.
[0089] Optionally, in this embodiment of the application, before S101, the following may also be included:
[0090] S104. Obtain the metadata of the first video. The metadata includes the frame rate per second of the first video or the video frame separator of the first video. The video frame separator of the first video is preset according to the frame rate per second of the first video.
[0091] Specifically, the first video carries metadata, which includes the number of frames per second of the first video or the video frame separator of the first video. It may also include the number of frames per second of the first video or the video frame separator of the first video. The video frame separator is used to divide the video into video frames, and it is preset according to the number of frames per second of the first video. If the metadata includes the video frame separator of the first video, then each video segment is divided into frames according to the video frame separator of the first video.
[0092] As one feasible approach, in S102, each video segment is divided into frames based on the frame rate per second of the first video. Specifically, this can be done as follows:
[0093] S1021. If the metadata includes the number of frames per second of the first video, then each video segment is divided into frames according to the number of frames per second of the first video.
[0094] S1022. If the metadata includes the video frame separator of the first video, then each video segment is divided according to the video frame separator of the first video.
[0095] Specifically, segmenting each video segment based on the frame rate per second (fps) of the first video and the video frame delimiter yields the same result, because the video frame delimiter for the first video is pre-set based on the fps of the first video. When segmenting each video segment based on the fps of the first video, the duration of the segmented video frames needs to be calculated. Segmenting each video segment based on the video frame delimiter of the first video is more convenient, as segmentation can be performed directly based on the video frame delimiter.
[0096] Taking a video with a frame rate of 30fps as an example, each video segment is divided into frames based on the frame rate of the first video. Each video frame is 1 second long. The 1-second video is divided into 30 video frames. The duration of each video frame is 1000 milliseconds / 30, which is approximately 33.33 milliseconds.
[0097] Taking a video with a frame rate of 60fps as an example, each video segment is divided into frames based on the frame rate of the first video. Each video frame is 1 second long. The 1-second video is divided into 60 video frames. The duration of each video frame is 1000 milliseconds / 60, which is approximately 16.67 milliseconds.
[0098] S103. Store multiple video frames according to the first method, or store multiple video frames according to the second method. The first method includes: storing multiple video frames sequentially, with the same video frame reusing the storage address of the first video frame. The second method includes: when storing N video frames corresponding to each video segment, storing the first video frame of each video segment and the pixel difference between the nth video frame and the first video frame sequentially, where n is greater than 1 and less than or equal to N.
[0099] Specifically, according to the first method, the multiple video frames obtained after segmentation can be stored sequentially. For the same video frames, the storage address of the first video frame is reused. That is, for the same multiple video frames, only the first video frame that appears is stored, and the storage address of the first video frame is reused for subsequent video frames. This can effectively reduce the video storage space and save a lot of video storage space.
[0100] When storing multiple video frames according to the second method, specifically when storing the N video frames corresponding to each video segment, the pixel differences between the first and nth video frames and the first video frame are stored sequentially, where n is greater than 1 and less than or equal to N. The process involves storing the first video frame, then the pixel differences between the second and third video frames and the first video frame, and so on, until the pixel difference between the Nth and the first video frame is reached. Compared to storing all video frames, this effectively reduces the video storage space and significantly saves storage capacity.
[0101] Optionally, as an implementable method, multiple video frames are stored in S103 according to the first method, specifically:
[0102] S1031. For each video frame in the multiple video frames, obtain the hash value of the video frame.
[0103] Specifically, there are multiple ways to calculate the hash value of a video frame. The different calculation methods differ in computational performance and collision rate. To calculate the hash value of a video frame, the same video frame will have the same hash value, while different video frames will have different hash values.
[0104] Optionally, the hash value of the video frame can be obtained, specifically by calculating the hash value of the video frame using a secure hashing algorithm.
[0105] S1032. Add a mapping relationship between the identifier of the video frame and the hash value of the video frame to the first mapping relationship table.
[0106] Specifically, the first mapping table stores the mapping relationship between the identifier of a video frame and the hash value of the video frame. For example, if the hash value of a video frame is calculated to be "f9a7d07fe7f64bcd12905754a4c3f32096889cdfc2fac9afceaca1cfd42f42de", the mapping relationship between the identifier of the video frame and the hash value of the video frame is added to the first mapping table.
[0107] S1033. If the hash value of the video frame is not found in the second mapping table between the hash value and the storage address of the video frame, then a storage address is allocated to the video frame, the mapping relationship between the hash value of the video frame and the storage address of the video frame is added to the second mapping table, and the video frame is stored according to the storage address.
[0108] Specifically, the second mapping table stores the mapping relationship between hash values and the storage addresses of video frames. Both the first and second mapping tables can be stored in memory. The second mapping table is retrieved from memory, and the calculated hash value of the video frame is searched within it. If not found, it indicates that the video frame is being stored for the first time, so a storage address is allocated to it. The mapping relationship between the hash value and the storage address of the video frame is added to the second mapping table, and the video frame is stored according to the storage address. For example, f9a7d07fe7f64bcd12905754a4c3f32096889cdfc2fac9afceaca1cfd42f42de: storage address 1 is added to the second mapping table.
[0109] S1034. If the hash value of a video frame is found in the second mapping table, the video frame is not stored.
[0110] Specifically, if the hash value of the video frame is found in the second mapping table, it means that the video frame has been stored before, and the video frame will not be stored again. Since the second mapping table already has a mapping relationship between the hash value and the storage address of the same video frame, the storage address of the video frame can be found according to the mapping relationship between the identifier and the hash value of the video frame stored in the first mapping table and according to the second mapping table. The same video frame reuses the same storage address, thereby saving video storage space.
[0111] Optionally, as another implementable method, multiple video frames are stored in S103 according to the first method, specifically:
[0112] S1031' For each video segment, obtain the first video frame from the N video frames.
[0113] Specifically, each video segment is 1 second long. For example, if the first video has a frame rate of 30fps, then each video segment corresponds to 30 video frames. For each video segment, the first video frame is obtained from the 30 video frames.
[0114] S1032' Calculate the pixel difference between each video frame from the 2nd to the Nth video frame and the 1st video frame.
[0115] For example, if N is 30, calculate the pixel difference between the 2nd video frame and the 1st video frame, calculate the pixel difference between the 3rd video frame and the 1st video frame, ..., calculate the pixel difference between the 30th video frame and the 1st video frame.
[0116] S1033': Allocate N storage addresses, and according to the N storage addresses, store the first video frame and the pixel difference between the nth video frame and the first video frame in sequence.
[0117] Specifically, for example, if N is 30, 30 storage addresses are allocated to sequentially store the pixel differences between the first and 30th video frames and the first video frame. For example, if the first video frame has 250 pixels and the second video frame has 255 pixels, and the pixel difference between the second and first video frames is 5, then the second video frame will store the pixel difference of 5.
[0118] In this embodiment, since the difference between each second of video is not significant, each video segment only stores the difference between the first frame and other video frames and the first frame. Therefore, the storage method of this embodiment can effectively reduce the video storage space and save a large amount of video storage space.
[0119] The video processing method provided in this embodiment first segments the first video according to the number of frames per second (N) to obtain multiple video segments. Then, each video segment is divided into multiple video frames according to the number of frames per second (N) of the first video. Each video frame corresponds to one still image. During storage, identical video frames reuse the storage address of the first video frame they appear in, meaning that identical video frames are stored only once. At the video frame level, many videos contain completely identical frame images, thus effectively reducing video storage space. Alternatively, when storing the N video frames corresponding to each video segment, the first video frame of each segment and the pixel difference between the first and nth video frames are stored sequentially, where n is greater than 1 and less than or equal to N. This also effectively reduces video storage space, significantly saving video storage space.
[0120] The following is combined with Figure 4 and Figure 5 The video processing process is explained in detail using two specific implementation examples.
[0121] Figure 4 This is a flowchart illustrating a video processing method provided in an embodiment of this application. This method can be executed by any electronic device with data processing capabilities, such as a server. Figure 4 As shown, the method may include:
[0122] S201. Divide the first video into segments per second to obtain multiple video segments.
[0123] Specifically, when storing the first video, the first video is first divided into segments according to the second, resulting in multiple video segments. For example, if the first video is a 35-second video, it is divided into 35 video segments according to the second.
[0124] S202. Obtain the metadata of the first video. The metadata includes the frame rate per second of the first video or the video frame separator of the first video. The video frame separator of the first video is preset according to the frame rate per second of the first video.
[0125] S203. Based on the frame rate per second of the first video, divide each video segment into frames to obtain multiple video frames. The multiple video frames include N video frames corresponding to each video segment, where N is equal to the frame rate per second.
[0126] As one feasible approach, in S203, each video segment is divided into frames based on the frame rate per second of the first video. Specifically, this can be done as follows:
[0127] S2031. If the metadata includes the frame rate per second of the first video, then each video segment is divided into frames according to the frame rate per second of the first video.
[0128] S2032. If the metadata includes the video frame separator of the first video, then each video segment is divided according to the video frame separator of the first video.
[0129] Specifically, segmenting each video segment based on the frame rate per second (fps) of the first video and the video frame delimiter yields the same result, because the video frame delimiter for the first video is pre-set based on the fps of the first video. When segmenting each video segment based on the fps of the first video, the duration of the segmented video frames needs to be calculated. Segmenting each video segment based on the video frame delimiter of the first video is more convenient, as segmentation can be performed directly based on the video frame delimiter.
[0130] S204. For each video frame in the multiple video frames, obtain the hash value of the video frame.
[0131] Specifically, there are multiple ways to calculate the hash value of a video frame. The different calculation methods differ in computational performance and collision rate. To calculate the hash value of a video frame, the same video frame will have the same hash value, while different video frames will have different hash values.
[0132] Optionally, the hash value of the video frame can be obtained, specifically by calculating the hash value of the video frame using a secure hashing algorithm.
[0133] S205. Add a mapping relationship between the identifier of the video frame and the hash value of the video frame to the first mapping relationship table.
[0134] S206. Look up the hash value of the video frame in the second mapping table between hash values and the storage address of the video frame.
[0135] If found, the process ends; otherwise, proceed to step S207.
[0136] S207. Allocate storage addresses for video frames, add a mapping relationship between the hash value of the video frame and the storage address of the video frame to the second mapping table, and store the video frame according to the storage address.
[0137] In this embodiment, optionally, in one embodiment, S201 may not be executed, that is, the first video may not be segmented, and S202-S207 may be executed directly.
[0138] The video processing method provided in this embodiment first divides the first video into segments per second to obtain multiple video segments. Then, each video segment is divided into frames according to the number of frames per second (N) of the first video to obtain multiple video frames. The multiple video frames include N video frames corresponding to each video segment. Each video frame corresponds to a still image. During storage, the storage address of the first video frame that appears is reused. That is, the same video frame is only stored once. At the video frame level, a large number of videos have completely identical frame images, thus effectively reducing the video storage space.
[0139] Figure 5 This is a flowchart illustrating a video processing method provided in an embodiment of this application. This method can be executed by any electronic device with data processing capabilities, such as a server. Figure 5 As shown, the method may include:
[0140] S301. Divide the first video into segments per second to obtain multiple video segments.
[0141] Specifically, when storing the first video, the first video is first divided into segments according to the second, resulting in multiple video segments. For example, if the first video is a 35-second video, it is divided into 35 video segments according to the second.
[0142] S302. Obtain the metadata of the first video. The metadata includes the frame rate per second of the first video or the video frame separator of the first video. The video frame separator of the first video is preset according to the frame rate per second of the first video.
[0143] S303. Based on the frame rate per second of the first video, divide each video segment into frames to obtain multiple video frames. The multiple video frames include N video frames corresponding to each video segment, where N is equal to the frame rate per second.
[0144] As one feasible approach, in S303, each video segment is divided into frames based on the frame rate per second of the first video. Specifically, this can be done as follows:
[0145] S3031. If the metadata includes the frame rate per second of the first video, then each video segment is divided into frames according to the frame rate per second of the first video.
[0146] S3032. If the metadata includes the video frame separator of the first video, then each video segment is divided according to the video frame separator of the first video.
[0147] Specifically, segmenting each video segment based on the frame rate per second (fps) of the first video and the video frame delimiter yields the same result, because the video frame delimiter for the first video is pre-set based on the fps of the first video. When segmenting each video segment based on the fps of the first video, the duration of the segmented video frames needs to be calculated. Segmenting each video segment based on the video frame delimiter of the first video is more convenient, as segmentation can be performed directly based on the video frame delimiter.
[0148] S304. For each video segment, which corresponds to N video frames, obtain the first video frame from the N video frames.
[0149] Specifically, each video segment is 1 second long. For example, if the first video has a frame rate of 30fps, then each video segment corresponds to 30 video frames. For each video segment, the first video frame is obtained from the 30 video frames.
[0150] S305. Calculate the pixel difference between each video frame from the 2nd to the Nth video frame and the 1st video frame.
[0151] For example, if N is 30, calculate the pixel difference between the 2nd video frame and the 1st video frame, calculate the pixel difference between the 3rd video frame and the 1st video frame, ..., calculate the pixel difference between the 30th video frame and the 1st video frame.
[0152] S306. Allocate N storage addresses, and according to the N storage addresses, store the first video frame and the pixel difference between the nth video frame and the first video frame in sequence.
[0153] Specifically, for example, if N is 30, 30 storage addresses are allocated to sequentially store the pixel differences between the first and 30th video frames and the first video frame. For example, if the first video frame has 250 pixels and the second video frame has 255 pixels, and the pixel difference between the second and first video frames is 5, then the second video frame will store the pixel difference of 5.
[0154] In this embodiment, since the difference between each second of video is not significant, each video segment only stores the difference between the first frame and other video frames and the first frame. Therefore, the storage method of this embodiment can effectively reduce the video storage space and save a large amount of video storage space.
[0155] The video processing method described in this embodiment can be used by a server when storing videos, and can further save video storage space on the basis of reducing storage space by compressing the video.
[0156] Figure 6This is a flowchart illustrating a video processing method provided in an embodiment of this application. This method can be executed by any electronic device with data processing capabilities, such as a terminal device. The method in this embodiment may include:
[0157] S401. Receive multiple video frames and the identifier of the first video corresponding to the multiple video frames. The multiple video frames are obtained by dividing the first video into segments per second, and then dividing each video segment into frames according to the frame rate of the first video per second. The multiple video frames include N video frames corresponding to each video segment, where N is equal to the frame rate per second.
[0158] Specifically, when a terminal device obtains the first video from a server, it can first send a video acquisition request to the server. This video acquisition request carries the identifier of the first video. After receiving the video acquisition request, the server sends multiple video frames corresponding to the first video to the terminal device according to the identifier of the first video. These multiple video frames are obtained by dividing the first video into segments per second. After obtaining multiple video segments, each video segment is further divided into frames according to the frame rate of the first video per second. The multiple video frames include N video frames corresponding to each video segment, where N is equal to the frame rate per second.
[0159] S402. Obtain the storage method of multiple video frames. The multiple video frames are stored according to the first method or the second method. The first method includes: storing multiple video frames sequentially, and reusing the storage address of the first video frame when the same video frame appears. The second method includes: when storing N video frames corresponding to each video segment, storing the first video frame of each video segment and the pixel difference between the nth video frame and the first video frame sequentially, where n is greater than 1 and less than or equal to N.
[0160] Specifically, after receiving multiple video frames, the storage method of these video frames is first obtained. When the server sends these video frames to the terminal device, it can indicate the storage method through indication information. Generally, the server will use one storage method, and in this case, it does not need to indicate the storage method; the terminal device defaults to the server's preset storage method. When storing the multiple video frames using the first method, the multiple video frames are stored sequentially, and the storage address of the first video frame is reused for the same video frame. When storing the multiple video frames using the second method, when storing the N video frames corresponding to each video segment, the first video frame of each video segment and the pixel difference between the first video frame and the nth video frame are stored sequentially, where n is greater than 1 and less than or equal to N.
[0161] S403. Based on the storage method of multiple video frames, acquire multiple video frames, encode and synthesize the multiple video frames to obtain the first video.
[0162] Optionally, as an implementable approach, S403 can acquire multiple video frames based on a storage method that uses multiple video frames. Specifically, this can be achieved by:
[0163] S4031. If the storage method of multiple video frames is the first method, according to the identifier of the first video, obtain the first mapping table and the second mapping table corresponding to the first video. The first mapping table is the mapping relationship between the identifier of the video frame and the hash value of the video frame, and the second mapping table is the mapping relationship between the hash value of the video frame and the storage address of the video frame.
[0164] S4032. Obtain each video frame from the multiple video frames according to the first mapping table and the second mapping table.
[0165] Optionally, in S4032, each video frame from multiple video frames is obtained according to the first mapping table and the second mapping table. Specifically, this can be done as follows:
[0166] S21. For each video frame among multiple video frames, look up the hash value of the video frame from the first mapping table based on the video frame's identifier.
[0167] S22. Find the storage address of the video frame from the second mapping table based on the hash value of the video frame.
[0168] S23. Obtain the video frame based on the storage address of the video frame.
[0169] Optionally, as another feasible approach, S403 can obtain multiple video frames based on a storage method that stores multiple video frames. Specifically, this can be achieved by:
[0170] S4031' If the storage method of multiple video frames is the second method, obtain the storage address of each video segment after the first video is segmented according to the identifier of the first video. The storage address of each video segment includes the storage addresses of the N video frames corresponding to each video segment.
[0171] S4032' For each video segment corresponding to N video frames, based on the storage address of the N video frames, obtain the first video frame among the N video frames and the pixel difference between the nth video frame and the first video frame.
[0172] S4033': Based on the pixel differences between the first video frame and the first video frame, the second to Nth video frames are synthesized sequentially.
[0173] The video processing method provided in this embodiment receives multiple video frames and identifiers of a first video corresponding to each video frame. The multiple video frames are obtained by segmenting the first video into segments per second. Each video segment is then further divided into frames based on the frame rate of the first video. Each video frame includes N video frames corresponding to a single video segment, where N equals the frame rate per second. Next, the storage method of the multiple video frames is obtained, and the multiple video frames are stored according to either a first method or a second method. Based on the storage method of the multiple video frames, the multiple video frames are obtained and encoded to synthesize the first video. Since the multiple video frames are obtained by segmenting the first video into segments per second, and then further divided into frames based on the frame rate of the first video, identical video frames reuse the storage address of the first video frame they appear in during storage. That is, identical video frames are stored only once. At the video frame level, many videos contain completely identical frame images, thus effectively reducing the video storage space. Alternatively, when storing the N video frames corresponding to each video segment, the first video frame of each video segment and the pixel difference between the first video frame and the nth video frame can be stored sequentially, where n is greater than 1 and less than or equal to N. This can also effectively reduce the video storage space and save a significant amount of video storage space.
[0174] The specific embodiments of this application have been described in detail above with reference to the accompanying drawings. However, this application is not limited to the specific details of the above embodiments. Within the scope of the technical concept of this application, various simple modifications can be made to the technical solutions of this application, and these simple modifications all fall within the protection scope of this application. For example, the various specific technical features described in the above embodiments can be combined in any suitable manner without contradiction. To avoid unnecessary repetition, this application will not describe the various possible combinations separately. Furthermore, various different embodiments of this application can also be arbitrarily combined, as long as they do not violate the spirit of this application, they should also be considered as the content disclosed in this application.
[0175] It should also be understood that, in the various method embodiments of this application, the sequence numbers of the above processes do not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application. It should be understood that these sequence numbers can be interchanged where appropriate so that the embodiments of this application described can be implemented in a sequence other than those illustrated or described.
[0176] The method embodiments of this application have been described in detail above. The following description, in conjunction with... Figures 7 to 9 The following describes in detail the device embodiments of this application.
[0177] Figure 7 This is a schematic diagram of the structure of a video processing device provided in an embodiment of this application, as shown below. Figure 7 As shown, the video processing device may include a processing module 11 and a storage module 12.
[0178] The processing module 11 is used to divide the first video into segments per second to obtain multiple video segments.
[0179] The processing module is also used to: divide each video segment into frames according to the frame rate per second of the first video to obtain multiple video frames, the multiple video frames including N video frames corresponding to each video segment, where N is equal to the frame rate per second.
[0180] The storage module 12 is used to store multiple video frames according to a first method or a second method. The first method includes storing multiple video frames sequentially, with the same video frame reusing the storage address of the first video frame. The second method includes storing the first video frame of each video segment and the pixel difference between the first video frame and the nth video frame in each video segment sequentially when storing N video frames corresponding to each video segment, where n is greater than 1 and less than or equal to N.
[0181] In one embodiment, the processing module 11 is further configured to:
[0182] Before dividing each video segment into frames based on the frame rate of the first video, the metadata of the first video is obtained. The metadata includes the frame rate of the first video or the video frame separator of the first video. The video frame separator of the first video is preset according to the frame rate of the first video.
[0183] In one embodiment, the processing module 11 is specifically used for:
[0184] If the metadata includes the frame rate per second of the first video, then each video segment is divided into frames based on the frame rate per second of the first video.
[0185] If the metadata includes the video frame separator of the first video, then each video segment is segmented according to the video frame separator of the first video.
[0186] In one embodiment, the storage module 12 is used for:
[0187] For each video frame in a set of multiple video frames, obtain the hash value of the video frame;
[0188] Add a mapping relationship between the identifier of the video frame and the hash value of the video frame to the first mapping table;
[0189] If the hash value of a video frame is not found in the second mapping table between hash values and storage addresses of video frames, a storage address is assigned to the video frame, the mapping relationship between the hash value of the video frame and the storage address of the video frame is added to the second mapping table, and the video frame is stored according to the storage address.
[0190] If the hash value of a video frame is found in the second mapping table, the video frame is not stored.
[0191] In one embodiment, the storage module 12 is specifically used to: calculate the hash value of a video frame using a secure hash algorithm.
[0192] In one embodiment, the storage module 12 is used for:
[0193] For each video segment with N video frames, obtain the first video frame from the N video frames;
[0194] Calculate the pixel difference between each video frame from the 2nd to the Nth video frame and the 1st video frame in sequence;
[0195] Allocate N storage addresses, and based on the N storage addresses, store the first video frame and the pixel difference between the nth video frame and the first video frame in sequence.
[0196] It should be understood that the device embodiments and method embodiments can correspond to each other, and similar descriptions can be referred to the method embodiments. To avoid repetition, further details will not be provided here. Specifically, Figure 7 The video processing device shown can perform Figure 3 The corresponding method embodiments, and the foregoing and other operations and / or functions of each module in the video processing apparatus are respectively for implementing Figure 3 For the sake of brevity, the corresponding processes in the method embodiments will not be described in detail here.
[0197] Figure 8 This is a schematic diagram of another video processing apparatus provided in an embodiment of this application, as shown below. Figure 8 As shown, the video processing device may include: a receiving module 21, an acquisition module 22, and a processing module 23.
[0198] The receiving module 21 is used to receive multiple video frames and the identifier of the first video corresponding to the multiple video frames. The multiple video frames are obtained by dividing the first video into segments per second, and then dividing each video segment into frames according to the frame rate of the first video per second. The multiple video frames include N video frames corresponding to each video segment, where N is equal to the frame rate per second.
[0199] The acquisition module 22 is used to acquire the storage method of multiple video frames. The multiple video frames are stored according to a first method or a second method. The first method includes: storing multiple video frames sequentially, and reusing the storage address of the first video frame when the same video frame appears. The second method includes: when storing N video frames corresponding to each video segment, storing the first video frame of each video segment and the pixel difference between the first video frame and the nth video frame sequentially, where n is greater than 1 and less than or equal to N.
[0200] The processing module 23 is used to acquire multiple video frames based on the storage method of multiple video frames, and encode and synthesize the multiple video frames to obtain the first video.
[0201] In one embodiment, the processing module 23 is used to:
[0202] If the storage method of multiple video frames is the first method, according to the identifier of the first video, obtain the first mapping table and the second mapping table corresponding to the first video. The first mapping table is the mapping relationship between the identifier of the video frame and the hash value of the video frame, and the second mapping table is the mapping relationship between the hash value of the video frame and the storage address of the video frame.
[0203] Based on the first mapping table and the second mapping table, obtain each video frame from the multiple video frames.
[0204] In one embodiment, the processing module 23 is specifically used for:
[0205] For each video frame among multiple video frames, look up the hash value of the video frame from the first mapping table based on the video frame's identifier;
[0206] The storage address of the video frame is looked up from the second mapping table based on the hash value of the video frame;
[0207] The video frame is obtained based on its storage address.
[0208] In one embodiment, the processing module 23 is used to:
[0209] If the storage method for multiple video frames is the second method, the storage address of each video segment after the first video is segmented is obtained according to the identifier of the first video. The storage address of each video segment includes the storage addresses of the N video frames corresponding to each video segment.
[0210] For each video segment with N video frames, based on the storage addresses of the N video frames, obtain the first video frame and the pixel difference between the nth video frame and the first video frame.
[0211] The second to Nth video frames are synthesized sequentially based on the pixel differences between the first and nth video frames and the first video frame.
[0212] It should be understood that the device embodiments and method embodiments can correspond to each other, and similar descriptions can be referred to the method embodiments. To avoid repetition, further details will not be provided here. Specifically, Figure 8 The video processing device shown can perform Figure 6 The corresponding method embodiments, and the foregoing and other operations and / or functions of each module in the video processing apparatus are respectively for implementing Figure 6For the sake of brevity, the corresponding processes in the method embodiments will not be described in detail here.
[0213] The video processing apparatus of this application embodiment has been described above from the perspective of functional modules in conjunction with the accompanying drawings. It should be understood that this functional module can be implemented in hardware, in software instructions, or in a combination of hardware and software modules. Specifically, the steps of the method embodiments in this application can be completed by integrated logic circuits in the processor's hardware and / or by software instructions. The steps of the method disclosed in this application embodiment can be directly manifested as being executed by a hardware encoding processor, or by a combination of hardware and software modules in the encoding processor. Optionally, the software module can be located in a mature storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps in the above method embodiments.
[0214] Figure 9 This is a schematic block diagram of the electronic device 30 provided in an embodiment of this application. The electronic device may be the video processing device mentioned above.
[0215] like Figure 9 As shown, the electronic device 30 may include:
[0216] The system includes a memory 31 and a processor 32. The memory 31 stores computer programs and transfers the program code to the processor 32. In other words, the processor 32 can retrieve and run the computer programs from the memory 31 to implement the methods described in the embodiments of this application.
[0217] For example, the processor 32 can be used to execute the above-described method embodiments according to instructions in the computer program.
[0218] In some embodiments of this application, the processor 32 may include, but is not limited to:
[0219] General-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0220] In some embodiments of this application, the memory 31 includes, but is not limited to:
[0221] Volatile memory and / or non-volatile memory. Non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDR SDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), and Direct Rambus RAM (DR RAM).
[0222] In some embodiments of this application, the computer program may be divided into one or more modules, which are stored in the memory 31 and executed by the processor 32 to perform the method provided in this application. The one or more modules may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program in the electronic device.
[0223] like Figure 9 As shown, the electronic device 30 may further include:
[0224] Transceiver 33, which can be connected to processor 32 or memory 31.
[0225] The processor 32 can control the transceiver 33 to communicate with other devices; specifically, it can send information or data to other devices or receive information or data sent by other devices. The transceiver 33 may include a transmitter and a receiver. The transceiver 33 may further include antennas, and the number of antennas may be one or more.
[0226] It should be understood that the various components in the electronic device are connected through a bus system, which includes a data bus, a power bus, a control bus, and a status signal bus.
[0227] This application also provides a computer storage medium storing a computer program thereon, which, when executed by a computer, enables the computer to perform the methods of the above-described method embodiments. Alternatively, embodiments of this application also provide a computer program product containing instructions that, when executed by a computer, cause the computer to perform the methods of the above-described method embodiments.
[0228] When implemented using software, it can be implemented entirely or partially as a computer program product. This computer program product includes one or more computer instructions. When these computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., digital video disc (DVD)), or a semiconductor medium (e.g., solid-state disk (SSD)).
[0229] It is understood that in the specific implementation of this application, when the above embodiments of this application are applied to specific products or technologies and involve user information and other related data, user permission or consent is required, and the collection, use and processing of related data must comply with relevant laws, regulations and standards.
[0230] Those skilled in the art will recognize that the modules and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0231] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or modules may be electrical, mechanical, or other forms.
[0232] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. For example, the functional modules in the various embodiments of this application may be integrated into one processing module, or each module may exist physically separately, or two or more modules may be integrated into one module.
[0233] The above description is merely a specific implementation of the embodiments of this application, but the protection scope of the embodiments of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the embodiments of this application should be included within the protection scope of the embodiments of this application. Therefore, the protection scope of the embodiments of this application should be determined by the protection scope of the claims.
Claims
1. A video processing method, characterized in that, include: The first video is divided into segments per second to obtain multiple video segments; Based on the frame rate per second of the first video, each video segment is divided into frames to obtain multiple video frames. The multiple video frames include N video frames corresponding to each video segment, where N is equal to the frame rate per second. The plurality of video frames may be stored according to a first method or a second method. The first method includes storing the plurality of video frames sequentially, with the same video frame reusing the storage address of the first video frame it appears in. The second method includes storing the first video frame of each video segment and the pixel difference between the first video frame and the nth video frame in each video segment sequentially, where n is greater than 1 and less than or equal to N.
2. The method according to claim 1, characterized in that, Before dividing each video segment into frames based on the frame rate of the first video, the method further includes: Obtain the metadata of the first video, which includes the frame rate per second of the first video or the video frame separator of the first video. The video frame separator of the first video is preset according to the frame rate per second of the first video.
3. The method according to claim 2, characterized in that, The step of dividing each video segment into frames based on the frame rate per second of the first video includes: If the metadata includes the number of frames per second of the first video, each video segment is divided into frames according to the number of frames per second of the first video. If the metadata includes the video frame separator of the first video, then each video segment is segmented according to the video frame separator of the first video.
4. The method according to any one of claims 1-3, characterized in that, The storage of the plurality of video frames according to the first method includes: For each of the plurality of video frames, obtain the hash value of the video frame; Add a mapping relationship between the identifier of the video frame and the hash value of the video frame to the first mapping table; If the hash value of the video frame is not found in the second mapping table between hash values and storage addresses of video frames, then a storage address is allocated to the video frame, the mapping relationship between the hash value of the video frame and the storage address of the video frame is added to the second mapping table, and the video frame is stored according to the storage address. If the hash value of the video frame is found in the second mapping table, the video frame is not stored.
5. The method according to claim 4, characterized in that, Obtaining the hash value of the video frame includes: The hash value of the video frame is calculated using a secure hashing algorithm.
6. The method according to any one of claims 1-3, characterized in that, The storage of the plurality of video frames according to the second method includes: For each video segment, which corresponds to N video frames, obtain the first video frame from the N video frames. Calculate the pixel difference between each video frame from the second video frame to the Nth video frame and the first video frame in sequence; Allocate N storage addresses, and according to the N storage addresses, store the first video frame and the pixel difference between the nth video frame and the first video frame in sequence.
7. A video processing method, characterized in that, include: Receive multiple video frames and the identifier of the first video corresponding to the multiple video frames. The multiple video frames are obtained by dividing the first video into segments per second, and then dividing each video segment into frames according to the frame rate of the first video per second. The multiple video frames include N video frames corresponding to each video segment, where N is equal to the frame rate per second. The storage method of the plurality of video frames is obtained. The plurality of video frames are stored according to a first method or a second method. The first method includes: storing the plurality of video frames sequentially, and reusing the storage address of the first video frame when the same video frame appears. The second method includes: when storing the N video frames corresponding to each video segment, storing the first video frame of each video segment and the pixel difference between the first video frame and the nth video frame sequentially, where n is greater than 1 and less than or equal to N. Based on the storage method of the multiple video frames, the multiple video frames are obtained, and the multiple video frames are encoded and synthesized to obtain the first video.
8. The method according to claim 7, characterized in that, The method of obtaining the multiple video frames based on the storage method of the multiple video frames includes: If the storage method of the plurality of video frames is the first method, according to the identifier of the first video, a first mapping table and a second mapping table corresponding to the first video are obtained. The first mapping table is the mapping relationship between the identifier of the video frame and the hash value of the video frame, and the second mapping table is the mapping relationship between the hash value of the video frame and the storage address of the video frame. Each video frame among the plurality of video frames is obtained according to the first mapping table and the second mapping table.
9. The method according to claim 8, characterized in that, The step of obtaining each video frame from the plurality of video frames according to the first mapping table and the second mapping table includes: For each of the plurality of video frames, the hash value of the video frame is looked up from the first mapping table based on the identifier of the video frame; The storage address of the video frame is looked up from the second mapping table based on the hash value of the video frame; The video frame is obtained based on its storage address.
10. The method according to claim 7, characterized in that, The method of obtaining the multiple video frames based on the storage method of the multiple video frames includes: If the storage method of the multiple video frames is the second method, the storage address of each video segment after the first video is segmented is obtained according to the identifier of the first video. The storage address of each video segment includes the storage addresses of the N video frames corresponding to each video segment. For each video segment with N video frames, based on the storage addresses of the N video frames, obtain the first video frame among the N video frames and the pixel difference between the nth video frame and the first video frame; The second to Nth video frames are synthesized sequentially based on the pixel differences between the first video frame and the nth video frame and the first video frame.
11. A video processing apparatus, characterized in that, include: The processing module is used to segment the first video into multiple video segments by dividing it into segments per second. The processing module is further configured to: divide each video segment into frames according to the frame rate per second of the first video to obtain multiple video frames, wherein the multiple video frames include N video frames corresponding to each video segment, and N is equal to the frame rate per second; A storage module is configured to store the plurality of video frames according to a first method or a second method. The first method includes storing the plurality of video frames sequentially, with identical video frames reusing the storage address of the first video frame they appear in. The second method includes storing the first video frame of each video segment and the pixel difference between the first video frame and the nth video frame when storing the N video frames corresponding to each video segment, wherein n is greater than 1 and less than or equal to N.
12. A video processing apparatus, characterized in that, include: The receiving module is used to receive multiple video frames and the identifier of the first video corresponding to the multiple video frames. The multiple video frames are obtained by dividing the first video into segments per second, and then dividing each video segment into frames according to the frame rate of the first video per second. The multiple video frames include N video frames corresponding to each video segment, where N is equal to the frame rate per second. The acquisition module is used to acquire the storage method of the plurality of video frames. The plurality of video frames are stored according to a first method or a second method. The first method includes: storing the plurality of video frames sequentially, and reusing the storage address of the first video frame when the same video frame appears. The second method includes: when storing N video frames corresponding to each video segment, storing the first video frame of each video segment and the pixel difference between the first video frame and the nth video frame sequentially, where n is greater than 1 and less than or equal to N. The processing module is used to acquire the multiple video frames based on the storage method of the multiple video frames, and to encode and synthesize the multiple video frames to obtain the first video.
13. A video processing device, characterized in that, include: A processor and a memory, the memory being used to store a computer program, the processor being used to invoke and run the computer program stored in the memory to perform the method of any one of claims 1-6 or 7-10.
14. A computer-readable storage medium, characterized in that, Used to store a computer program that causes a computer to perform the method as described in any one of claims 1-6 or 7-10.
15. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1-6 or 7-10.