CN109040769A - Direct broadcast time-shift method and device based on HLS protocol - Google Patents

Direct broadcast time-shift method and device based on HLS protocol Download PDF

Info

Publication number
CN109040769A
CN109040769A CN201810965928.1A CN201810965928A CN109040769A CN 109040769 A CN109040769 A CN 109040769A CN 201810965928 A CN201810965928 A CN 201810965928A CN 109040769 A CN109040769 A CN 109040769A
Authority
CN
China
Prior art keywords
time
file
request
shifting broadcasting
identifier
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.)
Pending
Application number
CN201810965928.1A
Other languages
Chinese (zh)
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.)
Guangdong Southern Digital Television Wireless Communication Co Ltd
Original Assignee
Guangdong Southern Digital Television Wireless Communication 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 Guangdong Southern Digital Television Wireless Communication Co Ltd filed Critical Guangdong Southern Digital Television Wireless Communication Co Ltd
Priority to CN201810965928.1A priority Critical patent/CN109040769A/en
Publication of CN109040769A publication Critical patent/CN109040769A/en
Pending legal-status Critical Current

Links

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/21Server components or server architectures
    • H04N21/218Source of audio or video content, e.g. local disk arrays
    • H04N21/2187Live feed
    • 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/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/432Content retrieval operation from a local storage medium, e.g. hard-disk
    • H04N21/4325Content retrieval operation from a local storage medium, e.g. hard-disk by playing back content from the storage medium
    • 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/45Management operations performed by the client for facilitating the reception of or the interaction with the content or administrating data related to the end-user or to the client device itself, e.g. learning user preferences for recommending movies, resolving scheduling conflicts
    • H04N21/458Scheduling content for creating a personalised stream, e.g. by combining a locally stored advertisement with an incoming stream; Updating operations, e.g. for OS modules ; time-related management operations
    • H04N21/4586Content update operation triggered locally, e.g. by comparing the version of software modules in a DVB carousel to the version stored locally
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/80Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
    • H04N21/83Generation or processing of protective or descriptive data associated with content; Content structuring
    • H04N21/845Structuring of content, e.g. decomposing content into time segments
    • H04N21/8456Structuring of content, e.g. decomposing content into time segments by decomposing the content in the time domain, e.g. in time segments
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/80Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
    • H04N21/85Assembly of content; Generation of multimedia applications
    • H04N21/854Content authoring
    • H04N21/85406Content authoring involving a specific file format, e.g. MP4 format

Abstract

The direct broadcast time-shift method and device based on HLS protocol that the invention discloses a kind of, first receive the time shifting broadcasting request that client is initiated, further according to the channel identication and initial time in request, the file name of the starting TS slicing files to be retrieved of determination, file name is then based on to search and record corresponding TS slicing files, to generate the played file of corresponding M3U8 format, played file is finally sent to client.Need to set concordance list compared with the prior art in advance, directly the time is written in the TS file name in M3U8 file for technical solution of the present invention, does not depend on independent index file, to reduce the time-consuming for searching index file, improves time shift efficiency.

Description

