CN108632642B - Streaming media pushing method and device - Google Patents

Streaming media pushing method and device Download PDF

Info

Publication number
CN108632642B
CN108632642B CN201710158093.4A CN201710158093A CN108632642B CN 108632642 B CN108632642 B CN 108632642B CN 201710158093 A CN201710158093 A CN 201710158093A CN 108632642 B CN108632642 B CN 108632642B
Authority
CN
China
Prior art keywords
media stream
target media
client
fragments
target
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
CN201710158093.4A
Other languages
Chinese (zh)
Other versions
CN108632642A (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.)
Hangzhou Hikvision Digital Technology Co Ltd
Original Assignee
Hangzhou Hikvision Digital Technology 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 Hangzhou Hikvision Digital Technology Co Ltd filed Critical Hangzhou Hikvision Digital Technology Co Ltd
Priority to CN201710158093.4A priority Critical patent/CN108632642B/en
Publication of CN108632642A publication Critical patent/CN108632642A/en
Application granted granted Critical
Publication of CN108632642B publication Critical patent/CN108632642B/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/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/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/234Processing of video elementary streams, e.g. splicing of video streams, manipulating MPEG-4 scene graphs
    • H04N21/2343Processing of video elementary streams, e.g. splicing of video streams, manipulating MPEG-4 scene graphs involving reformatting operations of video signals for distribution or compliance with end-user requests or end-user device requirements
    • H04N21/234336Processing of video elementary streams, e.g. splicing of video streams, manipulating MPEG-4 scene graphs involving reformatting operations of video signals for distribution or compliance with end-user requests or end-user device requirements by media transcoding, e.g. video is transformed into a slideshow of still pictures or audio is converted into text
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/235Processing of additional data, e.g. scrambling of additional data or processing content descriptors
    • H04N21/2355Processing of additional data, e.g. scrambling of additional data or processing content descriptors involving reformatting operations of additional data, e.g. HTML pages
    • 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/24Monitoring of processes or resources, e.g. monitoring of server load, available bandwidth, upstream requests
    • H04N21/2407Monitoring of transmitted content, e.g. distribution time, number of downloads
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/60Network structure or processes for video distribution between server and client or between remote clients; Control signalling between clients, server and network components; Transmission of management data between server and client, e.g. sending from server to client commands for recording incoming content stream; Communication details between server and client 
    • H04N21/63Control signaling related to video distribution between client, server and network components; Network processes for video distribution between server and clients or between remote clients, e.g. transmitting basic layer and enhancement layers over different transmission paths, setting up a peer-to-peer communication via Internet between remote STB's; Communication protocols; Addressing
    • H04N21/643Communication protocols

Abstract

The invention provides a streaming media pushing method and a streaming media pushing device, wherein the streaming media pushing method comprises the following steps: receiving information of a request target media stream sent by a client; detecting whether a predetermined number of segments of the requested target media stream already exist; if the preset number of fragments of the target media stream does not exist, sending a preset index of the preposed media stream to a client; acquiring data of the target media stream, and generating fragments of the target media stream according to the acquired data of the target media stream; and after the preset number of fragments of the target media stream are generated, transmitting the fragments of the target media stream to a client. The invention can solve the problem of the black screen of the client caused by that the server end does not generate the fragments of the preset number of the target media streams in time.

Description

