WO2016197691A1 - 下载流媒体的方法及装置 - Google Patents

下载流媒体的方法及装置 Download PDF

Info

Publication number
WO2016197691A1
WO2016197691A1 PCT/CN2016/078992 CN2016078992W WO2016197691A1 WO 2016197691 A1 WO2016197691 A1 WO 2016197691A1 CN 2016078992 W CN2016078992 W CN 2016078992W WO 2016197691 A1 WO2016197691 A1 WO 2016197691A1
Authority
WO
WIPO (PCT)
Prior art keywords
description file
latest
streaming media
information
segment
Prior art date
Application number
PCT/CN2016/078992
Other languages
English (en)
French (fr)
Inventor
赖昆盛
Original Assignee
广州市动景计算机科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 广州市动景计算机科技有限公司 filed Critical 广州市动景计算机科技有限公司
Publication of WO2016197691A1 publication Critical patent/WO2016197691A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/235Processing of additional data, e.g. scrambling of additional data or processing content descriptors
    • H04N21/2353Processing of additional data, e.g. scrambling of additional data or processing content descriptors specifically adapted to content descriptors, e.g. coding, compressing or processing of metadata
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/235Processing of additional data, e.g. scrambling of additional data or processing content descriptors
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/24Monitoring of processes or resources, e.g. monitoring of server load, available bandwidth, upstream requests
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/24Monitoring of processes or resources, e.g. monitoring of server load, available bandwidth, upstream requests
    • H04N21/2407Monitoring of transmitted content, e.g. distribution time, number of downloads
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/442Monitoring of processes or resources, e.g. detecting the failure of a recording device, monitoring the downstream bandwidth, the number of times a movie has been viewed, the storage space available from the internal hard disk
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/442Monitoring of processes or resources, e.g. detecting the failure of a recording device, monitoring the downstream bandwidth, the number of times a movie has been viewed, the storage space available from the internal hard disk
    • H04N21/44209Monitoring of downstream path of the transmission network originating from a server, e.g. bandwidth variations of a wireless network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/231Content storage operation, e.g. caching movies for short term storage, replicating data over plural servers, prioritizing data for deletion
    • H04N21/2312Data placement on disk arrays
    • H04N21/2318Data placement on disk arrays using striping
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/232Content retrieval operation locally within server, e.g. reading video streams from disk arrays

