CN108347625B - Method and device for positioning TS streaming media - Google Patents

Method and device for positioning TS streaming media Download PDF

Info

Publication number
CN108347625B
CN108347625B CN201810198835.0A CN201810198835A CN108347625B CN 108347625 B CN108347625 B CN 108347625B CN 201810198835 A CN201810198835 A CN 201810198835A CN 108347625 B CN108347625 B CN 108347625B
Authority
CN
China
Prior art keywords
target
index block
content
description information
index
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
Application number
CN201810198835.0A
Other languages
Chinese (zh)
Other versions
CN108347625A (en
Inventor
徐小龙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sumavision Technologies Co Ltd
Original Assignee
Sumavision Technologies Co Ltd
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 Sumavision Technologies Co Ltd filed Critical Sumavision Technologies Co Ltd
Priority to CN201810198835.0A priority Critical patent/CN108347625B/en
Publication of CN108347625A publication Critical patent/CN108347625A/en
Application granted granted Critical
Publication of CN108347625B publication Critical patent/CN108347625B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/239Interfacing the upstream path of the transmission network, e.g. prioritizing client content requests
    • H04N21/2393Interfacing the upstream path of the transmission network, e.g. prioritizing client content requests involving handling client 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/236Assembling of a multiplex stream, e.g. transport stream, by combining a video stream with other content or additional data, e.g. inserting a URL [Uniform Resource Locator] into a video stream, multiplexing software data into a video stream; Remultiplexing of multiplex streams; Insertion of stuffing bits into the multiplex stream, e.g. to obtain a constant bit-rate; Assembling of a packetised elementary stream
    • H04N21/23608Remultiplexing multiplex streams, e.g. involving modifying time stamps or remapping the packet identifiers
    • 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/238Interfacing the downstream path of the transmission network, e.g. adapting the transmission rate of a video stream to network bandwidth; Processing of multiplex streams
    • H04N21/2389Multiplex stream processing, e.g. multiplex stream encrypting
    • 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/242Synchronization processes, e.g. processing of PCR [Program Clock References]
    • 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/434Disassembling 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/4344Remultiplexing of multiplex streams, e.g. by modifying time stamps or remapping the packet identifiers
    • 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/435Processing of additional data, e.g. decrypting of additional data, reconstructing software from modules extracted from the transport stream
    • 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/438Interfacing the downstream path of the transmission network originating from a server, e.g. retrieving MPEG packets from an IP network
    • H04N21/4385Multiplex stream processing, e.g. multiplex stream decrypting
    • 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/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs
    • H04N21/4402Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs involving reformatting operations of video signals for household redistribution, storage or real-time display

Abstract

The embodiment of the invention provides a method and a device for positioning TS streaming media, which relate to the technical field of Internet and signal processing, and comprise the steps of firstly, acquiring a positioning playing request sent by a user, then, if the index block description information containing the target time position is not found in the description information cache pool, searching and downloading the target index block by a binary search method, finally determining the key frame byte position closest to the target time position based on the target index block, and the content position of the target TS content is searched according to the nearest key frame byte position, thereby achieving the purpose of quickly and accurately positioning the TS content, solving the technical problem that the positioning time is longer when the prior streaming media positioning technology positions the larger TS content, therefore, the technical effects of accurately positioning the target position of the TS content and quickly positioning the target position of the TS content are achieved.

Description

Method and device for positioning TS streaming media
Technical Field
The invention relates to the technical field of internet and signal processing, in particular to a method and a device for positioning TS streaming media.
Background
The TS format is MPEG2-TS, and the MPEG2-TS format is characterized by the requirement that any segment of the video stream can be decoded independently. Because the TS stream has a strong capability of resisting transmission error, the MPEG-2 code stream transmitted in the transmission medium at present basically adopts the packet format of the TS stream. In order to provide guaranteed end-to-end service quality for users, video content needs to be distributed from a central source storage to an edge CDN node close to a user end through a CDN (content Delivery network) system, and a streaming server of the edge CDN node provides VOD service for the users. And the TS content is injected into the CDN system through the media resource system, the CDN system realizes the storage, distribution and cache of the TS content, and finally the TS content is provided for the user to play. In consideration of user playing experience and playing quality, the CDN system is required to accurately and quickly position the TS content, so that playing delay is reduced, and playing quality is improved. With the development of high definition services, the TS content is larger and larger, and the requirement for positioning delay of the TS content is higher and higher.
Existing TS content location techniques are broadly classified into the following categories: the TS file is directly positioned, the TS file is positioned according to the byte proportion, and the positioning mode of combining the direct positioning of the TS file and the positioning of the TS file according to the byte proportion is adopted.
The TS file direct positioning mode has the defect of long positioning time, because the TS file is large, the time consumed for positioning according to the traversal mode is large, the playing delay is caused, and the larger the TS file is, the larger the positioning delay is. The problem of inaccurate positioning exists in the mode of positioning the TS file according to the byte proportion, and the positioned position is not necessarily the TS key frame, so that the playing effect is influenced. The positioning mode combining the direct positioning of the TS file and the positioning of the TS file according to the byte ratio requires scanning of the entire TS file, and in the CDN system, the edge node does not necessarily store the complete TS file, and needs to return to the source from the CDN center node, so that the target position cannot be obtained by the positioning method.
No effective solution has been proposed to the above problems.
Disclosure of Invention
In view of this, the present invention provides a method and an apparatus for locating a TS streaming media, so as to solve the technical problem that the existing streaming media locating technology needs a long locating time when locating a large TS content.
The embodiment of the invention provides a method for positioning TS streaming media, which is applied to a CDN system and comprises the following steps: acquiring a positioning playing request sent by a user, wherein the positioning playing request comprises a content name of a target TS content requested to be played and a target time position of the target TS content, and the target time position is a time position of the target TS content for requesting playing time; if the index block description information containing the target time position is not found in the description information cache pool, searching and downloading a target index block by a binary search method, wherein the target index block is the index block containing the target time position; and determining the key frame byte position closest to the target time position based on the target index block, and searching the content position of the target TS content according to the closest key frame byte position.
Further, determining a key frame byte position closest to the target time position based on the target index block, and searching a content position of the target TS content according to the closest key frame byte position includes: analyzing the target index block to obtain index block description information of the target index block, wherein the index block description information comprises an index starting key frame time position and an index ending key frame time position; and acquiring the key frame byte position closest to the target time position based on the index block description information, and searching the content position of the target TS content according to the closest key frame byte position.
Further, the index chunk description information includes at least one of: index start key frame time position, index end key frame time position, index byte offset position, and index block length.
Further, searching for the download target index block by a binary search method comprises: searching first index block description information from the description information cache pool, wherein the first index block description information is index block description information which is in front of the target time position and is closest to the target time position in the description information cache pool; if the first index block description information is found, searching second index block description information in the description information cache pool, wherein the second index block description information is index block description information which is behind the target time position and is closest to the target time position in the description information cache pool; and if the second index block description information is found, acquiring the position of an index block positioned in the middle between the second index block description information and the first index block description information, and taking the index block in the middle as the target index block.
Further, if the first index block description information is not found, downloading the last index block in an index file, and finding the target index block between the last index block and the index block in the middle by a binary finding method until the target index block is found; if the second index block description information is not found, downloading a first index block of an index file, and searching the target index block between the first index block and the index block in the middle by a binary search method until the target index block is found.
Further, the position of the index block in the middle is obtained by adding the position of the second index block description information and the position of the first index block description information and dividing by two.
Further, the method further comprises: acquiring a key frame byte position closest to the target time position from the target index block; scanning local TS content of an edge streaming media server, and if the target TS content exists in the local TS content of the edge streaming media server, locating the nearest key frame byte position in the local TS content of the edge streaming media server; and taking the position corresponding to the nearest key frame byte position in the local TS content of the edge streaming media server as the target TS content position, and sending the target TS content corresponding to the target TS content position to a terminal.
Further, the method further comprises: if the target TS content does not exist in the local TS content of the edge streaming media server, searching and downloading the TS content corresponding to the nearest key frame byte position from a CDN central source content storage device; scanning the downloaded TS content, and searching target TS content corresponding to the position of the target TS content from the TS content; and sending the corresponding target TS content to a terminal.
According to an embodiment of the present invention, there is also provided a device for positioning TS streaming media, where the device for positioning TS streaming media includes: an obtaining unit, configured to obtain a positioning playing request sent by a user, where the positioning playing request includes a content name of a target TS content requested to be played and a target time position of the target TS content, and the target time position is a time position of a playing time requested by the target TS content; a searching and downloading unit, configured to search and download a target index block by using a binary search method if index block description information including the target time position is not found in a description information cache pool, where the target index block is an index block including the target time position; and the searching and positioning unit is used for determining the key frame byte position closest to the target time position based on the target index block and searching the content position of the target TS content according to the closest key frame byte position.
Further, the searching and positioning unit comprises: the analysis module is used for analyzing the target index block to obtain index block description information of the target index block, wherein the index block description information comprises a starting key frame time position and an ending key frame time position; and the searching and positioning module is used for acquiring the key frame byte position closest to the target time position based on the index block description information, and further searching the content position of the target TS content according to the closest key frame byte position.
In the embodiment of the invention, firstly, a positioning playing request sent by a user is obtained, then, if index block description information containing a target time position is not found in a description information cache pool, a downloading target index block is searched through a binary search method, finally, a key frame byte position closest to the target time position is determined based on the target index block, and a content position of target TS content is searched according to the closest key frame byte position. In the embodiment of the invention, the purpose of quickly and accurately positioning the TS content is achieved by the method for downloading the TS content index in an incremental sectional manner, and the technical problem that the positioning time is long when the existing streaming media positioning technology is used for positioning the larger TS content is solved, so that the technical effects of accurately positioning the target position of the TS content and quickly positioning the target position of the TS content are realized.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a flowchart of a method for locating TS streaming media according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of a CDN system according to an embodiment of the present invention;
fig. 3 is a structural diagram of index chunk description information provided according to an embodiment of the present invention;
FIG. 4 is a flowchart of a method for searching a download target index block by binary search according to an embodiment of the present invention;
FIG. 5 is a flowchart of a positioning process for obtaining the byte position of the index key frame according to the target time position according to an embodiment of the present invention;
FIG. 6 is a diagram illustrating an embodiment of obtaining byte positions of index key frames from target time positions according to the present invention;
FIG. 7 is a flowchart of searching for target TS content based on the content location of the target TS content according to an embodiment of the present invention;
fig. 8 is a schematic diagram of a device for locating TS streaming media according to an embodiment of the present invention.
Detailed Description
To make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The first embodiment is as follows:
fig. 1 is a flowchart of a method for positioning TS streaming media according to an embodiment of the present invention, where the method for positioning TS streaming media is applied in a CDN system, and as shown in fig. 1, the method includes:
step S102, a positioning playing request sent by a user is obtained, wherein the positioning playing request comprises a content name of a target TS content requested to be played and a target time position of the target TS content, and the target time position is a time position of a target TS content request playing time.
And step S104, if the index block description information containing the target time position is not found in the description information cache pool, searching and downloading the target index block by a binary search method, wherein the target index block is the index block containing the target time position.
And step S106, determining the key frame byte position closest to the target time position based on the target index block, and searching the content position of the target TS content according to the closest key frame byte position.
In the embodiment of the invention, the user terminal sends a positioning playing request for positioning a TS video content playing request to the CDN system, wherein the positioning playing request carries the target time position of the TS video content to be played. The CDN system comprises a CDN central source content storage device and a CDN edge streaming media server. The CDN central source content storage device can provide the storage of the TS source content and the generation of the TS index; the CDN edge streaming media server can provide downloading, caching, positioning and streaming of TS content, and provides streaming media service for end users. Fig. 2 is a schematic structural diagram of a CDN system according to an embodiment of the present invention.
In the embodiment of the invention, firstly, a positioning playing request sent by a user is obtained, then, if index block description information containing a target time position is not found in a description information cache pool, a downloading target index block is searched through a binary search method, finally, a key frame byte position closest to the target time position is determined based on the target index block, and a content position of target TS content is searched according to the closest key frame byte position. In the embodiment of the invention, the purpose of quickly and accurately positioning the TS content is achieved by the method for downloading the TS content index in an incremental sectional manner, and the technical problem that the positioning time is long when the existing streaming media positioning technology is used for positioning the larger TS content is solved, so that the technical effects of accurately positioning the target position of the TS content and quickly positioning the target position of the TS content are realized.
In an optional embodiment, determining a key frame byte position closest to the target time position based on the target index block, and finding a content position of the target TS content according to the closest key frame byte position comprises:
analyzing the target index block to obtain index block description information of the target index block, wherein the index block description information comprises an index starting key frame time position and an index ending key frame time position;
and acquiring the key frame byte position closest to the target time position based on the index block description information, and searching the content position of the target TS content according to the closest key frame byte position.
Specifically, the index chunk description information includes at least one of: index start key frame time position, index end key frame time position, index byte offset position, and index block length.
Fig. 3 is a structural diagram of index chunk description information provided according to an embodiment of the present invention. In the embodiment of the present invention, as shown in fig. 3, the index block description information structure includes an index byte offset position, an index start key frame time position, an index end key frame time position, and an index block length, where the index byte offset position is a byte offset position of an index block relative to an index file start position and is an integer multiple of a fixed size of the index block; the index start key frame Time position is the PTS (Presentation Time Stamp) Time difference information of the first key frame in the index block, and is the difference value of the PTS of the first key frame in the first index block relative to the index file; the index end key frame time position is the PTS time difference information of the last key frame in the index block relative to the PTS difference of the first key frame in the first index block of the index file.
In the embodiment of the invention, the purpose of quickly and accurately positioning the TS content is achieved by the method for downloading the TS content index in an incremental sectional manner, and the technical problem that the positioning time is long when the existing streaming media positioning technology is used for positioning the larger TS content is solved, so that the technical effects of accurately positioning the target position of the TS content and quickly positioning the target position of the TS content are realized.
Fig. 4 is a flowchart of a method for searching a download target index block by binary search according to an embodiment of the present invention.
In an alternative embodiment, as shown in fig. 4, the searching for the download target index block by the binary search method includes the following steps:
step S401, searching for first index chunk description information from the description information cache pool, where the first index chunk description information is index chunk description information that is before the target time position and closest to the target time position in the description information cache pool.
In the embodiment of the present invention, an index location unit in the CDN edge streaming media server divides an index file into n blocks of a fixed size, that is, the index blocks, and records description information of the index blocks that have been cached by a cache unit using a cache pool, that is, the description information cache pool.
Step S402, if the first index block description information is found, second index block description information is found from the description information cache pool, wherein the second index block description information is index block description information which is behind the target time position and is closest to the target time position in the description information cache pool.
Step S403, if the second index block description information is found, acquiring a position of the index block located in the middle between the second index block description information and the first index block description information, and taking the index block in the middle as a target index block.
Step S404, if the description information of the first index block is not found, downloading the last index block in the index file, and searching a target index block between the last index block and the index block in the middle by a binary search method until the target index block is found;
step S405, if the description information of the second index block is not found, downloading the first index block of the index file, and finding the target index block between the first index block and the index block in the middle by a binary search method until the target index block is found.
Specifically, the position of the index block in the middle is obtained by adding the position of the second index block description information and the position of the first index block description information and dividing by two.
In the embodiment of the invention, the purpose of quickly and accurately positioning the TS content is achieved by the method for downloading the TS content index in an incremental sectional manner, and the technical problem that the positioning time is long when the existing streaming media positioning technology is used for positioning the larger TS content is solved, so that the technical effects of accurately positioning the target position of the TS content and quickly positioning the target position of the TS content are realized.
The following describes a specific example of the above positioning procedure for obtaining the byte position of the index key frame by the target time position.
Fig. 5 is a flowchart of a positioning process for obtaining the byte position of the index key frame by the target time position according to an embodiment of the present invention.
As shown in fig. 5, the positioning process for obtaining the byte position of the index key frame by the target time position includes the following steps:
in step S501, a client target time position seek _ npt is received, where the seek _ npt position is a time offset position.
Step S502, determining whether the index block description information cache pool includes a seek _ npt position, searching the index block description information cache pool, and finding the index block description information whose index start key frame time position is less than the seek _ npt and index end key frame time position is greater than the seek _ npt.
Step S503, if the index block description information can be found, ending the search, and entering the TS location positioning process.
In step S504, if the index block description information including the seek _ npt position is not found, the index block description information is searched by a binary search method, and steps S5041 to S5045 are the flow of the binary search method.
Step S5041, finding the index block descriptor min _ block (i.e., the first index block descriptor in fig. 4) closest to the left of the seek _ npt position from the index block descriptor cache pool, and comparing the ending key frame time position in the index block descriptor with the seek _ npt.
In step S5042, if the index block description information is not found on the left side of the seek _ npt, the first index block of the index file is obtained as the index block to be downloaded, and step S505 is continued.
Specifically, the block number of the first index block is 0, the offset bit of the start byte of the index block is 0, and the downloaded length is the size of the index block, which is handed to the index downloading unit to download the index block.
In step S5043, if the nearest index block description information is found on the left side of the seek _ npt, the index block description information max _ block (i.e., the second index block description information in fig. 4) closest to the right side of the seek _ npt position is found from the index block description information cache pool, and the comparison is performed according to the starting key frame time position in the index block description information and the seek _ npt.
In step S5044, if the index block description information is not found on the right of the seek _ npt, the last index block of the index file is obtained as the index block to be downloaded, and the step SS505 is continued.
Specifically, the starting byte offset of the last index chunk is set to the chunk number × chunk fixed size, the length of the download is the length of the last index chunk (the length of the last index chunk may not be larger than one index chunk fixed size), and the index chunk is delivered to the index download unit to download the index chunk.
In step S5045, if the latest index block description information is found on the right of the seek _ npt, the position of the index block located in the middle between the max _ block and the min _ block (i.e., the position of the index block located in the middle between the second index block description information and the first index block description information in fig. 4) is obtained, and then step S505 is continued.
Firstly, calculating the number of an intermediate index block, wherein mid _ block number is (max _ block number + min _ block number)/2, mid _ block start byte offset is set to mid _ block number block fixed size, the download length is the index block length, and the index block is delivered to an index download unit to download the index block.
Step S505, downloading the index block, obtaining the initial byte offset position of the index block as the download initial position, obtaining the download length, and downloading the index content from the CDN central source content device.
Step S506, the index block is parsed, the CDN edge streaming media server index parsing unit completes parsing, and the parsed index content is handed to the cache unit for caching after parsing is completed.
Step S507, caching the index block description information, analyzing a first key frame time position of the index block as a start key frame position, a last key frame time position of the index block as an end key frame position, a fixed size of the index block number x the index block as an initial download position of the index block, and storing three parameter description information of the index block in the cache.
Returning to step S502, continuing to determine whether the index block description information buffer pool contains the seek _ npt position, executing in a loop until the index key frame byte position seek _ offset is located, and exiting the locating process.
Fig. 6 is a schematic diagram of an embodiment of obtaining byte positions of index key frames from target time positions according to the present invention.
As shown in fig. 6, first, an index block with a number of 0 (i.e., the first index block in step S5042 in fig. 5) is downloaded, the index block is parsed, and an index header is obtained, wherein the index header is in the 1 st index block, the index header is parsed, the current size of the index file is obtained, if the size of the index file is 2592Kbytes, the index is diced according to the current size of the index file, for example, each index block has a fixed size of 64Kbytes, and is divided into 41 blocks, and the size of the last block with a number of 40 (i.e., the index block with a block number of block × block in step S5044 in fig. 5) is not more than 64Kbytes, and only 32Kbytes is obtained, seek _ npt is the first target time position of the user, and now is the end time position of the current TS.
By the index key frame positioning method shown in fig. 5, the index blocks with the numbers 0, 40, and 20 (i.e., the index block in the middle described in fig. 5) downloaded in sequence are the blocks to be downloaded, the index blocks with the numbers 0, 20, and 40 shown in fig. 6 are the blocks to be downloaded, the index block with the number 20 includes the target time position, and the key frame byte position seek _ offset is obtained.
In the embodiment of the invention, the index structure is used for describing an index file and comprises an index head and index record information, wherein the index head comprises information such as TS code rate, multiple speed, duration, size and the like; the index record information includes index record information such as TS video frames (I frame, P frame, and B frame), PCR, and the like, and the record information further includes information such as TS byte offset position, decoding Time stamp dts (decoding Time stamp), presentation Time stamp pts (presentation Time stamp), program clock reference PCR (programclock reference), and the like.
In the embodiment of the invention, the purpose of quickly and accurately positioning the TS content is achieved by the method for downloading the TS content index in an incremental sectional manner, and the technical problem that the positioning time is long when the existing streaming media positioning technology is used for positioning the larger TS content is solved, so that the technical effects of accurately positioning the target position of the TS content and quickly positioning the target position of the TS content are realized.
Fig. 7 is a flowchart for searching for target TS content based on a content location of the target TS content according to an embodiment of the present invention.
In an alternative embodiment, as shown in fig. 7, the process of finding the target TS content includes the following steps:
step S701, a key frame byte position closest to the target time position is obtained from the target index block.
Step S702, scan the local TS content of the edge streaming server.
Step S703, determining whether the local TS content of the edge streaming media server has the target TS content.
Step S704, if yes, locating the nearest key frame byte position in the local TS content of the edge streaming media server.
Step S705, the position corresponding to the nearest key frame byte position in the local TS content of the edge streaming server is taken as the target TS content position, and then step S708 is continuously executed.
Step S706, if the judgment result is no, searching and downloading TS content corresponding to the nearest key frame byte position from the CDN central source content storage device;
step S707, scanning the downloaded TS content, and searching a target TS content corresponding to the position of the target TS content from the TS content;
in step S708, the TS content corresponding to the target TS content location is transmitted to the terminal.
In the embodiment of the invention, the key frame byte position closest to the target time position is firstly obtained from the target index block, then the local TS content of the edge streaming media server is scanned, if the target TS content exists in the local TS content of the edge streaming media server, the nearest key frame byte position is positioned in the local TS content of the edge streaming media server, and then the target TS content is sent to the terminal from the position; if the local TS content of the edge streaming media server does not have the target TS content, searching and downloading the TS content corresponding to the nearest key frame byte position from the CDN central source content storage device, scanning the downloaded TS content, searching the target TS content corresponding to the target TS content position from the TS content, and further sending the target TS content to the terminal.
In this embodiment of the present invention, the CDN central source content storage device includes: the system comprises a TS file injection unit, an index generation unit and a stream pushing unit, wherein the TS file injection unit is used for receiving injection of TS content of a media asset system, storing the TS content to the local and managing the content, the TS content comprises real-time content and non-real-time content, the real-time content provides live broadcast, time shift and review services, and the non-real-time content provides on-demand services; the index generating unit is used for generating an index file for the TS content, and the index file describes information such as the duration, the size and the coding type of the TS content and the offset position of each video frame of the TS in the TS file; the stream pushing unit is used for receiving a request for downloading the TS or the index from the CDN edge stream media server and pushing the TS content or the index to the edge stream media server.
In the embodiment of the present invention, the CDN edge streaming server includes: the system comprises a TS/index downloading unit, a TS/index caching unit, an index analyzing unit, an index positioning unit, a TS positioning unit and a stream pushing unit.
The TS/index downloading unit is used for supporting TS downloading and index downloading, wherein the TS downloading is to download TS contents from the central source content storage device and cache TS content slices to the cache unit; the index downloading is to download the index content from the central source content storage device and send the index content to the index analysis unit for analysis.
And the index cache unit is used for caching the index content after the index analysis unit analyzes the index.
And the index analyzing unit is used for receiving the download content of the index downloading unit, analyzing the index according to the index structure, and caching the analyzed index content through the cache unit, wherein the analyzed index content comprises an index head and index recording information, and the index recording information comprises information of the TS key frame.
An index positioning unit for receiving a request of a TS positioning unit for searching a key frame position, the index positioning unit searching whether index block description information containing a request target time exists in an index block description information cache pool through a target time position, if so, the index positioning unit directly finding a key frame byte position with the nearest request target time from the cache unit, if not, searching an index block needing to be downloaded through a binary search algorithm to obtain an index byte offset position and an index block length of the index block, downloading the index block through an index downloading unit, analyzing an index of the index block, caching the analyzed content through the cache unit, recording the index block description information into the index block description information cache pool, and continuously positioning the index block containing the request target time from the index block description information cache pool through the request target time, the execution is repeated a plurality of times until the key frame byte position is found.
And the TS positioning unit is used for receiving a positioning playing request of a terminal user, acquiring a target time position, positioning a key frame byte position near the target time position from the index, and searching a target TS file from the local through the key frame byte position, namely a final target byte position. And if the local edge node does not exist, downloading the key frame byte position to the CDN central node through the TS downloading unit.
And the stream pushing unit is used for sending the TS data to the terminal user from the position of the TS key frame positioned by the TS positioning unit and providing the terminal user playing service.
In the embodiment of the invention, firstly, a positioning playing request sent by a user is obtained, then, if index block description information containing a target time position is not found in a description information cache pool, a downloading target index block is searched through a binary search method, finally, a key frame byte position closest to the target time position is determined based on the target index block, and a content position of target TS content is searched according to the closest key frame byte position. In the embodiment of the invention, the purpose of quickly and accurately positioning the TS content is achieved by the method for downloading the TS content index in an incremental sectional manner, and the technical problem that the positioning time is long when the existing streaming media positioning technology is used for positioning the larger TS content is solved, so that the technical effects of accurately positioning the target position of the TS content and quickly positioning the target position of the TS content are realized.
Example two:
the embodiment of the present invention further provides a device for positioning TS streaming media, where the device for positioning TS streaming media is mainly used to execute the method for positioning TS streaming media provided in the foregoing content of the embodiment of the present invention, and the device for positioning TS streaming media provided in the embodiment of the present invention is described in detail below.
Fig. 8 is a schematic diagram of a device for locating TS streaming media according to an embodiment of the present invention, as shown in fig. 8, the device for locating TS streaming media mainly includes an obtaining unit 10, a searching downloading unit 20, and a searching locating unit 30, where:
an obtaining unit 10, configured to obtain a positioning playing request sent by a user, where the positioning playing request includes a content name of a target TS content requested to be played and a target time position of the target TS content, and the target time position is a time position of a playing time requested by the target TS content;
the searching and downloading unit 20 is configured to search and download the target index block by using a binary search method if the index block description information including the target time position is not found in the description information cache pool, where the target index block is an index block including the target time position;
and the searching and positioning unit 30 is configured to determine, based on the target index block, a key frame byte position closest to the target time position, and search a content position of the target TS content according to the closest key frame byte position.
Optionally, the seeking location unit comprises: the analysis module is used for analyzing the target index block to obtain index block description information of the target index block, wherein the index block description information comprises a starting key frame time position and an ending key frame time position; and the searching and positioning module is used for acquiring the key frame byte position closest to the target time position based on the index block description information, and further searching the content position of the target TS content according to the closest key frame byte position.
In the embodiment of the invention, firstly, a positioning playing request sent by a user is obtained, then, if index block description information containing a target time position is not found in a description information cache pool, a downloading target index block is searched through a binary search method, finally, a key frame byte position closest to the target time position is determined based on the target index block, and a content position of target TS content is searched according to the closest key frame byte position. In the embodiment of the invention, the purpose of quickly and accurately positioning the TS content is achieved by the method for downloading the TS content index in an incremental sectional manner, and the technical problem that the positioning time is long when the existing streaming media positioning technology is used for positioning the larger TS content is solved, so that the technical effects of accurately positioning the target position of the TS content and quickly positioning the target position of the TS content are realized.
The device provided by the embodiment of the present invention has the same implementation principle and technical effect as the method embodiments, and for the sake of brief description, reference may be made to the corresponding contents in the method embodiments without reference to the device embodiments.
In addition, in the description of the embodiments of the present invention, unless otherwise explicitly specified or limited, the terms "mounted," "connected," and "connected" are to be construed broadly, e.g., as meaning either a fixed connection, a removable connection, or an integral connection; can be mechanically or electrically connected; they may be connected directly or indirectly through intervening media, or they may be interconnected between two elements. The specific meanings of the above terms in the present invention can be understood in specific cases to those skilled in the art.
In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicate orientations or positional relationships based on the orientations or positional relationships shown in the drawings, and are only for convenience of description and simplicity of description, but do not indicate or imply that the device or element being referred to must have a particular orientation, be constructed and operated in a particular orientation, and thus, should not be construed as limiting the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a non-volatile computer-readable storage medium executable by a processor. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
Finally, it should be noted that: the above-mentioned embodiments are only specific embodiments of the present invention, which are used for illustrating the technical solutions of the present invention and not for limiting the same, and the protection scope of the present invention is not limited thereto, although the present invention is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art can modify or easily conceive the technical solutions described in the foregoing embodiments or equivalent substitutes for some technical features within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the embodiments of the present invention, and they should be construed as being included therein. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (8)

1. A method for positioning TS streaming media is applied to a CDN system and comprises the following steps:
acquiring a positioning playing request sent by a user, wherein the positioning playing request comprises a content name of a target TS content requested to be played and a target time position of the target TS content, and the target time position is a time position of the target TS content for requesting playing time;
if the index block description information containing the target time position is not found in the description information cache pool, searching and downloading a target index block by a binary search method, wherein the target index block is the index block containing the target time position;
determining a key frame byte position closest to the target time position based on the target index block, and searching a content position of the target TS content according to the closest key frame byte position;
the searching for the download target index block by the binary search method comprises the following steps:
searching first index block description information from the description information cache pool, wherein the first index block description information is index block description information which is in front of the target time position and is closest to the target time position in the description information cache pool;
if the first index block description information is found, searching second index block description information in the description information cache pool, wherein the second index block description information is index block description information which is behind the target time position and is closest to the target time position in the description information cache pool;
if the second index block description information is found, acquiring the position of an index block positioned in the middle between the second index block description information and the first index block description information, and taking the index block in the middle as the target index block;
if the first index block description information is not found, downloading the last index block in an index file, and searching the target index block between the last index block and the index block in the middle by a binary search method until the target index block is found;
if the second index block description information is not found, downloading a first index block of an index file, and searching the target index block between the first index block and the index block in the middle by a binary search method until the target index block is found.
2. The method of claim 1, wherein determining a key frame byte position closest to the target temporal position based on the target index chunk, and finding a content position of the target TS content according to the closest key frame byte position comprises:
analyzing the target index block to obtain index block description information of the target index block, wherein the index block description information comprises an index starting key frame time position and an index ending key frame time position;
and acquiring the key frame byte position closest to the target time position based on the index block description information, and searching the content position of the target TS content according to the closest key frame byte position.
3. The method of claim 1, wherein the index chunk description information comprises at least one of: index start key frame time position, index end key frame time position, index byte offset position, and index block length.
4. The method of claim 1, wherein the position of the middle index block is obtained by adding the position of the second index block description information and the position of the first index block description information and dividing by two.
5. The method of claim 1, further comprising:
acquiring a key frame byte position closest to the target time position from the target index block;
scanning local TS content of an edge streaming media server, and if the target TS content exists in the local TS content of the edge streaming media server, locating the nearest key frame byte position in the local TS content of the edge streaming media server;
and taking the position corresponding to the nearest key frame byte position in the local TS content of the edge streaming media server as the target TS content position, and sending the target TS content corresponding to the target TS content position to a terminal.
6. The method of claim 5, further comprising:
if the target TS content does not exist in the local TS content of the edge streaming media server, searching and downloading the TS content corresponding to the nearest key frame byte position from a CDN central source content storage device;
scanning the downloaded TS content, and searching target TS content corresponding to the position of the target TS content from the TS content;
and sending the corresponding target TS content to a terminal.
7. An apparatus for TS streaming media positioning, wherein the apparatus for TS streaming media positioning comprises:
an obtaining unit, configured to obtain a positioning playing request sent by a user, where the positioning playing request includes a content name of a target TS content requested to be played and a target time position of the target TS content, and the target time position is a time position of a playing time requested by the target TS content;
a searching and downloading unit, configured to search and download a target index block by using a binary search method if index block description information including the target time position is not found in a description information cache pool, where the target index block is an index block including the target time position;
the searching and positioning unit is used for determining a key frame byte position closest to the target time position based on the target index block and searching the content position of the target TS content according to the closest key frame byte position;
wherein the search downloading unit is configured to:
searching first index block description information from the description information cache pool, wherein the first index block description information is index block description information which is in front of the target time position and is closest to the target time position in the description information cache pool;
if the first index block description information is found, searching second index block description information in the description information cache pool, wherein the second index block description information is index block description information which is behind the target time position and is closest to the target time position in the description information cache pool;
if the second index block description information is found, acquiring the position of an index block positioned in the middle between the second index block description information and the first index block description information, and taking the index block in the middle as the target index block;
if the first index block description information is not found, downloading the last index block in an index file, and searching the target index block between the last index block and the index block in the middle by a binary search method until the target index block is found;
if the second index block description information is not found, downloading a first index block of an index file, and searching the target index block between the first index block and the index block in the middle by a binary search method until the target index block is found.
8. The apparatus of claim 7, wherein the lookup location unit comprises:
the analysis module is used for analyzing the target index block to obtain index block description information of the target index block, wherein the index block description information comprises a starting key frame time position and an ending key frame time position;
and the searching and positioning module is used for acquiring the key frame byte position closest to the target time position based on the index block description information, and further searching the content position of the target TS content according to the closest key frame byte position.
CN201810198835.0A 2018-03-09 2018-03-09 Method and device for positioning TS streaming media Active CN108347625B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810198835.0A CN108347625B (en) 2018-03-09 2018-03-09 Method and device for positioning TS streaming media

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810198835.0A CN108347625B (en) 2018-03-09 2018-03-09 Method and device for positioning TS streaming media

Publications (2)

Publication Number Publication Date
CN108347625A CN108347625A (en) 2018-07-31
CN108347625B true CN108347625B (en) 2020-10-13

Family

ID=62957995

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810198835.0A Active CN108347625B (en) 2018-03-09 2018-03-09 Method and device for positioning TS streaming media

Country Status (1)

Country Link
CN (1) CN108347625B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109120989B (en) * 2018-10-08 2021-06-29 四川长虹电器股份有限公司 Method for tracing and positioning during TS stream playing
CN109862423B (en) * 2019-01-03 2021-06-22 珠海亿智电子科技有限公司 Video seek method, device, terminal and computer readable storage medium
CN112671690B (en) * 2019-10-16 2022-08-30 中国电信股份有限公司 Streaming media communication method, device, system and storage medium
CN110856046B (en) * 2019-11-06 2021-12-31 普联技术有限公司 Method, device, terminal equipment and medium for positioning TS streaming media file
CN113630643B (en) * 2020-05-09 2023-10-20 中央电视台 Media stream recording method and device, computer storage medium and electronic equipment
CN113642422A (en) * 2021-07-27 2021-11-12 东北电力大学 Continuous Chinese sign language recognition method

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101719161A (en) * 2009-12-23 2010-06-02 成都市华为赛门铁克科技有限公司 Video index method and device
CN102487458A (en) * 2010-12-02 2012-06-06 中兴通讯股份有限公司 Method for broadcasting and processing TS (Transport Stream) document and device thereof
CN103813185A (en) * 2014-01-26 2014-05-21 中兴通讯股份有限公司 Method, server and client for quickly distributing segmented programs
CN104954885A (en) * 2014-03-28 2015-09-30 中国电信股份有限公司 Method of distributing streaming media and content distribution network node
CN105979378A (en) * 2016-05-31 2016-09-28 深圳创维数字技术有限公司 Player fast forward fast rewind control method and player fast forward fast rewind control system
CN106031181A (en) * 2014-04-18 2016-10-12 Lg电子株式会社 Broadcast signal transmitting apparatus, broadcast signal receiving apparatus, broadcast signal transmitting method and broadcast signal receiving method

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040218760A1 (en) * 2003-01-03 2004-11-04 Chaudhuri Parimal Pal System and method for data encryption and compression (encompression)

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101719161A (en) * 2009-12-23 2010-06-02 成都市华为赛门铁克科技有限公司 Video index method and device
CN102487458A (en) * 2010-12-02 2012-06-06 中兴通讯股份有限公司 Method for broadcasting and processing TS (Transport Stream) document and device thereof
CN103813185A (en) * 2014-01-26 2014-05-21 中兴通讯股份有限公司 Method, server and client for quickly distributing segmented programs
CN104954885A (en) * 2014-03-28 2015-09-30 中国电信股份有限公司 Method of distributing streaming media and content distribution network node
CN106031181A (en) * 2014-04-18 2016-10-12 Lg电子株式会社 Broadcast signal transmitting apparatus, broadcast signal receiving apparatus, broadcast signal transmitting method and broadcast signal receiving method
CN105979378A (en) * 2016-05-31 2016-09-28 深圳创维数字技术有限公司 Player fast forward fast rewind control method and player fast forward fast rewind control system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
Programming Hierarchical TS Fuzzy Systems;Yuehui Chen ET AL;《2006 International Symposium on Evolving Fuzzy Systems》;20061130;全文 *

Also Published As

Publication number Publication date
CN108347625A (en) 2018-07-31

Similar Documents

Publication Publication Date Title
CN108347625B (en) Method and device for positioning TS streaming media
KR101442999B1 (en) Manifest file updates for network streaming of coded video data
KR101395193B1 (en) Enhanced block-request streaming system using signaling or block creation
KR101437530B1 (en) Enhanced block-request streaming using block partitioning or request controls for improved client-side handling
CN109348251B (en) Method and device for video playing, computer readable medium and electronic equipment
KR101741484B1 (en) Enhanced block-request streaming system for handling low-latency streaming
KR101395200B1 (en) Enhanced block-request streaming using scalable encoding
KR101456957B1 (en) Enhanced block-request streaming using cooperative parallel http and forward error correction
KR101480828B1 (en) Enhanced block-request streaming using url templates and construction rules
US20050066063A1 (en) Sparse caching for streaming media
WO2019011430A1 (en) Fast tune-in for low latency streaming
CN109168020A (en) Method for processing video frequency, device, calculating equipment and storage medium based on live streaming
US11843840B2 (en) Random access at resync points of DASH segments
WO2018014545A1 (en) Code stream data processing method and apparatus
CN112929677B (en) Live video playback method and device and server
CN109587517B (en) Multimedia file playing method and device, server and storage medium
EP4128809A1 (en) Determination of availability of chunks of data for network streaming media data
Patús Díaz Characterization and identification of Netflix encrypted traffic
CN114727130A (en) Method and system for virtually cutting TS file to provide HLS on-demand service
TR201905118T4 (en) Cheating modes for network streaming of encoded video data

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