Streaming media pushing method and device
Technical Field
The present invention relates to the field of streaming media technologies, and in particular, to a streaming media pushing method and apparatus.
Background
HLS (hypertext transfer protocol based real-time streaming media protocol) is a widely used multimedia protocol, and the working principle is as follows: the server divides the multimedia data into a plurality of small fragment files according to a certain rule and generates corresponding list files, and the client downloads the list files containing the code stream fragment information and then downloads the fragment files in the list files one by one. By continuously updating the list file, the multimedia data can be played on the browser in a quasi-real-time manner without plug-ins.
When a user needs to play streaming media, a client requests to connect to a server through a Uniform Resource Locator (URL), where the requested URL carries device information, that is, the client requests the server to obtain media data of a certain video acquisition device. According to the HLS protocol, the client must wait for the server to generate three slices (one slice includes at least one Group of Pictures (GOP)), before acquiring the index, and then acquiring the data for playing. If the server does not generate the three fragments, the client is in a black screen state within the time of generating the GOP of the three fragments by the server. When the black screen state is long, the user may think that the connection is failed, and reconnection may be performed, which greatly affects the user experience. The existing solutions are: by setting the GOP time length of the front-end acquisition equipment, the smaller the GOP time length is, the shorter the time for generating three fragments is, and the time for the client to be in a black screen is relatively shorter; or after the server generates one fragment, the fragment is copied into two parts, so that three same fragments are obtained and the condition of the number of the fragments is met, at the moment, the three fragments can be directly sent to the client, and the waiting time for the server to generate the two fragments is reduced equivalently.
The present inventors have found that at least the following problems exist in the above-described techniques:
although the technology can shorten part of the black screen time, the black screen time still has the duration of 3 GOPs or the sum of the generation time of 1 slice and the time of copying 2, so that the longer black screen time is still higher than the visual delay of human eyes and cannot be ignored by people, and a video viewer still sees the black screen for a certain time.
Disclosure of Invention
In view of this, the present invention provides a streaming media pushing method and apparatus, so as to better solve the problem of a client blank screen caused by that a server end does not generate a predetermined number of fragments of a target media stream in time.
Specifically, the method comprises the following technical scheme:
in one aspect, the present invention provides a streaming media pushing method, including:
receiving information of a request target media stream sent by a client;
detecting whether a predetermined number of segments of the requested target media stream already exist;
if the preset number of fragments of the target media stream does not exist, sending a preset index of a front media stream to the client to indicate the client to play the front media stream;
acquiring data of the target media stream, and generating fragments of the target media stream according to the acquired data of the target media stream;
and after the preset number of fragments of the target media stream are generated, transmitting the fragments of the target media stream to the client.
Optionally, the total duration of the pre-media stream is not less than the duration required from the start of acquiring the data of the target media stream to the generation of the predetermined number of segments of the target media stream.
Optionally, the generating the segment of the target media stream according to the acquired data of the target media stream includes:
and generating an image group based on the acquired data of the target media stream, and selecting a certain number of image group to form fragments according to the time length of a single image group and the preset time length of the minimum fragment.
Optionally, the sending an index of a preset pre-positioned media stream to the client, instructing the client to play the pre-positioned media stream, includes:
sending an index of a preset preposed media stream to a client, receiving a request of the client for acquiring a fragment corresponding to the index of the preposed media stream, and sending the fragment of the preposed media stream to the client so that the client plays the preposed media stream; or the like, or, alternatively,
and sending the index of the preset preposed media stream to a client, and instructing the client to play the locally stored preposed media stream of the client according to the index of the preposed media stream.
Optionally, sending the segment of the target media stream to the client includes:
and sending the index of the target media stream to the client, receiving a request of the client for acquiring a fragment corresponding to the index of the target media stream, and sending the fragment of the target media stream to the client.
Optionally, after the predetermined number of segments of the target media stream are generated, the method further includes:
and adding a label to an index corresponding to the first fragment of the target media stream, wherein the label is used for informing the client to stop playing the preposed media stream and playing the target media stream.
In another aspect, the present invention provides a streaming media pushing apparatus, including:
the receiving module is used for receiving the information of the request target media stream sent by the client;
a detection module for detecting whether there are a predetermined number of segments of the requested target media stream;
the first sending module is used for sending a preset index of a front media stream to the client to indicate the client to play the front media stream if the preset number of fragments of the target media stream are detected not to exist;
the processing module is used for acquiring the data of the target media stream and generating the fragments of the target media stream according to the acquired data of the target media stream;
and the second sending module is used for sending the fragments of the target media stream to the client after the fragments of the target media stream with the preset number are generated.
Optionally, the total duration of the pre-media stream is not less than the duration required from the start of acquiring the data of the target media stream to the generation of the predetermined number of segments of the target media stream.
Optionally, the processing module is specifically configured to:
and acquiring data of the target media stream, generating an image group based on the acquired data of the target media stream, and selecting a certain number of image groups to form fragments according to the time length of a single image group and the preset time length of the minimum fragment.
Optionally, the first sending module is specifically configured to:
if the preset number of fragments of the target media stream does not exist, sending a preset index of a front media stream to a client, receiving a request of the client for obtaining the fragments corresponding to the index of the front media stream, and sending the fragments of the front media stream to the client so that the client plays the preset front media stream; or the like, or, alternatively,
and sending the index of the preset preposed media stream to a client, and instructing the client to play the locally stored preposed media stream of the client according to the index of the preposed media stream.
Optionally, the second sending module is specifically configured to:
after the preset number of fragments of the target media stream are generated, sending the index of the target media stream to the client, receiving a request of the client for obtaining the fragment corresponding to the index of the target media stream, and sending the fragment of the target media stream to the client.
Optionally, the second sending module is further configured to:
and after the preset number of fragments of the target media stream are generated, adding a label to an index corresponding to the first fragment of the target media stream, wherein the label is used for informing the client to stop playing the preposed media stream and playing the target media stream.
The technical scheme provided by the embodiment of the invention has the beneficial effects that:
the invention provides a streaming media pushing method and a streaming media pushing device, wherein the method comprises the following steps: when detecting that the preset number of fragments of the target media stream requested by the client do not exist, sending a preset index of the front media stream to the client so that the client can play the front media stream; and acquiring the fragments of the target media stream, and after the fragments of the target media stream with the preset number are generated, sending the fragments of the target media stream to the client, and further stopping playing the pre-media stream and decoding the fragments of the target media stream for playing by the client. Therefore, even if the server side does not prepare the preset number of fragments of the target media stream in time, the client side can play the preset preposed media stream. Therefore, the method provided by the embodiment can solve the problem of client-side blank screen caused by that the server side does not generate the preset number of fragments of the media stream requested by the client side in time, so as to ensure that a user does not misunderstand that the user can not be connected to the streaming media server to perform operations such as reconnection and closing, and thus the user experience is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a schematic diagram of an exemplary implementation environment of the present invention;
fig. 2 is a flowchart of a streaming media pushing method according to an embodiment of the present invention;
fig. 3 is a block diagram of a streaming media pushing apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions and advantages of the present invention clearer, the following will describe embodiments of the present invention in further detail with reference to the accompanying drawings.
FIG. 1 is a schematic diagram of an exemplary implementation environment in which the present invention may be implemented. Referring to fig. 1, the implementation environment includes: the system comprises a front-end acquisition device 101, a server-end 102 and a client-end 103.
The client 103 may be a mobile terminal such as a mobile phone, a personal computer, or a workstation. The front-end capturing apparatus 101 may be plural, for example, a camera apparatus. The front-end acquisition device 101 communicates with the server 102 and the server 102 communicates with the client 103 in a wireless or wired manner. The front-end acquisition device 101 performs image pickup to generate media stream data (media stream for short), and sends the generated media stream data to the server 102, and the server 102 processes the media stream data to generate fragments of the media stream. When the client 103 needs to play a media stream acquired by a certain front-end acquisition device 101, a request is sent to the server 102, the server 102 generates a fragment of the media stream, and sends the fragment of the media stream to the client 103, so that the client 103 can play the media stream.
Example one
The embodiment provides a streaming media pushing method, which can be applied to a server side. The flow of the method is shown in fig. 2, and the steps will be described in detail below.
Step S101: and receiving the information of the request target media stream sent by the client.
For example, in this step, the client may send request information of a certain target media stream to the server via the URL. For example, the URL format of the request information may be http:// ip: port/xxx.m3u8, which is similar to the above format, where the URL carries information of the target media stream, and the server receives the request for the target media stream sent by the client, and may locate the target media stream.
In this embodiment, the target media stream, that is, the media stream corresponding to the request of the client, may be video, audio or data information of a combination of video and audio acquired by the acquisition device. The capture device may be a video recorder, a camera and/or a mobile phone, etc., and is not limited herein.
Step S102: it is detected whether a predetermined number of slices of the requested target media stream already exist.
In this embodiment, a slice refers to a portion of data of a target media stream that is independently decodable. For example, the server encapsulates the data of the target media stream to form a plurality of frames, several consecutive frames form a GOP, a GOP generally includes an I frame and other frames decoded by the I frame later, and a slice may include at least one GOP. The target media stream fragments can be played independently, so that the client can start playing after receiving the fragments sent by the server.
In this step, the server side detects whether there has been a predetermined number of segments of the requested target media stream. Specifically, the predetermined number may be three according to the HLS protocol, but the present invention is not limited thereto, and those skilled in the art will appreciate that the predetermined number may be other than three but other suitable numbers in other existing similar protocols or protocols developed further in the future.
If the server detects that the preset number of fragments of the requested target media stream already exist, the step S103 is switched to; if the server detects that the predetermined number of fragments of the requested target media stream have not been generated, the process goes to step S104 and step S105. Step S104 and step S105 may be performed simultaneously, or step S104 may be performed first, and then step S105 may be performed.
Step S103: and if detecting that the preset number of fragments of the requested target media stream exist, sending the fragments of the target media stream to the client.
In this step, if the server detects that there are a predetermined number of fragments of the requested target media stream, the server sends the fragments of the target media stream to the client, and the client can directly play the fragments of the target media stream without the problem of black screen. Specifically, the server may send the index of the target media stream to the client, and after receiving the index of the target media stream, the client sends a request for a segment corresponding to the index of the target media stream to the server. And the server receives a request of the client for acquiring the fragment corresponding to the index of the target media stream, and sends the fragment of the target media stream to the client. And the client receives the fragments of the target media stream and performs decoding playing.
Step S104: and if the preset number of fragments of the target media stream does not exist, sending a preset index of the front media stream to the client to indicate the client to play the front media stream.
In this step, if the server detects that the preset number of fragments of the target media stream do not exist, the server first sends the preset index of the pre-positioned media stream to the client, and the client receives the index of the pre-positioned media stream and then sends a request for acquiring the fragments of the pre-positioned media stream corresponding to the index of the pre-positioned media stream to the server. And the server receives a request of the client for acquiring the fragment corresponding to the index of the front media stream and sends the fragment of the front media stream to the client. And the client receives the fragments of the preposed media stream and performs decoding playing. In other embodiments, it is also possible to send the segment of the front media stream directly to the client. Or, if the client locally stores the pre-media stream, the server sends the index of the pre-media stream to the client, and then instructs the client to play the pre-media stream locally stored by the client. Specifically, the pre-media stream stored locally by the client may be a pre-media stream pre-stored in the client at the time of installation, or a pre-media stream downloaded when the client is opened.
Before this step, the server stores a segment of the pre-media stream in advance, and performs the trans-encapsulation, fragment generation and index processing on the pre-media stream. The index format of the front media stream may be, for example, as follows:
# EXTM3U// extended M3U File
Adaptivity of # EXT-X-VERSION:3// PlayList VERSION
NO// whether buffering is allowed or not, # EXT-X-ALLOW-CACHE
0// SEQUENCE number of the segment of the front MEDIA stream # EXT-X-MEDIA-SEQUENCE:// SEQUENCE number of the segment of the front MEDIA stream
2// maximum of the fragmentation duration of the front media stream
2.055,// EXTINF record tag describing the pre-media stream fragment specified by the back edge
Preset0.ts// name of slice of front media stream
2.000,// EXTINF record tag describing the slice of the front media stream specified by the back edge
Preset1.ts// name of slice of front media stream
2.000,// EXTINF record tag describing the slice of the front media stream specified by the back edge
Ts// name of the slice of the PreSet2. ts/Premedia stream
In an optional embodiment of the present invention, an extinnf tag is set before the segment name of each pre-media stream, and the format is as follows: # EXTINF: < DURATION >, < TITLE >; DURATION describes the DURATION of a slice in seconds, which can be a decimal when the EXT-X-VERSION tag is greater than or equal to 3, or else an integer.
It should be noted that, the index of the front media stream is illustrated by the number of the segments included in the front media stream being three, but the present invention is not limited thereto, and the number of the segments included in the front media stream may be other numbers.
Alternatively, the front media stream may be an advertisement, a video clip, or a song MV, etc. For example, the front media stream may be a video associated with a target media stream to be played. Assuming that the video to be played is movie a, the front media stream may be a segment of movie a or a summary advertisement, etc.
In this embodiment, the total duration of the pre-media stream may be set to be greater than the duration required by the server to generate the predetermined number of fragments from the beginning of acquiring the data of the target media stream. For example, the total duration of the pre-media stream may be set to be equal to the duration required by the server to obtain the data of the target media stream and generate the predetermined number of fragments and the corresponding indexes according to the data of the target media stream, plus the duration required by the server to send the index of the target media stream to the client, the duration required by the client to receive the index of the target media stream and request the fragments of the target media stream according to the index, the duration required by the server to receive the fragment request of the target media stream sent by the client and send the fragments of the target media stream, and the duration required by the client to receive and decode the fragments of the target media stream. Therefore, the problem that the target media stream cannot be played in time due to the fact that the total duration of the front media stream is too long can be avoided.
Step S105: and acquiring data of the target media stream, and generating the fragments of the target media stream according to the acquired data of the target media stream.
In the step, after the server side acquires the data of the target media stream, the acquired data of the target media stream is encapsulated to form a plurality of frames, a plurality of continuous frames form a GOP, a certain number of GOPs are selected to form fragments according to the duration of a single GOP of the target media stream and the duration of a preset minimum fragment, and one fragment comprises one GOP or a plurality of continuous GOPs. The time length of the fragment is selected to be the minimum time length of the fragment, so that the playing time of the front media stream can be reduced.
Step S106: and after the preset number of fragments of the target media stream are generated, transmitting the fragments of the target media stream to the client.
In this step, after the server detects that the predetermined number of fragments of the target media stream are generated, the index of the target media stream may be sent to the client first, and after receiving the index of the target media stream, the client sends a request for the fragment corresponding to the index of the target media stream to the server. And the server receives a request of the client for acquiring the fragment corresponding to the index of the target media stream, and sends the fragment of the target media stream to the client. And the client receives the fragments of the target media stream and performs decoding playing. In other embodiments, it is also possible to send the fragments of the target media stream directly to the client.
After the server generates the preset number of fragments of the target media stream, a label can be added to an index corresponding to the first fragment of the generated target media stream for informing the client to stop playing the pre-media stream and play the target media stream, and then the server sends the corresponding fragments to the client in sequence.
For example, the tag may be EXT-X-DISCONTINUITY, and the format of the index corresponding to the predetermined number of segments of the target media stream is as follows:
# EXTM3U// extended M3U File
Adaptivity of # EXT-X-VERSION:3// PlayList VERSION
NO// whether buffering is allowed or not, # EXT-X-ALLOW-CACHE
0// SEQUENCE number of the segment of the target MEDIA stream # EXT-X-MEDIA-SEQUENCE:// SEQUENCE number of the segment of the target MEDIA stream
2// maximum value of the slice duration of the target media stream
EXT-X-DISTIONATY// Label indicates the coding break between the segment of the target media stream following the label and the previous segment of the target media stream
2.000,// EXTINF record tag describing the segment of the target media stream specified later
segSet0.ts// name of segment of target media stream
2.000,// EXTINF record tag describing the segment of the target media stream specified later
segSet1.ts// name of segment of target media stream
2.000,// EXTINF record tag describing the segment of the target media stream specified later
segSet2.ts// name of media File
The above-mentioned index of the target media stream is exemplified by the predetermined number of the slices of the target media stream being three, but the present invention is not limited thereto, and the predetermined number may be other numbers.
After receiving the tagged index, the client requests the server for a preset number of fragments of the media stream corresponding to the tagged index, and stops playing the pre-media stream and plays the target media stream after receiving the fragments of the target media stream. And then, the server side continuously acquires the target media stream data to generate fragments and sends the fragments to the client side, so that the client side can continuously play the target media stream.
In this embodiment, one index corresponds to a predetermined number of slices. After the client sends the request of the fragments corresponding to the index of the target media stream, the server receives the request and then sends the fragments to the client according to the production sequence of the fragments with the preset number corresponding to the index. And the client receives the fragments of the target media stream and performs decoding playing according to the received sequence.
After that, the server repeats steps S101 to S106, continues to acquire new data of the target media stream, generates a new index and a segment corresponding to the new index, and sends the new index and the segment to the client. So that the client can continuously play the target media stream.
The streaming media pushing method provided in this embodiment may be used in a streaming media system based on HLS, but the present invention is not limited thereto, and may also be used in a streaming media system based on other similar protocols.
By using the streaming media pushing method provided by the embodiment, when the server side does not have the fragments of the preset number of the target media streams requested by the client side, the preset indexes of the pre-positioned media streams are sent to the client side, and then the client side can play the pre-positioned media streams; the server side obtains the data of the target media stream and generates fragments, when the fragments with the preset number of the target media stream are generated, the fragments of the target media stream are sent to the client side, and then the client side receives the fragments of the target media stream and carries out decoding playing. Therefore, even if the server side does not prepare the fragments with the preset number in time, the client side can play the preset preposed media stream, and the method provided by the embodiment can solve the problem that the client side is blank due to the fact that the server side does not generate the fragments with the preset number of the target media stream requested by the client side in time, so that the user can not misunderstand that the user can not be connected to the target streaming media service to carry out operations such as reconnection and closing, and the user experience is improved.
Example two
Corresponding to the first embodiment, the present embodiment provides a streaming media pushing apparatus, for example, a streaming media server, as shown in fig. 3, including a receiving module 201, a detecting module 202, a first sending module 203, a processing module 204, a second sending module 205, and a third sending module 206. Each module is described in detail below.
The receiving module 201 is configured to receive information of a request target media stream sent by a client.
The client requests a certain target media stream from the server through a URL (uniform resource locator), the URL format of the request can be http:// ip: port/XXX.m3u8, for example, the URL carries the information of the target media stream, and the server can be positioned to the corresponding target media stream after receiving the request for the target media stream sent by the client.
In this embodiment, the target media stream, that is, the media stream corresponding to the request of the client, may be video, audio or data information of a combination of video and audio acquired by the acquisition device. The capture device may be a video recorder, a camera and/or a mobile phone, etc., and is not limited herein.
A detection module 202 for detecting whether a predetermined number of segments of the requested target media stream already exist.
Specifically, according to the HLS protocol, the predetermined number may be three, but the present invention is not limited thereto, and those skilled in the art will appreciate that the predetermined number may not be three but other suitable numbers in other similar protocols or protocols developed further in the future.
If the detection module 202 detects that the predetermined number of fragments of the requested target media stream already exist, the third sending module 206 is invoked, and if the detection module 202 detects that the predetermined number of fragments of the requested target media stream does not yet exist, the second sending module 204 and the processing module 205 are invoked, which may invoke the second sending module 204 and the processing module 205 at the same time, or invoke the second sending module 204 first and then invoke the processing module 205.
A third sending module 206, configured to send the segments of the target media stream to the client when the detecting module 202 detects that the predetermined number of segments of the requested target media stream already exist.
If the detection module 202 detects that the predetermined number of fragments of the requested target media stream already exist, the client may not have the problem of a blank screen and may directly play the target media stream, at this time, the third sending module 206 may send the index of the target media stream to the client, and after receiving the index of the target media stream, the client sends the request of the fragment of the target media stream corresponding to the index of the target media stream to the streaming media service push device. The third sending module 206 receives a request of the client to obtain a segment corresponding to the index of the target media stream, and sends the segment of the target media stream to the client. The client receives the fragments of the target media stream sent by the third sending module 206, and performs decoding playing.
The first sending module 203 is configured to send, when the detecting module 202 detects that the predetermined number of segments of the target media stream do not exist, an index of a preset pre-media stream to the client, so as to instruct the client to play the pre-media stream.
The first sending module 203 sends the index of the preset pre-positioned media stream to the client, and after receiving the index of the pre-positioned media stream, the client sends a request for fragmentation of the pre-positioned media stream corresponding to the index of the pre-positioned media stream. The first sending module 203 receives a request of the client to obtain a segment corresponding to the index of the pre-positioned media stream, and sends the segment of the pre-positioned media stream to the client. The client receives the segment of the pre-positioned media stream sent by the first sending module 203, and performs decoding playing. In other embodiments, it is also possible to send the segment of the front media stream directly to the client. Or, if the client locally stores the pre-media stream, after the first sending module 203 sends the index of the pre-media stream to the client, the client is instructed to play the pre-media stream locally stored by the client. Specifically, the pre-media stream stored locally by the client may be a pre-media stream pre-stored in the client at the time of installation, or a pre-media stream downloaded when the client is opened.
Before this step, the streaming media pushing apparatus may store a segment of the pre-media stream in advance, and perform trans-encapsulation, fragment generation, and index processing on the pre-media stream. For example, the index format of the front media stream is as follows:
# EXTM3U// extended M3U File
Adaptivity of # EXT-X-VERSION:3// PlayList VERSION
NO// whether buffering is allowed or not, # EXT-X-ALLOW-CACHE
0// SEQUENCE number of the segment of the front MEDIA stream # EXT-X-MEDIA-SEQUENCE:// SEQUENCE number of the segment of the front MEDIA stream
2// maximum of the fragmentation duration of the front media stream
2.055,// EXTINF record tag describing the pre-media stream fragment specified by the back edge
Preset0.ts// name of slice of front media stream
2.000,// EXTINF record tag describing the slice of the front media stream specified by the back edge
Preset1.ts// name of slice of front media stream
2.000,// EXTINF record tag describing the slice of the front media stream specified by the back edge
Ts// name of the slice of the PreSet2. ts/Premedia stream
It should be noted that, the index of the front media stream is illustrated by the number of the segments included in the front media stream being three, but the present invention is not limited thereto, and the number of the segments included in the front media stream may be other numbers.
Alternatively, the front media stream may be an advertisement, a video clip, or a song MV, etc.
In this embodiment, the total duration of the pre-media stream may be set to be greater than the duration required from the start of acquiring the data of the target media stream to the generation of the predetermined number of fragments. Specifically, the total duration of the pre-media stream may be set to be equal to the duration required by the processing module 204 to acquire the data of the target media stream and generate the predetermined number of fragments and the corresponding indexes according to the data of the target media stream, plus the duration required by the second sending module 205 to send the index of the target media stream to the client, the duration required by the client to receive the index of the target media stream and request the fragments of the target media stream according to the index, the duration required by the second sending module 205 to receive the fragment request of the target media stream sent by the client and send the fragments of the media stream, and the duration required by the client to receive and decode the fragments of the target media stream. Therefore, the problem that the target media stream cannot be played in time due to the fact that the total duration of the front media stream is too long can be avoided.
The processing module 204 is configured to obtain data of the target media stream, and generate a segment of the target media stream according to the obtained data of the target media stream.
After the processing module 204 obtains the data of the target media stream, a certain number of GOPs are selected to form the fragments according to the duration of a single GOP of the target media stream and the duration of the preset minimum fragment. Specifically, after acquiring data of the target media stream, the processing module 204 encapsulates the acquired data of the target media stream to form a plurality of frames, several consecutive frames generate a GOP, and a certain number of GOPs are selected to form slices according to the duration of a single GOP of the target media stream and the duration of a preset minimum slice, where a slice includes a GOP or several consecutive GOPs. The time length of the fragment is selected to be the minimum time length of the fragment, so that the playing time of the front media stream can be reduced.
The second sending module 205 is configured to send the fragments of the target media stream to the client after generating a predetermined number of fragments of the target media stream.
In this step, when detecting that the predetermined number of fragments of the target media stream are generated, the second sending module 205 may send the index of the target media stream to the client first, and the client sends the request of the fragment corresponding to the index of the target media stream after receiving the index of the target media stream. The second sending module 205 receives a request of the client to obtain a segment corresponding to the index of the target media stream, and sends the segment of the target media stream to the client. And the client receives the fragments of the target media stream and performs decoding playing.
After the processing module 204 generates the predetermined number of segments of the target media stream, a tag may be added to an index corresponding to a first segment of the generated target media stream, where the tag is used to inform the client to stop playing the pre-media stream and play the target media stream.
For example, the tag may be EXT-X-DISCONTINUITY, and the format of the index corresponding to the predetermined number of segments of the target media stream is as follows:
# EXTM3U// extended M3U File
Adaptivity of # EXT-X-VERSION:3// PlayList VERSION
NO// whether buffering is allowed or not, # EXT-X-ALLOW-CACHE
0// SEQUENCE number of the segment of the target MEDIA stream # EXT-X-MEDIA-SEQUENCE:// SEQUENCE number of the segment of the target MEDIA stream
2// maximum value of the slice duration of the target media stream
EXT-X-DISTITUTION/the tag indicates the coding DISCONTINUITY between the segment of the target media stream following the tag and the previous segment of the target media stream
2.000,// EXTINF record tag describing the segment of the target media stream specified later
segSet0.ts// name of segment of target media stream
2.000,// EXTINF record tag describing the segment of the target media stream specified later
segSet1.ts// name of segment of target media stream
2.000,// EXTINF record tag describing the segment of the target media stream specified later
segSet2.ts// name of media File
The above-mentioned index of the target media stream is exemplified by the predetermined number of the slices of the target media stream being three, but the present invention is not limited thereto, and the predetermined number may be other numbers.
Illustratively, after receiving the tagged index, the client requests the streaming media pushing device to index the corresponding segment of the target media stream, and after receiving the segment of the target media stream, stops playing the pre-media stream and plays the target media stream.
In this embodiment, one index corresponds to a predetermined number of slices. When the client sends a request of a segment corresponding to an index of a target media stream, the second sending module 205 receives the request, and then sends the segment to the client according to the production sequence of a predetermined number of segments corresponding to the index. And the client receives the fragments of the target media stream and decodes and plays the fragments according to the sequence.
And after that, sequentially calling each module, continuously acquiring new data of the target media stream, generating a new index and a fragment corresponding to the new index, and sending the new index and the fragment to the client. So that the client can continuously play the target media stream.
Since the second embodiment corresponds to the first embodiment, the same advantageous effects can be brought, and are not described herein again.
In the embodiments provided in the present application, it should be understood that the method and apparatus provided are merely illustrative, for example, the division of the steps and modules is only one logical function division, and other division manners may be available in actual implementation. The method and the device can be realized by setting corresponding software and/or hardware by a computer device. The terms "first", "second", etc. are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only for facilitating the understanding of the technical solutions of the present invention by those skilled in the art, and is not intended to limit the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (4)

