Video data processing method and device, equipment and storage medium

By permanently storing video data only in the video encoding method with the highest compression rate and transcoding into a suitable video encoding method according to the client's support, the problem of CDN storage pressure is solved, and the dual goals of storage efficiency and multi-client compatibility are achieved.

CN120034662APending Publication Date: 2025-05-23TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311563389.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-21
Publication Date
2025-05-23

AI Technical Summary

Technical Problem

Since different clients support different video encoding methods, the prior art requires storing video data of multiple video encoding methods in the CDN at the same time, resulting in an increase in storage pressure.

Method used

Only the video data of the first video in the video encoding method with the highest compression rate is permanently stored, and the video data in other video encoding methods matching the client is obtained based on the data, and sent to the client.

Benefits of technology

It effectively reduces the use of video data on storage space, reduces storage pressure, and meets the demands of playing videos on different clients.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120034662A_ABST
    Figure CN120034662A_ABST
Patent Text Reader

Abstract

The invention discloses a video data processing method and device, equipment and a storage medium, and relates to the technical field of computers. The method comprises the following steps: in response to a video acquisition request from a first client, acquiring first video data of a first video in a first video coding mode from a database, for the first video, only permanently storing the first video data in the database, the first video data is used for acquiring video data of a first video in a plurality of candidate video coding modes, and under the same code rate, the compression ratio corresponding to the first video coding mode is greater than or equal to the compression ratio corresponding to the candidate video coding mode; determining a second video coding mode matched with the first client from the plurality of candidate video coding modes; and under the condition that the second video coding mode is different from the first video coding mode, acquiring second video data of the first video in the second video coding mode based on the first video data. According to the invention, the video storage pressure can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a method, apparatus, device and storage medium for processing video data. Background Art

[0002] With the continuous development of video encoding methods, the same video may correspond to video data under different video encoding methods, such as H265 video encoding method, H264 video encoding method, etc.

[0003] Since different clients can also support different video encoding methods, in order to meet the demand for playable videos on all clients, related technologies store both video data under H265 video encoding method and video data under H264 video encoding method in CDN (Content Delivery Network) for the same video, so as to send video data to different clients in a targeted manner. However, this will result in the need for more storage space for video data storage, thereby increasing the storage pressure of CDN. Summary of the invention

[0004] The embodiment of the present application provides a method, device, equipment and storage medium for processing video data. The technical solution includes the following contents.

[0005] According to one aspect of an embodiment of the present application, a method for processing video data is provided, the method comprising:

[0006] In response to a video acquisition request from a first client, first video data is acquired from a database; wherein the first video data refers to video data obtained by encoding the first video in a first video encoding method, and for the first video, the database only permanently stores the first video data, and the first video data is used to acquire video data of the first video in a plurality of candidate video encoding methods, respectively, and at the same bit rate, the compression ratio corresponding to the first video encoding method is greater than or equal to the compression ratio corresponding to the candidate video encoding method;

[0007] Determining, from the multiple candidate video encoding modes, a second video encoding mode that matches the first client;

[0008] When the second video encoding mode is different from the first video encoding mode, obtaining second video data of the first video in the second video encoding mode based on the first video data;

[0009] The second video data is sent to the first client.

[0010] According to one aspect of an embodiment of the present application, a video data processing device is provided, the device comprising:

[0011] A video data acquisition module, configured to obtain first video data from a database in response to a video acquisition request from a first client; wherein the first video data refers to video data obtained by encoding the first video in a first video encoding method, and for the first video, the database only permanently stores the first video data, and the first video data is used to obtain video data of the first video in multiple candidate video encoding methods, respectively, and under the same bit rate, the compression rate corresponding to the first video encoding method is greater than or equal to the compression rate corresponding to the candidate video encoding method;

[0012] An encoding mode determining module, configured to determine a second video encoding mode matching the first client from the plurality of candidate video encoding modes;

[0013] a video data transcoding module, configured to obtain, based on the first video data, second video data of the first video in the second video encoding mode when the second video encoding mode is different from the first video encoding mode;

[0014] A video data sending module is used to send the second video data to the first client.

[0015] According to one aspect of an embodiment of the present application, a computer device is provided, the computer device comprising a processor and a memory, the memory storing a computer program, the computer program being loaded and executed by the processor to implement the above-mentioned video data processing method.

[0016] According to one aspect of an embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored. The computer program is loaded and executed by a processor to implement the above-mentioned video data processing method.

[0017] According to one aspect of the embodiments of the present application, a computer program product is provided, the computer program product comprising a computer program, the computer program being stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the above-mentioned video data processing method.

[0018] The technical solution provided by the embodiments of the present application may include the following beneficial effects.

[0019] By permanently storing only the first video data of the first video in the first video encoding method, since the first video encoding method is the video encoding method with the highest compression rate at the same bit rate among multiple candidate video encoding methods, the storage space occupied by the first video can be effectively reduced, thereby reducing the storage pressure on the first video. In addition, by obtaining the second video data in the second video encoding method that matches the first client based on the first video data in the first video encoding method, and providing it to the first client, the demand for playing the first video on all clients (such as clients that support different video encoding methods) is met. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0021] Figure 1 It is a schematic diagram of an implementation environment of a solution provided by an embodiment of the present application;

[0022] Figure 2 is a flowchart of a method for processing video data provided by an embodiment of the present application;

[0023] Figure 3 is a schematic diagram of virtual index data provided by an embodiment of the present application;

[0024] Figure 4 is a flowchart of a method for processing video data provided by another embodiment of the present application;

[0025] Figure 5 is a schematic diagram of a method for processing video data provided by an embodiment of the present application;

[0026] Figure 6 is a schematic diagram of a method for processing video data provided by another embodiment of the present application;

[0027] Figure 7 is a schematic diagram of a method for processing video data provided by another embodiment of the present application;

[0028] Figure 8 is a schematic diagram of video playback provided by an embodiment of the present application;

[0029] Fig. 9 is a block diagram of a video data processing device provided by an embodiment of the present application;

[0030] Fig.10is a block diagram of a video data processing device provided by another embodiment of the present application;

[0031] Fig.11 It is a block diagram of a computer device provided by one embodiment of the present application. DETAILED DESCRIPTION

[0032] Before introducing the embodiments of the present application, the relevant terms involved in the present application are first explained.

[0033] 1. CDN (Content Delivery Network): It is a service technology used to accelerate network content transmission. In the video delivery scenario, CDN is often used to store video resources that users need to download in real time.

[0034] 2. MP4 (Moving Picture Experts Group Audio Layer IV): A digital multimedia container format used to store multimedia data such as audio, video, and subtitles. For videos, it is a common file format, and videos in the MP4 encapsulation format can be played on many devices and platforms.

[0035] 3. H264 video coding method: also known as AVC (Advanced Video Coding), it is a video coding standard that uses video coding technologies such as motion estimation, transformation, quantization and entropy coding to provide efficient video compression and transmission.

[0036] 4. H265 video coding method: also known as HEVC (High Efficiency Video Coding), it is a video coding standard. Under the same video quality, the compression rate corresponding to the H265 video coding method is usually higher than the compression rate corresponding to the H264 video coding method. The compression rate refers to the ratio of the size of the video data after compression to the size before compression.

[0037] 5. HLS (HTTP Live Streaming): A streaming media network transmission protocol based on HTTP (Hyper Text Transfer Protocol), which is used to cut the entire media file (such as video data) into small data segment files and transmit them using HTTP. It includes an index file and multiple data segment files. For example, HLS cuts the video data into small TS (Transport Stream) slices and generates an M3U8 playlist file. The client downloads the M3U8 playlist file through the HTTP protocol, and downloads and plays the TS slices in the order specified in the M3U8 playlist file, thereby achieving download-while-playing, similar to the effect of real-time online playback.