Direct broadcast time-shift method and device based on HLS protocol
Technical field
The present invention relates to field of computer technology more particularly to a kind of direct broadcast time-shift method and devices based on HLS protocol.
Background technique
HTTP Live Streaming (abbreviation is HLS) is the Streaming Media based on HTTP proposed by Apple Inc. The network transmission protocol.Its working principle be entire stream is divided into it is small one by one downloaded based on the file of HTTP, every time only It downloads.When Media Stream is playing, client be can choose from many different Back Up Sources under different rates Same resource is carried, flow media session is allowed to adapt to different data rates.When starting a flow media session, client meeting One extended M3U (m3u8) playlist file comprising metadata of downloading, for finding available Media Stream.
And if user wants to realize that time shifting broadcasting (after time shaft moves forward sometime, is broadcast into virtual live streaming Put), then it is traditional that the index file being pre-created can be searched based on HLS time shifting broadcasting, specific TS fragment is navigated to, is regenerated The M3U8 file of Cheng Xin is downloaded for user and is played.Record has sometime corresponding TS slicing files name in index file.When After a TS fragment in M3U8 file plays, sequence number parameter is added one automatically by server, to be switched to next TS fragment. This playback method depends on independent index file, need to record more parts of videos before time shifting broadcasting to create corresponding index text Part occupies the space of server, and retrieval time is longer, influences user experience.
Summary of the invention
The embodiment of the present invention proposes a kind of direct broadcast time-shift method and device based on HLS protocol, will directly be written the time In TS file name in M3U8 file, independent index file is not depended on, to reduce the time-consuming for searching index file, is improved Time shift efficiency.
The embodiment of the present invention provides a kind of direct broadcast time-shift method based on HLS protocol, comprising:
Receive the request of the first time shifting broadcasting;Wherein, first time shifting broadcasting request includes: the first channel identifier, the The first initial time that one time shift broadcast identifier and request play;Wherein, time shifting broadcasting identifier is current for unique identification The corresponding client of playing request;
According to first channel identifier and first initial time, the starting TS slicing files to be retrieved of determination File name;
Corresponding TS slicing files are searched and record, based on the file name to generate the broadcasting of corresponding M3U8 format File;
Send the played file of the M3U8 format.
Further, described to search and record corresponding TS slicing files based on the file name, it is corresponding to generate The played file of M3U8 format, specifically:
Search and record corresponding three TS slicing files based on the file name, and three TS slicing files File name is ranked up, and generates the played file of corresponding M3U8 format;
Wherein, first TS slicing files of the played file are the starting TS slicing files.
Further, the direct broadcast time-shift method based on HLS protocol further include:
Receive the request of the second time shifting broadcasting;
Second moves broadcast identifier and requests the play second starting when parsing the second time shifting broadcasting request to obtain Moment;
Judge that the second time shifting broadcasting identifier whether there is;
If it exists, then corresponding initial time of time shifting broadcasting identifier that will be recorded in memory, when as described second Move the initial time of playing request;
If it does not exist, then the second initial time played the request that the parsing obtains, broadcasts as second time shift Put the initial time of request.
Further, if the second time shifting broadcasting identifier exists, further comprise:
Update the TS slicing files in the played file of the corresponding M3U8 format of the second time shifting broadcasting identifier.
Correspondingly, the present invention provides a kind of direct broadcast time-shift device based on HLS protocol, comprising: the first receiving module, really Cover half block, generation module and sending module;
Wherein, first receiving module is for receiving the request of the first time shifting broadcasting;Wherein, first time shifting broadcasting is asked Ask includes: the first channel identifier, the first time shifting broadcasting identifier and the first initial time for requesting broadcasting;Wherein, time shift is broadcast Identifier is put for the corresponding client of the currently playing request of unique identification;
The determining module is used for according to first channel identifier and first initial time, what determination to be retrieved Originate the file name of TS slicing files;
The generation module is used to be searched based on the file name and be recorded corresponding TS slicing files, to generate correspondence M3U8 format played file;
The sending module is used to send the played file of the M3U8 format.
Further, the generation module is specifically used for: being searched based on the file name and records corresponding three TS Slicing files, and the file name of three TS slicing files is ranked up, and generates the played file of corresponding M3U8 format;
Wherein, first TS slicing files of the played file are the starting TS slicing files.
Further, the direct broadcast time-shift device based on HLS protocol further include: the second receiving module, is sentenced parsing module Disconnected module and adjustment module;
Wherein, second receiving module is for receiving the request of the second time shifting broadcasting;
Second moves broadcast identifier and asks when the parsing module is for parsing the second time shifting broadcasting request to obtain Seek the second initial time of broadcasting;
The judgment module is for judging that the second time shifting broadcasting identifier whether there is;
The adjustment module is used in the presence of the judgment module determines that the second time shifting broadcasting identifier is, will be interior The corresponding initial time of time shifting broadcasting identifier for depositing middle record, the initial time as second time shifting broadcasting request; And for being asked what the parsing obtained in the absence of the judgment module determines that the second time shifting broadcasting identifier is The second initial time for asking broadcasting, the initial time as second time shifting broadcasting request.
Further, the direct broadcast time-shift device based on HLS protocol further include: update module;
The update module is used for corresponding of the time shifting broadcasting identifier that will be recorded in memory in the adjustment module Begin the moment, after the initial time as second time shifting broadcasting request, it is corresponding to update the second time shifting broadcasting identifier TS slicing files in the played file of M3U8 format.
The implementation of the embodiments of the present invention has the following beneficial effects:
Direct broadcast time-shift method and device provided in an embodiment of the present invention based on HLS protocol first receives what client was initiated Time shifting broadcasting request, further according to the channel identication and initial time in request, the text of the starting TS slicing files to be retrieved of determination Part title is then based on file name and searches and record corresponding TS slicing files, to generate the broadcasting of corresponding M3U8 format Played file is finally sent to client by file.It needs to set concordance list, the technology of the present invention in advance compared with the prior art Directly the time is written in the TS file name in M3U8 file for scheme, independent index file is not depended on, to reduce lookup The time-consuming of index file improves time shift efficiency.
Detailed description of the invention
Fig. 1 is a kind of flow diagram of embodiment of the direct broadcast time-shift method provided by the invention based on HLS protocol;
Fig. 2 is the flow diagram of another embodiment of the direct broadcast time-shift method provided by the invention based on HLS protocol;
Fig. 3 is a kind of structural schematic diagram of embodiment of the direct broadcast time-shift device provided by the invention based on HLS protocol.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other Embodiment shall fall within the protection scope of the present invention.
Embodiment 1
It is a kind of process signal of embodiment of the direct broadcast time-shift method provided by the invention based on HLS protocol referring to Fig. 1 Figure.The method comprising the steps of 101 to step 104.
Step 101: receiving the request of the first time shifting broadcasting.
In the present embodiment, the first time shifting broadcasting request include: the first channel identifier, the first time shifting broadcasting identifier and Request the first initial time played;Wherein, time shifting broadcasting identifier is for the corresponding client of the currently playing request of unique identification End.
In the present embodiment, user operates on the client, need to carry out time shifting broadcasting, client is according to user operation records phase The initial time that the channel identifier and request answered play generates corresponding time shifting broadcasting request with this.Each time shifting broadcasting is asked Seek a corresponding unique time shifting broadcasting identifier.
Step 102: according to the first channel identifier and the first initial time, the starting TS slicing files to be retrieved of determination File name.
In the present embodiment, the corresponding memory space of channel identifier is stored with several and is sliced according to the TS named constantly File, and the playing duration of each TS slice file is N, what each TS was sliced file is the starting playing time according to itself To name;N≥2.The corresponding memory space of each channel stores the TS slice file of the channel recording.The present invention is according to frequency Road identifier enters corresponding memory space, further according to initial time, the filename of the starting TS slicing files to be retrieved of determination Claim.Playing duration N can be configured according to the actual situation, but the preferred time is 10 seconds, so that TS slice file will not be too Greatly, playing time shift will not be too short.
Step 103: searching and record corresponding TS slicing files, based on file name to generate corresponding M3U8 format Played file.
In the present embodiment, step 103 specifically: searched based on file name and record corresponding three TS fragment text Part, and the file name of three TS slicing files is ranked up, and generates the played file of corresponding M3U8 format;Wherein, it plays First TS slicing files of file are starting TS slicing files.
Step 104: sending the played file of M3U8 format.
As a kind of citing of the present embodiment, the direct broadcast time-shift method of the present embodiment further include:
Receive the request of the second time shifting broadcasting;Second moves broadcast identifier and asks when parsing the request of the second time shifting broadcasting to obtain Seek the second initial time of broadcasting;Judge that the second time shifting broadcasting identifier whether there is;It if it exists, then should by what is recorded in memory The corresponding initial time of time shifting broadcasting identifier, the initial time as the request of the second time shifting broadcasting;It if it does not exist, then will parsing The second initial time that the request of acquisition plays, the initial time as the request of the second time shifting broadcasting.
In this citing, when requesting again, unanimously due to time shifting broadcasting identifier (UID), server has recorded the time shift The corresponding initial time start of broadcast identifier, server can be to start plus the when long-time of 1 TS slicing files.
Further, if the second time shifting broadcasting identifier exists, it is corresponding to update the second time shifting broadcasting identifier TS slicing files in the played file of M3U8 format.Every time when request, M3U8 file content only increases a newest TS newly Fragment, and delete a TS fragment at most.Server does client-information records according to UID, moreover after entering time shift, It is that player is automatically performed that follow-up play, which please demand perfection,.
Correspondingly, referring to fig. 2, Fig. 2 is a kind of embodiment of the direct broadcast time-shift device provided by the invention based on HLS protocol Structural schematic diagram.As shown in Fig. 2, the device includes: the first receiving module 201, determining module 202, generation module 203 and hair Send module 204.
Wherein, the first receiving module 201 is for receiving the request of the first time shifting broadcasting;Wherein, the first time shifting broadcasting request packet It includes: the first initial time that the first channel identifier, the first time shifting broadcasting identifier and request play;Wherein, time shifting broadcasting mark Symbol is known for the corresponding client of the currently playing request of unique identification.
Determining module 202 is used for according to the first channel identifier and first initial time, the starting to be retrieved of determination The file name of TS slicing files.
Generation module 203 is used to search and record corresponding TS slicing files based on file name, corresponding to generate The played file of M3U8 format.
Sending module 204 is used to send the played file of M3U8 format.
In the present embodiment, generation module 203 is specifically used for: being searched based on file name and records corresponding three TS points Piece file, and the file name of three TS slicing files is ranked up, and generates the played file of corresponding M3U8 format;Wherein, First TS slicing files of played file are starting TS slicing files.
As a kind of citing of the present embodiment, the direct broadcast time-shift device of the invention based on HLS protocol further include: second connects Receive module, parsing module, judgment module, adjustment module and update module.
Wherein, second receiving module is for receiving the request of the second time shifting broadcasting.When parsing module is for parsing second Second moves broadcast identifier and requests the second initial time played when moving playing request to obtain.Judgment module is for judging institute Stating the second time shifting broadcasting identifier whether there is.Adjustment module is used to determine that the second time shifting broadcasting identifier is to deposit in judgment module When, the corresponding initial time of time shifting broadcasting identifier that will be recorded in memory, as the second time shifting broadcasting request starting Moment;And the request in the absence of judgment module determines that the second time shifting broadcasting identifier is, parsing to be obtained plays The second initial time, as the second time shifting broadcasting request initial time.Update module is used for will be in memory in adjustment module The corresponding initial time of time shifting broadcasting identifier of record after the initial time as the request of the second time shifting broadcasting, updates the TS slicing files in the played file of the corresponding M3U8 format of two time shifting broadcasting identifiers.
Therefore the time shifting broadcasting method and device provided in an embodiment of the present invention based on HLS protocol, first receive client The time shifting broadcasting request that end is initiated, further according to the channel identication and initial time in request, the starting TS fragment to be retrieved of determination The file name of file is then based on file name and searches and record corresponding TS slicing files, to generate corresponding M3U8 lattice The played file of formula, is finally sent to client for played file.It needs to set concordance list in advance compared with the prior art, this Directly the time is written in the TS file name in M3U8 file for inventive technique scheme, independent index file is not depended on, to subtract Lack the time-consuming for searching index file, improves time shift efficiency.
Embodiment 2
It is the stream of another embodiment of the direct broadcast time-shift method provided by the invention based on HLS protocol referring to Fig. 3, Fig. 3 Journey schematic diagram.The method comprising the steps of as shown in Figure 3 301 to step 304, and each step is specific as follows:
Step 301: receiving the time shifting broadcasting request that client is initiated;Wherein, time shifting broadcasting request includes: channel identication The initial time that symbol, time shifting broadcasting identifier and request play.
In the present embodiment, user operates on the client, need to carry out time shifting broadcasting, client is according to user operation records phase The initial time that the channel identifier and request answered play generates corresponding time shifting broadcasting request with this.Each time shifting broadcasting is asked Seek a corresponding unique time shifting broadcasting identifier.
Step 302: according to channel identifier and initial time, retrieval in the corresponding memory space of channel identifier whether File is sliced in the presence of the TS to match with initial time.
In the present embodiment, the corresponding memory space of channel identifier is stored with several and is sliced according to the TS named constantly File, and the playing duration of each TS slice file is N, what each TS was sliced file is the starting playing time according to itself To name;N≥2.The corresponding memory space of each channel stores the TS slice file of the channel recording.The present invention is according to frequency Road identifier enters corresponding memory space, is sliced file with the presence or absence of corresponding TS further according to initial time retrieval.When broadcasting Long N can be configured according to the actual situation, but the preferred time is 10 seconds, so that TS slice file is not too large, when broadcasting Shifting will not be too short.
In the present embodiment, step 302 specifically: initial time is converted to the first time of string format, and root Enter corresponding memory space according to channel identifier, retrieving in memory space has identical name with the presence or absence of with first time TS is sliced file.Since the file of memory space storage to name constantly, and the initial time in time shifting broadcasting request needs to convert After string format, retrieval matching just can be carried out.
Step 303: when retrieving the first TS slice file matched with initial time, when according to initial time and playing Long N retrieves next TS slice file in the corresponding memory space of channel identifier, until retrieving M TS slice file.
In the present embodiment, M >=2;File is sliced comprising the first TS in M TS slice file.When retrieving with starting When carving matched first TS slice file, server records the initial time in memory.
In the present embodiment, step 303 specifically includes step A to step C, and each step is specific as follows:
Step A: after retrieving the first TS slice file, initial time being increased i*N seconds, and will be after increase i*N seconds Initial time is converted to the i+1 time of string format, retrieves identical with the presence or absence of having with the i+1 time in memory space The TS of name is sliced file;Wherein, i≤M-1, and the initial value of i is 1;If it is present executing step B;Otherwise, step is executed Rapid C;
Step B: will there is the TS of identical name to be sliced file with the i+1 time, be sliced file as i+1 TS, then The value of i is added 1;If i is equal to M, confirmation retrieves M TS slice file, otherwise return step A;
Step C: terminate retrieval.
In the present embodiment, the TS slice file in memory space is named according to the starting play time of itself, each TS is sliced file playing duration having the same again, so when that can be played by increasing after retrieving a TS slice file Long N is sliced file to retrieve next TS.
It can also include: literary when retrieving the first TS slice before executing step A as a kind of citing of the present embodiment After part, initial time is increased N-1 second, and the initial time after increase N-1 seconds is converted into the first to be checked of string format The rope time is retrieved in memory space with the presence or absence of the TS slice file with the time to be retrieved with identical name;If it is not, Execute step A;Otherwise, step C is executed.
This citing first increases N-1 seconds, is retrieved with this, can be avoided missing for TS slice file, to improve implementation The stability of example.
Step 304: file being sliced according to M TS, the M3U8 file comprising time shifting broadcasting identifier is generated, for client M3U8 file is downloaded, time shifting broadcasting is completed.
In the present embodiment, each M3U8 file corresponds to a time shifting broadcasting identifier.When client is requested again When M3U8 file, server first judges whether the time shifting broadcasting identifier has existed, if it is present being old request, service Device generates the memory record time plus the new initial time obtained after a playing duration as the logic parameter of program New M3U8 file.Only newly-increased one newest TS is sliced file to the content of new M3U8 file, and erasing time is at most TS is sliced file.
If server does not find the time shifting broadcasting identifier, with the side of the step 301 of the present embodiment to step 304 Method executes.
Therefore the direct broadcast time-shift method provided by the invention based on HLS protocol, first receive the time shift that client is initiated Playing request, further according to the channel identifier and initial time in request, retrieval is with the presence or absence of the TS slice file to match;Such as Fruit has, then continues to retrieve according to initial time and playing duration N, until retrieving M TS slice file;Finally according to M TS It is sliced file, the M3U8 file comprising time shifting broadcasting identifier is generated, for client downloads and carries out time shifting broadcasting.Compared to The prior art needs to set concordance list in advance, and technical solution of the present invention does not depend on independent index file, realizes any duration Time shifting broadcasting not only saves the space of server, but also improves time shift efficiency.
Embodiment 3
Referring to fig. 4, Fig. 4 is the stream of another embodiment of the direct broadcast time-shift method provided by the invention based on HLS protocol Journey schematic diagram.The present embodiment the difference from example 2 is that, the time shifting broadcasting method of the present embodiment further include:
Step D: when the TS not retrieved with first time has identical name is sliced file, initial time is increased J seconds, and the initial time after increasing j second is converted into time to be retrieved of jth+1 of string format, it is in retrieval memory space It is no to there is the TS slice file that there is identical name with the time to be retrieved of jth+1.If it does not exist, then executing step E;Otherwise, Execute step F.
In the present embodiment, j≤M-1, and the initial value of j is 1.
Step E: it is sliced file with the TS that the second time to be retrieved had identical name if do not retrieved, by j's Value plus 1, return step D.
Step F: by+1 time of jth have identical name TS be sliced file, as the first TS be sliced file, further according to rise Begin moment and playing duration N, next TS slice file is retrieved in the corresponding memory space of channel identifier, until retrieving M TS is sliced file.
In this citing, server will record+1 time of jth, and in this, as the initial time of this time shifting broadcasting, will Matched TS slice file is sliced file as the first TS, then executes step 104.
In order to more illustrate technical solution of the present invention, can be further detailed using following examples:
1, the file of channel identifier is created, TS slice is recorded, a new TS is recorded within every ten seconds and is sliced file, file Title is as follows:
Live-2018-06-01_09:37:20.ts;
Live-2018-06-01_09:37:30.ts;
Live-2018-06-01_09:37:40.ts。
2, client initiates time shifting broadcasting request, requests as follows:
Http:// southtv.cn/api/timeshift? gid=cctv1&uid=abceadfadf&start= 1527817030
Wherein, gid is channel identifier, and uid is user's secondary time shifting broadcasting unique identifier, and start is initial time (from zero second on the stroke of midnight January 1 in 1970).
3, after server receives request, channel identifier file is initially entered, start is switched to character string by cctv1 The time of format is Live-2018-06-01_09:37:10.ts after conversion.
4, server checks that file name whether there is, and there is no then start is added 1 second, is then again converted to character The filename of string format: Live-2018-06-01_09:37:11.ts.
5, server recycles aforesaid operations, until finding corresponding TS slice file.Due to 10 seconds TS, so this time Step at most carries out 9 times, until hitting Live-2018-06-01_09:37:20.ts file, records look in memory at this time The corresponding initial time START of TS slice file arrived.
6, next TS slice file is found again, and the START of record is assigned to start, start plus 9 second, (for Avoid missing TS slice) and then it is again converted to the filename of string format: Live-2018-06-01_09:37: 29.ts.File is not present, then after start adds 1 second, is converted to Live-2018-06-01_09:37:30.ts, finds corresponding File is recorded.
7, this logic is repeated, until finding three TS slice files, then starts to generate M3U8 file.
Therefore the #EXT-X-MEDIA-SEQUENCE parameter in the M3U8 file of the prior art is every according to 1 step-length Secondary increase, and it is the search procedure of subsequent slicing files according to step-length 1 that the present invention, which only has when searching first slicing files, The step-length of middle #EXT-X-MEDIA-SEQUENCE parameter according to circumstances can be changed, and can be the numbers less than 9 such as 5,6,7 (because every 10 seconds slicing files), it so can shorten retrieval time, improve time shift efficiency.
In addition, the present embodiment other than the beneficial effect with embodiment 1, is not retrieving and initial time phase also When the TS slice file matched, after initial time is increased j seconds, then is retrieved, recycle above-mentioned steps, match until retrieving TS be sliced file, improve the fault-tolerance and practicability of entire technical solution.
Embodiment 4
It is a kind of structure of embodiment of the direct broadcast time-shift device provided by the invention based on HLS protocol referring to Fig. 5, Fig. 5 Schematic diagram.As shown in figure 5, the time shifting broadcasting device includes: receiving module 501, the first retrieval module 502, the second retrieval module 503 and generation module 504.
Wherein, receiving module 501 is used to receive the time shifting broadcasting request of client initiation;Wherein, time shifting broadcasting request packet It includes: the initial time that channel identifier, time shifting broadcasting identifier and request play.
First retrieval module 502 is used for according to channel identifier and initial time, and retrieval is deposited channel identifier is corresponding File is sliced with the presence or absence of the TS to match with initial time in storage space;Wherein, the corresponding memory space of channel identifier is deposited It contains several and is sliced file according to the TS named constantly, and the playing duration of each TS slice file is N;N≥2.
Second retrieval module 503 is used for when retrieving the first TS slice file matched with initial time, according to starting Moment and playing duration N retrieve next TS slice file, until retrieving M in the corresponding memory space of channel identifier A TS is sliced file;M≥2;M TS slice file includes that the first TS is sliced file.
Generation module 504 is used to be sliced file according to M TS, generates the M3U8 file comprising time shifting broadcasting identifier, with For client downloads M3U8 file, time shifting broadcasting is completed.
In the present embodiment, the first retrieval module is used to be retrieved according to channel identifier and initial time in channel identication It accords in corresponding memory space and is sliced file with the presence or absence of the TS to match with initial time, specifically:
Initial time is converted to the first time of string format by the first retrieval module, and is entered according to channel identifier Corresponding memory space is retrieved in memory space with the presence or absence of the TS slice file with first time with identical name.
In the present embodiment, the second retrieval module is used to retrieve and matched first TS of initial time is sliced file When, according to initial time and playing duration N, next TS slice file is inquired in the corresponding memory space of channel identifier, Until retrieving M TS slice file, specifically:
Step A: after retrieving the first TS slice file, initial time being increased i*N seconds, and will be after increase i*N seconds Initial time is converted to the i+1 time of string format, retrieves identical with the presence or absence of having with the i+1 time in memory space The TS of name is sliced file;Wherein, i≤M-1, and the initial value of i is 1;If it is present executing step B;Otherwise, step is executed Rapid C;
Step B: will there is the TS of identical name to be sliced file with the i+1 time, be sliced file as i+1 TS, then The value of i is added 1;If i is equal to M, confirmation retrieves M TS slice file, otherwise return step A;
Step C: terminate retrieval.
Further, before step A, further includes:
When retrieve the first TS slice file after, by initial time increase N-1 second, and by increase N-1 seconds after starting when The first time to be retrieved for being converted to string format is carved, is retrieved identical with the presence or absence of having with the time to be retrieved in memory space The TS of name is sliced file;If it is not, executing step A;Otherwise, step C is executed.
As a kind of citing of the present embodiment, time shifting broadcasting device can also include third retrieval module.This citing it is detailed Thin steps flow chart can be, but not limited to the associated description referring to embodiment 3.
Third retrieval module is used to execute step D to step F, specifically:
Step D: when the TS not retrieved with first time has identical name is sliced file, initial time is increased J seconds, and the initial time after increasing j second is converted into time to be retrieved of jth+1 of string format, it is in retrieval memory space It is no to there is the TS slice file that there is identical name with the time to be retrieved of jth+1;Wherein, j≤M-1, and the initial value of j is 1;Such as Fruit is not present, and thens follow the steps E;Otherwise, step F is executed;
Step E: it is sliced file with the TS that the second time to be retrieved had identical name if do not retrieved, by j's Value plus 1, return step D;
Step F: by+1 time of jth have identical name TS be sliced file, as the first TS be sliced file, further according to rise Begin moment and playing duration N, next TS slice file is retrieved in the corresponding memory space of channel identifier, until retrieving M TS is sliced file.
Therefore the direct broadcast time-shift device provided in an embodiment of the present invention based on HLS protocol, it first receives client and initiates Time shifting broadcasting request, further according to the channel identifier and initial time in request, retrieval is with the presence or absence of the TS slice to match File;If so, then continuing to retrieve according to initial time and playing duration N, until retrieving M TS slice file;Last root Be sliced file according to M TS, generate include time shifting broadcasting identifier M3U8 file, for client downloads and carry out time shift and broadcast It puts.Need to set concordance list compared with the prior art in advance, technical solution of the present invention does not depend on independent index file, realizes and appoints The time shifting broadcasting for duration of anticipating not only saves the space of server, but also improves time shift efficiency.
Those of ordinary skill in the art will appreciate that realizing all or part of the process in above-described embodiment method, being can be with Relevant hardware is instructed to complete by computer program, the program can be stored in a computer-readable storage medium In, the program is when being executed, it may include such as the process of the embodiment of above-mentioned each method.Wherein, the storage medium can be magnetic Dish, CD, read-only memory (Read-Only Memory, ROM) or random access memory (Random Access Memory, RAM) etc..
The above is a preferred embodiment of the present invention, it is noted that for those skilled in the art For, various improvements and modifications may be made without departing from the principle of the present invention, these improvements and modifications are also considered as Protection scope of the present invention.