1. A streaming media pushing method is characterized by comprising the following steps:
receiving information of a request target media stream sent by a client; detecting whether a predetermined number of slices of the requested target media stream already exist, the slices referring to data of the target media stream that are partially independently decodable;
if the preset number of fragments of the target media stream does not exist, sending a preset index of a front media stream to the client, receiving a request of the client for obtaining the fragments corresponding to the index of the front media stream, and sending the fragments of the front media stream to the client so that the client plays the front media stream; or, if it is detected that the preset number of fragments of the target media stream do not exist, sending a preset index of a pre-positioned media stream to the client, and instructing the client to play the pre-positioned media stream locally stored by the client according to the index of the pre-positioned media stream; the pre-media stream is a media stream related to the target media stream, the total duration of the pre-media stream is equal to the sum of the duration required for acquiring the data of the target media stream, generating a preset number of fragments and corresponding indexes according to the data of the target media stream, the duration required for sending the indexes of the target media stream to the client, the duration required for receiving the indexes of the target media stream by the client and requesting the fragments of the target media stream according to the indexes of the target media stream, the duration required for receiving the fragment requests of the target media stream sent by the client and sending the fragments of the target media stream, and the duration required for receiving and decoding the fragments of the target media stream by the client;
acquiring data of the target media stream, generating an image group according to the acquired data of the target media stream, and selecting a certain number of image groups to form fragments according to the time length of a single image group and the preset minimum fragment time length; after the preset number of fragments of the target media stream are generated, transmitting the fragments of the target media stream to the client;
after the predetermined number of segments of the target media stream are generated, the method further comprises:
and adding a label to an index corresponding to the first fragment of the target media stream, wherein the label is used for informing the client to stop playing the preposed media stream and playing the target media stream.
2. The streaming media pushing method according to claim 1, wherein sending the segment of the target media stream to the client comprises:
and sending the index of the target media stream to the client, receiving a request of the client for acquiring a fragment corresponding to the index of the target media stream, and sending the fragment of the target media stream to the client.
3. A streaming media pushing apparatus, comprising:
the receiving module is used for receiving the information of the request target media stream sent by the client;
a detection module for detecting whether there are already a predetermined number of segments of the requested target media stream, the segments referring to data of the target media stream that are partially independently decodable;
a first sending module, configured to send, if it is detected that the predetermined number of fragments of the target media stream do not exist, an index of a preset pre-media stream to the client to instruct the client to play the pre-media stream, where the pre-media stream is a media stream related to the target media stream, a total duration of the pre-media stream is equal to a duration required to obtain data of the target media stream and generate the predetermined number of fragments and corresponding indexes according to the data of the target media stream, a duration required to send the index of the target media stream to the client, a duration required for the client to receive the index of the target media stream and request the fragments of the target media stream according to the index of the target media stream, a duration required to receive the fragment request of the target media stream sent by the client and send the fragments of the target media stream, and a duration required for the client to receive the fragments of the target media stream and perform fragmentation and perform operations on the target media stream The sum of the durations required for decoding;
the processing module is used for acquiring the data of the target media stream and generating the fragments of the target media stream according to the acquired data of the target media stream;
the second sending module is used for sending the fragments of the target media stream to the client after the fragments of the target media stream with the preset number are generated;
the second sending module is further configured to:
after the preset number of fragments of the target media stream are generated, adding a label to an index corresponding to a first fragment of the target media stream, wherein the label is used for informing the client to stop playing the pre-positioned media stream and playing the target media stream;
the processing module is specifically configured to:
acquiring data of the target media stream, generating an image group based on the acquired data of the target media stream, and selecting a certain number of image groups to form fragments according to the time length of a single image group and the preset time length of the minimum fragment;
the first sending module is specifically configured to:
if the preset number of fragments of the target media stream does not exist, sending a preset index of a front media stream to a client, receiving a request of the client for obtaining the fragments corresponding to the index of the front media stream, and sending the fragments of the front media stream to the client so that the client plays the preset front media stream; or the like, or, alternatively,
and sending the index of the preset preposed media stream to a client, and instructing the client to play the locally stored preposed media stream of the client according to the index of the preposed media stream.
4. The streaming media pushing apparatus according to claim 3, wherein the second sending module is specifically configured to:
after the preset number of fragments of the target media stream are generated, sending the index of the target media stream to the client, receiving a request of the client for obtaining the fragment corresponding to the index of the target media stream, and sending the fragment of the target media stream to the client.
CN201710158093.4A 2017-03-16 2017-03-16 Streaming media pushing method and device Active CN108632642B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710158093.4A CN108632642B (en) 2017-03-16 2017-03-16 Streaming media pushing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710158093.4A CN108632642B (en) 2017-03-16 2017-03-16 Streaming media pushing method and device

