Video processing method and device for progressive downloading, equipment, storage medium and program product
By cutting video into multiple transport streams and distribute storage, the problem of limiting the size of a single video and excessive server access pressure in progressive downloads is solved, and efficient video storage and transmission is achieved.
Patent Information
- Application Number
- CN202411771971.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-02-25
AI Technical Summary
The traditional video processing method in progressive download has certain restrictions on the size of a single video, and it is easy to cause excessive access pressure on the server, especially during the storage and transmission of ultra-high-definition videos.
Slice a single video into multiple transport stream slices and store these slices in a storage server cluster. By receiving video request information, the transmission stream slice corresponding to the video is determined, and the slice data stream that meets the request range is requested and returned to achieve a progressive download of the video.
This solution can solve the problem of the storage server limiting the size of a single video in progressive download, dispersing the access pressure of the server, and quickly locking the relevant transport stream slices to reduce the slice access granularity and improve the data stream response efficiency.
Smart Images

Figure CN119520932A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of streaming media, and in particular to a video processing method, apparatus, computer equipment, computer-readable storage medium and computer program product for progressive downloading. Background Art
[0002] HTTP-based streaming media transmission methods include progressive download (PD) based on HTTP (Hypertext Transfer Protocol), etc. Each method is suitable for different scenarios according to its characteristics.
[0003] Among them, progressive download has the characteristics of supporting playback while downloading, allowing local storage, and supporting seek (search or jump). It can be suitable for scenarios that do not require high real-time performance, require multiple viewings or offline viewing, such as video on demand services.
[0004] The current on-demand service architecture usually includes a player, a streaming server, a cache server, and a storage server. Among them, the player can be responsible for receiving and playing video content; the streaming server can be responsible for processing playback requests and providing video streaming data; the cache server can be used to improve the efficiency and response speed of video transmission; the storage server can be used to store a large number of videos and other files. In large-scale businesses, each layer usually adopts multi-node deployment. In this architecture, the cache server can save the processed file content for a certain period of time and respond directly when receiving the same request. Therefore, a specific scheduling method (such as a hash-based scheduling method) can be used between the streaming server and the cache server to improve the cache hit rate, thereby further reducing the pressure on the back-end storage server.
[0005] However, with the continuous development of ultra-high-definition (UHD / 4K, 8K) technology, the storage space occupied by videos is increasing. Traditional video processing methods in progressive downloads have certain limitations on the size of a single video (such as the size limit of 4GB in the FAT32 file system) and can easily cause excessive access pressure on the server. Summary of the invention
[0006] Based on this, it is necessary to provide a video processing method, apparatus, computer device, computer-readable storage medium and computer program product for progressive downloading in order to solve the above technical problems.
[0007] In a first aspect, the present application provides a video processing method for progressive downloading, comprising:
[0008] Receive video request information sent by a requesting end; the video request information is used to request a progressively downloaded video;
[0009] Determine, according to the video request information, a plurality of transport stream slices corresponding to the video;
[0010] Requesting a slice data stream of each valid transport stream slice from the storage server cluster; the valid transport stream slice is a transport stream slice in the multiple transport stream slices that meets the request range indicated by the video request information;
[0011] According to the received slice data stream, the valid slice data stream in the slice data stream that meets the request range is returned to the requesting end for playing.
[0012] In one of the embodiments, determining multiple transport stream slices corresponding to the video based on the video request information includes: obtaining slice index information corresponding to the video based on the video request information; and determining the multiple transport stream slices based on the slice index information.
[0013] In one of the embodiments, obtaining slice index information corresponding to the video according to the video request information includes: obtaining main index information according to the video request information; determining sub-index information according to the main index information; and obtaining slice index information corresponding to the video according to the sub-index information.
[0014] In one of the embodiments, before receiving the video request information sent by the requesting end, the method further includes: cutting the video into the multiple transport stream slices; and distributing and storing the multiple transport stream slices in a storage server cluster.
[0015] In one of the embodiments, distributing and storing the multiple transport stream slices in a storage server cluster includes: generating corresponding slice index information based on the multiple transport stream slices; and storing the multiple transport stream slices and corresponding slice index information in the storage server cluster.
[0016] In one of the embodiments, generating corresponding slice index information based on the multiple transport stream slices includes: generating main index information and sub-index information corresponding to the multiple transport stream slices according to the hypertext live streaming protocol; the sub-index information includes the slice index information; storing the multiple transport stream slices and the corresponding slice index information in a storage server cluster includes: storing the multiple transport stream slices, the corresponding main index information and sub-index information in a storage server cluster.
[0017] In a second aspect, the present application further provides a video processing device for progressive downloading, comprising:
[0018] A request receiving module, used for receiving video request information sent by a requesting end; the video request information is used for requesting a progressively downloaded video;
[0019] A slice determination module, used to determine a plurality of transport stream slices corresponding to the video according to the video request information;
[0020] A stream request module, configured to request a slice data stream of each valid transport stream slice from a storage server cluster; the valid transport stream slice is a transport stream slice in the plurality of transport stream slices that meets the request range indicated by the video request information;
[0021] The stream returning module is used to return the valid slice data stream that meets the request range in the slice data stream to the requesting end for playback according to the received slice data stream.
[0022] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0023] Receive video request information sent by a requesting end; the video request information is used to request a progressively downloaded video; according to the video request information, determine multiple transport stream slices corresponding to the video; request a slice data stream of each valid transport stream slice from a storage server cluster; the valid transport stream slice is a transport stream slice in the multiple transport stream slices that meets the request range indicated by the video request information; according to the received slice data stream, return the valid slice data stream in the slice data stream that meets the request range to the requesting end for playback.
[0024] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:
[0025] Receive video request information sent by a requesting end; the video request information is used to request a progressively downloaded video; according to the video request information, determine multiple transport stream slices corresponding to the video; request a slice data stream of each valid transport stream slice from a storage server cluster; the valid transport stream slice is a transport stream slice in the multiple transport stream slices that meets the request range indicated by the video request information; according to the received slice data stream, return the valid slice data stream in the slice data stream that meets the request range to the requesting end for playback.
[0026] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:
[0027] Receive video request information sent by a requesting end; the video request information is used to request a progressively downloaded video; according to the video request information, determine multiple transport stream slices corresponding to the video; request a slice data stream of each valid transport stream slice from a storage server cluster; the valid transport stream slice is a transport stream slice in the multiple transport stream slices that meets the request range indicated by the video request information; according to the received slice data stream, return the valid slice data stream in the slice data stream that meets the request range to the requesting end for playback.
[0028] The above-mentioned video processing method, device, computer equipment, computer-readable storage medium and computer program product for progressive download receive video request information sent by the requesting end for requesting progressive download of the video; determine multiple transport stream slices corresponding to the video according to the video request information; request the slice data stream of each valid transport stream slice from the storage server cluster; the valid transport stream slice is the transport stream slice in the multiple transport stream slices that meets the request range indicated by the video request information; according to the received slice data stream, return the valid slice data stream in the slice data stream that meets the request range to the requesting end for playback. This solution can store and access a single video in the form of multiple transport stream slices, can solve the problem of the storage server's limitation on the size of a single video in progressive download, can also disperse the access pressure on the server, and can quickly lock the relevant transport stream slices in combination with the request range, reduce the slice access granularity, and improve the data stream response efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions 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 related drawings can be obtained based on these drawings without paying creative work.
[0030] FIG1 is a diagram of an application environment of a video processing method for progressive downloading in one embodiment;
[0031] FIG2 is a schematic flow chart of a video processing method for progressive downloading in one embodiment;
[0032] FIG3 is a schematic diagram of cutting a video into slices in one embodiment;
[0033] FIG4 is an interactive flow chart of a video processing method for progressive downloading in one embodiment;
[0034] FIG5 is a schematic flow chart of a video processing method for progressive downloading in another embodiment;
[0035] FIG6 is a structural block diagram of a video processing device for progressive downloading in one embodiment;
[0036] FIG. 7 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0037] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0038] Introduction to terms involved in the embodiments of this application:
[0039] HTTP (Hypertext Transfer Protocol): is an application layer protocol that specifies the rules for communication between the client (usually a web browser) and the server, and usually runs on top of TCP (Transmission Control Protocol).
[0040] PD (Progressive Download): is a technology that allows users to start playing videos while downloading them. There is no need to wait until the entire video is downloaded before playing it. It can be played while downloading. After the video is played, the entire video will be saved on the computer.
[0041] HLS (HTTP Live Streaming): A streaming network transmission protocol based on HTTP. It can be used to cut videos into TS (Transport Stream) slices, generate multi-level m3u8 playlist files (main m3u8, sub-m3u8), achieve the effect of downloading and playing at the same time, and can adapt the bit rate.
[0042] Streaming media server: It is responsible for receiving and processing playback requests from clients and sending video stream data to clients. It usually has functions such as video transcoding, storage management, and multi-terminal adaptation. It can provide appropriate video stream data based on client requests and network conditions.
[0043] The video processing method for progressive downloading provided in the embodiment of the present application can be applied in the application environment shown in FIG. 1, which can be a video-on-demand service architecture, and can include a player, a streaming media server, a cache server, and a storage server. Among them, the player can be responsible for receiving and playing video content; the streaming media server can be responsible for processing playback requests and providing video stream data; the cache server can be used to improve the efficiency and response speed of video transmission; the storage server can be used to store a large number of videos and other files. In large-scale businesses, each layer usually adopts multi-node deployment. In this architecture, the cache server can save the processed file content for a certain period of time and respond directly when receiving the same request. Therefore, a specific scheduling method (such as a hash-based scheduling method) can be used between the streaming media server and the cache server to improve the cache hit rate, thereby further reducing the pressure on the back-end storage server.
[0044] In the application environment shown in FIG1 , the access process of the traditional video processing method in progressive download using the overall storage and the access process of the decentralized storage in the embodiment of the present application are shown. The problems faced by the traditional video processing method in progressive download may include: 1. Some storage servers have certain restrictions on the size of a single file (such as the size limit of 4GB in the FAT32 file system); 2. A single file that is too large may increase the access pressure of a storage server, especially in the high concurrency scenario of hot videos; 3. A single file that is too large will cause uneven caching, which will be concentrated on a single server to cause cache pressure; 4. A file that is too large may affect the processing and response speed under a request with a request range. In this regard, the method of the embodiment of the present application can store and access a single video in the form of multiple transport stream slices, which can solve the problem of the storage server's restriction on the size of a single video in progressive download, and can also disperse the access pressure on the server, and can quickly lock the relevant transport stream slices in combination with the request range, reduce the slice access granularity, and improve the data stream response efficiency.
[0045] In the application environment shown in FIG1 , the player may belong to a terminal, which may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, IoT devices, and portable wearable devices. IoT devices may be smart speakers, smart TVs, smart air conditioners, smart car devices, and projection devices. Portable wearable devices may be smart watches, smart bracelets, head-mounted devices, and the like. Head-mounted devices may be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, and the like. A server may be an independent physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server that provides cloud computing services.
[0046] The following is an explanation of the video processing method for progressive downloading of the present application based on the application environment shown in FIG. 1 in combination with various embodiments and drawings.
[0047] In an exemplary embodiment, as shown in FIG. 2 , a video processing method for progressive download is provided. The method may be applied to a streaming media server as shown in FIG. 1 . The method may include:
[0048] Step S201: receiving video request information sent by a requesting end.
[0049] The requesting end may be a terminal for requesting to obtain a video, for example, the terminal where the player in FIG1 is located may be used as the requesting end. The video request information is used to request a progressively downloaded video. In this step, the streaming media server may receive the video request information sent by the requesting end for requesting a progressively downloaded video.
[0050] Step S202: Determine multiple transport stream slices corresponding to the video according to the video request information.
[0051] The video may be pre-divided into multiple transport stream slices (TS slices), and the multiple transport stream slices may be stored in different servers, such as the distributed storage server in Figure 1. In this step, the streaming media server may determine the multiple transport stream slices corresponding to the video according to the video request information.
[0052] Step S203: requesting a slice data stream of each valid transport stream slice from the storage server cluster.
[0053] The storage server cluster may be a storage server cluster storing slice data corresponding to the transport stream slices. The storage server cluster may be a distributed storage server as shown in FIG1 .
[0054] In this step, the streaming media server may request the storage server cluster for a slice data stream of each valid transport stream slice, wherein the valid transport stream slice refers to a transport stream slice in the plurality of transport stream slices that meets the request range indicated by the video request information.
[0055] As an example, when the video request information carries a request range header, in order to quickly obtain the data of the video corresponding to the request range, the streaming media server can store the valid transport stream slices that meet the request range indicated by the video request information into the waiting queue. The judgment method is as follows:
[0056] Assuming that the starting byte and the ending byte parsed from the request range header are start and end, the file name of the transport stream slice can be parsed to obtain the starting position of the transport stream slice as offset, and the size of the transport stream slice is size. Then the condition of the irrelevant transport stream slice is: offset >= end || offset+size <= start. The transport stream slices that meet the condition are not put into the waiting queue. Therefore, the valid transport stream slices can be added to the waiting queue in sequence to request the slice data stream of each valid transport stream slice in sequence from the storage server cluster. In the specific implementation, the waiting queue cannot be empty. If the waiting queue is not empty, it can be returned that the request does not meet the requirements.
[0057] Step S204: according to the received slice data stream, return the valid slice data stream that meets the request range in the slice data stream to the requesting end for playing.
[0058] In this step, the streaming media server can receive the slice data streams of each valid transport stream slice from the storage server cluster. The streaming media server can filter out the valid slice data streams in the slice data streams that meet the request range based on the received slice data streams, and return the valid slice data streams to the requesting end for playback.
[0059] Specifically, the streaming media server can return the response header to the requester after the slice data stream request of the first transport stream slice is successful. The response header may not contain the content-length field, that is, it can be transmitted in chunk mode. For the response body, in the absence of a request range requirement, the streaming media server can forward the slice data stream to the requester each time it is received, without waiting for the transport stream slice to be complete. Therefore, the requester can receive the slice data stream in streaming mode, achieving fast response and downloading while playing. After all transport stream slice responses are completed, the requester can form a complete video for subsequent offline viewing or multiple viewings.
[0060] When a request range is indicated, the streaming media server cannot directly forward the received slice data stream each time. It needs to filter out valid slice data that meets the request range according to the request range and then respond to the request end. As an implementation method, the method of processing into valid slice data is as follows:
[0061] In the whole process, the flags d_start and d_end are set to record the starting and ending positions of the currently received slice data in the whole video. Each time a valid transport stream slice is requested, the flag d_start is initialized to the starting position offset of the valid transport stream slice (indicating that the data starting from the offset position will be received). After each piece of response slice data (located from pos to the last byte in the memory) is received:
[0062] 1) Filter the valid range: d_end = d_start + last - pos, adjust the flag in the memory according to the request range start-end; if d_start > start, adjust the starting position pos = pos + (d_start -start); if d_end <= end, adjust the ending position last = last - (last - d_end). At this time, pos -last is the valid part of the request range and can be sent to the request end;
[0063] 2) Update the flag d_start = d_end, continue to receive and process the subsequent response slice data in the same way.
[0064] The video processing method for progressive downloading of this embodiment receives video request information sent by the requesting end for requesting progressive downloading of the video; determines multiple transport stream slices corresponding to the video according to the video request information; requests the slice data stream of each valid transport stream slice from the storage server cluster; the valid transport stream slice is the transport stream slice in the multiple transport stream slices that meets the request range indicated by the video request information; and returns the valid slice data stream in the slice data stream that meets the request range to the requesting end for playback according to the received slice data stream. This solution can store and access a single video in the form of multiple transport stream slices, can solve the problem of the storage server's limitation on the size of a single video in progressive downloading, can also disperse the access pressure on the server, and can quickly lock the relevant transport stream slices in combination with the request range, reduce the slice access granularity, and improve the data stream response efficiency.
[0065] In an exemplary embodiment, determining multiple transport stream slices corresponding to the video according to the video request information in step S202 may include:
[0066] According to the video request information, slice index information corresponding to the video is obtained; according to the slice index information, multiple transport stream slices are determined.
[0067] The slice index information is the index information of multiple transport stream slices corresponding to the video. The slice index information corresponding to the video can be used to index multiple transport stream slices corresponding to the video, and the slice index information can be used to record the uniform resource identifier URL of multiple transport stream slices, based on which all transport stream slices can be requested.
[0068] In this step, the streaming media server can obtain the slice index information corresponding to the video according to the file name of the video included in the video request information, can query the slice index information corresponding to the video according to the file name, and can obtain the corresponding slice index information according to the file name of the video included in the video request information by pre-establishing a correspondence between the file name of the video and the slice index information. Then, the streaming media server can determine the multiple transport stream slices recorded by the slice index information according to the slice index information.
[0069] In an exemplary embodiment, further, the above-mentioned obtaining the slice index information corresponding to the video according to the video request information may include:
[0070] According to the video request information, the main index information is obtained; according to the main index information, the sub-index information is determined; according to the sub-index information, the slice index information corresponding to the video is obtained.
[0071] In this embodiment, the streaming media server can obtain the main index information according to the video request information, determine the sub-index information according to the main index information, and then obtain the slice index information corresponding to the video according to the sub-index information. Among them, the main index information is the upper index of the sub-index information, and the corresponding sub-index information can be obtained through the main index information. The sub-index information can be used as the slice index information.
[0072] As an example, in conjunction with FIG3, a video file can be dispersedly stored as main index information, sub-index information and corresponding multiple transport stream slices. After the streaming media server receives the video request information, it can obtain the file name of the video according to the video request information, such as the cid. file suffix. The streaming media server can convert the video request information URL into a request information URL in the hypertext live stream HLS format, send a main m3u8 request to the back-end server (cache server), and determine whether the response code is a 200 normal response. If not, an error is returned to the request end. If so, the response content (cid / index.m3u8) of the main m3u8 request, i.e., the main index information, is parsed to obtain the sub-m3u8 request. The streaming media server then requests the sub-m3u8 file from the back-end. In the case of a successful response of 200, the streaming media server can obtain the response content (cid / rateid.m3u8) of the sub-m3u8 request, i.e., the sub-index information. The sub-index information can be used as the slice index information corresponding to the video. The sub-index information can contain a list of uniform resource identifier URLs of all transport stream slices, thereby determining the transport stream slice that needs to be requested.
[0073] In an exemplary embodiment, before receiving the video request information sent by the requesting end, the method of the present application may further include:
[0074] The video is cut into multiple transport stream slices; the multiple transport stream slices are distributed and stored in a storage server cluster.
[0075] In this embodiment, the video may be cut into multiple transport stream slices according to a fixed size, and the multiple transport stream slices may be distributed and stored in a storage server cluster, such as the distributed storage server shown in FIG. 1 .
[0076] As an example, in conjunction with Figure 3, the video can be cut according to a fixed size, and the naming rule of the transport stream slice can be cid_offset_size.ts, where cid is the file name of the video, and offset is the starting position of the transport stream slice in the entire video. Size is the size of the transport stream slice, such as 20***00_0_8388608.ts, which means that the file name of the video is the first 8M bytes of 20***00.
[0077] In an exemplary embodiment, further, the above-mentioned distributing and storing multiple transport stream slices in a storage server cluster may include:
[0078] According to the multiple transport stream slices, corresponding slice index information is generated; the multiple transport stream slices and the corresponding slice index information are stored in a storage server cluster.
[0079] In this embodiment, after obtaining multiple transport stream slices, corresponding slice index information, such as sub-index information, can be generated, and then the multiple transport stream slices and the corresponding slice index information can be stored in a storage server cluster. Among them, multiple transport stream slices can be stored in a distributed storage server as shown in FIG1, and the slice index information can be stored in a cache server as shown in FIG1, thereby facilitating the streaming media server to quickly request the slice index information and obtain multiple transport stream slices.
[0080] In an exemplary embodiment, further, the above-mentioned generating corresponding slice index information based on multiple transport stream slices may include: generating main index information and sub-index information corresponding to multiple transport stream slices according to the hypertext live streaming protocol; the sub-index information includes slice index information; the above-mentioned storing multiple transport stream slices and corresponding slice index information in a storage server cluster may include: storing multiple transport stream slices, corresponding main index information and sub-index information in a storage server cluster.
[0081] In this embodiment, a single video can be cut into multiple transport stream slices, and two-level m3u8 index information (main index information and sub-index information) corresponding to multiple transport stream slices can be generated according to the hypertext live stream HLS protocol, wherein the main index information can include the uniform resource identifier URL of the sub-index information, and the sub-index information can include a list of uniform resource identifier URLs of all transport stream slices, and the sub-index information can be used as slice index information. Then, multiple transport stream slices, corresponding main index information and sub-index information can be stored in each server (including distributed storage servers and cache servers) according to the hash rule, and the subsequent request to the server can also be scheduled according to the hash rule. As an example, as shown in Figure 3, the video cid.mp4 can be stored as the main m3u8 index (index.m3u8), sub-m3u8 index (rateid.m3u8) and multiple transport stream slices under the cid directory.
[0082] In one embodiment, in combination with FIG. 4 and FIG. 5 , a video processing method for progressive download is further provided. The method can be implemented based on the application environment shown in FIG. 1 , and the method can include the following steps:
[0083] Video (video file) splicing access process on the streaming media server (the streaming media server can be responsible for video file splicing):
[0084] 1) The streaming media server receives the video file request from the player - cid. file suffix, converts the uniform resource identifier URL of the video file request into a uniform resource identifier URL in the hypertext live streaming HLS format, and sends a main m3u8 request to the backend server - cid / index.m3u8, and determines whether the response code is 200 normal response. If not, an error is returned to the player. If so, the main m3u8 response content is parsed to obtain the uniform resource identifier URL of the sub-m3u8.
[0085] 2) The streaming media server then requests the sub-m3u8 file - cid / rateid.m3u8 - from the backend. If the response is successful 200, the server can obtain the list of all transport stream slices TS contained in the on-demand content. If the video file request does not carry the request range header, all the transport stream slices TS obtained by parsing will be stored in the waiting queue in order. If it carries the request range header, the relevant transport stream slices will be selected according to the request range and stored in the waiting queue.
[0086] 3) The subsequent streaming media server sequentially requests the transport stream slices TS in the queue, where the response header is returned to the player after the first transport stream slice request is successful. The response header does not contain the content-length field, that is, the chunk mode is used for transmission. The response body is immediately forwarded to the player every time the response stream of the transport stream slice is received, without waiting for the transport stream slice to be complete. Therefore, the player can stream the video file data, achieve fast response, and download while playing; after all the responses to the transport stream slices are completed, the player can form a complete video file for subsequent offline viewing or multiple viewings.
[0087] Among them, the processing of the request range of the video file request is as follows:
[0088] When the video file request carries the request range header, in order to quickly obtain the video file content corresponding to the request range, after parsing the transport stream slice TS list of the sub-m3u8 response and determining the transport stream slice TS, only the relevant transport stream slice TS is stored in the waiting queue in order. The judgment method is as follows:
[0089] Assuming that the start byte and end byte parsed from the request range header are start and end, the file name of the transport stream slice can be parsed to obtain the start position of the transport stream slice as offset, and the size of the transport stream slice is size. Then the condition of irrelevant transport stream slices is: offset >= end || offset+size <= start. The transport stream slices that meet this condition are not put into the waiting request queue. After parsing, the waiting request queue cannot be empty, otherwise the returned request does not meet the requirements.
[0090] The transport stream slices TS in the request queue are then requested in sequence. However, each time a response stream is received, it cannot be forwarded directly. Instead, it needs to be filtered to the valid range according to the request range before responding to the player. The method is as follows:
[0091] In the whole process, the flags d_start and d_end are set to record the starting and ending positions of the current received data in the whole video file. Each time a transport stream slice TS file request is sent, d_start is initialized to the starting position offset of the transport stream slice TS file (indicating that the data starting from the offset position will be received). After each response is received (located from pos to the last byte in the memory):
[0092] 1) Filter the valid range: d_end = d_start + last - pos, adjust the flag in the memory according to the requested range start-end; if d_start > start, adjust the starting position pos = pos + (d_start - start); if d_end <= end, adjust the ending position last = last - (last - d_end), then pos - last is the valid part of the requested range and can be sent to the player;
[0093] 2) Update the flag d_start = d_end, continue receiving and process subsequent responses in the same way.
[0094] In addition, for the file storage method of video files:
[0095] During storage, a single video file is cut into multiple transport stream slice TS files, and corresponding two-level m3u8 index files are generated according to the hypertext live streaming HLS protocol (the main m3u8 file contains the uniform resource identifier URL of the sub-m3u8, and the sub-m3u8 file contains a list of uniform resource identifier URLs of all transport stream slices TS), and each file is stored in each server according to the hash rule. Subsequent requests to the server are also scheduled according to the hash rule.
[0096] As shown in Figure 3, for example, a large video cid.mp4 file is stored as a main m3u8 file (index.m3u8), a sub-m3u8 file (rateid.m3u8) and a transport stream slice TS file under the cid directory, wherein the transport stream slice TS can be cut according to a fixed size, and the naming rule of the transport stream slice TS can be cid_offset_size.ts, where cid is the file name of the video, offset is the starting position of the transport stream slice file in the entire video file, and size is the size of the transport stream slice, such as 20***00_0_8388608.ts means that the on-demand file is the first 8M bytes of 20***00.
[0097] The solution of this embodiment, when storing files, cuts a single video file into multiple transport stream slice files of fixed sizes, generates corresponding m3u8 index files, and distributes each file in multiple storage servers according to the hash rule of the file name, so that the size of a single file is no longer limited by the server, and the requests to each storage server are more even, dispersing the server pressure; when accessing files, the streaming media server converts the uniform resource identifier URL of the video file requested by progressive download into the uniform resource identifier URL of the index file in the hypertext live stream HLS format, and then requests it to the back end, parses the index files of each level in response, obtains the slice list and related information, and then requests the relevant slices from the back end according to the actual request range (combined with the request range range request header) and returns them to the player. The solution of this embodiment not only solves the problem of limitation on the size of a single video file in the storage server, but also can distribute a request for a video-on-demand file to multiple storage servers and multiple cache servers in a slice mode, so that storage and caching are more uniform, server pressure is relieved, and overall performance is improved. At the same time, the corresponding slice can be quickly locked within the required request range, and only relevant slices are requested. Due to the existence of multiple slices, the request range of a large video file can be quickly locked to the relevant slice in the index file parsing stage, reducing the slice access granularity, thereby reducing network bandwidth and improving the processing and response speed of the seek (search or jump) function.
[0098] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0099] Based on the same inventive concept, the embodiment of the present application also provides a video processing device for progressive downloading for implementing the video processing method for progressive downloading involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations of one or more embodiments of the video processing device for progressive downloading provided below can refer to the limitations of the video processing method for progressive downloading above, and will not be repeated here.
[0100] In an exemplary embodiment, as shown in FIG6 , a video processing apparatus for progressive download is provided, and the apparatus 600 may include:
[0101] The request receiving module 601 is used to receive video request information sent by the requesting end; the video request information is used to request a progressively downloaded video;
[0102] A slice determination module 602, configured to determine a plurality of transport stream slices corresponding to the video according to the video request information;
[0103] The stream request module 603 is used to request a slice data stream of each valid transport stream slice from the storage server cluster; the valid transport stream slice is a transport stream slice in the multiple transport stream slices that meets the request range indicated by the video request information;
[0104] The stream returning module 604 is used to return the valid slice data stream that meets the request range in the slice data stream to the requesting end for playing according to the received slice data stream.
[0105] In an exemplary embodiment, the slice determination module 602 is used to obtain slice index information corresponding to the video according to the video request information; and determine the multiple transport stream slices according to the slice index information.
[0106] In an exemplary embodiment, the slice determination module 602 is used to obtain main index information according to the video request information; determine sub-index information according to the main index information; and obtain slice index information corresponding to the video according to the sub-index information.
[0107] In an exemplary embodiment, the device 600 may further include: a storage processing module, configured to cut the video into the multiple transport stream slices; and distribute and store the multiple transport stream slices in a storage server cluster.
[0108] In an exemplary embodiment, the storage processing module is also used to generate corresponding slice index information according to the multiple transport stream slices; and store the multiple transport stream slices and the corresponding slice index information in the storage server cluster.
[0109] In an exemplary embodiment, the storage processing module is also used to generate main index information and sub-index information corresponding to the multiple transport stream slices according to the hypertext live streaming protocol; the sub-index information includes the slice index information; and the multiple transport stream slices, the corresponding main index information and sub-index information are stored in a storage server cluster.
[0110] Each module in the above-mentioned video processing device for progressive downloading can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0111] In an exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in FIG7. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface is connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data related to video processing. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a video processing method for progressive download is implemented.
[0112] Those skilled in the art will understand that the structure shown in FIG. 7 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0113] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0114] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0115] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0116] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0117] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0118] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0119] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A video processing method for progressive downloading, characterized in that: The method comprises: Receive video request information sent by a requesting end; the video request information is used to request a progressively downloaded video; Determine, according to the video request information, a plurality of transport stream slices corresponding to the video; Requesting a slice data stream of each valid transport stream slice from the storage server cluster; the valid transport stream slice is a transport stream slice in the multiple transport stream slices that meets the request range indicated by the video request information; According to the received slice data stream, the valid slice data stream in the slice data stream that meets the request range is returned to the requesting end for playing.
2. The method according to claim 1, characterized in that The step of determining, according to the video request information, a plurality of transport stream slices corresponding to the video comprises: Obtaining slice index information corresponding to the video according to the video request information; The multiple transport stream slices are determined according to the slice index information.
3. The method according to claim 2, characterized in that The obtaining, according to the video request information, slice index information corresponding to the video includes: According to the video request information, obtaining main index information; Determine sub-index information according to the main index information; According to the sub-index information, the slice index information corresponding to the video is obtained.
4. The method according to claim 1, characterized in that: Before receiving the video request information sent by the requesting end, the method further includes: Cutting the video into the plurality of transport stream slices; The multiple transport stream slices are distributed and stored in a storage server cluster.
5. The method according to claim 4, characterized in that The distributing and storing the multiple transport stream slices in a storage server cluster includes: Generate corresponding slice index information according to the multiple transport stream slices; The multiple transport stream slices and corresponding slice index information are stored in a storage server cluster.
6. The method according to claim 5, characterized in that The generating corresponding slice index information according to the multiple transport stream slices includes: Generate main index information and sub-index information corresponding to the plurality of transport stream slices according to the hypertext live streaming protocol; the sub-index information includes the slice index information; The storing the plurality of transport stream slices and corresponding slice index information in a storage server cluster includes: The multiple transport stream slices, the corresponding main index information and the sub-index information are stored in a storage server cluster.
7. A video processing device for progressive downloading, characterized in that: The device comprises: A request receiving module, used for receiving video request information sent by a requesting end; the video request information is used for requesting a progressively downloaded video; A slice determination module, used to determine a plurality of transport stream slices corresponding to the video according to the video request information; A stream request module, configured to request a slice data stream of each valid transport stream slice from a storage server cluster; the valid transport stream slice is a transport stream slice in the plurality of transport stream slices that meets the request range indicated by the video request information; The stream returning module is used to return the valid slice data stream that meets the request range in the slice data stream to the requesting end for playback according to the received slice data stream.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.