Claims (8)

1. a kind of direct broadcast time-shift method based on HLS protocol characterized by comprising
Receive the request of the first time shifting broadcasting;Wherein, when the first time shifting broadcasting request includes: the first channel identifier, first Move the first initial time of broadcast identifier and request broadcasting;Wherein, time shifting broadcasting identifier is currently playing for unique identification Request corresponding client;
According to first channel identifier and first initial time, the file of the starting TS slicing files to be retrieved of determination Title;
Corresponding TS slicing files are searched and record, based on the file name to generate the broadcasting text of corresponding M3U8 format Part;
Send the played file of the M3U8 format.
2. the direct broadcast time-shift method based on HLS protocol according to claim 1, which is characterized in that described to be based on the file Corresponding TS slicing files are searched and recorded to title, to generate the played file of corresponding M3U8 format, specifically:
Corresponding three TS slicing files, and the file of three TS slicing files are searched and recorded based on the file name Title is ranked up, and generates the played file of corresponding M3U8 format;
Wherein, first TS slicing files of the played file are the starting TS slicing files.
3. the direct broadcast time-shift method based on HLS protocol according to claim 1, which is characterized in that further include:
Receive the request of the second time shifting broadcasting;
Second moves broadcast identifier and requests the second initial time played when parsing the second time shifting broadcasting request to obtain;
Judge that the second time shifting broadcasting identifier whether there is;
If it exists, then the corresponding initial time of time shifting broadcasting identifier that will be recorded in memory, broadcasts as second time shift Put the initial time of request;
If it does not exist, then the second initial time played the request that the parsing obtains, is asked as second time shifting broadcasting The initial time asked.
4. the direct broadcast time-shift method according to claim 3 based on HLS protocol, which is characterized in that if second time shift Broadcast identifier exists, and further comprises:
Update the TS slicing files in the played file of the corresponding M3U8 format of the second time shifting broadcasting identifier.
5. a kind of direct broadcast time-shift device based on HLS protocol characterized by comprising the first receiving module, determining module, life At module and sending module;
Wherein, first receiving module is for receiving the request of the first time shifting broadcasting;Wherein, the first time shifting broadcasting request packet It includes: the first initial time that the first channel identifier, the first time shifting broadcasting identifier and request play;Wherein, time shifting broadcasting mark Symbol is known for the corresponding client of the currently playing request of unique identification;
The determining module is used for according to first channel identifier and first initial time, the starting to be retrieved of determination The file name of TS slicing files;
The generation module is used to search and record corresponding TS slicing files based on the file name, corresponding to generate The played file of M3U8 format;
The sending module is used to send the played file of the M3U8 format.
6. the direct broadcast time-shift device according to claim 5 based on HLS protocol, which is characterized in that the generation module tool Body is used for: search and record corresponding three TS slicing files based on the file name, and three TS slicing files File name is ranked up, and generates the played file of corresponding M3U8 format;
Wherein, first TS slicing files of the played file are the starting TS slicing files.
7. the direct broadcast time-shift device according to claim 5 based on HLS protocol, which is characterized in that further include: second receives Module, parsing module, judgment module and adjustment module;
Wherein, second receiving module is for receiving the request of the second time shifting broadcasting;
The second shifting broadcast identifier and request are broadcast when the parsing module is for parsing the second time shifting broadcasting request to obtain The second initial time put;
The judgment module is for judging that the second time shifting broadcasting identifier whether there is;
The adjustment module is used in the presence of the judgment module determines that the second time shifting broadcasting identifier is, will be in memory The corresponding initial time of time shifting broadcasting identifier of record, the initial time as second time shifting broadcasting request;And For in the absence of the judgment module determines that the second time shifting broadcasting identifier is, the request that the parsing obtains to be broadcast The second initial time put, the initial time as second time shifting broadcasting request.
8. the direct broadcast time-shift device according to claim 7 based on HLS protocol, which is characterized in that further include: update mould Block;
The update module is used in the corresponding starting of described time shifting broadcasting identifier for will recording in memory of adjustment module It carves, after the initial time as second time shifting broadcasting request, updates the corresponding M3U8 of the second time shifting broadcasting identifier TS slicing files in the played file of format.
CN201810965928.1A 2018-08-22 2018-08-22 Direct broadcast time-shift method and device based on HLS protocol Pending CN109040769A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810965928.1A CN109040769A (en) 2018-08-22 2018-08-22 Direct broadcast time-shift method and device based on HLS protocol

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810965928.1A CN109040769A (en) 2018-08-22 2018-08-22 Direct broadcast time-shift method and device based on HLS protocol