Definitions

  • the embodiments of the present invention relate to the field of Internet technologies, and in particular, to a method and an apparatus for downloading streaming media.
  • the server cuts the compressed video source file into a number of small transport stream TS (Transport Stream) segments, or TS fragments, and each TS segment is stored separately. Different addresses in the server.
  • the server generates an m3u8 description file (or an m3u8 index file) corresponding to the video source file according to the storage address of each TS segment included in the source file, the duration information of each TS segment, and other related description information.
  • the server provides the user with the m3u8 description file address corresponding to the video.
  • the m3u8 description file is accessed by accessing the m3u8 description file address of the video, and the storage address corresponding to each TS segment is read from the m3u8 description file, and then each TS segment is downloaded from each storage address. Come down.
  • the server often changes the storage address of several TS segments corresponding to the streaming video, or re-cuts the streaming video.
  • the latest m3u8 description file of the video needs to be re-acquired, so as to obtain the latest storage address of the TS segment contained therein, and each TS segment is re-downloaded according to the latest storage address until the entire video download is completed. .
  • the embodiment of the present invention provides a method and an apparatus for downloading a streaming media, so as to solve the problem that the m3u8 description file corresponding to the streaming media fails to be downloaded again according to the latest m3u8 description file, causing time and bandwidth.
  • an embodiment of the present invention provides a method for downloading a streaming media, where the method is used to download a streaming media in an m3u8 format, where the method includes:
  • the latest m3u8 description file is matched with the expired m3u8 description file by the TS segment information. If the matching is successful, the latest address information of the TS segment that failed to download the streaming media is obtained from the latest m3u8 description file.
  • an embodiment of the present invention provides an apparatus for downloading a streaming media, where the apparatus is used to download streaming media in an m3u8 format, and the apparatus includes:
  • a first acquiring unit configured to acquire, after the current m3u8 description file for downloading the streaming media, the latest m3u8 description file corresponding to the streaming media;
  • a matching unit configured to perform TS segment information matching with the latest m3u8 description file and the invalid m3u8 description file
  • a second obtaining unit configured to obtain, from the latest m3u8 description file, latest address information of the TS segment that failed to download the streaming media if the matching is successful;
  • a downloading unit configured to continue downloading the TS segment that failed to download according to the latest address information.
  • the embodiment of the present invention can perform TS segment information matching on the latest m3u8 description file and the invalid m3u8 description file to ensure that the TS fragment that fails to be downloaded can be accurately obtained from the latest m3u8 description file, so that only the TS fragment that fails to be downloaded can be obtained. Downloading to avoid re-downloading the downloaded TS fragments results in wasted time and bandwidth resources.
  • FIG. 1 is a schematic flowchart of an embodiment of a method for downloading a streaming media according to an embodiment of the present invention
  • FIG. 2 is a schematic diagram of an m3u8 description file of streaming media video
  • 3 is another schematic diagram of an m3u8 description file of streaming media video
  • FIG. 4 is a schematic structural diagram of an embodiment of an apparatus for downloading a streaming media according to an embodiment of the present invention
  • FIG. 5 is a schematic structural diagram of another embodiment of an apparatus for downloading a streaming media according to an embodiment of the present invention.
  • FIG. 1 it is a schematic flowchart of an embodiment of a method for downloading a streaming media according to an embodiment of the present disclosure, where the method is used to download streaming media in the m3u8 format. For example, HD video, audio, etc.
  • This embodiment includes the following steps:
  • Step 101 If the current m3u8 description file for downloading the streaming media fails, obtain the latest m3u8 description file corresponding to the streaming media.
  • the latest m3u8 description file of the streaming media is re-requested according to the address link information of the streaming media, such as a URL.
  • the m3u8 description file is generally suffixed with ".m3u8" as the file name.
  • the downloading of the streaming media fails, it may be determined whether the currently used m3u8 description file is invalid according to the prompt information of the download failure, and if the download fails due to other reasons, the technical solution related to the embodiment of the present invention is not included. A situation that can be solved.
  • Step 102 Match the latest m3u8 description file with the invalid m3u8 description file to the TS segment information. If the matching is successful, obtain the latest address information of the TS segment that failed to download the streaming media from the latest m3u8 description file.
  • the matching success is to ensure that the server does not re-cut the streaming media, so that the address information of the TS fragments that have not been downloaded can be obtained from the latest m3u8 description file.
  • the streaming media server may re-cut the streaming media.
  • the latest TS segment included in the streaming media is different from the TS segment formed by the previous cutting method, so that the latest m3u8 description file is mapped.
  • the TS fragment is not the same as the TS fragment mapped by the invalid m3u8 description file, so it cannot be matched.
  • the TS fragment information included in the latest m3u8 description file and the corresponding TS fragment information included in the invalid m3u8 description file belong to the same TS fragment, and if yes, the matching is successful.
  • the matching is successful.
  • Step 103 Continue to download the TS segment that failed to download according to the latest address information.
  • the TS segment included in the latest m3u8 description file is matched with the TS segment in the invalid m3u8 description file one by one, and the matching succeeds.
  • step 102 it may be determined whether the TS fragment information included in the latest m3u8 description file and the corresponding TS fragment information included in the invalid m3u8 description file belong to the same TS. Fragment, and further determining whether the latest m3u8 description file and the invalid m3u8 description file perform TS segment information matching successfully:
  • the latest address information of the TS segment in which the streaming media fails to be downloaded may be obtained from the latest m3u8 description file according to the following method:
  • the matching in the above step 102 is successful, it indicates that the latest m3u8 description file is consistent with the TS segment of the invalid m3u8 description file mapping, so the information of the TS fragment that failed to be downloaded is the same as the index position information in the two description files. Therefore, the latest address information of the TS fragment that failed to be downloaded can be obtained from the latest m3u8 description file according to the index location information in the invalid m3u8 description file according to the address information of the TS fragment that failed to be downloaded.
  • FIG. 2 is a schematic diagram of a m3u8 description file of a streaming media video in the m3u8 format, and the name of the description file is "video.m3u8", the number of TS segments included in the video, the duration, and the storage address information of each segment of the TS segment can be obtained from FIG.
  • the video consists of 11 TS segments.
  • the number following "#EXTINF" indicates the duration of the corresponding TS segment.
  • the default unit is "second”.
  • the next segment is the actual storage address of the segment. Invasive When the download task is created, the storage address is read from the m3u8 description file, and the corresponding TS segment is downloaded according to the storage address.
  • the currently used description file "video” may be determined according to the pop-up prompt information such as "video source file address invalidation" or "video source file address error”. .m3u8" is invalid.
  • the prompt information may be a preset information prompt code in the form of letters or numbers, and each prompt code corresponds to an event, if the prompt code corresponds to an event that the current m3u8 description file fails. The prompt information determines that the current m3u8 description file is invalid.
  • the TS segment that failed to be downloaded can be determined by the prompt information or the intermediate file generated in the download. If it is a serial download in this embodiment, an error occurs when downloading the fifth TS segment, then the fifth TS segment and thereafter until the 11th. None of the TS fragments have been downloaded.
  • the above method can be reused until all TS fragments of the video are successfully downloaded.
  • FIG. 4 is a schematic structural diagram of an embodiment of an apparatus for downloading a streaming media according to an embodiment of the present invention.
  • the device of the present application is described by function, and each functional unit is separately described.
  • the functions of the various units may be implemented in the same software or software and/or hardware when implementing the embodiments of the present invention.
  • the device includes: a first obtaining unit 401, a matching unit 402, a second obtaining unit 403, and a downloading unit 404.
  • the first obtaining unit 401 is configured to acquire the latest m3u8 description file corresponding to the streaming media if the current m3u8 description file for downloading the streaming media fails.
  • the matching unit 402 is configured to perform TS on the latest m3u8 description file and the invalid m3u8 description file. Clip information matching;
  • the second obtaining unit 403 is configured to obtain, from the latest m3u8 description file, the latest address information of the TS segment that failed to download the streaming media if the matching succeeds;
  • the downloading unit 404 is configured to continue to download the TS segment that fails to download according to the latest address information.
  • the matching unit 402 is configured to: if the TS fragment information included in the latest m3u8 description file and the corresponding TS fragment information included in the invalid m3u8 description file belong to the same TS fragment, Then confirm that the match is successful.
  • the matching unit 402 is further configured to:
  • the second obtaining unit 403 is configured to obtain index position information of the address information of the TS segment that is not downloaded in the invalid m3u8 description file, and according to the index location information, from the latest m3u8 The latest address information of the TS segment in which the download failed is obtained in the description file.
  • FIG. 5 is a schematic structural diagram of another embodiment of an apparatus for downloading a streaming media according to an embodiment of the present invention, where the apparatus further includes:
  • the receiving unit 405 is configured to receive prompt information that the download fails if the streaming media download fails;
  • the determining unit 406 is configured to determine that the current m3u8 description file is invalid if the prompt information is prompt information corresponding to an event that the current m3u8 description file fails.
  • the apparatus of this embodiment when the current m3u8 description file for downloading the streaming media fails, matches the TS fragments included in the latest m3u8 description file with the TS fragments in the invalid m3u8 description file one by one, when the matching is successful. , indicating that the latest m3u8 description file has not been re-cutted by the original streaming media, so that the TS fragment that failed to download can be accurately obtained from the latest m3u8 description file, so that only the TS fragments that failed to be downloaded can be downloaded, and the download is prevented from being downloaded again.
  • a successful TS fragment causes a waste of time and bandwidth resources.
  • the various functional modules provided by the embodiments of the present application may be implemented in a mobile terminal, a computer terminal, or the like. It runs in the device and can also be stored as part of the storage medium.
  • an embodiment of the present invention may provide a computer terminal, which may be any computer terminal device in a computer terminal group.
  • the foregoing computer terminal may also be replaced with a terminal device such as a mobile terminal.
  • the computer terminal may be located in at least one network device of the plurality of network devices of the computer network.
  • the computer terminal is configured to download the streaming media in the m3u8 format.
  • the computer terminal may include:
  • a processor configured to acquire an latest m3u8 description file corresponding to the streaming media if the current m3u8 description file for downloading the streaming media fails;
  • control device configured to perform the TS segment information matching with the invalid m3u8 description file and the invalid m3u8 description file, and if the matching is successful, obtain the latest of the TS segment of the streaming media failed to be downloaded from the latest m3u8 description file. Address information;
  • the download port is further configured to continue to download the TS segment that failed to download according to the latest address information.
  • the computer terminal can include: one or more processors, memory, and transmission means.
  • Embodiments of the present invention also provide a storage medium.
  • the foregoing storage medium may be used to save program code executed by the method for downloading streaming media provided by the foregoing method embodiment and the device embodiment.
  • the foregoing storage medium may be located in any one of the computer terminal groups in the computer network, or in any one of the mobile terminal groups.
  • the storage medium is configured to store program code for downloading streaming media in the m3u8 format, wherein the storage medium is further configured to store program code for performing the following steps: if used for downloading If the current m3u8 description file of the streaming media fails, the latest m3u8 description file corresponding to the streaming media is obtained; the latest m3u8 description file is matched with the invalid m3u8 description file by TS fragment information, and if the matching is successful, the latest Obtaining, in the m3u8 description file, the latest address information of the TS segment that failed to download the streaming media; and continuing to download the TS segment that failed to download according to the latest address information.
  • the present invention The technical solution in the embodiments may be embodied in the form of a software product in essence or in the form of a software product, which may be stored in a storage medium such as a read only memory (ROM, Read- Only Memory), Random Access Memory (RAM), Disk, CD, etc., including instructions for causing a computer device (which may be a personal computer, server, or network device, etc.) to perform embodiments of the present invention
  • a computer device which may be a personal computer, server, or network device, etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Databases & Information Systems (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Library & Information Science (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

本发明实施例公开了下载流媒体的方法及装置,用于下载m3u8格式的流媒体,所述方法包括:如果用于下载流媒体的当前m3u8描述文件失效,则获取流媒体对应的最新m3u8描述文件;将最新m3u8描述文件与失效的m3u8描述文件进行TS片段信息匹配,如果匹配成功,从最新m3u8描述文件中获取流媒体的下载失败的TS片段的最新地址信息;根据最新地址信息继续下载所述下载失败的TS片段。本发明实施例通过将最新m3u8描述文件与失效的m3u8描述文件进行TS片段信息匹配,以保证从最新m3u8描述文件中获取到下载失败的TS片段,从而只对下载失败的TS片段进行下载,避免重新下载已下载完成的TS片段而造成时间和带宽资源浪费。

Description

下载流媒体的方法及装置 技术领域
本发明实施例涉及互联网技术领域,特别是涉及下载流媒体的方法及装置。
背景技术
随着移动互联网的飞速发展,用户通过移动终端来获取视频、音频等多媒体资源的需求不断增多。尤其是随着网络传输速率的不断提高,用户对高清视频的下载需求也越来越大。目前各大视频网站提供的高清视频大多是基于HLS(HTTP Live Streaming)流媒体播放协议的m3u8视频格式。
m3u8格式的流媒体资源如流媒体视频在制作时,由服务器把压缩后的视频源文件切割成若干小的传输流TS(Transport Stream)片段,或称为TS碎片,每个TS片段分别存储在服务器中的不同地址。服务器根据该源文件包含的各TS片段的存储地址、各TS片段的时长信息以及相关的其他描述信息,生成该视频源文件对应的m3u8描述文件(或称为m3u8索引文件)。服务器向用户提供该视频对应的m3u8描述文件地址。当用户下载该视频时,通过访问该视频的m3u8描述文件地址,获取m3u8描述文件,再从m3u8描述文件中读取出各TS片段对应的存储地址,进而从各存储地址将各TS片段分别下载下来。
在流媒体视频的下载过程中,有时会提示视频源文件地址失效,造成下载失败。这是因为m3u8描述文件具有一定的时效性,出于对视频版权的保护及安全性考虑,服务器经常会变更流媒体视频对应的若干TS片段的存储地址,或者对流媒体视频进行重新切割。当待下载视频的m3u8描述文件失效时,需要重新获取该视频的最新m3u8描述文件,从而获取其中包含的TS片段的最新存储地址,根据该最新存储地址重新下载各TS片段,直至整个视频下载完成。
在流媒体视频的下载过程中可能会出现多次地址失效的情况,并且由于流媒体视频一般都比较大,每一次下载失效后都需要根据最新的m3u8描述文件重新下载TS片段,从而造成时间和带宽资源的浪费。
发明内容
本发明实施例提供了一种下载流媒体的方法及装置,以解决现有技术中当流媒体对应的m3u8描述文件失效后,不得不根据最新的m3u8描述文件重新下载TS片段,造成时间和带宽资源的浪费的问题。
为了解决上述技术问题,本发明实施例公开了如下技术方案:
一方面,本发明实施例提供了一种下载流媒体的方法,所述方法用于下载m3u8格式的流媒体,所述方法包括:
如果用于下载流媒体的当前m3u8描述文件失效,则获取所述流媒体对应的最新m3u8描述文件;
将所述最新m3u8描述文件与失效的m3u8描述文件进行TS片段信息匹配,如果匹配成功,从所述最新m3u8描述文件中获取所述流媒体的下载失败的TS片段的最新地址信息;
根据所述最新地址信息继续下载所述下载失败的TS片段。
另一方面,本发明实施例提供了一种下载流媒体的装置,所述装置用于下载m3u8格式的流媒体,所述装置包括:
第一获取单元,用于如果用于下载流媒体的当前m3u8描述文件失效,则获取所述流媒体对应的最新m3u8描述文件;
匹配单元,用于将所述最新m3u8描述文件与失效的m3u8描述文件进行TS片段信息匹配;
第二获取单元,用于如果匹配成功,从所述最新m3u8描述文件中获取所述流媒体的下载失败的TS片段的最新地址信息;
下载单元,用于根据所述最新地址信息继续下载所述下载失败的TS片段。
本发明实施例可以通过将最新m3u8描述文件与失效的m3u8描述文件进行TS片段信息匹配,以保证能够从最新m3u8描述文件中准确获取到下载失败的TS片段,从而可以只对下载失败的TS片段进行下载,避免重新下载已下载完成的TS片段而造成时间和带宽资源浪费。
附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,对于本领域普通技术人员而言,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1为本发明实施例下载流媒体的方法的一个实施例的流程示意图;
图2为流媒体视频的m3u8描述文件的示意图;
图3为流媒体视频的m3u8描述文件的另一个示意图;
图4为本发明实施例下载流媒体的装置的一个实施例的结构示意图;
图5为本发明实施例下载流媒体的装置的另一个实施例的结构示意图。
具体实施方式
首先对本发明实施例下载流媒体的方法的实施例进行说明,参见图1,为本发明实施例下载流媒体的方法的一个实施例的流程示意图,所述方法用于下载m3u8格式的流媒体,例如高清视频、音频等。本实施例包括如下步骤:
步骤101:如果用于下载流媒体的当前m3u8描述文件失效,则获取所述流媒体对应的最新m3u8描述文件。
在下载流媒体的过程中,如果由于当前使用的m3u8描述文件失效而造成流媒体下载失败,则根据该流媒体的地址链接信息例如URL,重新请求获取该流媒体的最新m3u8描述文件。m3u8描述文件一般是以“.m3u8”作为文件名后缀。
具体的,如果所述流媒体下载失败,则可以根据下载失败的提示信息判断当前使用的m3u8描述文件是否失效,如果是其他原因引起的下载失败,则不属于本发明实施例涉及的技术方案所能解决的情形。
步骤102:将所述最新m3u8描述文件与失效的m3u8描述文件进行TS片段信息匹配,如果匹配成功,从所述最新m3u8描述文件中获取所述流媒体的下载失败的TS片段的最新地址信息。
匹配成功是为了确保服务器没有对流媒体进行重新切割,从而可以从最新的m3u8描述文件中获取到未下载完成的TS片段的地址信息。参考背景技术可知,有时候流媒体服务器可能会将流媒体重新切割,此时,该流媒体包含的最新TS片段与之前的切割方法所形成的TS片段不同,从而使最新的m3u8描述文件所映射的TS片段与失效的m3u8描述文件所映射的TS片段也不相同,因此就不能匹配上。
可具体通过判断最新m3u8描述文件中包含的TS片段信息与所述失效的m3u8描述文件中包含的对应TS片段信息是否属于同一TS片段,如果是,则说明匹配成功。
例如,如果最新的m3u8描述文件中的任意编号的TS片段信息与失效的m3u8描述文件中的对应编号的TS片段信息都属于同一个TS片段,则说明匹配成功。
步骤103:根据所述最新地址信息继续下载所述下载失败的TS片段。
本实施例的技术方案,当用于下载流媒体的当前m3u8描述文件失效时,通过将最新m3u8描述文件中包含的TS片段与失效的m3u8描述文件中的TS片段逐一进行信息匹配,当匹配成功时,说明最新的m3u8描述文件未对原流媒体重新切割,这样就能够从最新m3u8描述文件中准确获取到下载失败的TS片段,从而可以只对下载失败的TS片段进行下载,避免重新下载已下载成功的TS片段而造成时间和带宽资源浪费。
在本发明的其他实施例中,上述步骤102中,可以通过如下方法判断所述最新m3u8描述文件中包含的TS片段信息与所述失效的m3u8描述文件中包含的对应TS片段信息是否属于同一TS片段,进而进一步确定所述最新m3u8描述文件与失效的m3u8描述文件进行TS片段信息是否匹配成功:
a):判断所述最新m3u8描述文件中包含的TS片段信息的数量与所述失效的m3u8描述文件中包含的TS片段信息的数量是否相等;
b):判断所述最新m3u8描述文件中包含的TS片段时长与所述失效的m3u8描述文件中包含的对应TS片段时长是否相等。
如果上述a)、b)两项判断结果均为相等,则判定所述最新m3u8描述文件中包含的TS片段信息与所述失效的m3u8描述文件中包含的对应TS片段信息属于同一TS片段,进而确定所述最新m3u8描述文件与失效的m3u8描述文件的TS片段信息匹配成功。
在本发明的其他实施例中,上述步骤103中,具体可根据以下方法从所述最新m3u8描述文件中获取所述流媒体的下载失败的TS片段的最新地址信息:
获取所述下载失败的TS片段的地址信息在所述失效的m3u8描述文件中的索引位置信息;
根据所述索引位置信息从所述最新m3u8描述文件中获取所述下载失败的TS片段的最新地址信息。
如果上述步骤102中匹配成功,则说明最新的m3u8描述文件与失效的m3u8描述文件映射的TS片段是一致的,因此下载失败的TS片段的信息两个描述文件中的索引位置信息也是一样的,因此可以根据下载失败的TS片段的地址信息在所述失效的m3u8描述文件中的索引位置信息从最新m3u8描述文件中获取到下载失败的TS片段的最新地址信息。
下面通过一个实际应用中的实施例来具体介绍一下本发明实施例的下载流媒体的方法,如图2所示为一个m3u8格式的流媒体视频的m3u8描述文件的示意图,该描述文件的名称为“video.m3u8”,由图2中可获得该视频包含的TS片段的数量、时长及各段TS片段的存储地址信息。
通过统计可知,该视频由11个TS片段组成,“#EXTINF”后面的数字即表示对应的TS片段的时长,默认单位为“秒”,紧接着下一段为该片段的实际存储地址,在正常创 建下载任务时,会从m3u8描述文件中,读取出该存储地址,并根据该存储地址把对应的TS片段下载下来。
如果在下载该视频的过程中,提示下载出错或下载失败,则根据弹出的提示信息例如“视频源文件地址失效”或“视频源文件地址出错”等类似信息可以确定当前使用的描述文件“video.m3u8”失效。在另一些情况下,该提示信息可能是预设的字母或数字形式的信息提示码,每一种提示码都会对应一种事件,如果所述提示码为与当前m3u8描述文件失效这一事件对应的提示信息,则判定所述当前m3u8描述文件失效。进一步通过下载中产生的提示信息或中间文件可以确定下载失败的TS片段,假设本实施例中为串行下载,在下载第5个TS片段时出错,则第5个TS片段及之后直至第11个TS片段都未下载完成。
通过该视频的地址链接,重新请求获得该视频对应的最新m3u8描述文件,如图3所示,假设该最新m3u8描述文件的名称为“video_new.m3u8”,经过与“video.m3u8”描述文件比对可知,两个描述文件包含的TS片段的个数都为11个,各TS片段的时长对应相等,都为{8、3、3、3、9、9、9、10、10、10、10},单位为“秒”,则可确认该最新m3u8描述文件与原有的失效的描述文件匹配成功。
在描述文件video_new.m3u8中从出错的TS片段(即第5个)开始,读取出后面TS片段的存储地址(即第5至第11个),并用该地址替换掉原下载任务中的第5至第11个TS片段的原地址,继续下载该视频,原下载成功的TS片段(第1至第4个)可以重用,无需再下载。
如果在后续的下载过程中又出现相同类型的下载失败的提示,则可重复使用上述方法,直至该视频的所有TS片段都下载成功。
与上述下载流媒体的方法的实施例相对应,本发明实施例还提供了下载流媒体的装置的实施例,参见图4,为本发明实施例下载流媒体的装置的一个实施例的结构示意图,为了描述的方便,描述本申请的装置时以功能划分,对各个功能单元分别描述。当然,在实施本发明实施例时可以把各单元的功能集成在在同一个或多个软件和/或硬件中实现。
所述装置包括:第一获取单元401、匹配单元402、第二获取单元403、下载单元404。
其中,所述第一获取单元401,用于如果用于下载流媒体的当前m3u8描述文件失效,则获取所述流媒体对应的最新m3u8描述文件;
所述匹配单元402,用于将所述最新m3u8描述文件与失效的m3u8描述文件进行TS 片段信息匹配;
所述第二获取单元403,用于如果匹配成功,从所述最新m3u8描述文件中获取所述流媒体的下载失败的TS片段的最新地址信息;
所述下载单元404,用于根据所述最新地址信息继续下载所述下载失败的TS片段。
在本发明的其他实施例中,所述匹配单元402用于如果所述最新m3u8描述文件中包含的TS片段信息与所述失效的m3u8描述文件中包含的对应TS片段信息是否属于同一TS片段,则确认匹配成功。
优选的,所述匹配单元402还用于:
如果所述最新m3u8描述文件中包含的TS片段信息的数量与所述失效的m3u8描述文件中包含的TS片段信息的数量是否相等,并且
所述最新m3u8描述文件中包含的TS片段时长与所述失效的m3u8描述文件中包含的对应TS片段时长是否相等,则确认所述最新描述文件中包含的TS片段信息与所述失效的m3u8描述文件中包含的对应TS片段信息属于同一TS片段。
具体的,所述第二获取单元403用于获取所述未下载完成的TS片段的地址信息在所述失效的m3u8描述文件中的索引位置信息,并根据所述索引位置信息从所述最新m3u8描述文件中获取所述下载失败的TS片段的最新地址信息。
如图5所示,为本发明实施例下载流媒体的装置的另一个实施例的结构示意图,所述装置还包括:
接收单元405,用于如果所述流媒体下载失败,接收下载失败的提示信息;
判定单元406,用于如果所述提示信息为与当前m3u8描述文件失效这一事件对应的提示信息,则判定所述当前m3u8描述文件失效。
上述下载流媒体的装置的实施例,其中各个模块单元执行操作的具体方式已经在有关该方法的实施例中进行了详细描述,此处将不做详细阐述说明,相关之处参见上述方法实施例的部分说明即可。
本实施例的装置,当用于下载流媒体的当前m3u8描述文件失效时,通过将最新m3u8描述文件中包含的TS片段与失效的m3u8描述文件中的TS片段逐一进行信息匹配,当匹配成功时,说明最新的m3u8描述文件未对原流媒体重新切割,这样就能够从最新m3u8描述文件中准确获取到下载失败的TS片段,从而可以只对下载失败的TS片段进行下载,避免重新下载已下载成功的TS片段而造成时间和带宽资源浪费。
本申请实施例所提供的各个功能模块可以在移动终端、计算机终端或者类似的运算 装置中运行,也可以作为存储介质的一部分进行存储。
由此,本发明实施例可以提供一种计算机终端,该计算机终端可以是计算机终端群中的任意一个计算机终端设备。可选地,在本实施例中,上述计算机终端也可以替换为移动终端等终端设备。
可选地,在本实施例中,上述计算机终端可以位于计算机网络的多个网络设备中的至少一个网络设备。
在本实施例中,上述计算机终端用于下载m3u8格式的流媒体,一种可选方案中,上述计算机终端可以包括:
下载端口,用于下载流媒体的当前m3u8描述文件:
处理器,用于如果用于下载流媒体的当前m3u8描述文件失效,则获取所述流媒体对应的最新m3u8描述文件;
控制装置,用于将所述最新m3u8描述文件与失效的m3u8描述文件进行TS片段信息匹配,如果匹配成功,则从所述最新m3u8描述文件中获取所述流媒体的下载失败的TS片段的最新地址信息;
所述下载端口还用于根据所述最新地址信息继续下载所述下载失败的TS片段。
可选地,该计算机终端可以包括:一个或多个处理器、存储器、以及传输装置。
本发明的实施例还提供了一种存储介质。可选地,在本实施例中,上述存储介质可以用于保存上述方法实施例和装置实施例所提供的下载流媒体的方法所执行的程序代码。
可选地,在本实施例中,上述存储介质可以位于计算机网络中计算机终端群中的任意一个计算机终端中,或者位于移动终端群中的任意一个移动终端中。
可选地,在本实施例中,存储介质被设置为存储用于下载m3u8格式的流媒体的程序代码,其中,存储介质还被设置为存储用于执行以下步骤的程序代码:如果用于下载流媒体的当前m3u8描述文件失效,则获取所述流媒体对应的最新m3u8描述文件;将所述最新m3u8描述文件与失效的m3u8描述文件进行TS片段信息匹配,如果匹配成功,则从所述最新m3u8描述文件中获取所述流媒体的下载失败的TS片段的最新地址信息;根据所述最新地址信息继续下载所述下载失败的TS片段。
本领域的技术人员可以清楚地了解到本发明实施例实施例中的技术可借助软件加必需的通用硬件的方式来实现,通用硬件包括通用集成电路、通用CPU、通用存储器、通用元器件等,当然也可以通过专用硬件包括专用集成电路、专用CPU、专用存储器、专用元器件等来实现,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明 实施例实施例中的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在存储介质中,如只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明实施例各个实施例或者实施例的某些部分所述的方法。
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于装置和系统实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。
以上所述仅是本申请的具体实施方式,使本领域技术人员能够理解或实现本申请。对这些实施例的多种修改对本领域的技术人员来说将是显而易见的,本文中所定义的一般原理可以在不脱离本申请的精神或范围的情况下,在其它实施例中实现。因此,本申请将不会被限制于本文所示的这些实施例,而是要符合与本文所公开的原理和新颖特点相一致的最宽的范围。