[0038] 6. M3U8 (Moving Picture Experts Group Audio Layer 3Uniform Resource Locator 8): A playlist file format, commonly used in the HLS protocol, which can be used to specify the order and position of streaming media players playing videos or audio on the network.

[0039] 7. TS slice: A video transport stream format used to store audio, video and other related data. It uses segmented methods and is commonly used in digital TV broadcasting, video recording and streaming media transmission.

[0040] 8. Data Rate: refers to the data flow rate used by video data in a unit of time, which may also be referred to as bit stream, bit stream rate, etc. In some embodiments, the bit rate may be expressed as a bit rate.

[0041] 9. Temporary storage: refers to the process in a computer system used to store temporary data for application operation or business. The storage is short-term and the temporary data will be cleared or destroyed when the application ends. Temporary data does not need to be retained for a long time.

[0042] 10. Permanent storage: refers to the process used in computer systems to preserve user and system data for a long time. This storage is persistent.

[0043] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0044] Please refer to Figure 1 , which shows a schematic diagram of an implementation environment of a solution provided by an embodiment of the present application. The implementation environment may include: a terminal device 10 and a server 20.

[0045] The terminal device 10 may be an electronic device such as a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, a multimedia player, a PC (Personal Computer), an intelligent robot, a vehicle terminal, a wearable device, etc. The terminal device 10 may be installed with a client of a target application, and the target application may be a video player application, a game application, a browser application, a social entertainment application, a simulation learning application, a shopping application, a live broadcast application, and any application that supports video playback, which is not limited in the embodiments of the present application.

[0046] Optionally, the above-mentioned target application can be installed and run in different terminal devices 10 in the form of a mobile client, a PC client, a web client, a mini-program, etc., and the embodiment of the present application is not limited to this.

[0047] The server 20 is used to provide background services for the client of the target application (such as a video playback application) in the terminal device 10. For example, the server 20 can be a background server of the above-mentioned application (such as a video playback application) to provide background services for the client of the target application (such as a video playback application) in different terminal devices 10. The above-mentioned server 20 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. Optionally, the server 20 can be used to store resource content that needs to be downloaded in real time when the above-mentioned target application is used, such as video content corresponding to the video playback application.

[0048] The terminal device 10 and the server 20 can communicate with each other via a network 30. The network 30 can be a wired network or a wireless network.

[0049] Exemplarily, a terminal device 10 having a client installed and running a social entertainment application is taken as an example. In response to a user's trigger operation on a first video, the client sends a video acquisition request to the server 20, and the server 20 acquires the first video data of the first video in the H265 video encoding mode from the database according to the video acquisition request. When the server 20 detects that the optimal video encoding mode supported by the client is the H265 video encoding mode, the server 20 sends the first video data to the client; when the server 20 detects that the optimal video encoding mode supported by the client is the H264 video encoding mode, the server 20 transcodes the first video data into the first video data in the H264 video encoding mode, and then sends the first video data in the H264 video encoding mode to the client.

[0050] Optionally, the video data in the database are permanently stored only in H265 video encoding; or, part of the video data in the database are permanently stored only in H265 video encoding, which is not limited in the embodiments of the present application.

[0051] Below, the technical solution provided by this application will be introduced and explained through method embodiments.

[0052] Please refer to Figure 2 , which shows a flowchart of a method for processing video data provided by an embodiment of the present application. The execution subject of each step of the method may be Figure 1 In the server 20 in the implementation environment of the solution shown, the method may include the following steps (201-204).

[0053] Step 201, in response to a video acquisition request from a first client, first video data is acquired from a database; wherein the first video data refers to video data obtained by encoding the first video using a first video encoding method, and for the first video, the database only permanently stores the first video data, and the first video data is used to acquire video data of the first video under a plurality of candidate video encoding methods, respectively. Under the same bit rate, the compression ratio corresponding to the first video encoding method is greater than or equal to the compression ratio corresponding to the candidate video encoding method.

[0054] The first client may refer to any client with a video playback function. Exemplarily, the first client may refer to any client corresponding to the target application, such as any client corresponding to a video playback application (such as a video player), a social entertainment application (such as a chat application with a circle of friends), etc. The video acquisition request is used to request to obtain video data in order to play the video corresponding to the video data.

[0055] The video data refers to data used to describe a video, such as encoded data, compressed data, etc. of the video. For example, the first video data described above is used to describe the first video, which may be the encoded data of the first video. The video acquisition request may be generated by the first client. For example, in response to a user's acquisition operation for the first video, the first client generates a video acquisition request for requesting to acquire the first video. The first video may refer to any video.

[0056] The database in the embodiment of the present application can be used to store video data. Optionally, the database can exist independently of the server, or can be implemented as a part of the server, which is not limited in the embodiment of the present application.

[0057] In one example, for each video, only its video data under one video encoding method is permanently stored. For example, for each video, only the video data of each video under the first video encoding method is permanently stored in the database; for another example, for a part of the videos, only the video data of each video under the first video encoding method is permanently stored in the database, and for another part of the videos, only the video data of each video under a candidate video encoding method is permanently stored in the database, and the embodiments of the present application do not limit this. Since the compression rate corresponding to the first video encoding method is greater than or equal to the compression rate corresponding to the candidate video encoding method at the same bit rate, the video storage is combined with the first video encoding method with the highest compression rate at the same bit rate, which is conducive to reducing the storage space occupied by the video, thereby reducing the storage pressure on the video.

[0058] The embodiment of the present application does not limit the above-mentioned first video encoding method, which can be set and adjusted according to actual use requirements. For example, the first video encoding method can refer to the video encoding method with the highest compression rate under the same bit rate, which can not only reduce the storage space occupied by the video, but also ensure the quality of the video. In the embodiment of the present application, the candidate video encoding method can be determined based on the first video encoding method. Exemplarily, the video encoding method to which the first video encoding method can be converted can be determined as the candidate video encoding method. For example, if the video data under the first video encoding method can be transcoded into the video data under the video encoding method A, the video encoding method A can be determined as the candidate video encoding method.

[0059] The first video encoding method itself can also be used as a candidate video encoding method. Optionally, at the same bit rate, the compression ratios corresponding to the remaining candidate video encoding methods except the first video encoding method are smaller than the compression ratio corresponding to the first video encoding method. Based on the first video encoding method, the server can implement the delivery of video data under each candidate video encoding method, thereby satisfying the requirements of all clients (such as clients supporting different video encoding methods) for playing videos.

[0060] In an example, the first video encoding mode is the H265 video encoding mode, and the candidate video encoding modes include at least one of the following: the H265 video encoding mode and the H264 video encoding mode.

[0061] Exemplarily, for each video, only its video data under the H265 video encoding mode is permanently stored in the database. Based on the video data under the H265 video encoding mode, the server can provide the video data under the H265 video encoding mode and the video data under the H264 video encoding mode. Under the same video quality (bit rate), compared with the H264 video encoding mode, the H265 video encoding mode has a high compression rate, small memory usage, and small bandwidth. In addition, the H265 video encoding method can support higher resolutions and frame rates.

[0062] In a feasible example, when the first video encoding mode is H266 video encoding mode, the candidate video encoding mode includes at least one of the following: H266 video encoding mode, H265 video encoding mode, and H264 video encoding mode. Optionally, the candidate video encoding mode may also include H263 video encoding mode, which is not limited in the embodiment of the present application.