Publications (1)

Publication Number Publication Date
CN109040769A true CN109040769A (en) 2018-12-18

Family

ID=64627171

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810965928.1A Pending CN109040769A (en) 2018-08-22 2018-08-22 Direct broadcast time-shift method and device based on HLS protocol

Country Status (1)

Country Link
CN (1) CN109040769A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110536145A (en) * 2019-08-15 2019-12-03 咪咕视讯科技有限公司 Direct broadcast time-shift processing method, electronic equipment and storage medium
CN110784737A (en) * 2019-10-21 2020-02-11 北京东方广视科技股份有限公司 HLS protocol-based time-shifted television playing method, terminal and server
CN110809179A (en) * 2019-10-30 2020-02-18 烽火通信科技股份有限公司 Method and system for switching live broadcast time-shifting time axis under HLS protocol
CN112565906A (en) * 2020-11-05 2021-03-26 深圳市麦谷科技有限公司 On-demand video processing method and system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101795297A (en) * 2010-03-19 2010-08-04 北京天天宽广网络科技有限公司 Live broadcasting time shifting system based on P2P (peer-to-peer) technology and method thereof
CN105072458A (en) * 2015-07-23 2015-11-18 浪潮软件集团有限公司 Method for realizing time shifting in live broadcasting process of set top box based on HLS protocol
CN105357544A (en) * 2015-10-29 2016-02-24 浪潮软件集团有限公司 HLS-based multimedia file processing method and server
CN105721952A (en) * 2016-01-27 2016-06-29 观止云(北京)信息技术有限公司 Live streaming network transmission method and system for equal-length slices
CN106303671A (en) * 2016-08-16 2017-01-04 任晋军 A kind of player method of Streaming Media

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101795297A (en) * 2010-03-19 2010-08-04 北京天天宽广网络科技有限公司 Live broadcasting time shifting system based on P2P (peer-to-peer) technology and method thereof
CN105072458A (en) * 2015-07-23 2015-11-18 浪潮软件集团有限公司 Method for realizing time shifting in live broadcasting process of set top box based on HLS protocol
CN105357544A (en) * 2015-10-29 2016-02-24 浪潮软件集团有限公司 HLS-based multimedia file processing method and server
CN105721952A (en) * 2016-01-27 2016-06-29 观止云(北京)信息技术有限公司 Live streaming network transmission method and system for equal-length slices
CN106303671A (en) * 2016-08-16 2017-01-04 任晋军 A kind of player method of Streaming Media

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110536145A (en) * 2019-08-15 2019-12-03 咪咕视讯科技有限公司 Direct broadcast time-shift processing method, electronic equipment and storage medium
CN110536145B (en) * 2019-08-15 2022-03-25 咪咕视讯科技有限公司 Live broadcast time shifting processing method, electronic equipment and storage medium
CN110784737A (en) * 2019-10-21 2020-02-11 北京东方广视科技股份有限公司 HLS protocol-based time-shifted television playing method, terminal and server
CN110809179A (en) * 2019-10-30 2020-02-18 烽火通信科技股份有限公司 Method and system for switching live broadcast time-shifting time axis under HLS protocol
CN112565906A (en) * 2020-11-05 2021-03-26 深圳市麦谷科技有限公司 On-demand video processing method and system

