Method for improving playing efficiency and player
By merging the two-level M3U8 indexes of multi-bitrate HLS into a single-level index file, the problem of multiple HTTP requests in the HLS protocol is solved, improving the access efficiency of the player and the user experience, and reducing the management burden of CDN.
Patent Information
- Application Number
- CN202310349696.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-04
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2043-04-04
AI Technical Summary
The existing HTTP Live Streaming (HLS) protocol requires multiple HTTP requests when starting playback and switching bitrates, which increases the user's waiting time. In addition, the two-level M3U8 index file management of multi-bitrate HLS is burdensome and inefficient.
The two-level M3U8 index files of multi-bitrate HLS are merged into a single-level M3U8 index file. By adding multi-bitrate description information to the M3U8 list, it is simplified into a single file format. The player parses and requests the merged index file to reduce the number of HTTP requests.
It reduces the number of HTTP requests when the player starts playing, improves the player's access efficiency and user viewing experience, reduces the CDN's file management burden, and improves the efficiency of multi-bitrate switching playback.
Smart Images

Figure CN116389774B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the field of streaming media content production and playing, and particularly relates to a method for improving playing efficiency and a player. BACKGROUND
[0002] HTTP Live Streaming (HLS) is a HTTP-based streaming media network transmission protocol proposed by Apple, which contains an index file M3U8 describing media stream slice information and a series of continuous TS media stream slice files. After a player obtains the M3U8 index file, it can download the TS slices in sequence to realize the playing of the media stream. For the case of multiple code rates, the M3U8 contains a primary index file and a secondary index file, the primary index describes the information of multiple code rates and the information of the associated secondary index file, and the secondary index file contains the TS slice information of the media stream of its own code rate. In actual application, the player needs to first download the primary index file through HTTP request, then download the appropriate secondary index file according to the current network bandwidth to obtain the corresponding slice information, and then initiate HTTP request to obtain the final media data that can be played according to the slice information described in the secondary index file. As can be seen, at least three HTTP requests are required to complete a complete start playing, and for live streaming, at least two HTTP requests are required to complete the operation of switching code rate each time the code rate is switched, which is a limitation of the protocol and increases the waiting time of the user. There is no good solution at present.
[0003] In the prior art, the two-level M3U8 file of the multi-code rate HLS code stream is as follows:
[0004] The primary index M3U8 is responsible for describing the information of each different code rate media stream and the address information of the corresponding secondary index file. The media player needs to receive and process the index file to select the required media stream.
[0005] For example, as shown in the following example, the #EXT-X-STREAM-INF tag describes four media streams, and the bandwidth / code rate values of the four media streams are 1280000, 2560000, 7680000 and 65000 respectively. The secondary index file addresses associated with the TS slice information of the four media streams are http: / / example.com / low.m3u8, http: / / example.com / mid.m3u8, etc. The first three media streams correspond to video streams, and 65000 corresponds to a pure audio stream.
[0006] The specific example is as follows:
[0007] #EXTM3U
[0008] #EXT-X-STREAM-INF:BANDWIDTH=1280000,AVERAGE-BANDWIDTH=1000000
[0009] http: / / example.com / low.m3u8
[0010] #EXT-X-STREAM-INF:BANDWIDTH=2560000,AVERAGE-BANDWIDTH=2000000
[0011] http: / / example.com / mid.m3u8
[0012] #EXT-X-STREAM-INF:BANDWIDTH=7680000,AVERAGE-BANDWIDTH=6000000
[0013] http: / / example.com / hi.m3u8
[0014] #EXT-X-STREAM-INF:BANDWIDTH=65000,CODECS="mp4a.40.5"
[0015] http: / / example.com / audio-only.m3u8
[0016] The secondary index M3U8 refers to the TS slice information contained in the media stream of different bit rates / definition, including the slice duration pointed by the #EXTINF tag, and the HTTP address corresponding to the slice, etc. The media player receives and processes the M3U8 index file to pull the actual TS slice information, and realizes the media stream playing.
[0017] The specific examples are as follows:
[0018] #EXTM3U
[0019] #EXT-X-TARGETDURATION:10
[0020] #EXT-X-VERSION:3
[0021] #EXTINF:9.009,
[0022] http: / / media.example.com / first.ts
[0023] #EXTINF:9.009,
[0024] http: / / media.example.com / second.ts
[0025] #EXTINF:3.003,
[0026] http: / / media.example.com / third.ts
[0027] #EXT-X-ENDLIST SUMMARY
[0028] In view of the above problems, the present application provides a method and a player for improving playing efficiency, for a multi-rate HLS media stream, by adding multi-rate description information in the M3U8 list, changing the original two-level M3U8 index file into a single file format, reducing the file management burden of the content distribution network (CDN), and improving the access efficiency of the player.
[0029] To solve the above technical problems, the present application adopts the following technical solutions:
[0030] The present application provides a method for improving playing efficiency, comprising the following steps:
[0031] requesting an M3U8 file of a multi-rate stream from a media server, wherein the construction of the M3U8 file comprises a newly defined tag indicating that the index file is a special M3U8 first-level index file, and combined description of multi-rate information and slice description information;
[0032] analyzing the multi-rate information and the slice description information in the M3U8 file;
[0033] adding a code rate value parameter after the slice address according to the corresponding code rate value selected by the user, and sequentially requesting corresponding TS slice data from the media server;
[0034] receiving the TS slice data sent back by the media server, processing and playing.
[0035] In a possible implementation manner, the multi-rate information comprises code rate information of a video stream and a minimum code rate value of pure audio code rate.
[0036] In a possible implementation manner, the slice description information comprises time length and address information of a media stream slice.
[0037] In a possible implementation, the player constructs a new slice request address during playing, initiates an HTTP request to the media server, and the media server sends back corresponding slice data according to the new request address after the player switches the code rate, and the player continues playing after parsing and processing the media data sent back by the media server.
[0038] The embodiment of the application provides a player for improving playing efficiency, comprising:
[0039] An M3U8 file request module is configured to request an M3U8 file of a multi-code rate stream from a media server, wherein the construction of the M3U8 file comprises a newly defined tag indicating that the index file is a special M3U8 first-level index file, and merging description of multi-code rate information and slice description information.
[0040] An analysis module is configured to analyze and record the multi-code rate information and the slice description information in the M3U8 file.
[0041] A TS slice data request module is configured to obtain a corresponding code rate value according to the definition of the user-selected definition, add the code rate value parameter after the slice address, and sequentially request corresponding TS slice data from the media server.
[0042] A receiving and playing module is configured to receive the TS slice data sent back by the media server, process and play the TS slice data.
[0043] In a possible implementation, the multi-code rate information comprises code rate information of a video stream and a minimum code rate value of pure audio code rate.
[0044] In a possible implementation, the slice description information comprises time length and address information of a media stream slice.
[0045] In a possible implementation, the player constructs a new slice request address during playing, initiates an HTTP request to the media server, and the media server sends back corresponding slice data according to the new request address after the player switches the code rate, and the player continues playing after parsing and processing the media data sent back by the media server.
[0046] The application has the following beneficial effects:
[0047] (1) For a multi-code rate HLS media stream, the original two-level M3U8 index file is changed into a single file format by adding multi-code rate description information in the M3U8 list, thereby reducing the file management burden of a CDN and improving the access efficiency of a player.
[0048] (2) By simplifying the two-level M3U8 index to a one-level M3U8 index, the number of HTTP requests when the player starts playing can be reduced, thereby reducing the corresponding network time and improving the user's viewing experience. In the scene of live stream rate switching, there is no need to update the switched M3U8 file first, and then initiate a request for a new resolution TS file according to the M3U8 file information after switching, reducing the number of HTTP requests and improving the efficiency of multi-rate switching playback.
[0049] (3) Since the original two-level M3U8 index of the multi-rate media stream corresponds to multiple M3U8 files, the improved scheme also reduces the corresponding index file generation, storage and distribution requirements on the content generation and distribution side of the media server. In the live streaming scenario, only a single M3U8 file needs to be updated and maintained in real time, greatly improving the management efficiency. BRIEF DESCRIPTION OF DRAWINGS
[0050] Figure 1 A step flow chart of the method for improving the playing efficiency of an embodiment of the application;
[0051] Figure 2 A step flow chart of the method for improving the playing efficiency of another embodiment of the application;
[0052] Figure 3 A principle block diagram of the player for improving the playing efficiency of an embodiment of the application. DETAILED DESCRIPTION
[0053] The technical solutions in the embodiments of the application will be clearly and completely described below with reference to the drawings in the embodiments of the application. Obviously, the described embodiments are some but not all of the embodiments of the application. Based on the embodiments in the application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the protection scope of the application.
[0054] Referring to Figure 1 , a step flow chart of the method for improving the playing efficiency of an embodiment of the application is shown, including the following steps:
[0055] S10, requesting an M3U8 file of a multi-rate stream to a media server, wherein the construction of the M3U8 file includes a newly defined tag indicating that the index file is a special M3U8 one-level index file, and merging the multi-rate information and the slice description information; wherein the multi-rate information includes the code rate information of three grades of ultra-clear, high-definition and normal video streams and the minimum code rate value of pure audio code rate; and the slice description information includes the time length and address information of the media stream slice.
[0056] S20, parsing the multi-rate information and the slice description information in the recorded M3U8 file;
[0057] S30, obtaining a corresponding code rate value according to the definition of the user selection, adding the code rate value parameter after the slice address, and sequentially requesting the corresponding TS slice data to the media server;
[0058] S40, receiving the TS slice data sent back by the media server, processing and playing.
[0059] In an embodiment of the present application, the original two-level M3U8 index description of the multi-rate media stream information and the TS slice description information are combined, so that the modified M3U8 file has only one level, and a specific application example is as follows:
[0060] #EXTM3U
[0061] #EXT-X-MULTISTREAM
[0062] #EXT-X-STREAM-INF:BANDWIDTH=1280000,AVERAGE-BANDWIDTH=1000000
[0063] #EXT-X-STREAM-INF:BANDWIDTH=2560000,AVERAGE-BANDWIDTH=2000000
[0064] #EXT-X-STREAM-INF:BANDWIDTH=7680000,AVERAGE-BANDWIDTH=6000000
[0065] #EXT-X-STREAM-INF:BANDWIDTH=65000,CODECS="mp4a.40.5"
[0066] #EXT-X-TARGETDURATION:10
[0067] #EXT-X-VERSION:3
[0068] #EXTINF:9.009,
[0069] http: / / media.example.com / first.ts
[0070] #EXTINF:9.009,
[0071] http: / / media.example.com / second.ts
[0072] #EXTINF:3.003,
[0073] http: / / media.example.com / third.ts
[0074] #EXT-X-ENDLIST
[0075] The tag #EXT-X-MULTISTREAM is an example of a custom new tag that indicates that the index file is a special M3U8 first-level index file. It is a newly defined tag that indicates that the index file is a newly constructed merged multi-bitrate media stream M3U8 format, instructing the media player to process it according to the newly defined format. The other tags are all from the specification.
[0076] In one embodiment of the present invention, in steps S20 to S40, the player acquires the modified multi-bitrate HLS M3U8 file with only one level of resolution, parses and records the bitrate information of the media stream. For example, the video streams with three resolution levels—ultra-high definition, high definition, and normal—have corresponding bitrate values of BW1, BW2, and BW3, respectively, as well as the smallest bitrate value, BW4, which contains only pure audio.
[0077] Parse and record the duration and address information of media stream segments. For example, if the total number of segments is N, the corresponding HTTP address information of the segments is URL1, URL2, URL3, and so on down to the URL. N ;
[0078] The player selects the corresponding BW level from BW1 to BW4 based on the user's chosen resolution. i BW i It is one of BW1 to BW4, and is preparing to select the first slice of the media stream for download and playback. The corresponding HTTP address of this slice in M3U8 is URL1. The player adds parameter information pointing to the bitrate after this address, constructs the actual request address in the form of: URL1?bandwidth=BWi, and sends an HTTP request to the media server.
[0079] The media server receives the player's segment request and sends back the corresponding media segment data;
[0080] The player parses and processes the media data sent back by the media server and starts playback;
[0081] After the first segment finishes playing, the player requests the second segment. The HTTP address corresponding to this segment in M3U8 is URL2. What is the actual address of the segment requested by the player? bandwidth=BW i ;
[0082] Subsequent playback data requests for slices will follow the same pattern.
[0083] Further, see Figure 2The step flow chart of the method for improving the playing efficiency in another embodiment of the application comprises the following steps:
[0084] S10, requesting an M3U8 file of a multi-code rate stream from a media server, the construction of the M3U8 file comprising a newly defined tag indicating that the index file is a special M3U8 primary index file, and combining the description of multi-code rate information and slice description information; wherein the multi-code rate information comprises the code rate information of a video stream and the minimum code rate value of a pure audio code rate; and the slice description information comprises the time length and address information of a media stream slice.
[0085] S20, analyzing and recording the multi-code rate information and slice description information in the M3U8 file;
[0086] S30, obtaining a corresponding code rate value according to the definition selected by a user, adding a code rate value parameter after the slice address, and sequentially requesting corresponding TS slice data from the media server;
[0087] S40, receiving the TS slice data sent back by the media server, processing and playing;
[0088] S50, during the playing process, the user selects to switch the definition for playing, the player constructs a new slice request address, the player initiates an HTTP request to the media server, the media server sends back corresponding slice data according to the new request address after the player switches the code rate, the player analyzes and processes the media data sent back by the media server, and continues to play.
[0089] In an embodiment of the application, in S20 to S40, the player obtains the M3U8 file of the multi-code rate HLS with only one level after the modification, analyzes and records the code rate information of the media stream, for example, a video stream with three grades of super definition, high definition and normal definition, the corresponding code rate values of which are BW1, BW2 and BW3 respectively, and the code rate value BW4 containing the minimum pure audio code rate,
[0090] analyzes and records the time length and address information of the media stream slice, for example, the total number of slices is N, and the corresponding slice HTTP address information is URL1, URL2, URL3, and so on to URL N ;
[0091] the player selects one grade BW i from BW1 to BW4 according to the definition selected by the user, BW i is one of BW1 to BW4, and prepares to select the first slice of the media stream for downloading and playing, the corresponding HTTP address of the slice in the M3U8 file is URL1, the player adds the parameter information pointing to the code rate after the address, and constructs the actual request address as URL1?bandwidth=BW iand initiates HTTP request to the media server;
[0092] The media server receives the slice request from the player and sends back the corresponding media slice data;
[0093] The player parses and processes the media data sent back by the media server and starts playing;
[0094] After the first slice is played, the player requests the second slice, the corresponding HTTP address of which in M3U8 is URL2, and the actual slice address requested by the player is URL2?bandwidth=BW i The slice data request in the subsequent playing process is similar.
[0095] During the playing process, if the user selects to switch the resolution for playing, for example, the corresponding resolution in the M3U8 description information is switched from BW i to BW j , and BW j is one of BW1 to BW4;
[0096] Assuming that the slice index number after the rate switching is m, the corresponding HTTP address of which in M3U8 is URLm, the player constructs a new slice request address in the form of URLm?bandwidth=BW j , and initiates HTTP request to the media server with the new slice request address;
[0097] The media server sends back the corresponding slice data according to the new request address after the player switches the rate;
[0098] The player parses and processes the media data sent back by the media server and continues playing.
[0099] Corresponding to the method embodiment, refer to Figure 3The player for improving playing efficiency shown in the figure is an embodiment of the application, comprising an M3U8 file request module, an analysis module, a TS slice data request module and a receiving and playing module, wherein the M3U8 file request module is used for requesting an M3U8 file of a multi-rate stream from a media server, wherein the construction of the M3U8 file comprises a newly defined label indicating that the index file is a special M3U8 primary index file and combined description of multi-rate information and slice description information, the multi-rate information comprises code rate information of three grades of ultra-clear, high-definition and normal video streams and a code rate value of a pure audio code rate minimum, and the slice description information comprises time length and address information of a media stream slice; the analysis module is used for analyzing the multi-rate information and the slice description information in the recorded M3U8 file; the TS slice data request module is used for obtaining a corresponding code rate value according to a resolution selected by a user, adding a code rate value parameter after a slice address and sequentially requesting corresponding TS slice data from the media server; and the receiving and playing module is used for receiving the TS slice data sent back from the media server, processing and playing.
[0100] In an embodiment of the application, the multi-rate media stream information and the TS slice description information originally described by two-level M3U8 index are combined, so that the modified M3U8 file has only one level, and a specific application example is as follows:
[0101] #EXTM3U
[0102] #EXT-X-MULTISTREAM
[0103] #EXT-X-STREAM-INF:BANDWIDTH=1280000,AVERAGE-BANDWIDTH=1000000
[0104] #EXT-X-STREAM-INF:BANDWIDTH=2560000,AVERAGE-BANDWIDTH=2000000
[0105] #EXT-X-STREAM-INF:BANDWIDTH=7680000,AVERAGE-BANDWIDTH=6000000
[0106] #EXT-X-STREAM-INF:BANDWIDTH=65000,CODECS="mp4a.40.5"
[0107] #EXT-X-TARGETDURATION:10
[0108] #EXT-X-VERSION:3
[0109] #EXTINF:9.009,
[0110] http: / / media.example.com / first.ts
[0111] #EXTINF:9.009,
[0112] http: / / media.example.com / second.ts
[0113] #EXTINF:3.003,
[0114] http: / / media.example.com / third.ts
[0115] #EXT-X-ENDLIST
[0116] The tag #EXT-X-MULTISTREAM is an example of a custom new tag that indicates that the index file is a special M3U8 first-level index file. It is a newly defined tag that indicates that the index file is a newly constructed merged multi-bitrate media stream M3U8 format, instructing the media player to process it according to the newly defined format. The other tags are all from the specification.
[0117] In one embodiment of the present invention, the player acquires a modified M3U8 file of a multi-bitrate HLS stream with only one level of resolution, parses and records the bitrate information of the media stream. For example, the video streams with three resolution levels—ultra-high definition, high definition, and normal—have corresponding bitrate values of BW1, BW2, and BW3, respectively, and the smallest bitrate value, BW4, which contains only pure audio.
[0118] Parse and record the duration and address information of media stream segments. For example, if the total number of segments is N, the corresponding HTTP address information of the segments is URL1, URL2, URL3, and so on down to the URL. N ;
[0119] The player selects the corresponding BW level from BW1 to BW4 based on the user's chosen resolution. i BW i It's from BW1 to BW 34 One of the media stream segments is selected for download and playback. This segment corresponds to the HTTP address URL1 in M3U8. The player appends a parameter indicating the bitrate to this address, constructing the actual request address in the form: URL1?bandwidth=BW i And send an HTTP request to the media server;
[0120] The media server receives the player's segment request and sends back the corresponding media segment data;
[0121] The player parses and processes the media data sent back by the media server and starts playback;
[0122] After the first segment finishes playing, the player requests the second segment. The HTTP address corresponding to this segment in M3U8 is URL2. The actual segment address requested by the player is URL2?bandwidth=BWi;
[0123] Subsequent playback data requests for slices will follow the same pattern.
[0124] Furthermore, in another embodiment of the present invention, the player for improving playback efficiency further includes: during playback, when the user selects to switch the resolution, the player constructs a new slice request address, the player initiates an HTTP request to the media server, the media server sends back the corresponding slice data according to the new request address after the player switches the bitrate, the player parses and processes the media data sent back by the media server, and continues playback.
[0125] In one embodiment of the present invention, the player acquires a modified M3U8 file of a multi-bitrate HLS stream with only one level of resolution, parses and records the bitrate information of the media stream. For example, the video streams with three resolution levels—ultra-high definition, high definition, and normal—have corresponding bitrate values of BW1, BW2, and BW3, respectively, and the smallest bitrate value, BW4, which contains only pure audio.
[0126] Parse and record the duration and address information of media stream segments. For example, if the total number of segments is N, the corresponding HTTP address information of the segments is URL1, URL2, URL3, and so on down to the URL. N ;
[0127] The player selects the corresponding BW level from BW1 to BW4 based on the user's chosen resolution. i BW i It is one of BW1 to BW4, and it is preparing to select the very first segment of the media stream for download and playback. The corresponding HTTP address for this segment in M3U8 is URL1. The player adds parameters pointing to the bitrate to this address, constructing the actual request address in the form: URL1?bandwidth=BW i And send an HTTP request to the media server;
[0128] The media server receives the player's segment request and sends back the corresponding media segment data;
[0129] The player parses and processes the media data sent back by the media server and starts playback;
[0130] After the first slice is played, the player requests the second slice, which has a corresponding HTTP address of URL2 in the M3U8, and the actual slice address requested by the player is URL2?bandwidth=BW i ; and the slice data request in the subsequent playing process is similar.
[0131] During the playing process, if the user selects to switch the definition to play, for example, the corresponding definition in the M3U8 description information is switched from BW i to BW j , and BW j is one of BW1 to BW3;
[0132] Suppose the slice index number after the code rate switching is m, and the corresponding HTTP address in the M3U8 is URL m , then the player constructs a new slice request address in the form of URLm?bandwidth=BW j , and initiates an HTTP request to the media server with the new address;
[0133] The media server returns the corresponding slice data according to the new request address after the player switches the code rate;
[0134] The player parses and processes the media data returned by the media server and continues to play.
[0135] In a specific application example, suppose there is a media server S and a multi-code rate HLS media stream M, M contains "super clear" with a code rate of 7680000 (bps), "high definition" with a code rate of 2560000 bps, and "ordinary" with a code rate of 1280000 bps. The media stream is an on-demand stream, and the related M3U8 description file is as follows:
[0136] #EXTM3U
[0137] #EXT-X-MULTISTREAM
[0138] #EXT-X-STREAM-INF:BANDWIDTH=1280000,AVERAGE-BANDWIDTH=1000000
[0139] #EXT-X-STREAM-INF:BANDWIDTH=2560000,AVERAGE-BANDWIDTH=2000000
[0140] #EXT-X-STREAM-INF:BANDWIDTH=7680000,AVERAGE-BANDWIDTH=6000000
[0141] #EXT-X-TARGETDURATION:10
[0142] #EXT-X-VERSION:3
[0143] #EXTINF:3.000,
[0144] http: / / media.example.com / 01.ts
[0145] #EXTINF:3.000,
[0146] http: / / media.example.com / 02.ts
[0147] #EXTINF:3.000,
[0148] http: / / media.example.com / 03.ts
[0149] #EXTINF:3.000,
[0150] http: / / media.example.com / 98.ts
[0151] #EXTINF:3.000,
[0152] http: / / media.example.com / 99.ts
[0153] #EXT-X-ENDLIST
[0154] The existing player P prepares to play the media stream M, and the user selects the definition as high definition.
[0155] The player P requests the media server S to obtain the M3U8 file, parses and records the corresponding multi-rate information, and all slice information including slice duration and address description.
[0156] The definition selected by the user is high definition, and the player selects the media stream with the code rate value of 2560000. The address description information of the first slice is http: / / media.example.com / 01.ts, and the actual slice address constructed by the player is http: / / media.example.com / 01.ts?bandwidth=2560000, and the HTTP request is initiated to the media server S.
[0157] The media server S returns the corresponding TS slice media data, that is, the TS slice with the definition of high definition and the code rate value of 2560000;
[0158] The player P receives the media data of the first slice, processes it and starts playing;
[0159] When the processing of the first TS slice is completed, the player prepares the request for downloading the second TS slice, the address description information of the second slice is http: / / media.example.com / 02.ts, the actual slice address constructed by the player is http: / / media.example.com / 02.ts?bandwidth=2560000, and the player initiates an HTTP request to the media server S based on the actual slice address;
[0160] The player continues playing, and the subsequent slices are processed in the same way;
[0161] During the playing, the user selects the definition as super definition, the player P queries the M3U8 information to obtain the code rate value corresponding to the definition as 7680000, the number of slices being played is 30, and the slice has been downloaded and processed;
[0162] The player P initiates a request for the 31st slice to the media server, the address description information of the slice in the M3U8 file is http: / / media.example.com / 31.ts, http: / / media.example.com / 01.ts, the actual slice address constructed by the player is http: / / media.example.com / 31.ts?bandwidth=7680000, and the player initiates an HTTP request to the media server S based on the actual slice address;
[0163] The media server S returns the corresponding TS slice media data, i.e., the TS slice with the definition as super definition, the slice index as 31, and the code rate value as 7680000;
[0164] The player P receives the media data of the 31st slice, processes it and continues playing.
[0165] In another specific application example, it is assumed that there is a media server S, a multi-code rate HLS media stream M, the M includes three kinds of definition code streams, i.e., super definition with a code rate of 7680000 (bps), high definition with a code rate of 2560000 bps, and normal definition with a code rate of 1280000 bps, and the media stream is a live stream. The related M3U8 description file is as follows:
[0166] #EXTM3U
[0167] #EXT-X-STREAM-INF:BANDWIDTH=1280000,AVERAGE-BANDWIDTH=1000000
[0168] #EXT-X-STREAM-INF:BANDWIDTH=2560000,AVERAGE-BANDWIDTH=2000000
[0169] #EXT-X-STREAM-INF:BANDWIDTH=7680000,AVERAGE-BANDWIDTH=6000000
[0170] #EXT-X-TARGETDURATION:10
[0171] #EXT-X-VERSION:3
[0172] #EXTINF:3.000,
[0173] http: / / media.example.com / 01.ts
[0174] #EXTINF:3.000,
[0175] http: / / media.example.com / 02.ts
[0176] #EXTINF:3.000,
[0177] http: / / media.example.com / 03.ts
[0178] #EXTINF:3.000,
[0179] http: / / media.example.com / 04.ts
[0180] The existing player P prepares to play the media stream M, and the user selects the definition as high definition.
[0181] The player P requests the media server S to obtain the M3U8 file, parses and records the corresponding multi-rate information, and all slice information including slice duration and address description
[0182] The definition selected by the user is high definition, and the P selects the media stream with the code rate value of 2560000. The address description information of the first slice is http: / / media.example.com / 01.ts, and the actual slice address constructed by the player is http: / / media.example.com / 01.ts?bandwidth=2560000, and the HTTP request is initiated to the media server S
[0183] The media server S sends back the corresponding TS slice media data, that is, the TS slice with high definition and a code rate value of 2560000;
[0184] The player P receives the media data of the first slice, processes it, and starts playing;
[0185] When the processing of the first TS slice is completed, the player prepares a download request for the second TS slice. The address description information of the second slice is http: / / media.example.com / 02.ts. The player constructs the actual slice address as http: / / media.example.com / 02.ts?bandwidth=2560000, and initiates an HTTP request to the media server S based on the actual slice address;
[0186] During the playing of the second slice, the network is poor, and the user switches the definition. The player P queries the M3U8 information to obtain a code rate value of 1280000 corresponding to the definition.
[0187] After the downloading of the second slice is completed, the player P initiates a request for the third slice to the media server. The address description information of the third slice in the M3U8 file is http: / / media.example.com / 03.ts. The player constructs the actual slice address as http: / / media.example.com / 03.ts?bandwidth=1280000, and initiates an HTTP request to the media server S based on the actual slice address;
[0188] The media server S sends back the corresponding TS slice media data, that is, the TS slice with normal definition, a slice index of 3, and a code rate value of 1280000;
[0189] The player P receives the media data of the third slice, processes it, and continues playing.
[0190] The improved playing method and player for the multi-code rate HLS media stream through the above setting can improve the playing efficiency, the original two-level M3U8 index file is changed into a single file format by adding multi-code rate description information in the M3U8 list, the file management burden of CDN is reduced, and the access efficiency of the player is improved. By simplifying the two-level M3U8 index to a one-level M3U8 index, the number of HTTP requests when the player starts playing can be reduced, thereby reducing the corresponding network time consumption and improving the user's viewing experience. In the scene of switching code rate of live streaming, it is not necessary to update the switched M3U8 file first, and then initiate a request for a new resolution TS file according to the switched M3U8 file information, as in the traditional processing method, the number of HTTP requests is reduced, and the efficiency of multi-code rate switching playing is improved. At the same time, since the original two-level M3U8 index of the multi-code rate media stream corresponds to multiple M3U8 files, the improved scheme also reduces the corresponding index file generation, storage and distribution requirements on the content generation and distribution side of the media server, especially in the live streaming scenario, only a single M3U8 file needs to be updated and maintained in real time, which greatly improves the management efficiency.
[0191] It should be understood that the example embodiments described herein are illustrative and non-limiting. Although one or more embodiments of the application are described in conjunction with the attached figures, it should be understood that various changes in form and detail can be made without departing from the spirit and scope of the application as defined by the appended claims.
Claims
1. A method of improving play efficiency, characterized by, The method comprises the following steps: requesting an M3U8 file of a multi-code rate stream from a media server, wherein the construction of the M3U8 file comprises a newly defined tag indicating that the index file is a special M3U8 primary index file, and combined multi-code rate information and slice description information; wherein the multi-code rate information comprises code rate information of a video stream and a minimum code rate value of a pure audio code rate, and the slice description information comprises time length and address information of a media stream slice; analyzing the multi-code rate information and the slice description information recorded in the M3U8 file; adding a code rate value parameter after a slice address according to a corresponding code rate value selected by a user, sequentially requesting corresponding TS slice data from the media server; receiving the TS slice data sent back by the media server, processing and playing; during the playing process, the user selects to switch the definition to play, the player constructs a new slice request address, the player initiates an HTTP request to the media server, the media server sends back corresponding slice data according to the new request address after the player switches the code rate, the player analyzes and processes the media data sent back by the media server, and continues to play.
2. A player for improving a play efficiency, characterized by, The method comprises the following steps: an M3U8 file request module for requesting an M3U8 file of a multi-code rate stream from a media server, wherein the construction of the M3U8 file comprises a newly defined tag indicating that the index file is a special M3U8 primary index file, and combined multi-code rate information and slice description information; the multi-code rate information comprises code rate information of a video stream and a minimum code rate value of a pure audio code rate; and the slice description information comprises time length and address information of a media stream slice; an analysis module for analyzing the multi-code rate information and the slice description information recorded in the M3U8 file; a TS slice data request module for adding a code rate value parameter after a slice address according to a corresponding code rate value selected by a user, sequentially requesting corresponding TS slice data from the media server; a receiving and playing module for receiving the TS slice data sent back by the media server, processing and playing; during the playing process, the user selects to switch the definition to play, the player constructs a new slice request address, the player initiates an HTTP request to the media server, the media server sends back corresponding slice data according to the new request address after the player switches the code rate, the player analyzes and processes the media data sent back by the media server, and continues to play.
Citation Information
Patent Citations
Streaming media playing based on user wideband
CN108737355A