[0063] The embodiment of the present application does not limit the packaging method of the video data in the database, such as MP4, HLS, etc. Exemplarily, the video data in the database are permanently stored in the packaging method of MP4.

[0064] It should be noted that the video data under the above-mentioned multiple candidate video encoding modes do not need to be actually generated, and are only used to illustrate which candidate video encoding modes the server can support for sending video data.

[0065] Step 202: Determine a second video encoding method that matches the first client from a plurality of candidate video encoding methods.

[0066] Optionally, for a video encoding method that matches the client, the client supports decoding the video data in the video encoding method to play the video corresponding to the video data. Exemplarily, for the above-mentioned second video encoding method, the first client supports decoding the video data in the second video encoding method.

[0067] In one example, the video acquisition request carries the video encoding method supported by the first client, so that the server can quickly determine the second video encoding method that matches the first client; or the video acquisition request carries the relevant information of the first client, and the server determines the second video encoding method that matches the first client based on the relevant information of the first client. The relevant information may include at least one of the following: identification information and version number of the first client.

[0068] Optionally, after determining the video encoding method supported by the first client, the server determines the candidate video encoding methods supported by the first client based on the video encoding methods supported by the first client, such as determining the candidate video encoding method that is the same as the video encoding method supported by the first client as the candidate video encoding method supported by the first client, and then randomly selecting a candidate video encoding method from the candidate video encoding methods supported by the first client as the second video encoding method.

[0069] Optionally, after determining the candidate video encoding methods supported by the first client, the server may select the video encoding method that best matches the first client as the second video encoding method, thereby reducing the bandwidth occupied when downloading video data while ensuring the playback quality of the video, thereby improving the transmission efficiency of the video data. Exemplarily, the process may include the following:

[0070] 1. Determine an optimal encoding method corresponding to the first client from multiple candidate video encoding methods; wherein the optimal encoding method refers to a video encoding method with the highest compression rate at the same bit rate among the candidate video encoding methods supported by the first client.

[0071] Optionally, after determining the candidate video encoding method supported by the first client from multiple candidate video encoding methods, the server sorts the candidate video encoding methods supported by the first client in order of high to low compression rate at the same bit rate to obtain a candidate video encoding method sequence, and then determines the first candidate video encoding method in the candidate video encoding method sequence as the optimal encoding method.

[0072] For example, when the first client supports both the H265 video encoding mode and the H264 video encoding mode, the H265 video encoding mode can be determined as the optimal encoding mode; for another example, when the first client only supports the H264 video encoding mode, the H264 video encoding mode can be determined as the optimal encoding mode.

[0073] 2. Determine the optimal encoding method as the second video encoding method.

[0074] For example, when the first client supports both the H265 video encoding mode and the H264 video encoding mode, the H265 video encoding mode may be determined as the second video encoding mode; for another example, when the first client only supports the H264 video encoding mode, the H264 video encoding mode may be determined as the second video encoding mode.

[0075] Step 203: When the second video encoding method is different from the first video encoding method, based on the first video data, obtain second video data of the first video in the second video encoding method.

[0076] Optionally, when the second video encoding method is different from the first video encoding method, the server transcodes the first video data in the first video encoding method into the second video data in the second video encoding method. The first video data in the first video encoding method refers to the video data obtained by encoding the first video in the first video encoding method, and the second video data in the second video encoding method refers to the video data obtained by encoding the first video in the second video encoding method.

[0077] For example, when the first video encoding mode is the H265 video encoding mode and the second video encoding mode is the H264 video encoding mode, the server transcodes the first video data under the H265 video encoding mode into the second video data under the H264 video encoding mode.

[0078] In one example, an embodiment of the present application supports sending video data in the form of a video stream. For the first video data, the database also stores virtual index data corresponding to the first video data, and the virtual index data is used to indicate the segmentation position of the first video data.

[0079] For real index data, it is necessary to synchronously split the video data when generating the real index data, while the above-mentioned virtual index data only needs to record the correspondence between the virtual index and the video slice data to be split, without actually splitting the video data. The above-mentioned split position can be used to indicate the split range of the video slice data. Exemplarily, in the case where the video stream is composed of TS slices, the virtual index data records the correspondence between the video slice data to be split corresponding to each TS slice and the virtual index corresponding to the TS slice. According to the virtual index corresponding to the TS slice, the encapsulation of the video slice data to be split corresponding to the TS slice can be completed in real time to obtain the TS slice. In one example, the above-mentioned virtual index data is determined based on the M3U8 file corresponding to the first video data.

[0080] For example, refer to Figure 3For the first video data 301, each virtual index in the corresponding virtual index data 302 (such as Seg-0, Seg-1, Seg-2, Seg-3, etc.) corresponds to a TS slice that needs to be obtained (video slice data to be segmented and encapsulated).

[0081] Exemplarily, the process of acquiring the second video data may further include the following contents:

[0082] 1. Obtain virtual index data corresponding to the first video data, where the virtual index data is used to indicate a segmentation position of the first video data.

[0083] Optionally, in response to a video acquisition request from the first client, the server obtains the first video data and virtual index data corresponding to the first video data from the database based on the identification information of the first video. The first video data and the virtual index data corresponding to the first video data are stored correspondingly. The virtual index data corresponding to the first video data can be obtained based on the first video data using virtual slicing technology, such as HLS virtual slicing technology. The HLS virtual slicing technology is used to obtain virtual index data corresponding to TS slices.

[0084] 2. According to the virtual index data, the first video data is segmented and packaged to obtain a plurality of video slices under the first video encoding method.

[0085] The first video data is segmented in sequence according to the index range information corresponding to each virtual index in the virtual index data (i.e., the segmentation position) to obtain a plurality of video slice data, and each video slice data is then encapsulated to obtain a plurality of video slices under the first video encoding method. Exemplarily, the HLS encapsulation method can be used to encapsulate each video slice data to obtain a plurality of TS slices under the first video encoding method.

[0086] For example, while the first video data under the H265 video encoding method is permanently stored in MP4 encapsulation (abbreviated as H265MP4), the server also permanently stores virtual index data corresponding to the first video data. According to the segmentation position recorded in the virtual index data, the H265 MP4 can be segmented into multiple video slice data under the H265 video encoding method, and then the multiple video slice data under the H265 video encoding method are encapsulated to obtain multiple TS slices under the H265 video encoding method.

[0087] 3. Transcode multiple video slices in the first video encoding mode into multiple video slices in the second video encoding mode.

[0088] For example, multiple TS slices in the H265 video encoding mode are transcoded into multiple TS slices in the H264 video encoding mode.

[0089] 4. Combine multiple video slices under the second video encoding method to obtain second video data.

[0090] For example, by combining multiple TS slices in the H264 video encoding mode, the second video data in the form of a video stream (abbreviated as H264 HLS) can be obtained.

[0091] The embodiment of the present application supports real-time streaming transcoding of the first video data based on virtual index data, thereby avoiding the management difficulties when the first video data is permanently stored in the HLS encapsulation format.

[0092] In one example, an embodiment of the present application supports on-demand video slice data in the first video data. For example, when on-demand video slice data is received, it is only necessary to encapsulate the video slice data in real time to obtain the corresponding TS slice, and then transcode and send it down, without having to split and encapsulate all the first video data, thereby effectively reducing the workload.

[0093] Exemplarily, the following is introduced by taking the on-demand request from the first client as an example. The process may include the following contents:

[0094] 1. In response to a video-on-demand request for a first video from a first client, video slice data corresponding to the video-on-demand request is obtained from the first video data according to the virtual index data.