Similar Documents

Publication Publication Date Title
CN109040769A (en) Direct broadcast time-shift method and device based on HLS protocol
CN109729371B (en) Live broadcast time shifting system and method based on HLS protocol multilevel management
US11350139B2 (en) Video live broadcast method and apparatus
EP3062311B1 (en) Media content playback system and method
CN103179093B (en) The matching system and method for video caption
US10652343B2 (en) Locating and retrieving segmented content
CN101677325B (en) Method, device and system for publishing media description information and acquiring media
JP2007115247A (en) Method and apparatus for making client synchronize device suitable for multi-server environment
CN105282627A (en) Method for acquiring a live video clip and server
JP4354441B2 (en) Video data management apparatus, method and program
WO2017092327A1 (en) Playing method and apparatus
CN102055717A (en) Quick playing method, terminal and server
WO2004017217A1 (en) System and method for seamless selection of multiple digital content
CN103607639A (en) Live broadcast time shifting method and server
EP3057010B1 (en) Media content playback system and method
CN105959725A (en) Method and device for loading media special effects in video
CN108965910A (en) A kind of video cache method and player
US11003711B2 (en) Accessing audio files from an online content management system
WO2014040471A1 (en) Subtitle processing method, device and system, and storage medium
USRE44569E1 (en) System and method for filling content gaps
US20100191825A1 (en) Content acquisition apparatus, program, content acquisition method and content acquisition system
KR100570633B1 (en) Karaoke service system and method using set-top box
US9697294B2 (en) Method and apparatus for managing contents by using content tag
US8521844B2 (en) Information processing apparatus and method and program
CN105812831B (en) Network program recording method, device and system and playing 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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20181218