Playing response speed optimization method, device and system based on HLS
By generating a new m3u8 list and performing precise positioning and downloading, the response delay problem of HLS system when processing large data video streams is solved, and the instant response speed and user experience of video playback are improved.
Patent Information
- Application Number
- CN202411229771.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-03
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2044-09-03
AI Technical Summary
When the existing HTTP Live Streaming (HLS) system handles long-term video storage or large-data video streams, due to the huge playlists and video clips, it will cause significant response delays, which seriously affects the user experience.
By determining the video content selected by the user, obtain the total duration of the original m3u8 list and the relative offset time of the #EXT-X-DISCONTINUITY tag, generate a new m3u8 list, and send a download request to the server to receive the video file encapsulated in TS format , realize the precise positioning and targeted download of target clips, and reduce the cache time before video playback.
It significantly improves the instant response speed and user experience of video playback, reduces download time and user waiting time, and improves the delay problem in long-term video recording and large-data video stream processing.
Smart Images

Figure CN119071541A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and in particular to a method, device and system for optimizing playback response speed based on HLS. Background Art
[0002] With the rapid development of Internet technology and the significant growth of online video content consumption, users' performance requirements for streaming media playback systems have also increased accordingly, and the instant response and high efficiency of streaming media playback have become particularly important. However, existing HTTP Live Streaming (HLS) systems face many challenges when processing video streams that contain long-term recording storage or large amounts of data.
[0003] For example, in the field of security monitoring, video storage days are as long as or more than 90 days, and the capacity of a single m3u8 playlist often exceeds 100MB. Such a large playlist and the corresponding TS video clips need to be downloaded and cached from the server before the video is played, which will cause significant response delays. The player needs to spend a lot of time loading these files before starting to play the video. This long caching process seriously affects the user experience. Summary of the invention
[0004] The main purpose of the present invention is to provide a method, device and system for optimizing playback response speed based on HLS, so as to solve the problem that when the existing HTTP Live Streaming (HLS) system processes video streams containing long-term video storage or large amounts of data, due to the large playlists and video clips, significant response delays occur, thereby seriously affecting the user experience.
[0005] To achieve the above-mentioned purpose, the present invention provides a method for optimizing playback response speed based on HLS, and the method comprises the following steps: determining the video content selected by the user, and sending a query request to a server based on the video content; obtaining the total duration of the original m3u8 list corresponding to the video content fed back by the server and the relative offset time of all #EXT-X-DISCONTINUITY tags; generating a new m3u8 list according to the total duration of the original m3u8 list and the relative offset time of all #EXT-X-DISCONTINUITY tags; sending a download request to the server according to the new m3u8 list, and receiving the video file encapsulated in TS format returned by the server; and playing the video file fed back by the server according to the new m3u8 list.
[0006] Optionally, sending a query request to a server based on the video content includes: determining a unique identifier of the video content, and sending a query request to the server based on the unique identifier.
[0007] Optionally, a new m3u8 list is generated according to the total duration of the original m3u8 list and the relative offset time of all #EXT-X-DISCONTINUITY tags, including: dividing the total duration of the original m3u8 list by a preset TS segment length to determine the total number of TS segments of the original m3u8 list; dividing the relative offset time of each #EXT-X-DISCONTINUITY tag by the total duration of the original m3u8 list to determine the target TS segment corresponding to the #EXT-X-DISCONTINUITY tag; initializing a new m3u8 list according to the total number of TS segments and the TS segment corresponding to each #EXT-X-DISCONTINUITY tag.
[0008] Optionally, a new m3u8 list is initialized according to the total number of TS fragments and the TS fragments corresponding to each #EXT-X-DISCONTINUITY tag, including: initializing a new m3u8 list, and determining the total target number of TS fragments that need to be listed in the new m3u8 list according to the total number of TS fragments; starting from the first fragment in the new m3u8 list, gradually listing the total target number of TS files; identifying the target TS fragment in the new m3u8 list, and inserting the #EXT-X-DISCONTINUITY tag based on the starting offset point of the target TS fragment, to obtain a final new m3u8 list.
[0009] Optionally, after determining the video content selected by the user, the playback response speed optimization method further includes: determining a target segment in the video content selected by the user.
[0010] Further, sending a download request to the server according to the new m3u8 list, and receiving a video file encapsulated in TS format fed back by the server, including: sending a download request to the server according to the target segment in combination with the new m3u8 list, wherein the download request carries a starting offset point index value and an ending offset point index value; receiving a video file encapsulated in TS format fed back by the server according to the starting offset point index value and the ending offset point index value.
[0011] Optionally, after receiving the download request, the server indexes to the corresponding target video segment according to the start offset point index value and the end offset point index value carried in the download request, and performs non-encoding cropping and TS format encapsulation processing on the target video segment to obtain a video file.
[0012] The present invention also provides a playback response speed optimization device based on HLS, comprising: a sending unit, used to determine the video content selected by the user, and send an inquiry request to a server based on the video content; an acquiring unit, used to acquire the total duration of an original m3u8 list corresponding to the video content fed back by the server and the relative offset time of all #EXT-X-DISCONTINUITY tags; a generating unit, used to generate a new m3u8 list according to the total duration of the original m3u8 list and the relative offset time of all #EXT-X-DISCONTINUITY tags; a receiving unit, used to send a download request to the server according to the new m3u8 list, and receive a video file encapsulated in TS format fed back by the server; and a playing unit, used to play the video file returned by the server according to the new m3u8 list.
[0013] The present invention also provides a playback response speed optimization system based on HLS, comprising: a client request processing module, used for obtaining the total duration of an original m3u8 list sent by a server and the relative offset time of all #EXT-X-DISCONTINUITY tags, and generating a new m3u8 list according to the total duration of the original m3u8 list and the relative offset time of all #EXT-X-DISCONTINUITY tags, and sending a download request to the server according to the new m3u8 list, receiving a video file encapsulated in TS format fed back by the server, and playing the video file; a server video processing module, used for obtaining an inquiry request containing a unique identifier of video content sent by a client, and based on the total duration of the original m3u8 list corresponding to the video content fed back by the inquiry request and the relative offset time of the #EXT-X-DISCONTINUITY tags; and receiving a download request sent by the client, and generating a video file encapsulated in TS format according to at least a starting offset point index value and an ending offset point index value in the download request, and returning the video file to the client.
[0014] The present invention also provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any one of the above methods when executing the computer program.
[0015] The present invention also provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of any of the above-mentioned methods are implemented.
[0016] The HLS-based playback response speed optimization method, device and system provided by the present invention generates a new m3u8 list to reduce the cache time before video playback, reduces the loading requirements for a large playlist, and thus significantly improves the instant response speed of video playback and user experience. Specifically, it simplifies the download and playback process by analyzing and optimizing the original m3u8 list, ensuring that users can start watching videos more quickly, especially when dealing with long-term video storage or large data volume video streams, greatly improving the playback delay problem.
[0017] In addition, by introducing the identification of target segments and directed download requests, the present invention significantly improves the playback response speed of the HLS system. After determining the video content selected by the user, the system can accurately locate the target segments in the video and generate download requests for these segments. This method can shorten the download time of a single video data. Specifically, by carrying a download request with start and end offset point index values, the server can directly extract the required segments from the video file without encoding and processing the entire video file. This precise data cutting and packaging method ensures efficient transmission and fast decoding of video files, further reduces user waiting time, and improves the instant response performance of playback. Therefore, this optimization technology effectively solves the delay problem in long-term recording and large-volume video stream processing, and significantly improves the user's viewing experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 It is a schematic diagram of the steps of a method for optimizing playback response speed based on HLS in one embodiment of the present invention; Figure 2 It is a flow chart of a method for optimizing playback response speed based on HLS in one embodiment of the present invention; Figure 3 It is a structural block diagram of a device for optimizing playback response speed based on HLS in one embodiment of the present invention; Figure 4 It is a schematic block diagram of the structure of a computer device according to an embodiment of the present invention.
[0019] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0020] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention 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 invention and are not intended to limit the present invention.
[0021] Reference Figure 1The embodiment of the present invention provides a method for optimizing the playback response speed based on HLS, and the method for optimizing the playback response speed includes the following steps: S1, determining the video content selected by the user, and sending a query request to the server based on the video content; S2, obtaining the total duration of the original m3u8 list corresponding to the video content fed back by the server and the relative offset time of all #EXT-X-DISCONTINUITY tags; S3, generating a new m3u8 list according to the total duration of the original m3u8 list and the relative offset time of all #EXT-X-DISCONTINUITY tags; S4, sends a download request to the server according to the new m3u8 list, and receives the video file encapsulated in TS format fed back by the server; S5, according to the new m3u8 list, play the video file returned by the server.
[0022] It should be noted that the client can be a browser-supported system such as a smart phone, tablet computer, laptop or desktop computer; the server can be configured with a high-performance CPU and a large amount of RAM, as well as sufficient storage space to process and store a large amount of video data.
[0023] That is, in an embodiment of the present invention, first, the client needs to determine the video content selected by the user, and then sends a query request to the server to obtain the basic information about the video. This step is to obtain the original playback data of the video, and these data will be used for subsequent processing. Next, the client obtains the total duration of the original m3u8 list of the video content and the relative offset time of all #EXT-X-DISCONTINUITY tags from the server. The original m3u8 list contains all the information required for video playback, including the order and duration of the playback segments. The #EXT-X-DISCONTINUITY tag is used to indicate the time interval or other significant changes in the playlist, and it is most important for ensuring the continuity of playback. By obtaining this information, the client can accurately understand the playback structure and segment arrangement of the video, but does not need to download the entire m3u8 playlist, thereby reducing the amount of data transmission.
[0024] On this basis, the client generates a new m3u8 list based on the total duration of the original m3u8 list and the relative offset time of all #EXT-X-DISCONTINUITY tags. Subsequently, the client uses the generated new m3u8 list to send a download request to the server and receives the video file encapsulated in TS (Transport Stream) format returned by the server. Finally, the client plays the received video file according to the new m3u8 list. By parsing the new m3u8 list, the client understands the order and playback time of the video clips, thereby achieving a smooth playback experience.
[0025] In summary, the embodiment of the present invention generates a virtual m3u8 playlist of a specific request on the client, and downloads the video file from the server based on the virtual m3u8 playlist, which greatly reduces the time required to request the m3u8 playlist, thereby improving the response speed of video playback and achieving an efficient and fast video playback experience.
[0026] In one example, sending a query request to a server based on the video content includes: determining a unique identifier of the video content, and sending a query request to the server based on the unique identifier.
[0027] In this example, first, the client needs to determine the unique identifier of the video content. This identifier is a unique code or identification of the video content on the server, which is used to accurately represent and reference the video. For example, it may be a video ID, URL, or other form of unique encoding. This unique identifier ensures that the client can accurately locate the video content selected by the user without confusing or mistaking other videos. Next, the client uses this unique identifier to send a query request to the server. The purpose of this request is to obtain information related to the video content. Specifically, the client constructs a query request containing a unique identifier for the video content. This request is sent to the server, and the server identifies the corresponding video content based on the identifier and returns relevant playback information. This information usually includes the total duration of the original m3u8 list, the URL of the segment, the relative offset time of the #EXT-X-DISCONTINUITY tag, etc.
[0028] Therefore, the key to this process is to make precise requests through unique identifiers in order to obtain the minimum data set related to the video content, which can optimize subsequent playback processing steps and improve playback response speed.
[0029] In an example, a new m3u8 list is generated according to the total duration of the original m3u8 list and the relative offset time of all #EXT-X-DISCONTINUITY tags, including: dividing the total duration of the original m3u8 list by a preset TS segment length to determine the total number of TS segments of the original m3u8 list; dividing the relative offset time of each #EXT-X-DISCONTINUITY tag by the total duration of the original m3u8 list to determine the target TS segment corresponding to the #EXT-X-DISCONTINUITY tag; initializing a new m3u8 list according to the total number of TS segments and the TS segment corresponding to each #EXT-X-DISCONTINUITY tag.
[0030] In this example, the process of generating a new m3u8 list creates a new m3u8 list by combining the total length of the original m3u8 list and the relative offset time of the #EXT-X-DISCONTINUITY tag. The following is a detailed explanation: First, you need to clarify the total duration of the original m3u8 list and the relative offset time of the #EXT-X-DISCONTINUITY tag. The total duration in the original m3u8 list is the complete playback time of the video, while the #EXT-X-DISCONTINUITY tag marks the important time intervals or playback structure change points that may occur during the playback process.
[0031] 1. Determine the total number of TS segments: In the original m3u8 list, the video content is divided into multiple TS (Transport Stream) segments, each of which has a fixed length. By dividing the total duration of the original m3u8 list by the preset TS segment length, you can calculate how many TS segments there are in the playlist. The preset TS segment length refers to the standard length of each TS segment, for example, it may be set to 10 seconds, 15 seconds or other values. The purpose of this step is to determine the number of all TS segments in the original playlist so that they can be further processed.
[0032] 2. Determine the target TS segment: According to the relative offset time of the #EXT-X-DISCONTINUITY tag, the target TS segment corresponding to the tag can be calculated. The relative offset time indicates the time position of the tag in the original playlist. By dividing this relative offset time by the total duration of the original m3u8 list, a ratio can be obtained indicating the position of the tag relative to the total playback time. Then, by multiplying this ratio by the total number of TS segments, the corresponding target TS segment number can be found. The purpose of this step is to locate the TS segments that need attention so that these segments can be processed correctly when generating a new m3u8 list.
[0033] 3. Initialize a new m3u8 list: According to the calculated total number of TS segments and the TS segments corresponding to each #EXT-X-DISCONTINUITY tag, the client can initialize a new m3u8 list. The new m3u8 list will contain the key TS segments extracted from the original playlist, as well as the necessary play order and tag information. Of course, preferably, this new list can only contain the data necessary for the current playback operation, removing unnecessary parts, thereby reducing the amount of data and improving playback efficiency.
[0034] Furthermore, the above-mentioned technical solution of initializing a new m3u8 list according to the total number of TS fragments and the TS fragments corresponding to each #EXT-X-DISCONTINUITY tag can be implemented by the following steps: initialize a new m3u8 list, and determine the total target number of TS fragments that need to be listed in the new m3u8 list according to the total number of TS fragments; starting from the first fragment in the new m3u8 list, gradually list the total target number of TS files; identify the target TS fragment in the new m3u8 list, and insert the #EXT-X-DISCONTINUITY tag based on the starting offset point of the target TS fragment to obtain the final new m3u8 list.
[0035] Here is a detailed explanation of the process: ①、Initialize a new m3u8 list: Based on the total length of the original m3u8 list and the TS segments corresponding to each #EXT-X-DISCONTINUITY tag, the client needs to initialize a new m3u8 list. The purpose of this step is to create a new playlist.
[0036] ② Determine the total target number of TS segments: Based on the total number of TS segments calculated previously, the client needs to determine the total target number of TS segments that should be included in the new m3u8 list. This means that the client must select and list a certain number of TS segments based on the calculation results to ensure that the new playlist covers the main part of the video while reducing data redundancy. This target number determines how many TS segment files should be included in the new m3u8 list.
[0037] ③. List TS segments step by step: In the new m3u8 list, starting from the first segment, the client will gradually list the required TS segments. This process includes adding links or paths to TS segment files in sequence until the determined total target number is reached. The link of each TS segment file will be added to the new m3u8 list to ensure the order and smoothness of video playback.
[0038] ④. Insert #EXT-X-DISCONTINUITY tag: In the new m3u8 list, the client needs to identify the target TS segments that correspond to the positions of the #EXT-X-DISCONTINUITY tags in the original playlist. The #EXT-X-DISCONTINUITY tag is used to indicate the time interval or structural changes in the playlist, which is critical to ensure the continuity and correctness of playback. The client will adaptively insert the #EXT-X-DISCONTINUITY tag after the identified target TS segment to maintain the continuity and accuracy of video playback.
[0039] ⑤. Generate the final m3u8 list: The new m3u8 list obtained by the client includes optimized TS segments and appropriately inserted #EXT-X-DISCONTINUITY tags. This list is more streamlined and efficient than the original playlist. It only contains the data required for actual playback and ensures that the time intervals and structural changes during playback are correctly handled. In this way, the client can improve the responsiveness of video playback, reduce the amount of data transmitted over the network, and improve the user's viewing experience.
[0040] In general, this process creates a new, simplified list by optimizing and streamlining the m3u8 playlist, enabling clients to download and play video content more efficiently. Through calculation and positioning, the new m3u8 list not only improves the efficiency and smoothness of video playback, but also retains the necessary playback structure information to ensure the coherent playback of the video. This optimization significantly reduces unnecessary download time and improves the responsiveness of playback, thereby improving the user's viewing experience.
[0041] In an example, based on the starting offset point of the target TS segment, the #EXT-X-DISCONTINUITY tag is inserted to obtain the final new m3u8 list, which can be achieved in the following two ways: comparing the relative offset time of the #EXT-X-DISCONTINUITY tag with the starting offset point of the target TS segment corresponding to the #EXT-X-DISCONTINUITY tag to obtain a comparison result; according to the comparison result, the #EXT-X-DISCONTINUITY tag is inserted to obtain the final new m3u8 list.
[0042] Further, according to the comparison result, the #EXT-X-DISCONTINUITY tag is inserted, which may be specifically the following two cases: First, if the relative offset time of the #EXT-X-DISCONTINUITY tag is consistent with the starting offset point of the target TS segment corresponding to the #EXT-X-DISCONTINUITY tag, then add the #EXT-X-DISCONTINUITY tag before the target TS segment; Secondly, if the relative offset time of the #EXT-X-DISCONTINUITY tag is inconsistent with the starting offset point of the target TS segment corresponding to the #EXT-X-DISCONTINUITY tag, the target TS file is segmented according to the relative offset time of the #EXT-X-DISCONTINUITY tag, and the #EXT-X-DISCONTINUITY tag is added before the second TS sub-file after the segmentation.
[0043] In one example, after determining the video content selected by the user, the playback response speed optimization method further includes: determining a target segment in the video content selected by the user.
[0044] And, sending a download request to the server according to the new m3u8 list, and receiving the video file encapsulated in TS format fed back by the server, including: sending a download request to the server according to the target segment in combination with the new m3u8 list, wherein the download request carries a starting offset point index value and an ending offset point index value; receiving the video file encapsulated in TS format fed back by the server according to the starting offset point index value and the ending offset point index value.
[0045] In this example, the process of the playback response speed optimization method involves further optimizing the data request and receiving steps after determining the video content selected by the user. First, after determining the video content selected by the user, the client will carry the identification information of the video content, such as the video ID, and request the total duration of the original m3u8 list and the offset position of all EXT-X-DISCONTINUITY tags from the server, thereby improving efficiency and reducing unnecessary data transmission.
[0046] Next, the client generates a new m3u8 list based on the original m3u8 list information returned by the server. This list lists the necessary playback information including the target segment. After generating the new m3u8 list, the client sends a download request to the server according to the list. In order to optimize the download process, the client carries two important parameters in the request: the starting offset point index value and the ending offset point index value. These two index values indicate the specific range of the TS segments that need to be downloaded in the request, thereby ensuring that only the necessary segments are downloaded instead of the entire video file. After receiving these requests, the server will feedback the corresponding TS format video file according to the starting and ending index values. In this way, the client can efficiently obtain video data, reduce download time, and improve the response speed of playback, thereby optimizing the user's viewing experience.
[0047] In one example, after receiving a download request, the server indexes to the corresponding target video segment according to the start offset point index value and the end offset point index value carried in the download request, and performs non-encoding cropping and TS format encapsulation processing on the target video segment to obtain a video file.
[0048] In this example, the server's processing involves responding to the download request to provide the specific video segment that the user wants. The specific operation is as follows: When the server receives the download request sent by the client, the request contains two key parameters: the start offset point index value and the end offset point index value. These two index values specify the specific location range of the video segment that the client wants to download.
[0049] The server first uses these index values to locate the corresponding target video segment in its stored video files. Specifically, the start offset point index value and the end offset point index value are used to accurately find the start and end points of the video data. This step is completed by looking up the corresponding position in the index table or video data structure to ensure that the segment required by the user is correctly extracted.
[0050] Next, the server performs cropping on these target video clips. Cropping here does not involve re-encoding the video content, but directly cutting out the specified clips from the original video data. This operation ensures fast processing speed and does not affect the quality of the video because the video is not re-encoded or compressed. The cropped clips will be converted into TS (Transport Stream) format, which is a standard video transmission format suitable for streaming media playback.
[0051] Finally, after cropping and TS format encapsulation, the video file generated by the server is sent back to the client. This video file contains the specific segment requested by the client and is encapsulated in TS format to ensure that it can be correctly parsed and played. Through this processing method, the server can efficiently respond to download requests and provide accurate video content while maintaining good video quality and playback performance.
[0052] In order to explain the technical solution of the present invention more clearly, an embodiment is now provided. Figure 2 As shown, the user selects the video content to be played and initiates a play request, which includes the video ID. At this time, the client will request the total length of the m3u8 playlist of the video and the relative offset time points of all #EXT-X-DISCONTINUITY tags from the server based on the video ID. After receiving the client's request, the server will use the video ID to extract the total length of the m3u8 playlist and the relative offset time points of all #EXT-X-DISCONTINUITY tags from the m3u8 cache.
[0053] The client uses the total duration of the received m3u8 list and the relative offset time point information of the #EXT-X-DISCONTINUITY tag, combined with the preset TS video segment length, to dynamically generate a virtual m3u8 playlist. The player parses the virtual m3u8 list generated by the client, and then sends a request for the TS video segment to the server, which explicitly specifies the start and end time points of the required video segment.
[0054] Finally, after receiving the TS segment request, the server will quickly locate the original TS video segment in the m3u8 cache of the video according to the provided time point, and calculate the start and end time points of the cropped video according to the TS segment duration recorded by the #EXTINF tag of the TS segment in the original m3u8 list. The server crops the requested short TS file segment and sends it back to the client. After the client receives the video segment, it starts playing immediately, ensuring that the user can experience efficient and smooth video playback.
[0055] In other words, this solution generates a virtual m3u8 playlist for a specific request through the client, and only downloads the necessary m3u8 playlist description information from the server, rather than the complete m3u8 playlist, which greatly reduces the time to request the m3u8 playlist before playing the video clip. At the same time, the system optimizes the processing flow of video clips, and significantly improves the speed of caching TS clips and the startup speed during video playback by shortening the length of TS video clips. It is particularly suitable for application scenarios that require fast access to a large amount of video content, such as security monitoring playback scenarios.
[0056] Reference Figure 3 The embodiment of the present invention further provides a device for optimizing playback response speed based on HLS, comprising: A sending unit 1, used to determine the video content selected by the user, and send a query request to the server based on the video content; Acquisition unit 2, used to obtain the total duration of the original m3u8 list corresponding to the video content fed back by the server and the relative offset time of all #EXT-X-DISCONTINUITY tags; Generating unit 3, used for generating a new m3u8 list according to the total duration of the original m3u8 list and the relative offset time of all #EXT-X-DISCONTINUITY tags; Receiving unit 4 is used to send a download request to the server according to the new m3u8 list, and receive the video file encapsulated in TS format fed back by the server; The playback unit 5 is used to play the video file returned by the server according to the new m3u8 list.
[0057] In this embodiment, for the specific implementation of each unit in the above device embodiment, please refer to the above method embodiment, which will not be repeated here.
[0058] In addition, an embodiment of the present invention further provides a system for optimizing playback response speed based on HLS, including: A client request processing module is used to obtain the total duration of the original m3u8 list sent by the server and the relative offset time of all #EXT-X-DISCONTINUITY tags, and generate a new m3u8 list according to the total duration of the original m3u8 list and the relative offset time of all #EXT-X-DISCONTINUITY tags, and send a download request to the server according to the new m3u8 list, receive the video file encapsulated in TS format fed back by the server, and play the video file; The server video processing module is used to obtain an inquiry request containing a unique identifier of the video content sent by the client, and based on the total duration of the original m3u8 list corresponding to the video content fed back by the inquiry request and the relative offset time of the #EXT-X-DISCONTINUITY tag; and, receive a download request sent by the client, and generate a video file encapsulated in TS format based on at least the starting offset point index value and the ending offset point index value in the download request, and return the video file to the client.
[0059] Reference Figure 4In an embodiment of the present invention, a computer device is also provided. The computer device may be a server, and its internal structure may be as follows: Figure 4 As shown. The computer device includes a processor, a memory, a display screen, an input device, a network interface and a database connected through a system bus. Among them, the processor designed by the computer 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 the corresponding data in this embodiment. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the above method is implemented.
[0060] Those skilled in the art will understand that Figure 4 The structure shown in the figure is merely a block diagram of a portion of the structure related to the solution of the present invention, and does not constitute a limitation on the computer device to which the solution of the present invention is applied.
[0061] An embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the above method is implemented. It can be understood that the computer-readable storage medium in this embodiment can be a volatile readable storage medium or a non-volatile readable storage medium.
[0062] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods 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 memory, storage, database or other media provided by the present invention and used in the embodiments may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double-speed data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM.
[0063] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the presence of other identical elements in the process, device, article or method including the element.
[0064] The above description is only a preferred embodiment of the present invention, and does not limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made by using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A method for optimizing playback response speed based on HLS, characterized in that: The playback response speed optimization method comprises the following steps: Determining the video content selected by the user, and sending a query request to the server based on the video content; Obtain the total duration of the original m3u8 list corresponding to the video content fed back by the server and the relative offset time of all #EXT-X-DISCONTINUITY tags; Generate a new m3u8 list according to the total duration of the original m3u8 list and the relative offset time of all #EXT-X-DISCONTINUITY tags; Send a download request to the server according to the new m3u8 list, and receive the video file encapsulated in TS format fed back by the server; According to the new m3u8 list, the video file returned by the server is played.
2. The playback response speed optimization method according to claim 1, characterized in that: Sending a query request to a server based on the video content includes: A unique identifier of the video content is determined, and a query request is sent to the server based on the unique identifier.
3. The playback response speed optimization method according to claim 1, characterized in that: According to the total duration of the original m3u8 list and the relative offset time of all #EXT-X-DISCONTINUITY tags, a new m3u8 list is generated, including: The total duration of the original m3u8 list is divided by the preset TS segment length to determine the total number of TS segments in the original m3u8 list; The relative offset time of each #EXT-X-DISCONTINUITY tag is divided by the total duration of the original m3u8 list to determine the target TS segment corresponding to the #EXT-X-DISCONTINUITY tag; Initialize a new m3u8 list according to the total number of TS segments and the TS segments corresponding to each #EXT-X-DISCONTINUITY tag.
4. The playback response speed optimization method according to claim 3, characterized in that: Initialize a new m3u8 list according to the total number of TS segments and the TS segments corresponding to each #EXT-X-DISCONTINUITY tag, including: Initialize a new m3u8 list, and determine the total target number of TS segments that need to be listed in the new m3u8 list according to the total number of TS segments; Starting from the first fragment in the new m3u8 list, the total target number of TS files are listed step by step; The target TS segment is identified in the new m3u8 list, and based on the starting offset point of the target TS segment, the #EXT-X-DISCONTINUITY tag is inserted to obtain the final new m3u8 list.
5. The playback response speed optimization method according to claim 1, characterized in that: After determining the video content selected by the user, the playback response speed optimization method further includes: determining a target segment in the video content selected by the user; Sending a download request to the server according to the new m3u8 list, and receiving a video file encapsulated in TS format fed back by the server, including: In combination with the new m3u8 list, a download request is sent to the server according to the target segment, wherein the download request carries a start offset point index value and an end offset point index value; The video file encapsulated in TS format and fed back by the server according to the start offset point index value and the end offset point index value is received.
6. The playback response speed optimization method according to claim 1, characterized in that: After receiving the download request, the server indexes to the corresponding target video segment according to the start offset point index value and the end offset point index value carried in the download request, and performs non-encoding cropping and TS format encapsulation processing on the target video segment to obtain a video file.
7. A device for optimizing playback response speed based on HLS, characterized in that: include: a sending unit, configured to determine the video content selected by the user, and send a query request to the server based on the video content; An acquisition unit, used to acquire the total duration of the original m3u8 list corresponding to the video content fed back by the server and the relative offset time of all #EXT-X-DISCONTINUITY tags; A generating unit, used for generating a new m3u8 list according to the total duration of the original m3u8 list and the relative offset time of all #EXT-X-DISCONTINUITY tags; A receiving unit is used to send a download request to the server according to the new m3u8 list, and receive a video file encapsulated in TS format fed back by the server; The playback unit is used to play the video file returned by the server according to the new m3u8 list.
8. A playback response speed optimization system based on HLS, characterized in that: include: A client request processing module is used to obtain the total duration of the original m3u8 list sent by the server and the relative offset time of all #EXT-X-DISCONTINUITY tags, and generate a new m3u8 list according to the total duration of the original m3u8 list and the relative offset time of all #EXT-X-DISCONTINUITY tags, and send a download request to the server according to the new m3u8 list, receive the video file encapsulated in TS format fed back by the server, and play the video file; The server video processing module is used to obtain the query request containing the unique identifier of the video content sent by the client, and feedback the total duration of the original m3u8 list corresponding to the video content fed back by the query request and the relative offset time of the #EXT-X-DISCONTINUITY tag; And, receiving a download request sent by the client, and generating a video file encapsulated in TS format according to at least a start offset point index value and an end offset point index value in the download request, and returning the video file to the client.
9. A computer device comprising a memory and a processor, wherein a computer program is stored in the memory, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
10. 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.
Citation Information
Patent Citations
Online video playing method and system as well as play application proxy equipment
CN104581207A
Video data accelerated downloading method and device based on HLS (HTTP Live Streaming)stream media
CN105611328A
Offset correction method and device for current playlist of smart TV
CN106998478A
A streaming media playing method and a related device
CN109788372A
Method for realizing video editing on webpage based on m3u8 index file
CN116347172A