[0095] The above-mentioned on-demand request is used to request to start playing from the target video slice data corresponding to the first video, and the target video slice data is selected by the user. The on-demand request may include a target virtual index corresponding to the target video slice data, and the server may obtain the video slice data corresponding to the on-demand request from the first video data according to multiple virtual indexes starting from the target virtual index. Optionally, the number of video slice data corresponding to the on-demand request can be set and adjusted according to actual usage requirements to prevent excessive segmentation and packaging, thereby reducing the workload. For example, when receiving an on-demand request, the server can obtain the video slice data from the first video data according to three virtual indexes starting from the target virtual index, and perform real-time packaging. If no on-demand request (or video switching request, etc.) for the first video is received again during this period, the remaining video slice data will continue to be packaged in real time. Otherwise, according to the new on-demand request, the video slice data is packaged in real time.

[0096] The first client may download the first video data according to the real index data (or virtual index data), and may select an index in the real index data to realize on-demand playback.

[0097] 2. Encapsulate the video slice data to obtain video slices of the video slice data under a first video encoding method.

[0098] For example, the HLS encapsulation method is used to encapsulate the video slice data in real time to obtain TS slices under the H265 video encoding method.

[0099] 3. Transcode the video slice data in the first video encoding mode into the video slice data in the second video encoding mode.

[0100] For example, TS slices in H265 video encoding mode are transcoded into TS slices in H264 video encoding mode.

[0101] 4. Send the video slice data in the second video encoding mode to the first client.

[0102] For example, a TS slice in H264 video encoding mode is sent to a first client, and the first client decodes the TS slice in H264 video encoding mode to play a video segment corresponding to the TS slice.

[0103] In one example, after obtaining the video slice under the second video encoding mode, the video slice under the second video encoding mode can also be cached, so that when a video-on-demand request for the video slice under the second video encoding mode is received again, it can be directly provided to the first client without streaming transcoding, thereby effectively reducing the transcoding cost of the first video data and improving the efficiency of sending the first video data. Optionally, the same caching method can also be used for the video data under the above-mentioned H264 HLS, which is not limited in this embodiment of the present application.

[0104] Exemplarily, taking receiving a video-on-demand request from a second client again as an example, the process may include the following contents:

[0105] 1. The video slice data in the second video encoding mode is stored in a cache device.

[0106] The cache device in the embodiment of the present application can be used for caching video data, and the cache device can be implemented as a part of the server. The embodiment of the present application does not limit the cache device, which can be a SATA (Serial Advanced Technology Attachment) cache device, as well as other cache devices. The SATA cache device is a cache device for an industry-standard serial hardware driver interface. For example, TS slices under the H264 video encoding mode are cached in a SATA cache device.

[0107] The cache identifier of the video slice of the video slice data in the second video encoding mode is constructed based on the identification information of the first video data, the identification information of the video slice data and the index range information of the video slice data. The identification information of the first video data is used to uniquely identify the first video data, the identification information of the video slice data is used to uniquely identify the video slice data, and the index range information of the video slice data is used to indicate the position of the video slice data in the first video data, that is, the above-mentioned segmentation position.

[0108] Exemplarily, the cache identifier of the TS slice in the above H264 video encoding mode can be expressed as follows:

[0109] key=Vid+TS_ID+Index_range_info;

[0110] Among them, Vid is the identification information of the first video data, TS_ID is the identification information of the video slice data, and Index_range_info is the index range information of the video slice data.

[0111] The cache identifier is used by the server to pull the video slice corresponding to the cache identifier from the cache device.

[0112] 2. In response to a video-on-demand request for video slice data from a second client, when the video encoding method corresponding to the second client is the second video encoding method, obtain video slices of the video slice data in the second video encoding method from a cache device.

[0113] The second client may be different from the first client, and the second client may be the first client, which is not limited in the embodiment of the present application.

[0114] Optionally, when a video-on-demand request for video slice data is received again, the server first queries the cache device based on the cache identifier. If the video slice corresponding to the video slice data exists in the cache device, the server obtains the video slice of the video slice data under the second video encoding method from the cache device; otherwise, the video slice data under the first video encoding method is repackaged and transcoded according to the virtual index data.

[0115] 3. Send the video slice data in the second video encoding mode to the second client.

[0116] For example, the server pulls the TS slice in the H264 video encoding mode from the SATA cache device according to the cache identifier, and sends the TS slice in the H264 video encoding mode to the second client.

[0117] Step 204: Send the second video data to the first client.

[0118] Optionally, the server may directly send the second video data to the first client, and the first client plays the first video according to the second video data.

[0119] Optionally, the server may also generate a video link of the second video data, and then send the video link of the second video data to the first client, and the first client downloads the first video data according to the video link to play the first video. The video link refers to a link between a video and a web page or other media, which can be used to indicate a uniform resource location address of the video.

[0120] Exemplarily, for the second video data in the form of a video stream, the server may provide virtual index data (or real index data: M3U8 file) to the first client, and the first client downloads the first video data according to the virtual index data.

[0121] In an example, when the second video encoding method is the same as the first video encoding method, the server sends the first video data to the first client.

[0122] For example, when the first video data is H265 MP4 and the second video encoding method is H264 video encoding method, H265 MP4 can be directly sent to the first client.

[0123] Optionally, when the second video encoding method is the same as the first video encoding method, the server may also send the first video data to the first client in the form of a video stream. The process may include the following contents:

[0124] 1. Obtain virtual index data corresponding to the first video data, where the virtual index data is used to indicate a segmentation position of the first video data.

[0125] 2. According to the virtual index data, the first video data is segmented and packaged to obtain a plurality of video slices under the first video encoding method.

[0126] For example, according to the virtual index data, H265 MP4 is segmented and encapsulated to obtain multiple TS slices under the H265 video encoding method.

[0127] 3. Send multiple video slices in the first video encoding mode to the first client.

[0128] For example, multiple TS slices in H265 video encoding mode are sent to the first client.

[0129] Optionally, when the second video encoding method is the same as the first video encoding method, if a video-on-demand request for the first video is received, the server can encapsulate and send the video slice data corresponding to the video-on-demand request in real time according to the virtual index data without transcoding.

[0130] In summary, the technical solution provided by the embodiment of the present application can effectively reduce the storage space occupied by the first video, thereby reducing the storage pressure on the first video, by permanently storing only the first video data of the first video in the first video encoding method. Since the first video encoding method is the video encoding method with the highest compression rate at the same bit rate among multiple candidate video encoding methods. In addition, by obtaining the second video data in the second video encoding method matching the first client based on the first video data in the first video encoding method, and providing it to the first client, the demand for the first video to be playable on all clients (such as clients supporting different video encoding methods) is met.

[0131] In addition, by supporting caching of video data (such as video slices, video streams) under the second video encoding method, when a request to obtain video data under the second video encoding method is received again, it can be directly pulled and returned from the cache device, which is conducive to avoiding multiple transcoding of video data under the first video encoding method, thereby reducing the transcoding cost of video data.

[0132] The above describes the sending of video data in detail, and the storage of video data will be described in detail below. For the contents not described in the embodiments of the present application, reference can be made to the above embodiments.

[0133] Please refer to Figure 4 , which shows a flowchart of a method for processing video data provided by another embodiment of the present application. The execution subject of each step of the method may be Figure 1 In the server 20 in the implementation environment of the solution shown, the method may include the following steps (401-405).

[0134] Step 401: Acquire third video data uploaded by a third client, where the third video data refers to video data corresponding to the second video.