Claims (16)

  1. 一种下载流媒体的方法,所述方法用于下载m3u8格式的流媒体,所述方法包括:
    如果用于下载流媒体的当前m3u8描述文件失效,则获取所述流媒体对应的最新m3u8描述文件;
    将所述最新m3u8描述文件与失效的m3u8描述文件进行TS片段信息匹配,如果匹配成功,则从所述最新m3u8描述文件中获取所述流媒体的下载失败的TS片段的最新地址信息;
    根据所述最新地址信息继续下载所述下载失败的TS片段。
  2. 根据权利要求1所述的方法,其中,所述获取所述流媒体对应的最新m3u8描述文件包括:
    根据所述流媒体的地址链接信息获取所述流媒体对应的最新m3u8描述文件。
  3. 根据权利要求1所述的方法,其中,在获取所述流媒体对应的最新m3u8描述文件之前,所述方法还包括:
    如果所述流媒体下载失败,根据下载失败的提示信息判断所述当前m3u8描述文件是否失效。
  4. 根据权利要求1所述的方法,其中,所述将所述最新m3u8描述文件与失效的m3u8描述文件进行TS片段信息匹配包括:
    如果所述最新m3u8描述文件中包含的TS片段信息与所述失效的m3u8描述文件中包含的对应TS片段信息属于同一TS片段,则确认匹配成功。
  5. 根据权利要求4所述的方法,其中,当所述最新m3u8描述文件中包含的TS片段信息的数量与所述失效的m3u8描述文件中包含的TS片段信息的数量相等,并且,所述最新m3u8描述文件中包含的TS片段时长与所述失效的m3u8描述文件中包含的对应TS片段时长相等,则最新m3u8描述文件中包含的TS片段信息与所述失效的m3u8描述文件中包含的对应TS片段信息属于同一TS片段。
  6. 根据权利要求1至5中任意一项所述的方法,其中,所述从所述最新m3u8描述文件中获取所述流媒体的下载失败的TS片段的最新地址信息包括:
    获取所述下载失败的TS片段的地址信息在所述失效的m3u8描述文件中的索引位置信息;
    根据所述索引位置信息从所述最新m3u8描述文件中获取所述下载失败的TS片段的最新地址信息。
  7. 根据权利要求1至5中任意一项所述的方法,其中,还包括:
    如果所述流媒体下载失败,接收下载失败的提示信息,如果所述提示信息为与当前m3u8描述文件失效这一事件对应的提示信息,则判定所述当前m3u8描述文件失效。
  8. 一种下载流媒体的装置,所述装置方法用于下载m3u8格式的流媒体,所述装置包括:
    第一获取单元,用于如果用于下载流媒体的当前m3u8描述文件失效,则获取所述流媒体对应的最新m3u8描述文件;
    匹配单元,用于将所述最新m3u8描述文件与失效的m3u8描述文件进行TS片段信息匹配;
    第二获取单元,用于如果匹配成功,从所述最新m3u8描述文件中获取所述流媒体的下载失败的TS片段的最新地址信息;
    下载单元,用于根据所述最新地址信息继续下载所述下载失败的TS片段。
  9. 根据权利要求8所述的装置,其中,所述第一获取单元包括:
    获取模块,用于根据所述流媒体的地址链接信息获取所述流媒体对应的最新m3u8描述文件。
  10. 根据权利要求8所述的装置,其中,所述装置还包括:
    判断模块,用于如果所述流媒体下载失败,根据下载失败的提示信息判断所述当前m3u8描述文件是否失效。
  11. 根据权利要求8所述的装置,其中,所述匹配单元用于如果所述最新m3u8描述文件中包含的TS片段信息与所述失效的m3u8描述文件中包含的对应TS片段信息是否属于同一TS片段,则确认匹配成功。
  12. 根据权利要求11所述的装置,其中,所述匹配单元还用于:
    如果所述最新m3u8描述文件中包含的TS片段信息的数量与所述失效的m3u8描述文件中包含的TS片段信息的数量是否相等,并且
    所述最新m3u8描述文件中包含的TS片段时长与所述失效的m3u8描述文件中包含的对应TS片段时长是否相等,则确认所述最新描述文件中包含的TS片段信息与所述失效的m3u8描述文件中包含的对应TS片段信息属于同一TS片段。
  13. 根据权利要求8至12中任意一项所述的装置,其中,
    所述第二获取单元用于获取所述未下载完成的TS片段的地址信息在所述失效的m3u8描述文件中的索引位置信息,并根据所述索引位置信息从所述最新m3u8描述文件中获取所述下载失败的TS片段的最新地址信息。
  14. 根据权利要求8至12中任意一项所述的装置,其中,所述装置还包括:
    接收单元,用于如果所述流媒体下载失败,接收下载失败的提示信息;
    判定单元,用于如果所述提示信息为与当前m3u8描述文件失效这一事件对应的提示信息,则判定所述当前m3u8描述文件失效。
  15. 一种计算机终端,用于下载m3u8格式的流媒体,包括:
    下载端口,用于下载流媒体的当前m3u8描述文件:
    处理器,用于如果用于下载流媒体的当前m3u8描述文件失效,则获取所述流媒体对应的最新m3u8描述文件;
    控制装置,用于将所述最新m3u8描述文件与失效的m3u8描述文件进行TS片段信息匹配,如果匹配成功,则从所述最新m3u8描述文件中获取所述流媒体的下载失败的TS片段的最新地址信息;
    所述下载端口还用于根据所述最新地址信息继续下载所述下载失败的TS片段。
  16. 一种存储介质,所述存储介质被设置为存储用于下载m3u8格式的流媒体的程序代码,其中,
    所述存储介质还被设置为存储用于执行以下步骤的程序代码:如果用于下载流媒体的当前m3u8描述文件失效,则获取所述流媒体对应的最新m3u8描述文件;将所述最新m3u8描述文件与失效的m3u8描述文件进行TS片段信息匹配,如果匹配成功,则从所述最新m3u8描述文件中获取所述流媒体的下载失败的TS片段的最新地址信息;根据所述最新地址信息继续下载所述下载失败的TS片段。
