CN107872716B - A streaming data analysis method, device and electronic equipment with post-packaging - Google Patents
A streaming data analysis method, device and electronic equipment with post-packaging Download PDFInfo
- Publication number
- CN107872716B CN107872716B CN201610846684.6A CN201610846684A CN107872716B CN 107872716 B CN107872716 B CN 107872716B CN 201610846684 A CN201610846684 A CN 201610846684A CN 107872716 B CN107872716 B CN 107872716B
- Authority
- CN
- China
- Prior art keywords
- frame
- data
- index
- post
- offset
- Prior art date
- Legal status (The legal status 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 status listed.)
- Active
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/80—Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
- H04N21/85—Assembly of content; Generation of multimedia applications
- H04N21/854—Content authoring
- H04N21/8547—Content authoring involving timestamps for synchronizing content
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing 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/434—Disassembling of a multiplex stream, e.g. demultiplexing audio and video streams, extraction of additional data from a video stream; Remultiplexing of multiplex streams; Extraction or processing of SI; Disassembling of packetised elementary stream
- H04N21/4345—Extraction or processing of SI, e.g. extracting service information from an MPEG stream
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing 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/439—Processing of audio elementary streams
- H04N21/4394—Processing of audio elementary streams involving operations for analysing the audio stream, e.g. detecting features or characteristics in audio streams
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/80—Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
- H04N21/85—Assembly of content; Generation of multimedia applications
- H04N21/854—Content authoring
- H04N21/85406—Content authoring involving a specific file format, e.g. MP4 format
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Computer Security & Cryptography (AREA)
- Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)
Abstract
本发明的实施例公开一种后置封装的流式数据解析方法、装置及电子设备,涉及数据解析技术,能够提升流式解析效率。所述后置封装的流式数据解析方法包括:确定接收的文件中的数据为采用后置封装的流式数据;解析所述后置封装的流式数据的前第一阈值字节的信息,得到原子结构信息;提取原子结构信息中后第二阈值字节的信息,得到类型结构信息,所述第一阈值为所述第二阈值的两倍;在确定所述类型结构信息标识为索引结构后,依据所述索引结构对请求的数据进行解析。本发明适用于MP4‑后置封装的流式数据进行解析。
The embodiment of the present invention discloses a streaming data analysis method, device and electronic equipment with post-package, which relate to data analysis technology and can improve the efficiency of streaming analysis. The post-encapsulated streaming data analysis method includes: determining that the data in the received file is post-encapsulated streaming data; analyzing the information of the first threshold byte before the post-encapsulated streaming data, Obtain atomic structure information; extract the information of the second threshold byte in the atomic structure information to obtain type structure information, the first threshold is twice the second threshold; after determining that the type structure information is identified as an index structure Afterwards, the requested data is parsed according to the index structure. The present invention is suitable for parsing the streaming data of MP4 post-encapsulation.
Description
技术领域technical field
本发明涉及数据解析技术,尤其涉及一种后置封装的流式数据解析方法、装置及电子设备。The present invention relates to data parsing technology, in particular to a stream data parsing method, device and electronic equipment with post-packaging.
背景技术Background technique
MP4是一套用于音频、视频信息的压缩编码标准,由国际标准化组织(ISO)和国际电工委员会(IEC)下属的动态图像专家组(MPEG,Moving Picture Experts Group)制定,MP4文件是一种基于ISO/IEC 14496-12标准进行封装的媒体文件,相比采用其他封装格式封装的媒体文件,例如,RMVB、AVI、FLV、WMV、MKV等媒体文件,MP4文件具有更高的实用性和普及性,因而得到了广泛的应用。MP4 is a set of compression coding standards for audio and video information, formulated by the Moving Picture Experts Group (MPEG, Moving Picture Experts Group) under the International Organization for Standardization (ISO) and the International Electrotechnical Commission (IEC). Compared with media files encapsulated by other encapsulation formats, such as RMVB, AVI, FLV, WMV, MKV and other media files, MP4 files are more practical and popular than media files encapsulated by ISO/IEC 14496-12 standard , and thus has been widely used.
为了能够应用在不同的场景,MP4文件的封装格式包括:MP4-前置封装、MP4-后置封装、MP4-H5封装以及MP4-DASH封装。其中,MP4-后置封装主要应用于文件数据场景,较少应用于流式数据场景,MP4-H5封装和MP4-DASH封装主要应用于流式数据场景,MP4-前置封装既可以应用于文件数据场景,也可以用于流式数据场景。对于文件数据场景,在客户端对封装的MP4文件(数据)进行解析时,可以通过获取封装的MP4文件(数据)中的文件句柄,利用文件句柄搜索索引,依据索引实现对数据的定位和解析,并从定位的数据开始播放。对于流式数据场景,由于MP4-前置封装、MP4-H5封装和MP4-DASH封装的索引(特指MOOV或者MOOFBox结构,该结构明确了具体的编解码参数、帧长度、帧偏移、帧时间戳、帧位置等重要信息)位于负载数据的前面,在进行流式解析时,通过获取索引,依据索引解析后面的负载数据,不会出现解析上的时序逻辑问题;但对于MP4-后置封装,由于索引位于负载数据的后面,因而,在客户端进行解析时,需要将目标MP4文件(数据)下载并存储至缓存中,在缓存中进行解析,但该方法,需要将整个目标MP4文件下载完毕后才能进行解析,解析所需时间较长,流式解析效率较低;进一步地,如果目标文件越大,需要的缓存空间也越大,需要消耗大量的内存资源;而且,在进行流式解析时,由于索引位于负载数据的后面,可能出现解析上的时序逻辑问题,从而导致流式解析失败。In order to be applicable in different scenarios, the encapsulation formats of MP4 files include: MP4-pre-encapsulation, MP4-post-encapsulation, MP4-H5 encapsulation and MP4-DASH encapsulation. Among them, MP4-post-encapsulation is mainly used in file data scenarios, less used in streaming data scenarios, MP4-H5 encapsulation and MP4-DASH encapsulation are mainly used in streaming data scenarios, and MP4-front encapsulation can be applied to file Data scenarios can also be used in streaming data scenarios. For the file data scenario, when the client parses the encapsulated MP4 file (data), it can obtain the file handle in the encapsulated MP4 file (data), use the file handle to search the index, and realize the positioning and analysis of the data according to the index , and start playing from the positioned data. For streaming data scenarios, due to the index of MP4-pre-encapsulation, MP4-H5 encapsulation and MP4-DASH encapsulation (specifically the MOOV or MOOFBox structure, this structure specifies the specific codec parameters, frame length, frame offset, frame Timestamp, frame position and other important information) are located in front of the load data. When performing stream parsing, by obtaining the index and parsing the subsequent load data according to the index, there will be no timing logic problems in parsing; but for MP4-post Encapsulation, since the index is located behind the load data, when parsing on the client side, the target MP4 file (data) needs to be downloaded and stored in the cache, and parsed in the cache, but this method requires the entire target MP4 file Parsing can only be done after the download is complete, which takes a long time to parse, and the stream parsing efficiency is low; further, if the target file is larger, the cache space required will be larger, and a large amount of memory resources will be consumed; moreover, when streaming When stream parsing, since the index is located behind the load data, there may be timing logic problems in parsing, resulting in stream parsing failure.
发明内容Contents of the invention
有鉴于此,本发明实施例提供一种后置封装的流式数据解析方法、装置及电子设备,能够提升流式解析效率,以解决现有的后置封装的流式数据解析方法中,需要将整个目标MP4文件下载完毕后才能进行解析导致的解析所需时间较长、流式解析效率较低的问题。In view of this, the embodiments of the present invention provide a post-encapsulation stream data analysis method, device, and electronic equipment, which can improve the efficiency of stream analysis, so as to solve the problems in the existing post-package stream data analysis method. The parsing can only be performed after the entire target MP4 file is downloaded, which results in long parsing time and low streaming parsing efficiency.
第一方面,本发明实施例提供一种后置封装的流式数据解析方法,包括:In the first aspect, the embodiment of the present invention provides a post-encapsulation streaming data parsing method, including:
确定接收的文件中的数据为采用后置封装的流式数据;Determine that the data in the received file is streaming data with post-encapsulation;
解析所述后置封装的流式数据的前第一阈值字节的信息,得到原子结构信息;Analyzing the information of the first threshold byte before the post-encapsulated streaming data to obtain atomic structure information;
提取原子结构信息中后第二阈值字节的信息,得到类型结构信息,所述第一阈值为所述第二阈值的两倍;Extracting the information of the last second threshold byte in the atomic structure information to obtain the type structure information, the first threshold is twice the second threshold;
如果所述类型结构信息标识不为索引结构,依据所述原子结构信息中前第二阈值字节的信息计算索引偏移;从所述索引偏移处请求数据,并执行所述解析所述后置封装的流式数据的前第一阈值字节的信息的步骤;If the type structure information identification is not an index structure, calculate the index offset according to the information of the first second threshold byte in the atomic structure information; request data from the index offset, and perform the parsing and the post-processing A step of setting the information of the first threshold byte of the encapsulated streaming data;
在确定所述类型结构信息标识为索引结构后,依据所述索引结构对请求的数据进行解析;After determining that the type structure information is identified as an index structure, the requested data is parsed according to the index structure;
其中,所述确定接收的文件中的数据为采用后置封装的流式数据包括:Wherein, determining that the data in the received file is streaming data using post-encapsulation includes:
解析接收的文件的文件类型字段,如果文件类型字段标识为MP4-后置封装且应用于流式数据场景,则接收的文件中的数据为采用后置封装的流式数据。Parse the file type field of the received file. If the file type field is identified as MP4-post-encapsulation and applied to streaming data scenarios, the data in the received file is streaming data using post-encapsulation.
结合第一方面,在第一方面的第二种实施方式中,所述第一阈值为8,第二阈值为4。With reference to the first aspect, in a second implementation manner of the first aspect, the first threshold is 8, and the second threshold is 4.
结合第一方面,在第一方面的第三种实施方式中,所述在确定所述类型结构信息标识为索引结构后,依据所述索引结构对请求的数据进行解析包括:With reference to the first aspect, in the third implementation manner of the first aspect, after determining that the type structure information is identified as an index structure, parsing the requested data according to the index structure includes:
如果所述类型结构信息标识为索引结构,解析所述索引结构,得到索引;If the type structure information is identified as an index structure, parse the index structure to obtain an index;
请求数据,依据所述索引对请求的数据进行解析。Request data, and analyze the requested data according to the index.
结合第一方面的第三种实施方式,在第一方面的第四种实施方式中,所述依据所述原子结构信息中前第二阈值字节的信息计算索引偏移包括:With reference to the third implementation manner of the first aspect, in the fourth implementation manner of the first aspect, the calculating the index offset based on the information of the first second threshold byte in the atomic structure information includes:
获取存储的预留索引偏移;Obtain the stored reserved index offset;
将所述前第二阈值字节的信息对应的长度与所述存储的预留索引偏移相加,得到索引偏移;adding the length corresponding to the information of the first second threshold byte to the stored reserved index offset to obtain the index offset;
利用所述索引偏移更新所述存储的预留索引偏移。Utilizing the index offset to update the stored reserved index offset.
结合第一方面的第四种实施方式,在第一方面的第五种实施方式中,如果所述类型结构信息标识为索引结构,所述方法还包括:With reference to the fourth implementation manner of the first aspect, in the fifth implementation manner of the first aspect, if the type structure information is identified as an index structure, the method further includes:
将存储的预留索引偏移清空。Clear the stored reserved index offset.
结合第一方面的第三种实施方式,在第一方面的第六种实施方式中,所述请求数据,依据所述索引对请求的数据进行解析包括:With reference to the third implementation manner of the first aspect, in the sixth implementation manner of the first aspect, the requesting data, parsing the requested data according to the index includes:
获取播放定位时间点;Obtain the playback positioning time point;
请求从所述播放定位时间点的数据并解析播放。Request data from the playback location point in time and parse the playback.
结合第一方面的第六种实施方式,在第一方面的第七种实施方式中,所述请求从所述播放定位时间点的数据包括:With reference to the sixth implementation manner of the first aspect, in the seventh implementation manner of the first aspect, the requesting data at the playback location time point includes:
累加客户端中视频轨道时间戳-帧对应表结构盒子中的帧时间戳;Accumulate the frame timestamp in the video track timestamp-frame correspondence table structure box in the client;
从累加的帧时间戳中,获取与所述播放定位时间点最接近的帧时间戳对应的帧号;From the accumulated frame time stamps, obtain the frame number corresponding to the frame time stamp closest to the playback positioning time point;
利用视频轨道的块偏移信息表盒子,查询所述帧号对应的视频帧偏移;Use the block offset information table box of the video track to query the video frame offset corresponding to the frame number;
向服务器请求从所述视频帧偏移处的数据。Request data at the video frame offset from the server.
结合第一方面的第七种实施方式,在第一方面的第八种实施方式中,所述视频帧偏移为I帧视频帧偏移。With reference to the seventh implementation manner of the first aspect, in an eighth implementation manner of the first aspect, the video frame offset is an I-frame video frame offset.
结合第一方面的第六种实施方式,在第一方面的第九种实施方式中,所述请求从所述播放定位时间点的数据包括:With reference to the sixth implementation manner of the first aspect, in the ninth implementation manner of the first aspect, the requesting data at the playback location time point includes:
按照帧时长以及帧命名规则,计算所述播放定位时间点对应的帧号;According to the frame duration and frame naming rules, calculate the frame number corresponding to the playback positioning time point;
利用视频轨道的块偏移信息表盒子,查询所述帧号对应的视频帧偏移;Use the block offset information table box of the video track to query the video frame offset corresponding to the frame number;
向服务器请求从所述视频帧偏移处的数据。Request data at the video frame offset from the server.
结合第一方面的第六种实施方式,在第一方面的第十种实施方式中,所述解析播放包括:With reference to the sixth implementation manner of the first aspect, in the tenth implementation manner of the first aspect, the parsing and playing includes:
解析层解析请求的数据,如果是第一帧,且第一帧为B帧或P帧,丢弃所述B帧或P帧,如果第一帧为I帧,透传至播放层进行播放;The analysis layer parses the requested data, if it is the first frame, and the first frame is a B frame or a P frame, discarding the B frame or P frame, if the first frame is an I frame, transparently transmits it to the playback layer for playback;
如果不是第一帧,将解析得到的B帧或P帧或I帧透传至播放层进行播放。If it is not the first frame, transparently transmit the analyzed B frame or P frame or I frame to the playback layer for playback.
第二方面,本发明实施例提供一种后置封装的流式数据解析装置,包括:后置封装确定模块、原子结构解析模块、类型结构提取模块、判断单元、索引偏移计算单元、数据请求单元以及数据解析模块,其中,In the second aspect, an embodiment of the present invention provides a post-encapsulation streaming data analysis device, including: a post-encapsulation determination module, an atomic structure analysis module, a type structure extraction module, a judgment unit, an index offset calculation unit, a data request unit and data parsing module, in which,
后置封装确定模块,用于确定接收的文件中的数据为采用后置封装的流式数据;A post-encapsulation determination module, configured to determine that the data in the received file is streaming data with post-encapsulation;
原子结构解析模块,用于解析所述后置封装的流式数据的前第一阈值字节的信息,得到原子结构信息;The atomic structure analysis module is used to analyze the information of the first threshold byte of the post-encapsulated streaming data to obtain the atomic structure information;
类型结构提取模块,用于提取原子结构信息中后第二阈值字节的信息,得到类型结构信息,所述第一阈值为所述第二阈值的两倍;The type structure extraction module is used to extract the information of the second threshold byte in the atomic structure information to obtain the type structure information, and the first threshold is twice the second threshold;
判断单元,用于判断所述类型结构信息标识是否为索引结构,如果是,通知数据解析模块,如果不是,通知索引偏移计算单元;A judging unit, configured to judge whether the type structure information identifier is an index structure, if yes, notify the data parsing module, and if not, notify the index offset calculation unit;
索引偏移计算单元,用于依据所述原子结构信息中前第二阈值字节的信息计算索引偏移;An index offset calculation unit, configured to calculate an index offset according to the information of the first second threshold byte in the atomic structure information;
数据请求单元,用于从所述索引偏移处请求数据,输出至原子结构解析模块;A data request unit, configured to request data from the index offset and output to the atomic structure analysis module;
数据解析模块,用于在确定所述类型结构信息标识为索引结构后,依据所述索引结构对请求的数据进行解析;A data parsing module, configured to parse the requested data according to the index structure after determining that the type structure information is identified as an index structure;
其中,所述确定接收的文件中的数据为采用后置封装的流式数据包括:Wherein, determining that the data in the received file is streaming data using post-encapsulation includes:
解析接收的文件的文件类型字段,如果文件类型字段标识为MP4-后置封装且应用于流式数据场景,则接收的文件中的数据为采用后置封装的流式数据。Parse the file type field of the received file. If the file type field is identified as MP4-post-encapsulation and applied to streaming data scenarios, the data in the received file is streaming data using post-encapsulation.
结合第二方面,在第二方面的第二种实施方式中,所述第一阈值为8,第二阈值为4。With reference to the second aspect, in a second implementation manner of the second aspect, the first threshold is 8, and the second threshold is 4.
结合第二方面,在第二方面的第三种实施方式中,所述数据解析模块包括:索引获取单元以及数据解析单元,其中,With reference to the second aspect, in a third implementation manner of the second aspect, the data parsing module includes: an index acquisition unit and a data parsing unit, wherein,
索引获取单元,用于解析所述索引结构,得到索引;an index acquiring unit, configured to parse the index structure to obtain an index;
数据解析单元,用于请求数据,依据所述索引对请求的数据进行解析。The data parsing unit is configured to request data, and parse the requested data according to the index.
结合第二方面的第三种实施方式,在第二方面的第四种实施方式中,所述索引偏移计算单元包括:预留索引偏移获取子单元、索引偏移计算子单元以及更新子单元,其中,With reference to the third implementation manner of the second aspect, in the fourth implementation manner of the second aspect, the index offset calculation unit includes: a reserved index offset acquisition subunit, an index offset calculation subunit, and an update subunit unit, where
预留索引偏移获取子单元,用于获取存储的预留索引偏移;The reserved index offset acquisition subunit is used to acquire the stored reserved index offset;
索引偏移计算子单元,用于将所述前第二阈值字节的信息对应的长度与所述存储的预留索引偏移相加,得到索引偏移;An index offset calculation subunit, configured to add the length corresponding to the information of the first second threshold byte to the stored reserved index offset to obtain an index offset;
更新子单元,用于利用所述索引偏移更新所述存储的预留索引偏移。An updating subunit, configured to use the index offset to update the stored reserved index offset.
结合第二方面的第四种实施方式,在第二方面的第五种实施方式中,所述索引偏移计算单元还包括:With reference to the fourth implementation manner of the second aspect, in the fifth implementation manner of the second aspect, the index offset calculation unit further includes:
清空子单元,用于在接收到判断单元输出至索引获取单元的通知后,将存储的预留索引偏移清空。The clearing subunit is configured to clear the stored reserved index offset after receiving the notification output from the judging unit to the index acquiring unit.
结合第二方面的第三种实施方式,在第二方面的第六种实施方式中,所述数据解析单元包括:播放定位时间点获取子单元以及解析播放子单元,其中,With reference to the third implementation manner of the second aspect, in the sixth implementation manner of the second aspect, the data parsing unit includes: a playback positioning time point acquisition subunit and an analysis playback subunit, wherein,
播放定位时间点获取子单元,用于获取播放定位时间点;The playback positioning time point acquisition subunit is used to obtain the playback positioning time point;
解析播放子单元,用于请求从所述播放定位时间点的数据并解析播放。The parsing and playing subunit is used for requesting the data of the positioning time point from the playing and parsing the playing.
结合第二方面的第六种实施方式,在第二方面的第七种实施方式中,所述解析播放子单元包括:累加器、帧号获取器、查询器、数据请求器以及解析播放器,其中,With reference to the sixth implementation manner of the second aspect, in the seventh implementation manner of the second aspect, the parsing and playing subunit includes: an accumulator, a frame number acquirer, a queryer, a data requester, and an analytic player, in,
累加器,用于累加客户端中视频轨道时间戳-帧对应表结构盒子中的帧时间戳;The accumulator is used to accumulate the frame timestamps in the video track timestamp-frame correspondence table structure box in the client;
帧号获取器,用于从累加的帧时间戳中,获取与所述播放定位时间点最接近的帧时间戳对应的帧号;A frame number acquirer, configured to acquire, from the accumulated frame time stamps, the frame number corresponding to the frame time stamp closest to the playback positioning time point;
查询器,用于利用视频轨道的块偏移信息表盒子,查询所述帧号对应的视频帧偏移;A query device, configured to use the block offset information table box of the video track to query the video frame offset corresponding to the frame number;
数据请求器,用于向服务器请求从所述视频帧偏移处的数据;A data requester, configured to request data from a server at an offset from the video frame;
解析播放器,用于将请求的数据解析后进行播放。The parsing player is used to parse the requested data and play it.
结合第二方面的第七种实施方式,在第二方面的第八种实施方式中,所述视频帧偏移为I帧视频帧偏移。With reference to the seventh implementation manner of the second aspect, in an eighth implementation manner of the second aspect, the video frame offset is an I-frame video frame offset.
结合第二方面的第六种实施方式,在第二方面的第九种实施方式中,所述解析播放子单元包括:帧号计算器、视频帧偏移器、数据请求器以及解析播放器,其中,With reference to the sixth implementation manner of the second aspect, in the ninth implementation manner of the second aspect, the analysis and playback subunit includes: a frame number calculator, a video frame offset device, a data requester, and an analysis player, in,
帧号计算器,用于按照帧时长以及帧命名规则,计算所述播放定位时间点对应的帧号;A frame number calculator, configured to calculate the frame number corresponding to the playback positioning time point according to the frame duration and frame naming rules;
视频帧偏移器,用于利用视频轨道的块偏移信息表盒子,查询所述帧号对应的视频帧偏移;A video frame offset device, configured to use the block offset information table box of the video track to query the video frame offset corresponding to the frame number;
数据请求器,用于向服务器请求从所述视频帧偏移处的数据;A data requester, configured to request data from a server at an offset from the video frame;
解析播放器,用于将请求的数据解析后进行播放。The parsing player is used to parse the requested data and play it.
结合第二方面的第六种实施方式,在第二方面的第十种实施方式中,所述解析播放包括:With reference to the sixth implementation manner of the second aspect, in the tenth implementation manner of the second aspect, the parsing and playing includes:
解析层解析请求的数据,如果是第一帧,且第一帧为B帧或P帧,丢弃所述B帧或P帧,如果第一帧为I帧,透传至播放层进行播放;The analysis layer parses the requested data, if it is the first frame, and the first frame is a B frame or a P frame, discarding the B frame or P frame, if the first frame is an I frame, transparently transmits it to the playback layer for playback;
如果不是第一帧,将解析得到的B帧或P帧或I帧透传至播放层进行播放。If it is not the first frame, transparently transmit the analyzed B frame or P frame or I frame to the playback layer for playback.
第三方面,本发明实施例提供一种电子设备,所述电子设备包括:壳体、处理器、存储器、电路板和电源电路,其中,电路板安置在壳体围成的空间内部,处理器和存储器设置在电路板上;电源电路,用于为上述电子设备的各个电路或器件供电;存储器用于存储可执行程序代码;处理器通过读取存储器中存储的可执行程序代码来运行与可执行程序代码对应的程序,用于执行前述任一所述的后置封装的流式数据解析方法。In a third aspect, an embodiment of the present invention provides an electronic device, the electronic device includes: a housing, a processor, a memory, a circuit board, and a power supply circuit, wherein the circuit board is placed inside the space enclosed by the housing, and the processor and the memory are arranged on the circuit board; the power supply circuit is used to supply power to each circuit or device of the above-mentioned electronic equipment; the memory is used to store the executable program code; the processor runs and can read the executable program code stored in the memory Executing a program corresponding to the program code is used to execute any one of the aforementioned post-encapsulation streaming data analysis methods.
本发明实施例提供的一种后置封装的流式数据解析方法、装置及电子设备,通过确定接收的文件中的数据为采用后置封装的流式数据;解析所述后置封装的流式数据的前第一阈值字节的信息,得到原子结构信息;提取原子结构信息中后第二阈值字节的信息,得到类型结构信息,所述第一阈值为所述第二阈值的两倍;在确定所述类型结构信息标识为索引结构后,依据所述索引结构对请求的数据进行解析,能够提升流式解析效率,以解决现有的后置封装的流式数据解析方法中,需要将整个目标MP4文件下载完毕后才能进行解析导致的解析所需时间较长、流式解析效率较低的问题。The embodiment of the present invention provides a post-encapsulation stream data analysis method, device, and electronic equipment, by determining that the data in the received file is stream data using post-encapsulation; parsing the post-encapsulation stream data The information of the first threshold byte before the data is obtained to obtain the atomic structure information; the information of the second threshold byte in the atomic structure information is extracted to obtain the type structure information, and the first threshold is twice the second threshold; After determining that the type structure information is identified as an index structure, parsing the requested data according to the index structure can improve the efficiency of streaming parsing, so as to solve the problem that in the existing post-encapsulation streaming data parsing method, the The entire target MP4 file can only be parsed after it has been downloaded, resulting in a long time for parsing and low stream parsing efficiency.
附图说明Description of drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其它的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments of the present invention. Those skilled in the art can also obtain other drawings based on these drawings without creative work.
图1为本发明的实施例一后置封装的流式数据解析方法流程示意图;FIG. 1 is a schematic flow chart of a streaming data parsing method for post-encapsulation according to an embodiment of the present invention;
图2为现有播放操作示意图;FIG. 2 is a schematic diagram of an existing playback operation;
图3为本实施例的播放操作示意图;Fig. 3 is a schematic diagram of the playback operation of the present embodiment;
图4为本发明的实施例二后置封装的流式数据解析方法流程示意图;FIG. 4 is a schematic flow chart of a post-encapsulation streaming data analysis method according to Embodiment 2 of the present invention;
图5为本发明的实施例三后置封装的流式数据解析方法流程示意图;FIG. 5 is a schematic flow chart of a post-encapsulation streaming data analysis method according to Embodiment 3 of the present invention;
图6为本发明的实施例四后置封装的流式数据解析装置结构示意图;FIG. 6 is a schematic structural diagram of a post-package streaming data analysis device according to Embodiment 4 of the present invention;
图7为本发明电子设备一个实施例的结构示意图。FIG. 7 is a schematic structural diagram of an embodiment of the electronic device of the present invention.
具体实施方式Detailed ways
下面结合附图对本发明实施例进行详细描述。Embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings.
应当明确,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其它实施例,都属于本发明保护的范围。It should be clear that the described embodiments are only some of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of the present invention.
图1为本发明的实施例一后置封装的流式数据解析方法流程示意图,如图1所示,本实施例的方法可以包括:Fig. 1 is a schematic flow chart of a post-encapsulated stream data parsing method according to an embodiment of the present invention. As shown in Fig. 1, the method of this embodiment may include:
步骤101,确定接收的文件中的数据为采用后置封装的流式数据;Step 101, determining that the data in the received file is streaming data with post-encapsulation;
本实施例中,作为一可选实施例,确定接收的文件中的数据为采用后置封装的流式数据包括:In this embodiment, as an optional embodiment, determining that the data in the received file is streaming data using post-encapsulation includes:
解析接收的文件的文件类型字段,如果文件类型字段标识为MP4-后置封装且应用于流式数据场景,则接收的文件中的数据为采用后置封装的流式数据。Parse the file type field of the received file. If the file type field is identified as MP4-post-encapsulation and applied to streaming data scenarios, the data in the received file is streaming data using post-encapsulation.
本实施例中,对于MP4文件,根据ISO/IEC 14496-12标准的规定,采用MP4封装格式的文件或数据以文件类型盒子(FTYP Box,File Type Box)结构作为起始结构,文件类型盒子包含有文件类型(FTYP,File Type)字段,该文件类型字段位于文件的起始位置,用于标识MP4格式。In the present embodiment, for the MP4 file, according to the provisions of the ISO/IEC 14496-12 standard, the file or data in the MP4 encapsulation format is used as the initial structure with the file type box (FTYP Box, File Type Box) structure, and the file type box includes There is a file type (FTYP, File Type) field, which is located at the beginning of the file and used to identify the MP4 format.
本实施例中,如果解析的文件类型字段标识不为MP4-后置封装且应用于流式数据场景,则按照现有技术流程进行处理。In this embodiment, if the parsed file type field identifier is not MP4-post-encapsulation and is applied to a streaming data scenario, processing is performed according to the existing technical process.
步骤102,解析所述后置封装的流式数据的前第一阈值字节的信息,得到原子结构信息;Step 102, analyzing the information of the first threshold byte of the post-encapsulated streaming data to obtain atomic structure information;
本实施例中,作为一可选实施例,第一阈值为8。In this embodiment, as an optional embodiment, the first threshold is 8.
本实施例中,采用MP4-后置封装的媒体文件为一MDAT(数据)+MOOV(索引)的结构,其中,MOOV即为索引,是一包含编解码参数、帧时间戳、帧偏移、帧长度、帧位置等信息的索引结构,MDAT(Media Data)是多媒体数据,即负载数据(裸数据)的封装结构。In this embodiment, the media file that adopts MP4-post-packaging is a structure of MDAT (data)+MOOV (index), wherein, MOOV is the index, which is a codec parameter, frame timestamp, frame offset, The index structure of frame length, frame position and other information, MDAT (Media Data) is the encapsulation structure of multimedia data, that is, payload data (bare data).
根据ISO/IEC 14496-12标准的规定和定义,无论何种封装结构,都会遵循基本原子结构的描述,即在一流式数据(帧)的前8字节中,采用包含长度结构以及类型结构的原子结构描述方式,其中,前4字节为长度结构,标识负载数据(MDAT数据的长度),后4字节为类型结构,标识该流式数据(帧)的类型。因而,本实施例中,通过获取流式数据(帧)的原子结构信息,可以利用原子结构信息来确定是否为索引。According to the provisions and definitions of the ISO/IEC 14496-12 standard, no matter what kind of encapsulation structure, it will follow the description of the basic atomic structure, that is, in the first 8 bytes of stream data (frame), use the length structure and type structure The atomic structure description method, wherein, the first 4 bytes are the length structure, which identifies the payload data (the length of the MDAT data), and the last 4 bytes are the type structure, which identifies the type of the streaming data (frame). Therefore, in this embodiment, by acquiring the atomic structure information of the streaming data (frame), the atomic structure information can be used to determine whether it is an index.
步骤103,提取原子结构信息中后第二阈值字节的信息,得到类型结构信息,所述第一阈值为所述第二阈值的两倍;Step 103, extracting the information of the last second threshold byte in the atomic structure information to obtain the type structure information, the first threshold is twice the second threshold;
本实施例中,作为一可选实施例,第一阈值为8,第二阈值为4。In this embodiment, as an optional embodiment, the first threshold is 8, and the second threshold is 4.
步骤104,在确定所述类型结构信息标识为索引结构后,依据所述索引结构对请求的数据进行解析。Step 104, after determining that the type structure information is identified as an index structure, parse the requested data according to the index structure.
本实施例中,索引是进行流式数据解析的依据和关键,由于MP4-后置封装的索引在负载数据的后面,因而,使得现有技术需要全部接收完流式数据后,才能在缓存中进行解析,导致解析所需的时间较长、流式解析效率较低。因而,如果能够快速获取索引,将直接提升流式解析效率。In this embodiment, the index is the basis and key for streaming data parsing. Since the MP4-post-encapsulated index is behind the load data, the existing technology needs to receive all the streaming data before it can be stored in the cache. Parsing, resulting in a long time required for parsing and low efficiency of streaming parsing. Therefore, if the index can be obtained quickly, the efficiency of streaming parsing will be directly improved.
本实施例中,通过解析数据的前8字节,得到原子结构信息,并利用原子结构信息中的后4字节的类型结构信息来判断当前结构是否为所需要的索引(MOOV Box)结构,如果类型结构信息表明当前结构不是索引结构,则可以根据前4字节指示的长度类型通知服务器跳过当前非索引结构的原子结构,即利用原子结构信息中后4字节的类型结构,判断该类型结构是否为索引结构,如果不是,依据前4节的长度结构指示的长度信息(负载数据长度)跳过该结构,使得服务器跳过该长度信息的流式数据,直到跳到类型结构为索引结构为止,无需传输长度类型标识的长度数据,从而无需对该长度数据进行解析,有效降低解析所需的时间、提升流式解析效率。In this embodiment, the atomic structure information is obtained by analyzing the first 8 bytes of the data, and the type structure information of the last 4 bytes in the atomic structure information is used to judge whether the current structure is the required index (MOOV Box) structure, If the type structure information indicates that the current structure is not an index structure, you can notify the server to skip the current atomic structure that is not an index structure according to the length type indicated by the first 4 bytes, that is, use the type structure of the last 4 bytes in the atomic structure information to determine the Whether the type structure is an index structure, if not, skip the structure according to the length information (load data length) indicated by the length structure in the first 4 sections, so that the server skips the streaming data of the length information until it jumps to the type structure as an index structure, there is no need to transmit the length data identified by the length type, so there is no need to parse the length data, which effectively reduces the time required for parsing and improves the efficiency of streaming parsing.
本实施例中,作为一可选实施例,包括:In this embodiment, as an optional embodiment, it includes:
A11,如果所述类型结构信息标识不为索引结构,依据所述原子结构信息中前第二阈值字节的信息计算索引偏移;A11, if the type structure information identifier is not an index structure, calculate the index offset according to the information of the first second threshold byte in the atomic structure information;
本实施例中,前第二阈值字节的信息为原子结构信息中的长度结构,指示负载数据长度。In this embodiment, the information of the first second threshold byte is the length structure in the atomic structure information, which indicates the length of the payload data.
本实施例中,作为一可选实施例,依据所述原子结构信息中前第二阈值字节的信息计算索引偏移包括:In this embodiment, as an optional embodiment, calculating the index offset according to the information of the first second threshold byte in the atomic structure information includes:
B11,获取存储的预留索引偏移;B11, obtain the stored reserved index offset;
本实施例中,如果在预先设置的存储区未存储有预留索引偏移,则设置存储的预留索引偏移为零。In this embodiment, if no reserved index offset is stored in the preset storage area, the stored reserved index offset is set to zero.
B12,将所述前第二阈值字节的信息对应的长度与所述存储的预留索引偏移相加,得到索引偏移;B12, adding the length corresponding to the information of the first second threshold byte to the stored reserved index offset to obtain an index offset;
本实施例中,如果当前不是MOOV Box结构,计算索引偏移:用已经解析的数据长度加上当前原子结构的长度,得到需要偏移的数据长度后发送给服务器。服务器会从请求的偏移的数据长度对应的偏移位置处开始发送数据,客户端获取到新的数据后继续分析,再次判断当前结构是否为MOOV Box,如此循环下去,直到文件解析结束或者找到MOOV Box。例如,假设第一次解析后4字节的字段类型结构,如果确定不是索引结构,则根据前4字节的长度信息,通知服务器跳过该长度信息的数据再进行发送,之后,再根据发来的前8个字节判断,如果后4字节的字段类型结构还不是索引结构,计算该次的数据偏移,即上一次跳过的数据长度与这次需要跳过的数据长度之和。In this embodiment, if the current structure is not a MOOV Box, calculate the index offset: use the parsed data length plus the length of the current atomic structure to obtain the data length to be offset and send it to the server. The server will start sending data from the offset position corresponding to the requested offset data length, and the client will continue to analyze after obtaining the new data, and then judge whether the current structure is a MOOV Box, and so on, until the file parsing ends or the file is found MOOV Box. For example, suppose the 4-byte field type structure is parsed for the first time. If it is determined that it is not an index structure, then according to the length information of the first 4 bytes, the server is notified to skip the data of this length information and then send it. The first 8 bytes come to judge, if the field type structure of the last 4 bytes is not an index structure, calculate the data offset of this time, that is, the sum of the data length skipped last time and the data length that needs to be skipped this time .
B13,利用所述索引偏移更新所述存储的预留索引偏移。B13. Utilize the index offset to update the stored reserved index offset.
A12,从所述索引偏移处请求数据,并执行所述解析所述后置封装的流式数据的前第一阈值字节的信息的步骤;A12, requesting data from the index offset, and performing the step of parsing the information of the first threshold byte before the post-encapsulated streaming data;
本实施例中,通知服务器跳过长度结构指示的负载数据长度的流式数据,即从计算得到的索引偏移处开始传输流式数据,而对于索引偏移前的流式数据,不进行传输。In this embodiment, the server is notified to skip the streaming data with the payload data length indicated by the length structure, that is, the streaming data is transmitted from the calculated index offset, and the streaming data before the index offset is not transmitted .
在确定所述类型结构信息标识为索引结构后,依据所述索引结构对请求的数据进行解析包括:After determining that the type structure information is identified as an index structure, parsing the requested data according to the index structure includes:
A13,如果所述类型结构信息标识为索引结构,解析所述索引结构,得到索引;A13, if the type structure information is identified as an index structure, parse the index structure to obtain an index;
本实施例中,索引(MOOV Box)包括:编解码参数、帧长度、帧偏移、帧时间戳、帧位置等信息。获取了索引,就可以实现对流式数据的解析,即当客户端接收到MOOV Box后,就可以进行流式解析。In this embodiment, the index (MOOV Box) includes information such as codec parameters, frame length, frame offset, frame time stamp, and frame position. After obtaining the index, the analysis of streaming data can be realized, that is, when the client receives the MOOV Box, it can perform streaming analysis.
本实施例中,作为一可选实施例,如果所述类型结构信息标识为索引结构,该方法还包括:In this embodiment, as an optional embodiment, if the type structure information is identified as an index structure, the method further includes:
将存储的预留索引偏移清空。Clear the stored reserved index offset.
A14,请求数据,依据所述索引对请求的数据进行解析。A14, requesting data, parsing the requested data according to the index.
本实施例中,作为一可选实施例,请求数据,依据所述索引对请求的数据进行解析包括:In this embodiment, as an optional embodiment, requesting data, parsing the requested data according to the index includes:
C11,获取播放定位时间点;C11, obtain the playback positioning time point;
本实施例中,用户可以在播放过程中,选取播放定位时间点,也可以不选取播放定位时间点,从默认时间点进行播放。In this embodiment, the user may select a playback positioning time point during playback, or may not select a playback positioning time point, and play from a default time point.
本实施例中,作为一可选实施例,获取播放定位时间点包括:In this embodiment, as an optional embodiment, obtaining the playback positioning time point includes:
获取用户在客户端的播放器进度条上进行的定位操作位置点;Obtain the position point of the positioning operation performed by the user on the player progress bar of the client;
根据总播放时间、进度条总长度和当前定位操作位置点,计算播放定位时间点。According to the total playback time, the total length of the progress bar and the current positioning operation position point, calculate the playback positioning time point.
本实施例中,计算得到的播放定位时间点为一定位时间戳。In this embodiment, the calculated playback positioning time point is a positioning timestamp.
C12,请求从所述播放定位时间点的数据并解析播放。C12, requesting the data of the positioning time point from the playback and parsing the playback.
本实施例中,作为一可选实施例,请求从所述播放定位时间点的数据包括:In this embodiment, as an optional embodiment, requesting data from the playback positioning time point includes:
D11,累加客户端中视频轨道时间戳-帧对应表结构盒子(STTS Box,Time toSample Box)中的帧时间戳;D11, accumulating the frame timestamp in the video track timestamp-frame correspondence table structure box (STTS Box, Time toSample Box) in the client;
D12,从累加的帧时间戳中,获取与所述播放定位时间点最接近的帧时间戳对应的帧号;D12, from the accumulated frame time stamps, obtain the frame number corresponding to the frame time stamp closest to the playback positioning time point;
本实施例中,将STTS Box结构字段中的帧时间戳按照链表顺序逐个累加,直到帧时间戳之和达到播放定位时间点,获取最后参与累加的帧时间戳对应的帧号。In this embodiment, the frame timestamps in the STTS Box structure field are accumulated one by one according to the order of the linked list until the sum of the frame timestamps reaches the playback positioning time point, and the frame number corresponding to the last frame timestamp participating in the accumulation is obtained.
本实施例中,对于多媒体数据的第一帧来说,以I帧为开始的媒体数据才是有效数据(B/P帧不能独立呈现完整的画面,会造成花屏现象),因而,本实施例中,作为一可选实施例,帧号为I帧帧号。即从累加的帧时间戳中,获取与所述播放定位时间点最接近的I帧帧时间戳对应的I帧帧号。具体来说,将同步样本表盒子(STSS Box,Sync Sample Box),即所有I帧帧号记录表中的I帧帧号通过STTS Box结构转化为具体的时间戳,顺序比对转化的时间戳与播放定位时间点,选取与播放定位时间点最接近的一时间戳(即最靠近的一个I帧,故误差最大为一个GOP时长,最小为0,平均为半个GOP时长),将该时间戳再还原回I帧帧号,并在STCO Box中查找该视频帧I帧帧号所对应的偏移。In this embodiment, for the first frame of the multimedia data, the media data starting with the I frame is valid data (the B/P frame cannot independently present a complete picture, which will cause a blurred screen phenomenon), therefore, in this embodiment In, as an optional embodiment, the frame number is the frame number of the I frame. That is, from the accumulated frame time stamps, the frame number of the I frame corresponding to the time stamp of the I frame closest to the playback positioning time point is obtained. Specifically, the STSS Box, Sync Sample Box, that is, the I-frame frame numbers in all I-frame frame number recording tables are converted into specific timestamps through the STTS Box structure, and the converted timestamps are sequentially compared With the playback positioning time point, select a timestamp closest to the playback positioning time point (that is, the closest I frame, so the maximum error is a GOP duration, the minimum is 0, and the average is half a GOP duration), and the time Stamp and restore the I frame number, and find the offset corresponding to the I frame number of the video frame in the STCO Box.
D13,利用视频轨道的块偏移信息表盒子(STCO Box,Chunk Offset Box),查询所述帧号对应的视频帧偏移;D13, utilizing the block offset information table box (STCO Box, Chunk Offset Box) of the video track to query the video frame offset corresponding to the frame number;
本实施例中,作为一可选实施例,视频帧偏移为I帧视频帧偏移。In this embodiment, as an optional embodiment, the video frame offset is an I-frame video frame offset.
本实施例中,为了音视频同步,音频也要找对应的数据,直接查找音频STCO Box,获取大于所述视频帧偏移的第一个偏移,得到音频偏移。In this embodiment, in order to synchronize the audio and video, the audio also needs to find the corresponding data, directly search the audio STCO Box, obtain the first offset greater than the video frame offset, and obtain the audio offset.
D14,向服务器请求从所述视频帧偏移处的数据。D14, requesting the server for data offset from the video frame.
本实施例中,STCO Box为每个样本(帧)相对文件头的偏移信息表。In this embodiment, STCO Box is an offset information table of each sample (frame) relative to the file header.
本实施例中,用户在客户端的播放器进度条上进行定位操作,可根据总播放时间、进度条总长度和当前定位点位置按比例计算出一定位时间戳,该时间戳在客户端通过累加视频轨道(时间戳的计算只参考视频帧,其他轨道帧的计算要与当前视频帧同步)STTS Box中的帧时间戳,得到最接近该定位时间戳的帧号,然后通过视频轨道的STCO Box,搜索到该帧号对应的偏移(该偏移为精确的视频帧偏移),最后将该偏移数值发送到服务器,服务器返回该请求偏移处的数据给客户端,客户端后续依据预先得到的索引进行裸数据的解析和播放。In this embodiment, the user performs a positioning operation on the player progress bar of the client, and a positioning timestamp can be calculated proportionally according to the total playback time, the total length of the progress bar, and the position of the current positioning point, and the timestamp is accumulated on the client side. Video track (the calculation of time stamp only refers to the video frame, and the calculation of other track frames must be synchronized with the current video frame) the frame time stamp in the STTS Box, get the frame number closest to the positioning time stamp, and then pass the STCO Box of the video track , search for the offset corresponding to the frame number (the offset is an accurate video frame offset), and finally send the offset value to the server, and the server returns the data at the requested offset to the client, and the client follows up with The pre-obtained index is used to parse and play raw data.
本实施例中,作为另一可选实施例,请求从所述播放定位时间点的数据包括:In this embodiment, as another optional embodiment, requesting data from the playback positioning time point includes:
E11,按照帧时长以及帧命名规则,计算所述播放定位时间点对应的帧号;E11. Calculate the frame number corresponding to the playback positioning time point according to the frame duration and frame naming rules;
E12,利用视频轨道的块偏移信息表盒子(STCO Box,Chunk Offset Box),查询所述帧号对应的视频帧偏移;E12, using the block offset information table box (STCO Box, Chunk Offset Box) of the video track to query the video frame offset corresponding to the frame number;
E13,向服务器请求从所述视频帧偏移处的数据。E13, request the data at the offset from the video frame from the server.
本实施例中,查找音频STCO Box,获取大于所述视频帧偏移的第一个偏移,得到音频偏移。In this embodiment, the audio STCO Box is searched, and the first offset greater than the video frame offset is obtained to obtain the audio offset.
本实施例中,作为一可选实施例,解析播放包括:In this embodiment, as an optional embodiment, parsing and playing includes:
解析层解析请求的数据,如果是第一帧,且第一帧为B帧或P帧,丢弃所述B帧或P帧,如果第一帧为I帧,透传至播放层进行播放;The analysis layer parses the requested data, if it is the first frame, and the first frame is a B frame or a P frame, discarding the B frame or P frame, if the first frame is an I frame, transparently transmits it to the playback layer for playback;
如果不是第一帧,将解析得到的B帧或P帧或I帧透传至播放层进行播放。If it is not the first frame, transparently transmit the analyzed B frame or P frame or I frame to the playback layer for playback.
本实施例中,如果上述的帧号为I帧帧号,则解析请求的数据,第一帧为I帧,透传至播放层即可;如果帧号不是I帧帧号,则解析请求的数据,第一帧可以为I帧,也可以为B帧,还可以为P帧。由于在第一帧中,B帧或P帧不能独立呈现完整的画面,会造成花屏现象,只有以I帧为开始的媒体数据才是有效数据。本实施例中,通过在定位过程中加入最近I帧定位机制,即定位I帧帧号;以及,在解析层提供第一帧处理机制,不但可以减轻上层控制层的负荷,而且可以提高平均半个GOP时长的播放延时。In the present embodiment, if the above-mentioned frame number is an I frame frame number, then parse the requested data, the first frame is an I frame, which can be transparently transmitted to the playback layer; if the frame number is not an I frame frame number, then parse the requested data For data, the first frame can be an I frame, a B frame, or a P frame. Since in the first frame, the B frame or the P frame cannot independently present a complete picture, which will cause a blurred screen phenomenon, only the media data starting with the I frame is valid data. In this embodiment, by adding the latest I-frame positioning mechanism in the positioning process, that is, positioning the frame number of the I-frame; Playback delay of GOP duration.
图2为现有播放操作示意图。参见图2,以播放定位时间点T2为例,在播放操作中,底层的解析层会将播放定位时间点所对应的准确帧(T1时间点)数据顺序输入到控制层,由控制层进行有效数据的过滤,即I帧之前的无效帧数据全部丢掉,图中所示为T1到T4之间的数据,最终真正开始播放的数据是T4时间点的I帧。这样,不但产生了T1到T4之间无效数据的解析(请求、发送、接收、解析、过滤等)延时,而且播放总时长减少了(T4-T1)时长。Fig. 2 is a schematic diagram of the existing playback operation. Referring to Figure 2, taking the playback positioning time point T2 as an example, in the playback operation, the underlying analysis layer will sequentially input the accurate frame (T1 time point) data corresponding to the playback positioning time point into the control layer, and the control layer will effectively Data filtering, that is, all invalid frame data before the I frame is lost. The data shown in the figure shows the data between T1 and T4, and the data that actually starts to be played is the I frame at the time point of T4. In this way, not only the analysis (request, sending, receiving, analysis, filtering, etc.) delay of invalid data between T1 and T4 is generated, but also the total playing time is reduced by (T4-T1) time.
图3为本实施例的播放操作示意图。参见图3,以播放定位时间点T2为例,本实施例中,底层的解析层通过采用最近I帧定位机制的定位操作,将距离播放定位时间点T1最近的I帧时间点T0及之后的数据直接透传到播放层,控制层不需要再进行有效数据的过滤,完全避免了无效数据的发送、接收和解析的延时,而且将播放总时长相比传统定位方案多出1个GOP时长(T4-T1+T1-T0=T4-T0),可以使得客户端能在最短的时间内播放有效数据,能够有效避免产生花屏现象,减轻上层控制逻辑负荷,平均误差为半个图像组(GOP,Group OfPicture)时长,其中,GOP指I帧及其后面依靠该I帧解码的其他帧。FIG. 3 is a schematic diagram of the playback operation of this embodiment. Referring to FIG. 3 , taking the playback positioning time point T2 as an example, in this embodiment, the underlying analysis layer uses the positioning operation of the nearest I frame positioning mechanism to place the I frame time point T0 closest to the playback positioning time point T1 and subsequent The data is directly transparently transmitted to the playback layer, and the control layer does not need to filter valid data, which completely avoids the delay of sending, receiving and analyzing invalid data, and the total playback time is 1 GOP longer than the traditional positioning solution (T4-T1+T1-T0=T4-T0), which can enable the client to play valid data in the shortest time, can effectively avoid the phenomenon of blurred screen, reduce the logic load of the upper layer control, and the average error is half a group of pictures (GOP , Group OfPicture) duration, wherein, GOP refers to an I frame and other frames decoded by the I frame behind it.
图4为本发明的实施例二后置封装的流式数据解析方法流程示意图,如图4所示,本实施例的方法可以包括:Fig. 4 is a schematic flow chart of the post-encapsulated streaming data parsing method of Embodiment 2 of the present invention. As shown in Fig. 4, the method of this embodiment may include:
步骤401,服务器向客户端发送数据;Step 401, the server sends data to the client;
本实施例中,服务器发送的数据为MP4-后置封装的流式数据(文件)。In this embodiment, the data sent by the server is MP4-post-encapsulated streaming data (file).
步骤402,客户端定位索引位置,向服务器请求索引偏移(offset1)的数据;Step 402, the client locates the index position, and requests the data of the index offset (offset1) from the server;
步骤403,服务器从索引偏移处发送数据,客户端解析获取索引;Step 403, the server sends data from the index offset, and the client parses and obtains the index;
步骤404,客户端进行定位操作,计算定位操作对应的视频帧偏移,向服务器请求视频帧偏移(offset2)的数据;Step 404, the client performs a positioning operation, calculates the video frame offset corresponding to the positioning operation, and requests the data of the video frame offset (offset2) from the server;
步骤405,服务器从视频帧偏移处发送数据,客户端解析数据。Step 405, the server sends data from the video frame offset, and the client parses the data.
图5为本发明的实施例三后置封装的流式数据解析方法流程示意图,如图5所示,本实施例的方法可以包括:Fig. 5 is a schematic flow chart of a post-encapsulated streaming data parsing method according to Embodiment 3 of the present invention. As shown in Fig. 5, the method of this embodiment may include:
步骤501,解析接收数据的文件类型;Step 501, analyzing the file type of the received data;
本实施例中,文件类型(FTYP,File Type)位于文件的起始位置,用于标识MP4格式,如果为MP4-后置封装,执行步骤502。In this embodiment, the file type (FTYP, File Type) is located at the beginning of the file and is used to identify the MP4 format. If it is MP4-post-encapsulation, step 502 is performed.
步骤502,解析非MOOV长度;Step 502, analyzing the non-MOOV length;
本实施例中,非MOOV长度即原子结构信息,如果原子结构信息中的类型信息表明不是索引结构,执行步骤503。In this embodiment, the non-MOOV length is the atomic structure information. If the type information in the atomic structure information indicates that it is not an index structure, step 503 is performed.
步骤503,计算索引偏移;Step 503, calculating index offset;
本实施例中,依据原子结构信息中的长度结构信息以及存储的预留索引偏移计算索引偏移。In this embodiment, the index offset is calculated according to the length structure information in the atomic structure information and the stored reserved index offset.
步骤504,请求索引偏移处数据;Step 504, request the data at the index offset;
步骤505,判断是否为MOOV Box,如果不是,返回执行步骤502,如果是,执行步骤506;Step 505, judge whether it is a MOOV Box, if not, return to step 502, if yes, execute step 506;
步骤506,解析索引;Step 506, analyzing the index;
步骤507,是否需要定位,如果是,执行步骤508,如果不是,执行步骤512;Step 507, whether positioning is required, if yes, execute step 508, if not, execute step 512;
本实施例中,进行定位操作后,客户端向服务器请求的数据是有效数据,即负载数据。In this embodiment, after the positioning operation is performed, the data requested by the client to the server is valid data, that is, payload data.
步骤508,按照预先设置的偏移转化机制进行处理;Step 508, process according to the preset offset conversion mechanism;
本实施例中,偏移转化机制为最近I帧定位机制。In this embodiment, the offset conversion mechanism is the nearest I frame positioning mechanism.
步骤509,请求数据;Step 509, request data;
本实施例中,依据定位得到的视频帧偏移请求数据。In this embodiment, the data is requested based on the video frame offset obtained by positioning.
步骤510,解析数据;Step 510, analyzing data;
本实施例中,解析数据是指将进行封装的媒体数据去封装或解封装,使之为裸流数据。In this embodiment, parsing the data refers to decapsulating or decapsulating the encapsulated media data to make it into bare stream data.
步骤511,判断是否为数据的最后一帧,如果是,结束流程,如果不是,返回步骤507;Step 511, judge whether it is the last frame of data, if yes, end the process, if not, return to step 507;
步骤512,顺序获取数据,执行步骤510。Step 512, acquire data sequentially, and execute step 510.
本实施例后置封装的流式数据解析方法,通过确定接收的文件中的数据为采用后置封装的流式数据;解析所述后置封装的流式数据的前第一阈值字节的信息,得到原子结构信息;提取原子结构信息中后第二阈值字节的信息,得到类型结构信息,所述第一阈值为所述第二阈值的两倍;在确定所述类型结构信息标识为索引结构后,依据所述索引结构对请求的数据进行解析。这样,通过原子结构信息进行类型结构信息判断,可以有效获取索引,无需将整个目标MP4文件下载完毕,可以实现对MP4文件的解析,解析所需时间短,流式解析效率高;同时,需要缓存的数据较小,内存资源消耗低;而且,通过快速获取索引,可以避免出现解析上的时序逻辑问题,从而提升了流式解析成功率。具体来说,通过提出一种快速、准确和有效的流式解析和定位机制,具有如下有益技术效果:The post-encapsulated streaming data analysis method of this embodiment determines that the data in the received file is post-encapsulated streaming data; and analyzes the information of the first threshold byte before the post-encapsulated streaming data , to obtain the atomic structure information; extract the information of the second threshold byte in the atomic structure information to obtain the type structure information, and the first threshold is twice the second threshold; after determining that the type structure information is identified as an index After the structure, the requested data is parsed according to the index structure. In this way, the type structure information can be judged through the atomic structure information, and the index can be effectively obtained without downloading the entire target MP4 file, and the MP4 file can be parsed, the time required for parsing is short, and the streaming parsing efficiency is high; at the same time, caching is required The data is small, and the memory resource consumption is low; moreover, by quickly obtaining the index, it is possible to avoid temporal logic problems in parsing, thereby improving the success rate of streaming parsing. Specifically, by proposing a fast, accurate and effective flow parsing and positioning mechanism, it has the following beneficial technical effects:
1,快速获取索引。其中,获取索引包括:确定索引的偏移位置以及获取完整的索引,其中,1. Get the index quickly. Among them, obtaining the index includes: determining the offset position of the index and obtaining the complete index, wherein,
确定索引的偏移位置,MP4-后置封装的媒体文件为一MDAT(数据)+MOOV(索引)的结构,其中,MOOV即为索引,MDAT(Media Data)是多媒体数据,即负载数据(裸数据)的封装结构。通过MDAT字段中的长度字段,得到负载数据的长度,然后通知服务器跳过该长度的数据信息,直到跳到MOOV,当客户端接收到MOOV后,就可以进行流式解析,这样,可以快速确定索引的偏移位置。Determining the offset position of the index, the media file of the MP4-post-package is a structure of MDAT (data)+MOOV (index), wherein, MOOV is the index, and MDAT (Media Data) is multimedia data, i.e. load data (naked data) encapsulation structure. Through the length field in the MDAT field, the length of the payload data is obtained, and then the server is notified to skip the data information of this length until it jumps to MOOV. When the client receives the MOOV, it can perform streaming analysis, so that it can be quickly determined. The offset position of the index.
在确定索引的偏移位置后,由于索引相比负载数据来说小的多,因而,可以快速获取完整的索引,从而对于用户来说,进行流式解析需要等待的响应时间短。After determining the offset position of the index, since the index is much smaller than the load data, the complete index can be obtained quickly, so that the user needs to wait for a short response time for stream parsing.
2,准确。定位操作时采用时间戳(或帧号)-偏移转化机制,为用户提供帧号和时间戳两种定位选择方案,客户端请求的是精确的数据偏移位置,可以避免冗余数据解析所带来的额外耗时和等待;2. Accurate. The time stamp (or frame number)-offset conversion mechanism is used in the positioning operation to provide users with two positioning options of frame number and time stamp. The client requests the precise data offset position, which can avoid redundant data parsing. Additional time-consuming and waiting;
3,有效。定位操作时采用最近I帧定位机制,可以使得客户端能在最短的时间内播放有效数据,即以I帧为开头的数据,能够有效避免产生花屏现象,减轻上层控制逻辑负担。3. Effective. The latest I-frame positioning mechanism is adopted in the positioning operation, so that the client can play valid data in the shortest time, that is, the data starting with the I frame, which can effectively avoid the phenomenon of blurred screen and reduce the burden of upper-layer control logic.
图6为本发明的实施例四后置封装的流式数据解析装置结构示意图,如图6所示,本实施例的装置可以包括:后置封装确定模块61、原子结构解析模块62、类型结构提取模块63以及数据解析模块64,其中,Fig. 6 is a schematic structural diagram of a streaming data analysis device with post-packaging in Embodiment 4 of the present invention. As shown in Fig. 6, the device in this embodiment may include: a post-packaging determination module 61, an atomic structure analysis module 62, a type structure Extraction module 63 and data parsing module 64, wherein,
后置封装确定模块61,用于确定接收的文件中的数据为采用后置封装的流式数据;Post-encapsulation determination module 61, configured to determine that the data in the received file is streaming data using post-encapsulation;
本实施例中,作为一可选实施例,确定接收的文件中的数据为采用后置封装的流式数据包括:In this embodiment, as an optional embodiment, determining that the data in the received file is streaming data using post-encapsulation includes:
解析接收的文件的文件类型字段,如果文件类型字段标识为MP4-后置封装且应用于流式数据场景,则接收的文件中的数据为采用后置封装的流式数据。Parse the file type field of the received file. If the file type field is identified as MP4-post-encapsulation and applied to streaming data scenarios, the data in the received file is streaming data using post-encapsulation.
本实施例中,如果解析的文件类型字段标识不为MP4-后置封装且应用于流式数据场景,则按照现有技术流程进行处理。In this embodiment, if the parsed file type field identifier is not MP4-post-encapsulation and is applied to a streaming data scenario, processing is performed according to the existing technical process.
原子结构解析模块62,用于解析所述后置封装的流式数据的前第一阈值字节的信息,得到原子结构信息;The atomic structure analysis module 62 is used to analyze the information of the first threshold byte before the post-encapsulated streaming data to obtain the atomic structure information;
类型结构提取模块63,用于提取原子结构信息中后第二阈值字节的信息,得到类型结构信息,所述第一阈值为所述第二阈值的两倍;The type structure extraction module 63 is used to extract the information of the second threshold byte in the atomic structure information to obtain the type structure information, and the first threshold is twice the second threshold;
本实施例中,作为一可选实施例,第一阈值为8,第二阈值为4。In this embodiment, as an optional embodiment, the first threshold is 8, and the second threshold is 4.
本实施例中,前4字节为长度结构,标识负载数据(MDAT数据的长度),后4字节为类型结构,标识该流式数据(帧)的类型。因而,本实施例中,通过获取流式数据(帧)的原子结构信息,可以利用原子结构信息来确定是否为索引。In this embodiment, the first 4 bytes are a length structure, which identifies the payload data (the length of the MDAT data), and the last 4 bytes are a type structure, which identifies the type of the streaming data (frame). Therefore, in this embodiment, by acquiring the atomic structure information of the streaming data (frame), the atomic structure information can be used to determine whether it is an index.
数据解析模块64,用于在确定所述类型结构信息标识为索引结构后,依据所述索引结构对请求的数据进行解析。The data parsing module 64 is configured to parse the requested data according to the index structure after determining that the type structure information is identified as an index structure.
本实施例中,通过解析数据的前8字节,得到原子结构信息,并利用原子结构信息中的后4字节的类型结构信息来判断当前结构是否为所需要的索引(MOOV Box)结构,如果类型结构信息表明当前结构不是索引结构,则可以根据前4字节指示的长度类型通知服务器跳过当前非索引结构的原子结构。In this embodiment, the atomic structure information is obtained by analyzing the first 8 bytes of the data, and the type structure information of the last 4 bytes in the atomic structure information is used to judge whether the current structure is the required index (MOOV Box) structure, If the type structure information indicates that the current structure is not an index structure, the server may be notified to skip the current atomic structure that is not an index structure according to the length type indicated by the first 4 bytes.
本实施例中,作为一可选实施例,所述装置还包括:判断单元、索引偏移计算单元、数据请求单元,其中,In this embodiment, as an optional embodiment, the device further includes: a judgment unit, an index offset calculation unit, and a data request unit, wherein,
判断单元,用于判断所述类型结构信息标识是否为索引结构,如果是,通知索引获取单元,如果不是,通知索引偏移计算单元;A judging unit, configured to judge whether the type structure information identifier is an index structure, if yes, notify the index acquisition unit, if not, notify the index offset calculation unit;
索引偏移计算单元,用于依据所述原子结构信息中前第二阈值字节的信息计算索引偏移;An index offset calculation unit, configured to calculate an index offset according to the information of the first second threshold byte in the atomic structure information;
本实施例中,作为一可选实施例,索引偏移计算单元包括:预留索引偏移获取子单元、索引偏移计算子单元以及更新子单元,其中,In this embodiment, as an optional embodiment, the index offset calculation unit includes: a reserved index offset acquisition subunit, an index offset calculation subunit, and an update subunit, wherein,
预留索引偏移获取子单元,用于获取存储的预留索引偏移;The reserved index offset acquisition subunit is used to acquire the stored reserved index offset;
本实施例中,如果在预先设置的存储区未存储有预留索引偏移,则设置存储的预留索引偏移为零。In this embodiment, if no reserved index offset is stored in the preset storage area, the stored reserved index offset is set to zero.
索引偏移计算子单元,用于将所述前第二阈值字节的信息对应的长度与所述存储的预留索引偏移相加,得到索引偏移;An index offset calculation subunit, configured to add the length corresponding to the information of the first second threshold byte to the stored reserved index offset to obtain an index offset;
更新子单元,用于利用所述索引偏移更新所述存储的预留索引偏移。An updating subunit, configured to use the index offset to update the stored reserved index offset.
作为另一可选实施例,索引偏移计算单元还包括:As another optional embodiment, the index offset calculation unit further includes:
清空子单元,用于在接收到判断单元输出至索引获取单元的通知后,将存储的预留索引偏移清空。The clearing subunit is configured to clear the stored reserved index offset after receiving the notification output from the judging unit to the index acquiring unit.
数据请求单元,用于从所述索引偏移处请求数据,输出至原子结构解析模块。The data request unit is used to request data from the index offset and output to the atomic structure analysis module.
作为一可选实施例,数据解析模块64包括:As an optional embodiment, the data parsing module 64 includes:
索引获取单元,用于解析所述索引结构,得到索引;an index acquiring unit, configured to parse the index structure to obtain an index;
数据解析单元,用于请求数据,依据所述索引对请求的数据进行解析。The data parsing unit is configured to request data, and parse the requested data according to the index.
本实施例中,作为一可选实施例,数据解析单元包括:播放定位时间点获取子单元以及解析播放子单元,其中,In this embodiment, as an optional embodiment, the data parsing unit includes: a playback positioning time point acquisition subunit and a parsing playback subunit, wherein,
播放定位时间点获取子单元,用于获取播放定位时间点;The playback positioning time point acquisition subunit is used to obtain the playback positioning time point;
本实施例中,用户在客户端的播放器进度条上进行定位操作,可根据总播放时间、进度条总长度和当前定位点位置按比例计算出一定位时间戳,该定位时间戳为播放定位时间点。In this embodiment, the user performs a positioning operation on the player progress bar of the client, and can calculate a positioning timestamp proportionally according to the total playback time, the total length of the progress bar, and the position of the current positioning point, and the positioning timestamp is the playback positioning time point.
解析播放子单元,用于请求从所述播放定位时间点的数据并解析播放。The parsing and playing subunit is used for requesting the data of the positioning time point from the playing and parsing the playing.
本实施例中,作为一可选实施例,解析播放子单元包括:累加器、帧号获取器、查询器、数据请求器以及解析播放器,其中,In this embodiment, as an optional embodiment, the parsing and playing subunit includes: an accumulator, a frame number acquirer, a query device, a data requester, and a parsing player, wherein,
累加器,用于累加客户端中视频轨道时间戳-帧对应表结构盒子中的帧时间戳;The accumulator is used to accumulate the frame timestamps in the video track timestamp-frame correspondence table structure box in the client;
帧号获取器,用于从累加的帧时间戳中,获取与所述播放定位时间点最接近的帧时间戳对应的帧号;A frame number acquirer, configured to acquire, from the accumulated frame time stamps, the frame number corresponding to the frame time stamp closest to the playback positioning time point;
本实施例中,作为一可选实施例,视频帧偏移为I帧视频帧偏移。In this embodiment, as an optional embodiment, the video frame offset is an I-frame video frame offset.
本实施例中,为了音视频同步,音频也要找对应的数据,直接查找音频STCO Box,获取大于所述视频帧偏移的第一个偏移,得到音频偏移。In this embodiment, in order to synchronize the audio and video, the audio also needs to find the corresponding data, directly search the audio STCO Box, obtain the first offset greater than the video frame offset, and obtain the audio offset.
查询器,用于利用视频轨道的块偏移信息表盒子,查询所述帧号对应的视频帧偏移;A query device, configured to use the block offset information table box of the video track to query the video frame offset corresponding to the frame number;
数据请求器,用于向服务器请求从所述视频帧偏移处的数据;A data requester, configured to request data from a server at an offset from the video frame;
解析播放器,用于将请求的数据解析后进行播放。The parsing player is used to parse the requested data and play it.
本实施例中,作为另一可选实施例,解析播放子单元包括:帧号计算器、视频帧偏移器、数据请求器以及解析播放器,其中,In this embodiment, as another optional embodiment, the parsing and playing subunit includes: a frame number calculator, a video frame shifter, a data requester, and a parsing player, wherein,
帧号计算器,用于按照帧时长以及帧命名规则,计算所述播放定位时间点对应的帧号;A frame number calculator, configured to calculate the frame number corresponding to the playback positioning time point according to the frame duration and frame naming rules;
视频帧偏移器,用于利用视频轨道的块偏移信息表盒子,查询所述帧号对应的视频帧偏移;A video frame offset device, configured to use the block offset information table box of the video track to query the video frame offset corresponding to the frame number;
数据请求器,用于向服务器请求从所述视频帧偏移处的数据;A data requester, configured to request data from a server at an offset from the video frame;
解析播放器,用于将请求的数据解析后进行播放。The parsing player is used to parse the requested data and play it.
本实施例中,作为一可选实施例,解析播放包括:In this embodiment, as an optional embodiment, parsing and playing includes:
解析层解析请求的数据,如果是第一帧,且第一帧为B帧或P帧,丢弃所述B帧或P帧,如果第一帧为I帧,透传至播放层进行播放;The analysis layer parses the requested data, if it is the first frame, and the first frame is a B frame or a P frame, discarding the B frame or P frame, if the first frame is an I frame, transparently transmits it to the playback layer for playback;
如果不是第一帧,将解析得到的B帧或P帧或I帧透传至播放层进行播放。If it is not the first frame, transparently transmit the analyzed B frame or P frame or I frame to the playback layer for playback.
本实施例中,如果上述的帧号为I帧帧号,则解析请求的数据,第一帧为I帧,透传至播放层即可;如果帧号不是I帧帧号,则解析请求的数据,第一帧可以为I帧,也可以为B帧,还可以为P帧。由于在第一帧中,B帧或P帧不能独立呈现完整的画面,会造成花屏现象,只有以I帧为开始的媒体数据才是有效数据。本实施例中,通过在定位过程中加入最近I帧定位机制,即定位I帧帧号;以及,在解析层提供第一帧处理机制,不但可以减轻上层控制层的负荷,而且可以提高平均半个GOP时长的播放延时。In the present embodiment, if the above-mentioned frame number is an I frame frame number, then parse the requested data, the first frame is an I frame, which can be transparently transmitted to the playback layer; if the frame number is not an I frame frame number, then parse the requested data For data, the first frame can be an I frame, a B frame, or a P frame. Since in the first frame, the B frame or the P frame cannot independently present a complete picture, which will cause a blurred screen phenomenon, only the media data starting with the I frame is valid data. In this embodiment, by adding the latest I-frame positioning mechanism in the positioning process, that is, positioning the frame number of the I-frame; Playback delay of GOP duration.
本实施例的装置,可以用于执行图1至图5所示方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。The device in this embodiment can be used to execute the technical solutions of the method embodiments shown in FIG. 1 to FIG. 5 , and its implementation principles and technical effects are similar, and will not be repeated here.
需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个......”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is a relationship between these entities or operations. any such actual relationship or order exists between them. Furthermore, the term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article, or apparatus comprising a set of elements includes not only those elements, but also includes elements not expressly listed. other elements of or also include elements inherent in such a process, method, article, or device. Without further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article or apparatus comprising said element.
本说明书中的各个实施例均采用相关的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。Each embodiment in this specification is described in a related manner, the same and similar parts of each embodiment can be referred to each other, and each embodiment focuses on the differences from other embodiments.
尤其,对于装置实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。In particular, as for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and for relevant parts, please refer to part of the description of the method embodiment.
在流程图中表示或在此以其他方式描述的逻辑和/或步骤,例如,可以被认为是用于实现逻辑功能的可执行指令的定序列表,可以具体实现在任何计算机可读介质中,以供指令执行系统、装置或设备(如基于计算机的系统、包括处理器的系统或其他可以从指令执行系统、装置或设备取指令并执行指令的系统)使用,或结合这些指令执行系统、装置或设备而使用。就本说明书而言,”计算机可读介质”可以是任何可以包含、存储、通信、传播或传输程序以供指令执行系统、装置或设备或结合这些指令执行系统、装置或设备而使用的装置。计算机可读介质的更具体的示例(非穷尽性列表)包括以下:具有一个或多个布线的电连接部(电子装置),便携式计算机盘盒(磁装置),随机存取存储器(RAM),只读存储器(ROM),可擦除可编辑只读存储器(EPROM或闪速存储器),光纤装置,以及便携式光盘只读存储器(CDROM)。另外,计算机可读介质甚至可以是可在其上打印所述程序的纸或其他合适的介质,因为可以例如通过对纸或其他介质进行光学扫描,接着进行编辑、解译或必要时以其他合适方式进行处理来以电子方式获得所述程序,然后将其存储在计算机存储器中。The logic and/or steps represented in the flowcharts or otherwise described herein, for example, can be considered as a sequenced listing of executable instructions for implementing logical functions, can be embodied in any computer-readable medium, For use with instruction execution systems, devices, or devices (such as computer-based systems, systems including processors, or other systems that can fetch instructions from instruction execution systems, devices, or devices and execute instructions), or in conjunction with these instruction execution systems, devices or equipment for use. For the purposes of this specification, a "computer-readable medium" may be any device that can contain, store, communicate, propagate or transmit a program for use in or in conjunction with an instruction execution system, device or device. More specific examples (non-exhaustive list) of computer-readable media include the following: electrical connection with one or more wires (electronic device), portable computer disk case (magnetic device), random access memory (RAM), Read Only Memory (ROM), Erasable and Editable Read Only Memory (EPROM or Flash Memory), Fiber Optic Devices, and Portable Compact Disc Read Only Memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program can be printed, since the program can be read, for example, by optically scanning the paper or other medium, followed by editing, interpretation or other suitable processing if necessary. processing to obtain the program electronically and store it in computer memory.
应当理解,本发明的各部分可以用硬件、软件、固件或它们的组合来实现。It should be understood that various parts of the present invention can be realized by hardware, software, firmware or their combination.
在上述实施方式中,多个步骤或方法可以用存储在存储器中且由合适的指令执行系统执行的软件或固件来实现。例如,如果用硬件来实现,和在另一实施方式中一样,可用本领域公知的下列技术中的任一项或他们的组合来实现:具有用于对数据信号实现逻辑功能的逻辑门电路的离散逻辑电路,具有合适的组合逻辑门电路的专用集成电路,可编程门阵列(PGA),现场可编程门阵列(FPGA)等。In the embodiments described above, various steps or methods may be implemented by software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented by any one or combination of the following techniques known in the art: Discrete logic circuits, ASICs with suitable combinational logic gates, programmable gate arrays (PGAs), field programmable gate arrays (FPGAs), etc.
本发明实施例还提供一种电子设备,所述电子设备包含前述任一实施例所述的装置。An embodiment of the present invention further provides an electronic device, the electronic device including the device described in any one of the foregoing embodiments.
图7为本发明电子设备一个实施例的结构示意图,可以实现本发明图1-6所示实施例的流程,如图7所示,上述电子设备可以包括:壳体71、处理器72、存储器73、电路板74和电源电路75,其中,电路板74安置在壳体71围成的空间内部,处理器72和存储器73设置在电路板74上;电源电路75,用于为上述电子设备的各个电路或器件供电;存储器73用于存储可执行程序代码;处理器72通过读取存储器73中存储的可执行程序代码来运行与可执行程序代码对应的程序,用于执行前述任一实施例所述的后置封装的流式数据解析方法。FIG. 7 is a schematic structural diagram of an embodiment of the electronic device of the present invention, which can realize the flow of the embodiment shown in FIGS. 1-6 of the present invention. As shown in FIG. 73. A circuit board 74 and a power supply circuit 75, wherein the circuit board 74 is placed inside the space enclosed by the casing 71, and the processor 72 and the memory 73 are arranged on the circuit board 74; the power supply circuit 75 is used for the above-mentioned electronic equipment Each circuit or device is powered; the memory 73 is used to store the executable program code; the processor 72 runs the program corresponding to the executable program code by reading the executable program code stored in the memory 73, and is used to execute any of the foregoing embodiments The post-encapsulation streaming data parsing method described above.
处理器72对上述步骤的具体执行过程以及处理器72通过运行可执行程序代码来进一步执行的步骤,可以参见本发明图1-6所示实施例的描述,在此不再赘述。For the specific execution process of the above steps by the processor 72 and the further steps executed by the processor 72 by running executable program codes, refer to the description of the embodiment shown in FIGS. 1-6 of the present invention, and details are not repeated here.
该电子设备以多种形式存在,包括但不限于:This electronic device exists in many forms, including but not limited to:
(1)移动通信设备:这类设备的特点是具备移动通信功能,并且以提供话音、数据通信为主要目标。这类终端包括:智能手机(例如iPhone)、多媒体手机、功能性手机,以及低端手机等。(1) Mobile communication equipment: This type of equipment is characterized by mobile communication functions, and its main goal is to provide voice and data communication. Such terminals include: smart phones (such as iPhone), multimedia phones, feature phones, and low-end phones.
(2)超移动个人计算机设备:这类设备属于个人计算机的范畴,有计算和处理功能,一般也具备移动上网特性。这类终端包括:PDA、MID和UMPC设备等,例如iPad。(2) Ultra-mobile personal computer equipment: This type of equipment belongs to the category of personal computers, with computing and processing functions, and generally also has the characteristics of mobile Internet access. Such terminals include: PDA, MID and UMPC equipment, such as iPad.
(3)便携式娱乐设备:这类设备可以显示和播放多媒体内容。该类设备包括:音频、视频播放器(例如iPod),掌上游戏机,电子书,以及智能玩具和便携式车载导航设备。(3) Portable entertainment equipment: This type of equipment can display and play multimedia content. Such devices include: audio and video players (such as iPod), handheld game consoles, e-books, as well as smart toys and portable car navigation devices.
(4)服务器:提供计算服务的设备,服务器的构成包括处理器、硬盘、内存、系统总线等,服务器和通用的计算机架构类似,但是由于需要提供高可靠的服务,因此在处理能力、稳定性、可靠性、安全性、可扩展性、可管理性等方面要求较高。(4) Server: A device that provides computing services. The composition of a server includes processors, hard disks, memory, and system buses. , Reliability, security, scalability, manageability and other aspects have high requirements.
(5)其他具有数据交互功能的电子设备。(5) Other electronic devices with data interaction functions.
本技术领域的普通技术人员可以理解实现上述实施例方法携带的全部或部分步骤是可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,该程序在执行时,包括方法实施例的步骤之一或其组合。Those of ordinary skill in the art can understand that all or part of the steps carried by the methods of the above embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium. During execution, one or a combination of the steps of the method embodiments is included.
为了描述的方便,描述以上装置是以功能分为各种单元/模块分别描述。当然,在实施本发明时可以把各单元/模块的功能在同一个或多个软件和/或硬件中实现。For the convenience of description, the above devices are described by dividing their functions into various units/modules and describing them separately. Of course, when implementing the present invention, the functions of each unit/module can be implemented in one or more pieces of software and/or hardware.
通过以上的实施方式的描述可知,本领域的技术人员可以清楚地了解到本发明可借助软件加必需的通用硬件平台的方式来实现。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在存储介质中,如ROM/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例或者实施例的某些部分所述的方法。It can be seen from the above description of the implementation manners that those skilled in the art can clearly understand that the present invention can be implemented by means of software plus a necessary general hardware platform. Based on this understanding, the essence of the technical solution of the present invention or the part that contributes to the prior art can be embodied in the form of software products, and the computer software products can be stored in storage media, such as ROM/RAM, disk , CD, etc., including several instructions to make a computer device (which may be a personal computer, server, or network device, etc.) execute the methods described in various embodiments or some parts of the embodiments of the present invention.
以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到的变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以权利要求的保护范围为准。The above is only a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Anyone skilled in the art can easily think of changes or substitutions within the technical scope disclosed in the present invention. All should be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims (21)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201610846684.6A CN107872716B (en) | 2016-09-23 | 2016-09-23 | A streaming data analysis method, device and electronic equipment with post-packaging |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201610846684.6A CN107872716B (en) | 2016-09-23 | 2016-09-23 | A streaming data analysis method, device and electronic equipment with post-packaging |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN107872716A CN107872716A (en) | 2018-04-03 |
| CN107872716B true CN107872716B (en) | 2019-12-06 |
Family
ID=61751638
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201610846684.6A Active CN107872716B (en) | 2016-09-23 | 2016-09-23 | A streaming data analysis method, device and electronic equipment with post-packaging |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN107872716B (en) |
Families Citing this family (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110248245B (en) * | 2019-06-21 | 2022-05-06 | 维沃移动通信有限公司 | Video positioning method and device, mobile terminal and storage medium |
| CN110267062B (en) * | 2019-07-26 | 2022-07-08 | 深圳Tcl新技术有限公司 | Optimization method and device for assembled video frame and readable storage medium |
| CN113542764A (en) * | 2021-07-12 | 2021-10-22 | 中国电信股份有限公司 | Method, apparatus, electronic device, and computer-readable medium for quick start of video |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1516184A (en) * | 2003-01-10 | 2004-07-28 | 华为技术有限公司 | A kind of processing method of multimedia data |
| CN101060623A (en) * | 2006-04-20 | 2007-10-24 | 佳能株式会社 | Moving image reproducing apparatus and method |
| CN101146212A (en) * | 2006-09-11 | 2008-03-19 | 思华科技(上海)有限公司 | Stream media encapsulation and unpacking method and system for video order network |
| CN102754444A (en) * | 2010-01-08 | 2012-10-24 | 索尼公司 | Image processing device, information recording medium, image processing medium, and program |
| CN105915935A (en) * | 2016-05-30 | 2016-08-31 | 乐视控股(北京)有限公司 | Video transmission control method and video transmission control device |
Family Cites Families (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US8214655B2 (en) * | 2002-03-29 | 2012-07-03 | Kabushiki Kaisha Toshiba | Data structure of multimedia file format, encrypting method and device thereof, and decrypting method and device thereof |
| JP5086879B2 (en) * | 2008-04-21 | 2012-11-28 | キヤノン株式会社 | Image processing apparatus, control method therefor, and program |
| KR102115323B1 (en) * | 2012-03-16 | 2020-05-26 | 엘지전자 주식회사 | Method for storing image information, method for parsing image information and apparatus using same |
-
2016
- 2016-09-23 CN CN201610846684.6A patent/CN107872716B/en active Active
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1516184A (en) * | 2003-01-10 | 2004-07-28 | 华为技术有限公司 | A kind of processing method of multimedia data |
| CN101060623A (en) * | 2006-04-20 | 2007-10-24 | 佳能株式会社 | Moving image reproducing apparatus and method |
| CN101146212A (en) * | 2006-09-11 | 2008-03-19 | 思华科技(上海)有限公司 | Stream media encapsulation and unpacking method and system for video order network |
| CN102754444A (en) * | 2010-01-08 | 2012-10-24 | 索尼公司 | Image processing device, information recording medium, image processing medium, and program |
| CN105915935A (en) * | 2016-05-30 | 2016-08-31 | 乐视控股(北京)有限公司 | Video transmission control method and video transmission control device |
Non-Patent Citations (1)
| Title |
|---|
| AMENDMENT 2: Support for image file format;ISO office;《INTERNATIONAL STANDARD》;20151215;全文 * |
Also Published As
| Publication number | Publication date |
|---|---|
| CN107872716A (en) | 2018-04-03 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN100456284C (en) | Decentralized caching for streaming media | |
| CN107979783B (en) | Streaming data analysis method and device and electronic equipment | |
| US8886896B2 (en) | Storage format for media streams | |
| US9374403B2 (en) | Media stream fragment request | |
| US8825790B2 (en) | Caching of fragmented streaming media | |
| CN109348251B (en) | Method and device for video playing, computer readable medium and electronic equipment | |
| US10033788B2 (en) | Method and a system for smooth streaming of media content in a distributed content delivery network | |
| CN110662017B (en) | A kind of video playback quality detection method and device | |
| CN105228001B (en) | A kind of method and system that FLV format videos play online | |
| CN110401858B (en) | Video playing method and device, electronic equipment and storage medium | |
| CN105979404A (en) | Streaming media processing method and device | |
| CN108259998B (en) | Player, play control method and device, electronic equipment and play system | |
| JP6969013B2 (en) | Synchronous playback method, device and storage medium for media files | |
| WO2018076998A1 (en) | Method and device for generating playback video file | |
| CN104661058A (en) | MP4 video on demand data stream transmission method, client side and video on demand system | |
| CN108347625B (en) | Method and device for positioning TS streaming media | |
| CN105979373A (en) | Play method and device | |
| US9832493B2 (en) | Method and apparatus for processing audio/video file | |
| CN107872716B (en) | A streaming data analysis method, device and electronic equipment with post-packaging | |
| WO2012146098A1 (en) | Method and corresponding system for storing and playing streaming media | |
| CN103957471A (en) | Network video playing method and device | |
| CN110784741A (en) | Time-shift response method and device for media data | |
| WO2024245234A1 (en) | Media file preloading method and apparatus, electronic device, and storage medium | |
| CN103051953B (en) | One utilizes video player to carry out coding/decoding method to video file | |
| CN103546829A (en) | A video service processing method and device |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant | ||
| TR01 | Transfer of patent right |
Effective date of registration: 20250729 Address after: Rooms 602 and 605, No. 85 Xiangxue Avenue Middle, Huangpu District, Guangzhou City, Guangdong Province 510000 Patentee after: Guangzhou Gaohang Technology Transfer Co.,Ltd. Country or region after: China Address before: Hangzhou City, Zhejiang province 310051 Binjiang District Qianmo Road No. 555 Patentee before: Hangzhou Hikvision Digital Technology Co.,Ltd. Country or region before: China |
|
| TR01 | Transfer of patent right |