Publications (2)

Publication Number Publication Date
CN108632642A CN108632642A (en) 2018-10-09
CN108632642B true CN108632642B (en) 2021-09-03

Family

ID=63686780

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710158093.4A Active CN108632642B (en) 2017-03-16 2017-03-16 Streaming media pushing method and device

Country Status (1)

Country Link
CN (1) CN108632642B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020216035A1 (en) * 2019-04-22 2020-10-29 北京开广信息技术有限公司 Real-time pushing method and real-time receiving method for media stream, server, and client
CN110324727A (en) 2019-07-16 2019-10-11 浙江大华技术股份有限公司 Computer readable storage medium, server and its method for responding playing request
CN112449209B (en) * 2019-08-29 2022-06-10 中移物联网有限公司 Video storage method and device, cloud server and computer readable storage medium
CN110602122A (en) * 2019-09-20 2019-12-20 北京达佳互联信息技术有限公司 Video processing method and device, electronic equipment and storage medium
CN112104893B (en) * 2020-11-04 2021-01-29 武汉中科通达高新技术股份有限公司 Video stream management method and device for realizing plug-in-free playing of webpage end
CN115297095B (en) * 2022-08-08 2024-03-08 上海哔哩哔哩科技有限公司 Back source processing method, device, computing equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101094169A (en) * 2006-06-23 2007-12-26 腾讯科技(深圳)有限公司 Method, system, and client terminal for playing back advertisement in procedure of buffering network living broadcast
CN101471919A (en) * 2007-12-29 2009-07-01 突触计算机系统(上海)有限公司 Method and device for downloading slicing of equipment based on point-to-point transmission protocol
CN104125516A (en) * 2013-04-24 2014-10-29 华为技术有限公司 Media file receiving method and apparatus, media file sending method and apparatus, and system
CN104135678A (en) * 2014-08-13 2014-11-05 浪潮软件集团有限公司 Method for realizing video advertisement putting in video on demand based on HLS protocol
CN105872598A (en) * 2016-04-25 2016-08-17 乐视控股(北京)有限公司 Multimedia live method and device
WO2017001289A1 (en) * 2015-06-30 2017-01-05 British Telecommunications Public Limited Company Low latency media streaming

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101094169A (en) * 2006-06-23 2007-12-26 腾讯科技(深圳)有限公司 Method, system, and client terminal for playing back advertisement in procedure of buffering network living broadcast
CN101471919A (en) * 2007-12-29 2009-07-01 突触计算机系统(上海)有限公司 Method and device for downloading slicing of equipment based on point-to-point transmission protocol
CN104125516A (en) * 2013-04-24 2014-10-29 华为技术有限公司 Media file receiving method and apparatus, media file sending method and apparatus, and system
CN104135678A (en) * 2014-08-13 2014-11-05 浪潮软件集团有限公司 Method for realizing video advertisement putting in video on demand based on HLS protocol
WO2017001289A1 (en) * 2015-06-30 2017-01-05 British Telecommunications Public Limited Company Low latency media streaming
CN105872598A (en) * 2016-04-25 2016-08-17 乐视控股(北京)有限公司 Multimedia live method and device