PCT/CN2016/078992 2015-06-08 2016-04-11 下载流媒体的方法及装置 WO2016197691A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510312810.5 2015-06-08
CN201510312810.5A CN106303577B (zh) 2015-06-08 2015-06-08 下载流媒体的方法及装置

Publications (1)

Publication Number Publication Date
WO2016197691A1 true WO2016197691A1 (zh) 2016-12-15

Family

ID=57503055

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/078992 WO2016197691A1 (zh) 2015-06-08 2016-04-11 下载流媒体的方法及装置

Country Status (2)

Country Link
CN (1) CN106303577B (zh)
WO (1) WO2016197691A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109756782A (zh) * 2017-11-06 2019-05-14 阿里巴巴集团控股有限公司 一种资源处理方法、装置及流媒体服务器
CN113163226A (zh) * 2021-03-26 2021-07-23 维沃移动通信有限公司 媒体文件的播放方法、装置、电子设备、服务器和介质

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107070923B (zh) * 2017-04-18 2020-07-28 上海云熵网络科技有限公司 减少编码片段重复的p2p直播系统及方法
CN110545459A (zh) * 2018-05-29 2019-12-06 武汉斗鱼网络科技有限公司 一种缓存视频的方法以及相关设备

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120151080A1 (en) * 2010-12-14 2012-06-14 of California Media Repackaging Systems and Software for Adaptive Streaming Solutions, Methods of Production and Uses Thereof
WO2012114107A2 (en) * 2011-02-25 2012-08-30 British Sky Broadcasting Limited Media system
CN103546830A (zh) * 2013-10-28 2014-01-29 Tcl集团股份有限公司 一种视频地址失效的处理方法及系统
CN103686455A (zh) * 2013-11-22 2014-03-26 乐视致新电子科技(天津)有限公司 一种基于hls协议的视频播放方法和装置
CN104135672A (zh) * 2014-08-13 2014-11-05 浪潮软件集团有限公司 一种基于hls实现视频点播无缝容灾的方法
CN104811796A (zh) * 2014-01-24 2015-07-29 贝壳网际(北京)安全技术有限公司 网络视频续传方法及装置

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8583818B2 (en) * 2011-01-31 2013-11-12 Cbs Interactive Inc. System and method for custom segmentation for streaming video
CN102695081A (zh) * 2012-06-13 2012-09-26 百视通网络电视技术发展有限责任公司 基于互联网电视的视频资源调度方法及电视终端
CN103648019A (zh) * 2013-11-29 2014-03-19 乐视致新电子科技(天津)有限公司 一种基于hls协议的视频下载方法及其装置
CN104125229B (zh) * 2014-07-31 2016-09-21 合一网络技术(北京)有限公司 流媒体的播放方法与播放装置

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120151080A1 (en) * 2010-12-14 2012-06-14 of California Media Repackaging Systems and Software for Adaptive Streaming Solutions, Methods of Production and Uses Thereof
WO2012114107A2 (en) * 2011-02-25 2012-08-30 British Sky Broadcasting Limited Media system
CN103546830A (zh) * 2013-10-28 2014-01-29 Tcl集团股份有限公司 一种视频地址失效的处理方法及系统
CN103686455A (zh) * 2013-11-22 2014-03-26 乐视致新电子科技(天津)有限公司 一种基于hls协议的视频播放方法和装置
CN104811796A (zh) * 2014-01-24 2015-07-29 贝壳网际(北京)安全技术有限公司 网络视频续传方法及装置
CN104135672A (zh) * 2014-08-13 2014-11-05 浪潮软件集团有限公司 一种基于hls实现视频点播无缝容灾的方法

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109756782A (zh) * 2017-11-06 2019-05-14 阿里巴巴集团控股有限公司 一种资源处理方法、装置及流媒体服务器
CN113163226A (zh) * 2021-03-26 2021-07-23 维沃移动通信有限公司 媒体文件的播放方法、装置、电子设备、服务器和介质