[0135] The third client may refer to any client corresponding to the above-mentioned target application. The second video is different from the first video. The embodiment of the present application does not limit the video encoding method of the third video data, such as H265 video encoding method, H264 video encoding method, etc. The embodiment of the present application does not limit the packaging method of the third video data, such as MP4, HLS, etc.

[0136] Exemplarily, the third client encodes the second video in H264 video encoding to obtain encoded data, then encapsulates the encoded data in MP4 encapsulation format to obtain third video data, and finally the third client uploads the third video data to the server.

[0137] The third video may refer to a video provided by a user, such as a video shot by a user, a video produced by a user, a video forwarded by a user, etc., which is not limited in the present embodiment of the application. For example, the second video may refer to a video posted by a user in a circle of friends, and the first video may refer to a video watched by a user when browsing the circle of friends. The circle of friends refers to a social function in an application, through which a user can post and share content.

[0138] Step 402: Based on the third video data, fourth video data of the second video in the first video encoding mode is obtained.

[0139] Optionally, the server asynchronously transcodes the third video data to obtain fourth video data of the second video in the first video encoding mode.

[0140] For example, when the video encoding method of the third video data is the H264 video encoding method, it is transcoded into the fourth video data under the H265 video encoding method; when the video encoding method of the third video data is the H265 video encoding method, it can be transcoded into the fourth video data under the H265 video encoding method under a specified style. The specified format can be set and adjusted according to actual usage requirements, and the embodiments of the present application are not limited to this.

[0141] Step 403: Using virtual slicing technology, obtain virtual index data corresponding to the fourth video data.

[0142] The virtual index data corresponding to the fourth video data is used to indicate the segmentation position of the fourth video data, and records the corresponding relationship between the video slice data to be segmented corresponding to the fourth video data and the virtual index.

[0143] Optionally, the HLS virtual slicing technology may be used to virtually slice the fourth video data to obtain virtual index data corresponding to the fourth video data. Figure 3Taking the first video data 301 as an example, the encapsulation format of the first video data 301 is MP4, and its corresponding media information and key frame index are stored in MoovBox (header information). The server generates virtual index data 302 based on the header information corresponding to the first video data 301 using HLS virtual slicing technology. For example, for TS slice 0 (ie 0.ts), which corresponds to Sampel1 (video slice data), a virtual index Seg-0 can be generated for Sampel1. start and end are used to indicate the offset (ie segmentation position) of the video frames, audio frames, subtitles, etc. corresponding to the video slice data in the first video data 301.

[0144] In one example, the virtual index data corresponding to the fourth video data includes multiple virtual indexes; in the virtual index data corresponding to the fourth video data, the length of the video slice data corresponding to the first n virtual indexes is less than or equal to a first threshold, and the length of the video slice data corresponding to the remaining virtual indexes is greater than or equal to a second threshold, the first threshold is less than the second threshold, and n is a positive integer.

[0145] Among them, n, the first threshold and the second threshold can be set and adjusted according to empirical values, and the embodiment of the present application does not limit this. The length of the video slice data can be represented by its corresponding duration. For example, refer to Figure 3 For the first virtual index, the length of the corresponding video slice data can be set to 1 second. For the second and third virtual indexes, the length of the corresponding video slice data can be set to 2 seconds. Starting from the fourth virtual index, the length of the video slice data corresponding to each virtual index can be set to 5 seconds. Figure 3 The unit of sample in can be FPS (Frames PerSecond, frames per second), such as each sample represents a frame with a duration of 1 second.

[0146] In this way, virtual index data is generated according to the segmentation rule of short at the beginning and long at the end. Since the duration of the first n video slices (such as TS slices) is relatively short, the video can be played quickly. In addition, in the automatic video playback scenario, since the video slices do not take a long time to transcode, the "short at the beginning" will not cause a waste of resources for the video slices that have not been transcoded. Since the subsequent video segments are longer in length, the list corresponding to the index file (such as M3U8 file) in the HLS encapsulation format will not be too long, thereby avoiding the untimely caching of video data in the client.

[0147] Step 404: permanently store the fourth video data and the virtual index data corresponding to the fourth video data.

[0148] Optionally, the server permanently stores the fourth video data and the virtual index data corresponding to the fourth video data in a database.

[0149] For example, the fourth video data under H265 MP4 and the virtual index data are permanently stored in correspondence in a database. When receiving a video acquisition request from a client whose optimal encoding method is the H264 video encoding method, the server transcodes the fourth video data under H265 MP4 into video data under H264 HLS based on the virtual index data, and sends it to the client. When receiving a video acquisition request from a client whose optimal encoding method is the H265 video encoding method, the server may encapsulate the fourth video data under H265 MP4 into video data under H265 HLS based on the virtual index data, and send it to the client, or the server may directly send the fourth video data under H265 MP4 to the client.

[0150] Step 405: temporarily store the third video data.

[0151] Optionally, when the video encoding mode of the third video data is the first video encoding mode, the server deletes the third video data.

[0152] For example, when the video encoding method of the third video data is the H265 video encoding method, after the server completes the transcoding of the third video data to obtain the fourth video data, the server can directly delete the third video data to avoid occupying storage space.

[0153] Optionally, when a video encoding method of the third video data is not the first video encoding method, the server temporarily stores the third video data.

[0154] For example, when the video encoding method of the third video data is the H264 video encoding method, the server may temporarily store the third video data after completing the transcoding of the third video data to obtain the fourth video data.

[0155] When the second video is a hot video (e.g., it has a large number of views), there may be a large demand for the third video data under H264 MP4. In this way, the third video data under H264 MP4 that is temporarily stored can be used to meet the large demand, thereby avoiding repeated transcoding of the fourth video data, thereby reducing the transcoding cost of the video data and enabling the server to have a certain anti-hotspot capability. Optionally, after the second video becomes a cold stream (with a small number of views), there may be a small demand (or even no demand) for the third video data under H264 MP4, and the server can delete the third video data under H264 MP4 to free up storage space.

[0156] In an example, after temporarily storing the third video data, the embodiment of the present application may further include the following content:

[0157] 1. Obtain the recycling time of the third video data, where the recycling time is determined based on the playback volume of the third video data.

[0158] The recycling time is used to indicate the deletion time of the temporarily stored third video data. Exemplarily, the server obtains the average playback volume of the third video data under H264 MP4 in each time period, determines the storage cost of the third video data based on the average playback volume, and the increased traffic cost when downloading the third video data (such as relative to the download of the video data under H264 HLS), obtains the transcoding cost of transcoding the fourth video data under H265 MP4 into the video data under H264 HLS, and when the transcoding cost < (storage cost + traffic cost), the server determines the time point as the recycling time of the third video data.

[0159] 2. Delete the third video data at the recycling time.

[0160] Optionally, the server first queries whether the fourth video data and the virtual index file of the fourth video data have been stored completely at the time of recycling, and automatically deletes the third video data if the storage has been completed.

[0161] Optionally, the server may write the identification information and recycling time of the third video data into a recycling device (such as a recycling center), and the recycling device calls back the server at the recycling time. When the server queries the database for the existence of the fourth video data and the virtual index file of the fourth video data, it automatically deletes the third video data. The recycling device is used to recycle data.

[0162] In one example, when the video encoding method of the third video data is the second video encoding method, in response to the acquisition request for the second video from the first client, if the third video data has not been deleted, the third video data is sent to the first client. If the third video data has been deleted, the video data of the second video in the second video encoding method is obtained by transcoding based on the fourth video data, and the video data of the second video in the second video encoding method is sent to the first client.

