Method and device for reducing HLS protocol playing delay, equipment and medium
By adding custom slicing identifiers to the playlist of the HLS protocol, the problem of playback delay of the HLS protocol is solved, and the rapid download and playback of GOP is realized, improving the user experience.
Patent Information
- Application Number
- CN202510838385.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-23
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2045-06-23
AI Technical Summary
The existing HLS protocol has a large delay in video playback, resulting in poor user experience.
By adding a custom slice identifier to the playlist, including the first slice identifier and the second slice identifier, the position and duration range of the GOP are determined, and the GOP is quickly downloaded and played.
Reduces the playback delay of the HLS protocol, keeping it within a GOP duration range, and improving user experience.
Smart Images

Figure CN120378651A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of streaming media technology, and particularly to a method, device, equipment and medium for reducing the playback delay of the HLS protocol. Background Art
[0002] When playing videos, the commonly used playback protocol in the prior art is the HLS protocol. However, the traditional HLS protocol has a significant drawback, that is, its delay is relatively large. This delay mainly stems from the mechanism of the HLS protocol during segmentation processing and playback, resulting in delays for users when watching videos and a poor experience. 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 the playback delay of the HLS protocol, which reduces the playback delay of the HLS protocol.
[0004] One aspect of the present invention provides a method for reducing the playback delay of the HLS protocol, including: Generating a playlist and generated slices according to the HLS standard protocol; Adding a first slice identifier to the generated slices, where the first slice identifier is used to characterize the position of the GOP in the generated slices; Generating a second slice identifier according to the slices to be generated, and adding the second slice identifier to the playlist; In response to a streaming media playback request, performing the download and playback of the GOP according to the first slice identifier and the second slice identifier.
[0005] According to the method for reducing the playback delay of the HLS protocol, where generating a playlist and generated slices according to the HLS standard protocol includes: Pulling streaming media data packets from the acquisition server, continuously parsing the streaming media data packets to obtain the GOP; If the GOP meets the slicing condition, performing slicing processing and updating the playlist; If the GOP does not meet the slicing condition, updating the playlist, where the slicing condition is a preset playback duration.
[0006] According to the method for reducing the playback delay of the HLS protocol, where adding a first slice identifier to the playlist includes: When obtaining the generated slices and updating the playlist, adding the first slice identifier to the generated slices, where the first slice identifier is used to describe the byte range of each GOP, and the first slice identifier is a custom annotation.
[0007] According to the method for reducing the playback latency of the HLS protocol, where a second slice identifier is generated based on the slice to be generated, and the second slice identifier is added to the playlist, including: When only updating the playlist, add a second slice identifier to the slice to be generated, and add the byte range of the newly added GOP to the first slice identifier according to the second slice identifier.
[0008] According to the method for reducing the playback latency of the HLS protocol, where the method further includes: Carry the generated slices, the slices to be generated, the first slice identifier, and the second slice identifier through the playlist.
[0009] According to the method for reducing the playback latency of the HLS protocol, where in response to a streaming media playback request, perform the download and playback of the GOP according to the first slice identifier and the second slice identifier, including: Continuously download the playlist, determine the byte range of the GOP according to the first slice identifier, download the slice to be generated including the second slice identifier, determine the slice to be generated according to the duration range, and determine and download the newly generated GOP.
[0010] According to the method for reducing the playback latency of the HLS protocol, where the method further includes: Determine the byte range through the byte ranges of the first slice identifier and the second slice identifier.
[0011] Another aspect of the present invention provides an apparatus for reducing the playback latency of the HLS protocol, including: A first module for generating a playlist and generated slices according to the HLS standard protocol; A second module for adding a first slice identifier to the generated slices, where the first slice identifier is used to represent the position of the GOP in the generated slices; A third module for generating a second slice identifier according to the slice to be generated and adding the second slice identifier to the playlist; A fourth module for performing the download and playback of the GOP according to the first slice identifier and the second slice identifier in response to a streaming media playback request.
[0012] Another aspect of the embodiments of the present invention provides an electronic device, including a processor and a memory; The memory is used to store a program; The processor executes the program to implement the method described above.
[0013] An embodiment of the present invention also discloses a computer program product or a computer program. The computer program product or the computer program includes computer instructions, and the computer instructions are 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 the processor executes the computer instructions, so that the computer device executes the method described above.
[0014] The beneficial effects of the present invention are as follows: By customizing annotations for the generated slices in the playlist and 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 duration range of the GOP, so that the HLS protocol playback delay is maintained within the duration range of one GOP, reducing the playback delay. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 It is a schematic flowchart of a method for reducing the HLS protocol playback delay according to an embodiment of the present invention.
[0016] Figure 2 It is a schematic structural diagram of a system for reducing the HLS protocol playback delay according to an embodiment of the present invention.
[0017] Figure 3 It is a schematic flowchart of a slice generation process according to an embodiment of the present invention.
[0018] Figure 4 It is a schematic flowchart of a client download according to an embodiment of the present invention.
[0019] Figure 5 It is a schematic diagram of a device for reducing the HLS protocol playback delay according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0020] Embodiments of the present invention will be described in detail below. Examples of the embodiments are shown in the accompanying drawings, where the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. In the following description, suffixes such as "module", "component", or "unit" used to denote elements are only for the convenience of describing the present invention and have no specific meaning in themselves. Therefore, "module", "component", or "unit" can be used interchangeably. "First", "second", etc. are only used to distinguish technical features and should not be construed as indicating or implying relative importance or implicitly indicating the quantity of the indicated technical features or implicitly indicating the sequence of the indicated technical features. In the following description, the consecutive numbering of method steps is for the convenience of review and understanding. Considering the overall technical solution of the present invention and the logical relationship between each step, adjusting the execution order between steps will not affect the technical effect achieved by the technical solution of the present invention. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention and should not be construed as limiting the present invention.
[0021] Term Explanation: #EXT - SEGMENT, the first slice identifier of the embodiment of the present invention, which identifies the generated slice (file); _preload, the second slice identifier of the embodiment of the present invention, which identifies the slice to be generated; M3u8, a playlist file; GOP, the video encoding result, which consists of a group of consecutive image frames.
[0022] Figure 1 It is a schematic flowchart of the method for reducing the playback delay of the HLS protocol in the embodiment of the present invention, which includes but is not limited to steps S100 to S400: S100, generate a playlist and generated slices according to the HLS standard protocol.
[0023] In some embodiments, referring to Figure 2 the schematic diagram of the system structure for reducing the playback delay of the HLS protocol shown, which includes: Pull the streaming media data packet from the acquisition server, continuously parse the streaming media data packet to obtain GOP; if GOP meets the slicing condition, perform slicing processing and update the playlist; if GOP does not meet the slicing condition, only update the playlist, where the slicing condition is a preset playback duration.
[0024] S200, add a first slice identifier to the generated slices, and the first slice identifier is used to characterize the position of GOP in the generated slices.
[0025] In some embodiments, referring to Figure 3The schematic diagram of the slicing process shown includes adding a first slice identifier to the generated slice when the generated slice is obtained and the playlist is updated.
[0026] 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 annotation, such as the custom identifier "#EXT - SEGMENT".
[0027] S300, generate a second slice identifier according to the slice to be generated, and add the second slice identifier to the playlist.
[0028] When only the playlist is updated, add the second slice identifier to the slice to be generated, and add the byte range of the new GOP, such as "_preload", to the first slice identifier according to the second slice identifier.
[0029] S400, in response to a streaming media playback request, perform the download and playback of the GOP according to the first slice identifier and the second slice identifier.
[0030] In some embodiments, continuously download the playlist, determine the duration range of the GOP according to the first slice identifier, download the slice to be generated including the second slice identifier, determine the slice to be generated according to the duration range, and determine the latest generated GOP and download it.
[0031] In some embodiments, refer to Figure 4 The client download flow chart shown. After the client downloads the M3u8 file, it needs to be parsed. The "#EXT - SEGMENT" acts in the client parsing stage, that is, when the client parses this annotation, it can know the GOP byte range of the TS slice.
[0032] It can be understood that there are generated slices and slices to be generated in the M3u8 file. After determining the duration range of the GOP (or after the duration range), judge the time required for the slice to be generated to generate a GOP (within a duration range), that is, obtain the latest GOP.
[0033] In some embodiments, in combination with Figure 2 The schematic diagram of the system structure for reducing the playback delay of the HLS protocol shown, and its process includes: The slicing server pulls the stream from the acquisition server, continuously parses the streaming media data packet, and judges whether a slice needs to be generated every time a GOP is parsed.
[0034] If the conditions for generating a slice are met (generally set the playback duration of the slice), then generate a slice and update the M3u8 file. The custom annotation "#EXT - SEGMENT" needs to be added to each slice in the M3u8 file to describe the byte range of each GOP.
[0035] If the conditions for generating slices are not met (usually the playback duration of the slices is set), only the M3u8 is updated, and the byte range of the newly added GOP is added to the custom annotation "#EXT-SEGMENT" corresponding to the slice with the word "_preload".
[0036] The client continuously downloads and updates the M3u8. When it finds that the GOP has been updated, it can immediately download the latest content.
[0037] Compared with the traditional way of updating M3u8 by slices in HLS, the present invention can update the M3u8 immediately when a GOP is updated, and control the playback delay within the duration of one GOP.
[0038] In some embodiments, according to the above rules, the client can adaptively control the download of a specific GOP. If the latest GOP is selected for download and playback, the playback delay can be controlled within the duration of one GOP.
[0039] In some embodiments, an example of the playlist M3u8 is as follows: Byte ranges of the GOPs of the generated slices, #EXT-SEGMENT: 0-282187, 282188-508915, 508916-800691, 800692-1071223, 1071224-1430115#EXTINF: 5.005, no desc; demo / demo1315905.ts; Slices to be generated. Currently, only one GOP has been updated, and the range is expressed as 0-250791, #EXT-SEGMENT: 0-250791; demo / demo_preload.ts.
[0040] Figure 5 It is a schematic diagram of a device for reducing the playback delay of the HLS protocol 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.
[0041] 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 slices, and the first slice identifier is used to characterize the position of the GOP in the generated slices; the third module is used to generate a second slice identifier according to the slices 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.
[0042] Exemplarily, with the cooperation of the first module, the second module, the third module, and the fourth module in the device, the device of the embodiment can implement any one of the foregoing methods for reducing the HLS protocol playback delay, that is, generating a playlist and generated slices according to the HLS standard protocol; adding a first slice identifier to the generated slices, where the first slice identifier is used to characterize the position of the GOP in the generated slices; generating a second slice identifier according to the slices to be generated, and adding the second slice identifier to the playlist; in response to a streaming media playback request, downloading and playing the GOP according to the first slice identifier and the second slice identifier. The beneficial effect of the present invention is that by customizing the annotation of the generated slices in the playlist and 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 duration range of the GOP, so that the HLS protocol playback delay is maintained within a GOP duration range, reducing the playback delay.
[0043] An embodiment of the present invention further provides an electronic device, which includes a processor and a memory; The memory stores a program; The processor executes the program to execute the foregoing method for reducing the HLS protocol playback delay; this electronic device has the function of carrying and running the software system for reducing the HLS protocol playback delay provided by the embodiment of the present invention. For example, a personal computer, a minicomputer, a mainframe, a workstation, a network or distributed computing environment, a separate or integrated computer platform, or communicating with charged particle tools or other imaging devices, etc.
[0044] An embodiment of the present invention further provides a computer-readable storage medium, where the storage medium stores a program, and the program is executed by a processor to implement the method for reducing the HLS protocol playback delay as described above.
[0045] In some alternative embodiments, the functions / operations mentioned in the block diagram may not occur in the order mentioned in the operation diagram. For example, depending on the functions / operations involved, two consecutive blocks shown may actually be executed substantially simultaneously or the blocks can sometimes be executed in the reverse order. In addition, the embodiments presented and described in the flowcharts of the present invention are provided by way of example for the purpose of providing a more comprehensive understanding of the technology. The disclosed methods are not limited to the operations and logical flows presented herein. Alternative embodiments are contemplated where the order of various operations is changed and where sub-operations described as part of a larger operation are executed independently.
[0046] An embodiment of the present invention also discloses a computer program product or a computer program. The computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. A processor of a computer device may read the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the foregoing method for reducing the playback delay of the HLS protocol.
[0047] In addition, although the present invention has been described in the context of functional modules, it should be understood that, unless otherwise stated to the contrary, one or more of the functions and / or features described may be integrated in 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 should also be understood that a detailed discussion of the actual implementation of each module is not necessary for understanding the present invention. More precisely, considering the attributes, functions, and internal relationships of the various functional modules in the devices disclosed herein, the actual implementation of the modules will be understood within the ordinary skills of an engineer. Therefore, those skilled in the art can implement the present invention as set forth in the claims without undue experimentation. It should 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.
[0048] If the described function is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of the technical solution, may be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The foregoing storage medium includes: various media such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disc that can store program codes.
[0049] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a definitional sequence of executable instructions for implementing logical functions, which can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, a system including a processor, or other systems that can fetch and execute instructions from the instruction execution system, apparatus, or device. As used in this specification, a "computer-readable medium" can be any medium that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device.
[0050] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection portion with one or more wirings (electronic device), 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). Additionally, the computer-readable medium can even be paper or other suitable media on which the program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other media, followed by editing, interpretation, or otherwise processing as appropriate, and then storing it in a computer memory.
[0051] It should be understood that the various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above-described embodiments, multiple steps or methods can be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or a combination of the following techniques well known in the art can be used: discrete logic circuits having logic gate circuits for implementing logical functions on data signals, application-specific integrated circuits having appropriate combinational logic gate circuits, programmable gate arrays (PGAs), field programmable gate arrays (FPGAs), and the like.
[0052] In the description of this specification, the descriptions referring to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples", etc., mean that the specific features, structures, materials, or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.
[0053] Although embodiments of the present invention have been shown and described, those of ordinary skill in the art can understand that various changes, modifications, substitutions, and variations can be made to these embodiments without departing from the principles and spirit of the present invention. The scope of the present invention is defined by the claims and their equivalents.
[0054] The above has specifically described the preferred embodiments of the present invention, but the present invention is not limited to the described embodiments. Those skilled in the art can also make various equivalent deformations or substitutions without departing from the spirit of the present invention, and these equivalent deformations or substitutions are all included within the scope defined by the claims of this application.
Claims
1. A method for reducing the playback latency of the HLS protocol, characterized in that, including: generating a playlist and generated slices according to the HLS standard protocol; adding a first slice identifier to the generated slices, the first slice identifier being used to characterize the position of the GOP in the generated slices; generating a second slice identifier according to the slices to be generated, and adding the second slice identifier to the playlist; in response to a streaming media playback request, performing download and playback of the GOP according to the first slice identifier and the second slice identifier.
2. The method for reducing the playback delay of the HLS protocol according to claim 1, wherein The generating a playlist and generated slices according to the HLS standard protocol includes: pulling streaming media data packets from a collection server, continuously parsing the streaming media data packets to obtain GOPs; if the GOP meets the slicing condition, performing slicing processing and updating the playlist; if the GOP does not meet the slicing condition, updating the playlist, where the slicing condition is a preset playback duration.
3. The method for reducing the playback delay of the HLS protocol according to claim 2, wherein The adding a first slice identifier to the playlist includes: when obtaining the generated slices and updating the playlist, adding the first slice identifier to the generated slices, where the first slice identifier is used to describe the byte range of each GOP, and the first slice identifier is a custom annotation.
4. The method for reducing the playback delay of the HLS protocol according to claim 3, wherein The generating a second slice identifier according to the slices to be generated and adding the second slice identifier to the playlist includes: when only updating the playlist, adding a second slice identifier to the slices to be generated, and adding the byte range of the newly added GOP to the first slice identifier according to the second slice identifier.
5. The method for reducing the playback delay of the HLS protocol according to claim 1, characterized in that, The method further includes: carrying the generated slices, the slices to be generated, the first slice identifier, and the second slice identifier through the playlist.
6. The method for reducing the playback delay of the HLS protocol according to claim 5, wherein The in response to a streaming media playback request, performing download and playback of the GOP according to the first slice identifier and the second slice identifier includes: continuously downloading the playlist, determining the byte range of the GOP according to the first slice identifier, downloading the slices to be generated including the second slice identifier, determining the slices to be generated according to the duration range, determining the newly generated GOP and downloading it.
7. The method for reducing the playback delay of the HLS protocol according to claim 6, wherein The method further includes: determining the byte range through the byte ranges of the first slice identifier and the second slice identifier.
8. A device for reducing the playback latency of the HLS protocol, characterized in that, including: a first module for generating a playlist and generated slices according to the HLS standard protocol; a second module for adding a first slice identifier to the generated slices, the first slice identifier being used to characterize the position of the GOP in the generated slices; a third module for generating a second slice identifier according to the slices to be generated and adding the second slice identifier to the playlist; a fourth module for performing download and playback of the GOP according to a streaming media playback request, according to the first slice identifier and the second slice identifier.
9. An electronic device, characterized in that, including a processor and a memory; the memory is used to store a program; the processor executes the program to implement the method for reducing the playback delay of the HLS protocol as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, the storage medium stores a program, and the program is executed by the processor to implement the method for reducing the playback delay of the HLS protocol as described in any one of claims 1-7.
Citation Information
Patent Citations
Data playing method and device and storage medium
CN110166834A
HLS on-demand quick play starting method and system
CN110677736A
HLS live broadcast rapid play starting method and system
CN110677737A
Video alignment method, video coding method, video alignment device, video coding device and storage medium
CN115119009A
Cited By
Streaming media transmission method and system
CN121012819A
A streaming media transmission method and system
CN121012819B