Also Published As

Publication number Publication date
CN106303577B (zh) 2019-10-08
CN106303577A (zh) 2017-01-04

Similar Documents

Publication Publication Date Title
US9509784B2 (en) Manifest chunking in content delivery in a network
US9264481B2 (en) Responding to hypertext transfer protocol (HTTP) requests
WO2016197691A1 (zh) 下载流媒体的方法及装置
US11126590B2 (en) Data processing method and device
TWI558180B (zh) 用於運用容錯移轉程序支援大量用戶端之媒體傳送服務協定
US11490173B2 (en) Switch of audio and video
CN103702176B (zh) 一种基于hls协议的视频下载方法及其装置
US8824676B2 (en) Streaming video to cellular phones
WO2019227427A1 (zh) 文件下载方法、装置及设备/终端/服务器
US9596313B2 (en) Method, terminal, cache server and system for updating webpage data
WO2020133608A1 (zh) 一种拖拉视频数据的处理方法及代理服务器
US10749930B2 (en) Indication for partial segment
WO2017097210A1 (zh) 软件升级方法、装置及系统
US10412138B2 (en) Indication for partial segment
CN115208951A (zh) 请求处理方法、装置、电子设备及计算机可读存储介质
JP6619017B2 (ja) 部分的セグメント用の表示
CN105635753B (zh) 媒体数据的下载方法和装置
WO2016029384A1 (zh) 一种资源下载方法、电子设备及装置
JP6182578B2 (ja) メディア資産を比較する方法およびシステム
US9648135B2 (en) Method, device, client end and system for network resource management
CN110545489A (zh) 自适应流媒体的播放方法、系统及客户端
US20140068006A1 (en) Method, apparatus and system for providing content
CN106341480B (zh) 数据包的上传方法及装置
WO2016188315A1 (zh) 一种推送多媒体信息的方法及终端
US20160034450A1 (en) Comparison of content presented by client devices operating in different languages for consistent content presentation

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16806589

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16806589

Country of ref document: EP

Kind code of ref document: A1