Also Published As

Publication number Publication date
CN108632642A (en) 2018-10-09

Similar Documents

Publication Publication Date Title
CN108632642B (en) Streaming media pushing method and device
US11470405B2 (en) Network video streaming with trick play based on separate trick play files
RU2652099C2 (en) Transmission device, transmission method, reception device and reception method
EP3028433B1 (en) Averting ad skipping in adaptive bit rate systems
US9247317B2 (en) Content streaming with client device trick play index
US8818021B2 (en) Watermarking of digital video
US20140359678A1 (en) Device video streaming with trick play based on separate trick play files
EP2961162A1 (en) Information processing apparatus, data management method, and program
US10863211B1 (en) Manifest data for server-side media fragment insertion
US9153127B2 (en) Video transmitting apparatus, video receiving apparatus, and video transmission system
WO2014193996A2 (en) Network video streaming with trick play based on separate trick play files
US11412272B2 (en) System and method for converting adaptive stream to downloadable media
CN103404159B (en) System and method for communicating session information for use in forensic watermarking
CN109587514B (en) Video playing method, medium and related device
US9390274B2 (en) Media data processing method and apparatus
RU2651241C2 (en) Transmission device, transmission method, reception device and reception method
US9641908B2 (en) Method and system for transferring real-time audio/video stream
US20160105717A1 (en) Receiving device, receiving method, transmitting device, transmitting method, and program
US20230164398A1 (en) Video stream control
JP2005086362A (en) Data multiplexing method, data transmitting method and data receiving method
US11706275B2 (en) Media streaming
CA3174009A1 (en) Advertisement preparation systems
KR20170012211A (en) Reception apparatus, reception method, transmission apparatus, and transmission method
KR101690153B1 (en) Live streaming system using http-based non-buffering video transmission method
US11689776B2 (en) Information processing apparatus, information processing apparatus, and program

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