[0163] For example, when the optimal encoding method of the first client is the H264 video encoding method and the first video encoding method is the H265 video encoding method, in response to the acquisition request for the second video from the first client, if the third video data under H264MP4 has not been deleted, the server directly sends the third video data to the first client; if the third video data under H264MP4 has been deleted, the server transcodes the fourth video data under H265 MP4 into video data under H264 HLS to provide it to the first client.

[0164] In summary, the technical solution provided by the embodiment of the present application can effectively reduce the storage space occupied by the first video, thereby reducing the storage pressure on the first video, by permanently storing only the first video data of the first video in the first video encoding method. Since the first video encoding method is the video encoding method with the highest compression rate at the same bit rate among multiple candidate video encoding methods. In addition, by obtaining the second video data in the second video encoding method that matches the first client based on the first video data in the first video encoding method, and providing it to the first client, the demand for the first video to be playable on all clients (such as clients that support different video encoding methods) is met.

[0165] In addition, by temporarily storing the third video data and deleting the third video at the recycling time, the anti-hotspot capability of the server can be effectively improved.

[0166] In some embodiments, some clients only support the playback of video data in H264 video encoding mode, some clients support the playback of video data in both H264 video encoding mode and H265 video encoding mode, and most Web clients do not support the playback of video data in H265 video encoding mode.

[0167] For example, reference Figure 5 For different clients, the server can send video data in different video encoding modes:

[0168] 1. When the first client 503 is a Web client (H264 client for short), if there is temporarily stored video data under H264MP4 (i.e., f0), the server 501 sends a video link of the video data under H264 MP4; otherwise, the server 501 encapsulates the video data under H265 HLS in real time based on the permanently stored video data under H265 MP4 (i.e., f30) and the virtual index data (i.e., f30.index), then transcodes the video data under H265 HLS into video data under H264 HLS in real time, and finally sends a video link of the video data under H264 HLS.

[0169] 2. When the first client 503 is a client supporting the H265 video encoding method (hereinafter referred to as the H265 client), the server 501 may send a video link of the video data in H265 MP4 or a video link of the video data in H265 HLS.

[0170] 3. When the first client is a client that does not support the H265 video encoding method (H264 end for short), if there is temporarily stored video data in H264 MP4 (i.e. f0), the server 501 sends the video link of the video data in H264 MP4; otherwise, the server 501 sends the video link of the video data in H264 HLS.

[0171] Optionally, refer to Figure 5 , when the video data in H264 MP4 is uploaded by the third client 502, after receiving the video data in H264 MP4 uploaded by the third client 502, the server 501 temporarily stores the video data in H264 MP4, asynchronously transcodes the video data in H264 MP4 into video data in H265 MP4, and asynchronously generates virtual index data (f30.index) based on the video data in H265 MP4.

[0172] refer to Figure 6 After asynchronously transcoding to obtain the video data in H265 MP4, the server 501 sends the Vid (identification information) and recycling time of the video data in H265 MP4 to the recycling center 504. The recycling center 504 calls back the server 501 at the recycling time to delete the temporarily stored video data in H264 MP4. After confirming that the video data in H265 MP4 and the virtual index data have completed permanent storage, the server 501 deletes the temporarily stored video data in H264 MP4.

[0173] During this period, when receiving a request to obtain video data under H264, the server 501 first checks whether the video data under H264 MP4 is deleted. If not, the video link of the video data under H264 MP4 is directly sent to the client. Otherwise, the server sends the video link of the video data under H264 HLS to the client. Optionally, the server may also directly send the video link of the video data under H264 HLS to the client without querying the video data under H264 MP4.

[0174] refer to Figure 7During the real-time transcoding process of the video data under H264 HLS, the server 501 can also cache the video data under H264 HLS (such as the TS slice under H264) in the SATA cache device 505, and generate a cache identifier corresponding to the video data under H264 HLS. When the server 501 receives a request to obtain the TS slice under H264, it can directly obtain the TS slice under H264 based on the cache identifier and send it to the client.

[0175] refer to Figure 8 After receiving the video data in H264 MP4 or H264 HLS or H265 MP4 or H265 HLS, the client plays the video 506 corresponding to the video data.

[0176] In summary, the technical solution provided by the embodiment of the present application can effectively reduce the storage space occupied by video data, thereby reducing the storage pressure on video data, by using the H265 video encoding method with the highest compression rate at the same bit rate for permanent storage of video data. In addition, by obtaining video data in a video encoding method that matches the client based on video data in the H265 video encoding method, and providing it to the client, the demand for playable video data on all clients (such as clients that support different video encoding methods) is met.

[0177] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.

[0178] refer to Fig. 9 , which shows a block diagram of a video data processing device provided by an embodiment of the present application. The device has the function of implementing the above method example, and the function can be implemented by hardware, or by hardware executing corresponding software. The device can be the terminal device introduced above, or it can be set in the terminal device. Fig. 9 As shown, the device 900 includes: a video data acquisition module 901, an encoding mode determination module 902, a video data transcoding module 903 and a video data sending module 904.

[0179] The video data acquisition module 901 is used to respond to a video acquisition request from a first client and obtain first video data from a database; wherein the first video data refers to video data obtained by encoding the first video using a first video encoding method. For the first video, the database only permanently stores the first video data. The first video data is used to obtain video data of the first video under multiple candidate video encoding methods. Under the same bit rate, the compression rate corresponding to the first video encoding method is greater than or equal to the compression rate corresponding to the candidate video encoding method.

[0180] The encoding mode determining module 902 is used to determine a second video encoding mode that matches the first client from the multiple candidate video encoding modes.

[0181] The video data transcoding module 903 is used to obtain second video data of the first video in the second video encoding mode based on the first video data when the second video encoding mode is different from the first video encoding mode.

[0182] The video data sending module 904 is used to send the second video data to the first client.

[0183] In some embodiments, the video data transcoding module 903 is used to:

[0184] Acquire virtual index data corresponding to the first video data, where the virtual index data is used to indicate a segmentation position of the first video data;

[0185] According to the virtual index data, the first video data is segmented and packaged to obtain a plurality of video slices in the first video encoding mode;

[0186] Transcoding the plurality of video slices in the first video encoding mode into the plurality of video slices in the second video encoding mode;

[0187] Combine multiple video slices in the second video encoding mode to obtain the second video data.

[0188] In some embodiments, Fig.10 As shown, the device 900 further includes: a slice data acquisition module 905 , a video slice generation module 906 , a video slice transcoding module 907 and a video slice sending module 908 .

[0189] The slice data acquisition module 905 is used to respond to the on-demand request for the first video from the first client and acquire the video slice data corresponding to the on-demand request from the first video data according to the virtual index data.

[0190] The video slice generating module 906 is used to encapsulate the video slice data to obtain video slices of the video slice data under the first video encoding mode.

[0191] The video slice transcoding module 907 is used to transcode the video slices of the video slice data in the first video encoding mode into video slices of the video slice data in the second video encoding mode.

[0192] The video slice sending module 908 is used to send the video slices of the video slice data in the second video encoding mode to the first client.

[0193] In some embodiments, Fig.10 As shown, the device 900 further includes: a video slice caching module 909 and a video slice acquiring module 910 .

[0194] The video slice cache module 909 is used to store the video slices of the video slice data under the second video encoding method in a cache device; wherein the cache identifier of the video slice of the video slice data under the second video encoding method is constructed based on the identification information of the first video data, the identification information of the video slice data and the index range information of the video slice data.

