Method, device, equipment and medium for reducing HLS protocol playback delay
By adding a custom segment identifier to the HLS protocol playlist, the problem of HLS protocol playback delay is solved, fast GOP download within the GOP duration range is achieved, and the user experience is improved.
Patent Information
- Application Number
- CN202510838385.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-23
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2045-06-23
AI Technical Summary
The existing HLS protocol has a large delay when playing videos, resulting in a poor user experience.
By adding custom slice identifiers in the playlist, including the first slice identifier and the second slice identifier, which are used to represent the GOP positions in the generated and to-be-generated slices, the GOP is downloaded and played according to these identifiers to ensure that the latest GOP is obtained in the shortest time.
The playback delay of the HLS protocol is reduced, keeping it within the duration of one GOP, and improving the user experience.
Smart Images

Figure CN120378651B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of streaming media technology, and in particular to a method, device, equipment and medium for reducing HLS protocol playback delay. Background Art
[0002] The HLS protocol is a common video playback protocol used in existing technologies. However, the traditional HLS protocol has a significant drawback: high latency. This latency stems primarily from the HLS protocol's segmented processing and playback mechanisms, resulting in delays and a poor viewing experience for users. Summary of the Invention
[0003] Aiming to solve at least one of the technical problems existing in the prior art, the present invention provides a method for reducing HLS protocol playback delay, thereby reducing the HLS protocol playback delay.
[0004] One aspect of the present invention provides a method for reducing HLS protocol playback delay, comprising:
[0005] Generate playlists and generated segments according to the HLS standard protocol;
[0006] adding a first slice identifier to the generated slice, where the first slice identifier is used to indicate a position of a GOP in the generated slice;
[0007] Generate a second slice identifier according to the slice to be generated, and add the second slice identifier to the playlist;
[0008] In response to the streaming media playback request, downloading and playing of the GOP are performed according to the first slice identifier and the second slice identifier.
[0009] According to the method for reducing HLS protocol playback delay, generating a playlist and generated segments according to the HLS standard protocol includes:
[0010] Pull streaming media data packets from the acquisition server and continuously parse the streaming media data packets to obtain GOP;
[0011] If the GOP meets the slicing conditions, perform slicing processing and update the playlist;
[0012] If the GOP does not meet the slicing condition, the playlist is updated, where the slicing condition is the preset playback duration.
[0013] According to the method for reducing HLS protocol playback delay, adding a first slice identifier to the playlist includes:
[0014] When the generated slice is obtained and the playlist is updated, the first slice identifier is added to the generated slice, wherein the first slice identifier is used to describe the byte range of each GOP, and the first slice identifier is a custom annotation.
[0015] According to the method for reducing HLS protocol playback delay, generating a second slice identifier according to the slice to be generated, and adding the second slice identifier to the playlist includes:
[0016] When only the playlist is updated, a second slice identifier is added to the slice to be generated, and a byte range of the newly added GOP is added to the first slice identifier according to the second slice identifier.
[0017] According to the method for reducing HLS protocol playback delay, the method further includes:
[0018] The playlist carries the generated slice, the slice to be generated, the first slice identifier and the second slice identifier.
[0019] According to the method for reducing HLS protocol playback delay, in response to a streaming media playback request, downloading and playing the GOP according to the first slice identifier and the second slice identifier is performed, including:
[0020] The playlist is continuously downloaded, the byte range of the GOP is determined according to the first slice identifier, the slice to be generated including the second slice identifier is downloaded, the slice to be generated is determined according to the duration range, and the latest generated GOP is determined and downloaded.
[0021] According to the method for reducing HLS protocol playback delay, the method further includes:
[0022] The byte range is determined by the byte ranges of the first slice identifier and the second slice identifier.
[0023] Another aspect of the present invention provides a device for reducing HLS protocol playback delay, comprising:
[0024] The first module is used to generate a playlist and generated segments according to the HLS standard protocol;
[0025] A second module is configured to add a first slice identifier to the generated slice, where the first slice identifier is used to indicate a position of a GOP in the generated slice;
[0026] A third module is configured to generate a second slice identifier according to the slice to be generated, and add the second slice identifier to a playlist;
[0027] The fourth module is used to execute GOP downloading and playback according to the streaming media playback request, the first slice identifier and the second slice identifier.
[0028] Another aspect of an embodiment of the present invention provides an electronic device, including a processor and a memory;
[0029] The memory is used to store programs;
[0030] The processor executes the program to implement the method described above.
[0031] Embodiments of the present invention further disclose a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device can read the computer instructions from the computer-readable storage medium and execute the computer instructions, causing the computer device to perform the method described above.
[0032] The beneficial effects of the present invention are as follows: by making customized annotations on the generated slices in the playlist and marking the slices to be generated, when the client downloads the GOP, the latest GOP generated in the shortest time is determined and downloaded through the GOP duration range, so that the HLS protocol playback delay is maintained within a GOP duration range, thereby reducing the playback delay. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 This is a flow chart of a method for reducing HLS protocol playback delay according to an embodiment of the present invention.
[0034] Figure 2 3 is a schematic diagram of the system structure for reducing the playback delay of the HLS protocol according to an embodiment of the present invention.
[0035] Figure 3 4 is a schematic diagram of the process of generating slices according to an embodiment of the present invention.
[0036] Figure 4 This is a client download flow chart of an embodiment of the present invention.
[0037] Figure 5 Schematic diagram of a device for reducing HLS protocol playback delay according to an embodiment of the present invention. DETAILED DESCRIPTION
[0038] The following describes embodiments of the present invention in detail. Examples of the embodiments are shown in the accompanying drawings, where the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. In the subsequent description, suffixes such as "module," "component," or "unit" used to represent elements are used solely to facilitate the description of the present invention and have no specific meaning in themselves. Therefore, "module," "component," or "unit" may be used interchangeably. "First," "second," and the like are used solely to distinguish technical features and should not be construed as indicating or implying relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features. In this subsequent description, the consecutive numbering of method steps is for ease of review and understanding. In conjunction with the overall technical solution of the present invention and the logical relationship between the various steps, adjusting the order of implementation of the steps does not affect the technical effects achieved by the technical solution of the present invention. The embodiments described below with reference to the accompanying drawings are exemplary and are intended only to explain the present invention and should not be construed as limiting the present invention.
[0039] Explanation of terms:
[0040] #EXT-SEGMENT, the first slice identifier of the embodiment of the present invention, identifies the generated slice (file);
[0041] _preload, a second slice identifier in an embodiment of the present invention, identifying a slice to be generated;
[0042] M3u8, a playlist file;
[0043] GOP, the result of video encoding, consists of a group of consecutive image frames.
[0044] Figure 1 1 is a flow chart of a method for reducing HLS protocol playback delay according to an embodiment of the present invention, which includes but is not limited to steps S100 to S400:
[0045] S100: Generate a playlist and generated segments according to the HLS standard protocol.
[0046] In some embodiments, reference Figure 2 The system structure diagram for reducing the playback delay of the HLS protocol shown in the figure includes:
[0047] Pull streaming data packets from the acquisition server, continuously parse the streaming data packets to obtain GOP; if the GOP meets the slicing conditions, perform slicing processing and update the playlist; if the GOP does not meet the slicing conditions, only update the playlist, where the slicing condition is the preset playback duration.
[0048] S200: Add a first slice identifier to the generated slice, where the first slice identifier is used to indicate a position of a GOP in the generated slice.
[0049] In some embodiments, reference Figure 3 The slicing process diagram shown includes adding a first slice identifier to the generated slice when obtaining the generated slice and updating the play list.
[0050] In some embodiments, the first slice identifier is used to describe the byte range of each GOP, and the first slice identifier is a custom comment, such as a custom identifier "#EXT-SEGMENT".
[0051] S300: Generate a second slice identifier according to the slice to be generated, and add the second slice identifier to a playlist.
[0052] When only the playlist is updated, a second slice identifier is added to the slice to be generated, and a byte range of the newly added GOP is added to the first slice identifier according to the second slice identifier, such as "_preload".
[0053] S400 , in response to a streaming media playback request, executing downloading and playback of a GOP according to a first slice identifier and a second slice identifier.
[0054] In some embodiments, the playlist is continuously downloaded, the duration range of the GOP is determined based on the first slice identifier, the slice to be generated including the second slice identifier is downloaded, the slice to be generated is determined based on the duration range, and the latest generated GOP is determined and downloaded.
[0055] In some embodiments, reference Figure 4 As shown in the client download flow chart, after the client downloads the M3u8 file, it needs to be parsed. "#EXT-SEGMENT" acts on the client parsing stage. That is, when the client parses this comment, it can know the GOP byte range of the TS segment.
[0056] It can be understood that the M3u8 file contains generated slices and slices to be generated. By determining the duration range of the GOP (or after the duration range) through the M3u8 file, the time required for the slice to be generated to generate the GOP (within a duration range) is judged to obtain the latest GOP.
[0057] In some embodiments, combined Figure 2 The system structure diagram for reducing the playback delay of the HLS protocol shown in the figure includes the following steps:
[0058] The slice server pulls the stream from the acquisition server and continuously parses the streaming data packets. After each GOP is parsed, it determines whether a slice needs to be generated.
[0059] If the conditions for generating segments are met (generally, the playback duration of the segments is set), the segments are generated and the M3u8 file is updated. A custom comment "#EXT-SEGMENT" needs to be added to each segment in the M3u8 file to describe the byte range of each GOP.
[0060] If the conditions for generating segments are not met (generally setting the playback duration of the segments), only the M3u8 is updated, and the byte range of the newly added GOP is added to the custom comment "#EXT-SEGMENT" corresponding to the segment carrying the word "_preload".
[0061] The client continuously downloads and updates M3u8. When it finds that GOP has been updated, it can immediately download the latest content.
[0062] Compared with the traditional HLS that updates M3u8 by slicing, the present invention can update M3u8 immediately after updating a GOP, and control the playback delay within the length of a GOP.
[0063] In some embodiments, the client can adaptively control the downloading of a specific GOP through the above rules. If the latest GOP is selected for download and playback, the playback delay can be controlled within the duration of a GOP.
[0064] In some embodiments, a sample playlist M3u8 is shown below:
[0065] Byte range of the GOP for which slices have been generated, #EXT-SEGMENT: 0-282187, 282188-508915, 508916-800691, 800692-1071223, 1071224-1430115 #EXTINF: 5.005, no desc;
[0066] demo / demo1315905.ts;
[0067] Slices to be generated. Currently only one GOP is updated. The range is 0-250791. #EXT-SEGMENT: 0-250791; demo / demo_preload.ts.
[0068] Figure 5 Schematic diagram of a device for reducing HLS protocol playback delay according to an embodiment of the present invention. The device includes a first module 510, a second module 520, a third module 530, and a fourth module 540.
[0069] Among them, the first module is used to generate a playlist and generated slices according to the HLS standard protocol; the second module is used to add a first slice identifier to the generated slice, and the first slice identifier is used to represent the position of the GOP in the generated slice; the third module is used to generate a second slice identifier based on the slice to be generated, and add the second slice identifier to the playlist; the fourth module is used to execute the download and playback of the GOP according to the streaming media playback request, the first slice identifier and the second slice identifier.
[0070] Exemplarily, with the cooperation of the first module, the second module, the third module, and the fourth module in the device, the embodiment device can implement any of the aforementioned methods for reducing the playback delay of the HLS protocol, namely, generating a playlist and generated slices according to the HLS standard protocol; adding a first slice identifier to the generated slice, the first slice identifier being used to characterize the position of the GOP in the generated slice; generating a second slice identifier based on the slice to be generated, and adding the second slice identifier to the playlist; and executing the download and playback of the GOP based on the first slice identifier and the second slice identifier in response to a streaming media playback request. The beneficial effect of the present invention is that by making custom annotations to the generated slices in the playlist and by identifying the slices to be generated, when the client downloads the GOP, the latest GOP generated in the shortest time is determined and downloaded through the GOP duration range, so that the HLS protocol playback delay is maintained within a GOP duration range, thereby reducing the playback delay.
[0071] An embodiment of the present invention further provides an electronic device, the electronic device including a processor and a memory;
[0072] The memory stores a program;
[0073] The processor executes a program to perform the aforementioned method for reducing the HLS protocol playback delay; the electronic device has the function of carrying and running the software system for reducing the HLS protocol playback delay provided by an embodiment of the present invention, such as a personal computer, a minicomputer, a main frame, a workstation, a network or distributed computing environment, a separate or integrated computer platform, or communicating with a charged particle tool or other imaging device, etc.
[0074] An embodiment of the present invention further provides a computer-readable storage medium, wherein the storage medium stores a program, and the program is executed by a processor to implement the method for reducing HLS protocol playback delay as described above.
[0075] In some optional embodiments, the function / operation mentioned in the block diagram may not occur in the order mentioned in the operation diagram. For example, depending on the function / operation involved, the two boxes shown in succession can actually be executed substantially simultaneously or the boxes can sometimes be executed in reverse order. In addition, the embodiment presented and described in the flow chart of the present invention is provided in an exemplary manner for the purpose of providing a more comprehensive understanding of the technology. The disclosed method is not limited to the operation and logic flow presented herein. Optional embodiments are contemplated in which the order of the various operations is changed and the sub-operations described as a part of a larger operation are performed independently.
[0076] An embodiment of the present invention further discloses a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device can read the computer instructions from the computer-readable storage medium and execute the computer instructions, causing the computer device to perform the aforementioned method for reducing HLS protocol playback delay.
[0077] Furthermore, although the present invention is described in the context of functional modules, it should be understood that, unless otherwise indicated, one or more of the functions and / or features described may be integrated into a single physical device and / or software module, or one or more functions and / or features may be implemented in separate physical devices or software modules. It will also be understood that a detailed discussion of the actual implementation of each module is not necessary for understanding the present invention. More specifically, given the properties, functions, and internal relationships of the various functional modules in the devices disclosed herein, the actual implementation of the module will be understood within the ordinary skill of an engineer. Therefore, a person skilled in the art using ordinary skill will be able to implement the present invention set forth in the claims without undue experimentation. It will also be understood that the specific concepts disclosed are merely illustrative and are not intended to limit the scope of the present invention, which is determined by the full scope of the appended claims and their equivalents.
[0078] If the functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the portion that contributes to the prior art, or the portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage media include various media capable of storing program code, such as USB flash drives, mobile hard drives, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical disks.
[0079] The logic and / or steps represented in the flowcharts or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing the logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (e.g., a computer-based system, a system including a processor, or other system that can fetch and execute instructions from an instruction execution system, apparatus, or device). For purposes of this specification, "computer-readable medium" can be any medium that can contain, store, communicate, propagate, or transport a program for use by, or in conjunction with, an instruction execution system, apparatus, or device.
[0080] More specific examples (a non-exhaustive list) of computer-readable media include the following: an electrical connection with one or more wires (electronic devices), a portable computer disk (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering, or processing in another suitable manner as necessary, and then stored in a computer memory.
[0081] It should be understood that various components of the present invention may be implemented using hardware, software, firmware, or a combination thereof. In the aforementioned embodiments, multiple steps or methods may be implemented using software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented using hardware, as in another embodiment, any one or a combination of the following technologies known in the art may be used: a discrete logic circuit having logic gate circuits for implementing logic functions on data signals, an application-specific integrated circuit having suitable combinational logic gate circuits, a programmable gate array (PGA), a field-programmable gate array (FPGA), etc.
[0082] Throughout this specification, reference to terms such as "one embodiment," "some embodiments," "examples," "specific examples," or "some examples" means that a specific feature, structure, material, or characteristic described in conjunction with that embodiment or example is included in at least one embodiment or example of the present invention. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
[0083] While embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions, and variations may be made to the embodiments without departing from the principles and spirit of the invention, and that the scope of the invention is defined by the claims and their equivalents.
[0084] The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the embodiments. Those skilled in the art can make various equivalent modifications or substitutions without violating the spirit of the present invention. These equivalent modifications or substitutions are all included in the scope defined by the claims of this application.
Claims
1. A method for reducing HLS protocol playback delay, characterized in that: include: Generate playlists and generated segments according to the HLS standard protocol; adding a first slice identifier to the generated slice, where the first slice identifier is used to indicate a position of a GOP in the generated slice; Generate a second slice identifier according to the slice to be generated, and add the second slice identifier to the playlist; In response to a streaming media playback request, executing downloading and playback of the GOP according to the first slice identifier and the second slice identifier; Generating a playlist and generated slices according to the HLS standard protocol includes: pulling streaming data packets from an acquisition server, continuously parsing the streaming data packets to obtain a GOP; if the GOP meets a slicing condition, performing slicing processing and updating the playlist; if the GOP does not meet the slicing condition, updating the playlist, wherein the slicing condition is a preset playback duration; The adding of the first slice identifier in the playlist includes: when obtaining the generated slice and updating the playlist, adding the first slice identifier to the generated slice, wherein the first slice identifier is used to describe the byte range of each GOP, and the first slice identifier is a custom annotation; Generating a second slice identifier according to the slice to be generated, and adding the second slice identifier to the playlist includes: when only the playlist is updated, adding the second slice identifier to the slice to be generated, and adding a byte range of a newly added GOP to the first slice identifier according to the second slice; In response to the streaming media playback request, executing download and playback of the GOP according to the first slice identifier and the second slice identifier includes: continuously downloading the playlist, determining a byte range of the GOP according to the first slice identifier, downloading a to-be-generated slice including the second slice identifier, determining a latest generated GOP according to the duration range of the to-be-generated slice, and downloading the latest generated GOP; The byte range is determined by the byte ranges of the first slice identifier and the second slice identifier.
2. The method for reducing HLS protocol playback delay according to claim 1, characterized in that: The method further comprises: The playlist carries the generated slice, the slice to be generated, the first slice identifier and the second slice identifier.
3. A device for reducing HLS protocol playback delay, characterized in that: include: The first module is used to generate a playlist and generated segments according to the HLS standard protocol; A second module is configured to add a first slice identifier to the generated slice, where the first slice identifier is used to indicate a position of a GOP in the generated slice; A third module is configured to generate a second slice identifier according to the slice to be generated, and add the second slice identifier to a playlist; A fourth module is configured to execute downloading and playing of the GOP according to the streaming media playback request and the first slice identifier and the second slice identifier; Generating a playlist and generated slices according to the HLS standard protocol includes: pulling streaming data packets from an acquisition server, continuously parsing the streaming data packets to obtain a GOP; if the GOP meets a slicing condition, performing slicing processing and updating the playlist; if the GOP does not meet the slicing condition, updating the playlist, wherein the slicing condition is a preset playback duration; The adding of the first slice identifier in the playlist includes: when obtaining the generated slice and updating the playlist, adding the first slice identifier to the generated slice, wherein the first slice identifier is used to describe the byte range of each GOP, and the first slice identifier is a custom annotation; Generating a second slice identifier according to the slice to be generated, and adding the second slice identifier to the playlist includes: when only the playlist is updated, adding the second slice identifier to the slice to be generated, and adding a byte range of a newly added GOP to the first slice identifier according to the second slice; The downloading and playing of the GOP according to the streaming media playback request and the first slice identifier and the second slice identifier includes: continuously downloading the playlist, determining a byte range of the GOP according to the first slice identifier, downloading a to-be-generated slice including the second slice identifier, determining a latest generated GOP according to the duration range of the to-be-generated slice, and downloading the latest generated GOP; The byte range is determined by the byte ranges of the first slice identifier and the second slice identifier.
4. An electronic device, characterized in that: including a processor and a memory; The memory is used to store programs; The processor executes the program to implement the method for reducing HLS protocol playback delay as described in claim 1 or 2.
5. A computer-readable storage medium, characterized in that The storage medium stores a program, and the program is executed by a processor to implement the method for reducing HLS protocol playback delay as described in claim 1 or 2.
Citation Information
Patent Citations
HLS on-demand quick play starting method and system
CN110677736A