[0195] The video slice acquisition module 910 is used to respond to a video-on-demand request for the video slice data from a second client, and when the video encoding method corresponding to the second client is the second video encoding method, obtain the video slices of the video slice data under the second video encoding method from the cache device.

[0196] The video slice sending module 908 is further configured to send the video slices of the video slice data in the second video encoding mode to the second client.

[0197] In some embodiments, the video data sending module 904 is further configured to send the first video data to the first client when the second video encoding method is the same as the first video encoding method.

[0198] In some embodiments, Fig.10 As shown, the device 900 further includes: an index data acquisition module 911.

[0199] The index data acquisition module 911 is used to acquire virtual index data corresponding to the first video data, where the virtual index data is used to indicate a segmentation position of the first video data.

[0200] The video slice generation module 906 is further configured to segment and encapsulate the first video data according to the virtual index data to obtain a plurality of video slices in the first video encoding mode.

[0201] The video slice sending module 908 is further configured to send a plurality of video slices in the first video encoding mode to the first client.

[0202] In some embodiments, the encoding mode determination module 902 is further used to:

[0203] Determine an optimal encoding method corresponding to the first client from the multiple candidate video encoding methods; wherein the optimal encoding method refers to a video encoding method with the highest compression rate at the same bit rate among the candidate video encoding methods supported by the first client;

[0204] The optimal encoding method is determined as the second video encoding method.

[0205] In some embodiments, the first video encoding mode is an H265 video encoding mode, and the candidate video encoding modes include at least one of the following: the H265 video encoding mode and the H264 video encoding mode.

[0206] In some embodiments, Fig.10 As shown, the device 900 further includes: an index data generating module 912 and a video data storing module 913 .

[0207] The video data acquisition module 901 is further used to acquire third video data uploaded by a third client, where the third video data refers to video data corresponding to the second video.

[0208] The video data transcoding module 903 is further configured to obtain fourth video data of the second video in the first video encoding mode based on the third video data.

[0209] The index data generating module 912 is used to obtain virtual index data corresponding to the fourth video data by adopting virtual slicing technology.

[0210] The video data storage module 913 is used to permanently store the fourth video data and the virtual index data corresponding to the fourth video data.

[0211] The video data storage module 913 is also used to temporarily store the third video data.

[0212] In some embodiments, the virtual index data corresponding to the fourth video data includes multiple virtual indexes; in the virtual index data corresponding to the fourth video data, the length of the video slice data corresponding to the first n virtual indexes is less than or equal to a first threshold, and the length of the video slice data corresponding to the remaining virtual indexes is greater than or equal to a second threshold, the first threshold is less than the second threshold, and n is a positive integer.

[0213] In some embodiments, the video data storage module 913 is used to:

[0214] When the video encoding method of the third video data is the first video encoding method, deleting the third video data;

[0215] Alternatively, when the video encoding method of the third video data is not the first video encoding method, the third video data is temporarily stored.

[0216] In some embodiments, Fig.10 As shown, the device 900 further includes: a recycling time acquisition module 914 and a video data deletion module 915 .

[0217] The recycling time acquisition module 914 is used to acquire the recycling time of the third video data, where the recycling time is determined based on the playback volume of the third video data.

[0218] The video data deleting module 915 is used to delete the third video data at the recycling time.

[0219] In some embodiments, the video data sending module 904 is also used to send the third video data to the first client in response to an acquisition request for the second video from the first client when the video encoding method of the third video data is the second video encoding method, if the third video data has not been deleted.

[0220] In summary, the technical solution provided by the embodiment of the present application can effectively reduce the storage space occupied by the first video, thereby reducing the storage pressure on the first video, by permanently storing only the first video data of the first video in the first video encoding method. Since the first video encoding method is the video encoding method with the highest compression rate at the same bit rate among multiple candidate video encoding methods. In addition, by obtaining the second video data in the second video encoding method that matches the first client based on the first video data in the first video encoding method, and providing it to the first client, the demand for the first video to be playable on all clients (such as clients that support different video encoding methods) is met.

[0221] It should be noted that the device provided in the above embodiment, when implementing its functions, is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.

[0222] Please refer to Fig.11 , which shows a structural block diagram of a computer device provided in one embodiment of the present application. The computer device can be used to implement the video data processing method provided in the above embodiment. Specifically, it can include the following contents.

[0223] The computer device 1100 includes a central processing unit (such as a CPU (Central Processing Unit), a GPU (Graphics Processing Unit) and an FPGA (Field Programmable Gate Array)) 1101, a system memory 1104 including a RAM (Random-Access Memory) 1102 and a ROM (Read-Only Memory) 1103, and a system bus 1105 connecting the system memory 1104 and the central processing unit 1101. The computer device 1100 also includes a basic input / output system (Input Output System, I / O system) 1106 for helping to transmit information between various devices in the computer device, and a large-capacity storage device 1107 for storing an operating system 1113, application programs 1114 and other program modules 1115.

[0224] The basic input / output system 1106 includes a display 1108 for displaying information and an input device 1109 such as a mouse and a keyboard for user inputting information. The display 1108 and the input device 1109 are connected to the central processing unit 1101 through an input / output controller 1110 connected to the system bus 1105. The basic input / output system 1106 may also include an input / output controller 1110 for receiving and processing inputs from a plurality of other devices such as a keyboard, a mouse, or an electronic stylus. Similarly, the input / output controller 1110 also provides output to a display screen, a printer, or other types of output devices.

[0225] The mass storage device 1107 is connected to the central processing unit 1101 via a mass storage controller (not shown) connected to the system bus 1105. The mass storage device 1107 and its associated computer readable medium provide non-volatile storage for the computer device 1100. That is, the mass storage device 1107 may include a computer readable medium (not shown) such as a hard disk or a CD-ROM (Compact Disc Read-Only Memory) drive.

[0226] Without loss of generality, the computer-readable medium may include computer storage media and communication media. Computer storage media include volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer-readable instructions, data structures, program modules or other data. Computer storage media include RAM, ROM, EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electrically Erasable Programmable Read-Only Memory), flash memory or other solid-state storage technology, CD-ROM, DVD (Digital Video Disc) or other optical storage, cassettes, tapes, disk storage or other magnetic storage devices. Of course, those skilled in the art will know that the computer storage medium is not limited to the above. The above-mentioned system memory 1104 and mass storage device 1107 can be collectively referred to as memory.

[0227] According to an embodiment of the present application, the computer device 1100 can also be connected to a remote computer on the network through a network such as the Internet. That is, the computer device 1100 can be connected to the network 1112 through the network interface unit 1111 connected to the system bus 1105, or the network interface unit 1111 can be used to connect to other types of networks or remote computer systems (not shown).

[0228] The memory also includes a computer program, which is stored in the memory and configured to be executed by one or more processors to implement the above-mentioned video data processing method.

[0229] In some embodiments, a computer-readable storage medium is further provided, wherein a computer program is stored in the storage medium, and when the computer program is executed by a processor of a computer device, the computer program implements the above-mentioned method for processing video data.

[0230] Optionally, the computer readable storage medium may include: ROM (Read-Only Memory), RAM (Random-Access Memory), SSD (Solid State Drives) or optical disks, etc. Among them, the random access memory may include ReRAM (Resistance Random Access Memory) and DRAM (Dynamic Random Access Memory).

[0231] In some embodiments, a computer program product is further provided, the computer program product comprising a computer program, the computer program being stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the above-mentioned method for processing video data.

[0232] It should be noted that, before collecting the relevant data of the user and during the process of collecting the relevant data of the user, the embodiment of the present application can display a prompt interface, a pop-up window or output a voice prompt information, and the prompt interface, pop-up window or voice prompt information is used to prompt the user that the relevant data is currently being collected, so that the present application only starts to execute the relevant steps of obtaining the relevant data of the user after obtaining the confirmation operation issued by the user to the prompt interface or pop-up window, otherwise (that is, when the confirmation operation issued by the user to the prompt interface or pop-up window is not obtained), the relevant steps of obtaining the relevant data of the user are terminated, that is, the relevant data of the user is not obtained. In other words, all user data collected by this application are processed strictly in accordance with the requirements of the laws and regulations of relevant countries, and the informed consent or separate consent of the subject of personal information is obtained with the consent and authorization of the user. The subsequent data use and processing behavior is carried out within the scope of authorization of laws and regulations and the subject of personal information, and the collection, use and processing of relevant user data need to comply with the relevant laws, regulations and standards of relevant countries and regions. For example, the video data involved in this application are all obtained with full authorization.

[0233] It should be understood that the "multiple" mentioned in this article refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. In addition, the step numbers described in this article only illustrate a possible execution sequence between the steps. In some other embodiments, the above steps may not be executed in the order of the numbers, such as two steps with different numbers are executed at the same time, or two steps with different numbers are executed in the opposite order to the diagram. The embodiments of the present application are not limited to this.

[0234] The above description is only an exemplary embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.

Claims

1. A method for processing video data, It is characterized in that The method comprises: In response to a video acquisition request from a first client, first video data is acquired from a database; wherein the first video data refers to video data obtained by encoding the first video in a first video encoding method, and for the first video, the database only permanently stores the first video data, and the first video data is used to acquire video data of the first video in a plurality of candidate video encoding methods, respectively, and at the same bit rate, the compression ratio corresponding to the first video encoding method is greater than or equal to the compression ratio corresponding to the candidate video encoding method; Determining, from the multiple candidate video encoding modes, a second video encoding mode that matches the first client; When the second video encoding mode is different from the first video encoding mode, obtaining second video data of the first video in the second video encoding mode based on the first video data; The second video data is sent to the first client.

2. The method according to claim 1, It is characterized in that The acquiring, based on the first video data, second video data of the first video in the second video encoding mode includes: Acquire virtual index data corresponding to the first video data, where the virtual index data is used to indicate a segmentation position of the first video data; According to the virtual index data, the first video data is segmented and packaged to obtain a plurality of video slices in the first video encoding mode; Transcoding the plurality of video slices in the first video encoding mode into the plurality of video slices in the second video encoding mode; Combine multiple video slices in the second video encoding mode to obtain the second video data.

3. The method according to claim 2, It is characterized in that The method further comprises: In response to a video-on-demand request for the first video from the first client, acquiring video slice data corresponding to the video-on-demand request from the first video data according to the virtual index data; Encapsulating the video slice data to obtain video slices of the video slice data in the first video encoding mode; Transcoding the video slice data in the first video encoding mode into video slice data in the second video encoding mode; Sending video slices of the video slice data in the second video encoding mode to the first client.

4. The method according to claim 3, It is characterized in that After transcoding the video slice data in the first video encoding mode into the video slice data in the second video encoding mode, the method further includes: storing the video slices of the video slice data in the second video encoding mode in a cache device; wherein the cache identifier of the video slice of the video slice data in the second video encoding mode is constructed based on the identifier information of the first video data, the identifier information of the video slice data and the index range information of the video slice data; In response to a video-on-demand request for the video slice data from a second client, when a video encoding mode corresponding to the second client is the second video encoding mode, obtaining video slices of the video slice data in the second video encoding mode from the cache device; Send the video slices of the video slice data in the second video encoding mode to the second client.

5. The method according to claim 1, It is characterized in that The method further comprises: When the second video encoding method is the same as the first video encoding method, the first video data is sent to the first client.

6. The method according to claim 5, It is characterized in that The method further comprises: Acquire virtual index data corresponding to the first video data, where the virtual index data is used to indicate a segmentation position of the first video data; According to the virtual index data, the first video data is segmented and packaged to obtain a plurality of video slices in the first video encoding mode; Send multiple video slices in the first video encoding mode to the first client.

7. The method according to claim 1, It is characterized in that The step of determining, from the plurality of candidate video encoding modes, a second video encoding mode that matches the first client includes: Determine an optimal encoding method corresponding to the first client from the multiple candidate video encoding methods; wherein the optimal encoding method refers to a video encoding method with the highest compression rate at the same bit rate among the candidate video encoding methods supported by the first client; The optimal encoding method is determined as the second video encoding method.

8. The method according to claim 1, It is characterized in that The first video encoding mode is the H265 video encoding mode, and the candidate video encoding modes include at least one of the following: the H265 video encoding mode and the H264 video encoding mode.

9. The method according to claim 1, It is characterized in that The method further comprises: Acquire third video data uploaded by a third client, where the third video data refers to video data corresponding to the second video; Based on the third video data, obtaining fourth video data of the second video in the first video encoding mode; Using virtual slicing technology, obtaining virtual index data corresponding to the fourth video data; Permanently storing the fourth video data and the virtual index data corresponding to the fourth video data; The third video data is temporarily stored.

10. The method according to claim 9, It is characterized in that The virtual index data corresponding to the fourth video data includes a plurality of virtual indexes; In the virtual index data corresponding to the fourth video data, the lengths of the video slice data corresponding to the first n virtual indexes are less than or equal to a first threshold, and the lengths of the video slice data corresponding to the remaining virtual indexes are greater than or equal to a second threshold, the first threshold is less than the second threshold, and n is a positive integer.

11. The method according to claim 9, It is characterized in that The temporarily storing the third video data comprises: When the video encoding method of the third video data is the first video encoding method, deleting the third video data; or, When the video encoding method of the third video data is not the first video encoding method, the third video data is temporarily stored.

12. The method according to claim 9, It is characterized in that After temporarily storing the third video data, the method further includes: Acquire a recycling time of the third video data, where the recycling time is determined based on the playback volume of the third video data; The third video data is deleted at the recycling time.

13. The method according to claim 12, It is characterized in that The method further comprises: In a case where the video encoding method of the third video data is the second video encoding method, in response to an acquisition request for the second video from the first client, if the third video data is not deleted, the third video data is sent to the first client.

14. A video data processing device, It is characterized in that The device comprises: A video data acquisition module, configured to obtain first video data from a database in response to a video acquisition request from a first client; wherein the first video data refers to video data obtained by encoding the first video in a first video encoding method, and for the first video, the database only permanently stores the first video data, and the first video data is used to obtain video data of the first video in multiple candidate video encoding methods, respectively, and under the same bit rate, the compression rate corresponding to the first video encoding method is greater than or equal to the compression rate corresponding to the candidate video encoding method; An encoding mode determining module, configured to determine a second video encoding mode matching the first client from the plurality of candidate video encoding modes; a video data transcoding module, configured to obtain, based on the first video data, second video data of the first video in the second video encoding mode when the second video encoding mode is different from the first video encoding mode; A video data sending module is used to send the second video data to the first client.

15. A computer device, It is characterized in that The computer device includes a processor and a memory, wherein a computer program is stored in the memory, and the computer program is loaded and executed by the processor to implement the video data processing method according to any one of claims 1 to 13.

16. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and the computer program is loaded and executed by a processor to implement the video data processing method according to any one of claims 1 to 13.

17. A computer program product, It is characterized in that The computer program product comprises a computer program, the computer program is stored in a computer-readable storage medium, and a processor reads and executes the computer program from the computer-readable storage medium to implement the method for processing video data according to any one of claims 1 to 13.