CN113691886B - Downloading method and device of streaming media file - Google Patents
Downloading method and device of streaming media file Download PDFInfo
- Publication number
- CN113691886B CN113691886B CN202110980865.9A CN202110980865A CN113691886B CN 113691886 B CN113691886 B CN 113691886B CN 202110980865 A CN202110980865 A CN 202110980865A CN 113691886 B CN113691886 B CN 113691886B
- Authority
- CN
- China
- Prior art keywords
- downloading
- granularity
- data
- segment
- code rate
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 50
- 239000012634 fragment Substances 0.000 claims abstract description 56
- 230000008569 process Effects 0.000 claims description 12
- 238000000547 structure data Methods 0.000 claims description 10
- 238000012544 monitoring process Methods 0.000 claims description 6
- 230000003044 adaptive effect Effects 0.000 claims description 3
- 230000008901 benefit Effects 0.000 description 7
- 238000012545 processing Methods 0.000 description 7
- 230000006870 function Effects 0.000 description 5
- 230000001360 synchronised effect Effects 0.000 description 4
- 238000010586 diagram Methods 0.000 description 3
- 238000003491 array Methods 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 2
- 238000004590 computer program Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 238000007781 pre-processing Methods 0.000 description 2
- 230000011218 segmentation Effects 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000000903 blocking effect Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 238000003780 insertion Methods 0.000 description 1
- 230000037431 insertion Effects 0.000 description 1
- AWSBQWZZLBPUQH-UHFFFAOYSA-N mdat Chemical group C1=C2CC(N)CCC2=CC2=C1OCO2 AWSBQWZZLBPUQH-UHFFFAOYSA-N 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L65/00—Network arrangements, protocols or services for supporting real-time applications in data packet communication
- H04L65/60—Network streaming of media packets
- H04L65/61—Network streaming of media packets for supporting one-way streaming services, e.g. Internet radio
- H04L65/612—Network streaming of media packets for supporting one-way streaming services, e.g. Internet radio for unicast
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/80—Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
- H04N21/83—Generation or processing of protective or descriptive data associated with content; Content structuring
- H04N21/845—Structuring of content, e.g. decomposing content into time segments
- H04N21/8456—Structuring of content, e.g. decomposing content into time segments by decomposing the content in the time domain, e.g. in time segments
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L65/00—Network arrangements, protocols or services for supporting real-time applications in data packet communication
- H04L65/60—Network streaming of media packets
- H04L65/75—Media network packet handling
- H04L65/752—Media network packet handling adapting media to network capabilities
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L65/00—Network arrangements, protocols or services for supporting real-time applications in data packet communication
- H04L65/80—Responding to QoS
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/06—Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/20—Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
- H04N21/23—Processing of content or additional data; Elementary server operations; Server middleware
- H04N21/234—Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs
- H04N21/2343—Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs involving reformatting operations of video signals for distribution or compliance with end-user requests or end-user device requirements
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/20—Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
- H04N21/23—Processing of content or additional data; Elementary server operations; Server middleware
- H04N21/238—Interfacing the downstream path of the transmission network, e.g. adapting the transmission rate of a video stream to network bandwidth; Processing of multiplex streams
- H04N21/2387—Stream processing in response to a playback request from an end-user, e.g. for trick-play
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/20—Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
- H04N21/25—Management operations performed by the server for facilitating the content distribution or administrating data related to end-users or client devices, e.g. end-user or client device authentication, learning user preferences for recommending movies
- H04N21/266—Channel or content management, e.g. generation and management of keys and entitlement messages in a conditional access system, merging a VOD unicast channel into a multicast channel
- H04N21/2662—Controlling the complexity of the video stream, e.g. by scaling the resolution or bitrate of the video stream based on the client capabilities
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/80—Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
- H04N21/83—Generation or processing of protective or descriptive data associated with content; Content structuring
- H04N21/84—Generation or processing of descriptive data, e.g. content descriptors
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/80—Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
- H04N21/83—Generation or processing of protective or descriptive data associated with content; Content structuring
- H04N21/845—Structuring of content, e.g. decomposing content into time segments
- H04N21/8455—Structuring of content, e.g. decomposing content into time segments involving pointers to the content, e.g. pointers to the I-frames of the video stream
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Computer Networks & Wireless Communication (AREA)
- Databases & Information Systems (AREA)
- Information Transfer Between Computers (AREA)
- Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)
Abstract
The application discloses a method and a device for downloading a streaming media file, wherein the method comprises the following steps: when a fragment of a streaming media file needs to be downloaded, determining a first downloading granularity, downloading fragment description data of the fragment by taking the first downloading granularity as the data volume of single request downloading, and constructing a data frame index table based on the fragment description data; and determining a second downloading granularity, and downloading the content data frames indicated by the data frame index table by taking the second downloading granularity as the data quantity of single-time request downloading. The application can improve the downloading and playing performance of the streaming media file by carrying out split downloading on each segment of the streaming media file according to a certain downloading granularity.
Description
Technical Field
The present invention relates to streaming media downloading technologies, and in particular, to a method and an apparatus for downloading a streaming media file.
Background
Dynamic adaptive streaming over HTTP (DASH) is currently widely used for internet video streaming. The audio and video stream is transmitted in FRAGMENT MP format, the server distributes in the unit of segment, the client player applies for downloading the audio and video content segment in the unit of segment, and then the video content is downloaded and played.
The inventors found in the course of implementing the present invention that: when the method for applying for downloading the audio/video content clips by using the clips as units is used for downloading the high-definition video, the problems of poor downloading and playing performances of the streaming media file exist, and the method comprises the following steps: the problems of low downloading speed, high memory expense, poor audio and video downloading synchronism, poor playing fluency, large live stream delay and the like are solved by research and analysis, and the specific reasons are as follows:
The existing video downloading scheme is that a client player searches an address of a fragment file of each fragment according to a description of a media index file (MPD), and applies for downloading the fragment in a whole section to a server according to the address. With the increasing requirement of users on video definition, DASH video with 4K and 8K resolutions is followed, and the corresponding segments of the high-resolution video are also larger, so that the downloading time of a single segment is longer, and the total downloading time of two audio and video segments needing to be synchronously played is longer. When the streaming media is played, the synchronous playing can be performed only after the complete downloading of the video clips and the audio clips with the matched time is completed, and thus, when the downloading of one audio or video clip is completed, the downloading of the other video or audio clip with the matched time is also required to be completed. Therefore, when the downloading time length of a single segment is long, the time length waiting for the corresponding synchronous segment is also long, so that on one hand, more buffer space is required to store the downloaded data which cannot be synchronously played, and on the other hand, the received video segment or audio segment cannot be timely played due to the waiting, so that the synchronism of audio and video downloading is poor, the playing fluency is further influenced, and the delay of the live broadcast stream is increased.
Disclosure of Invention
Therefore, the main objective of the present invention is to provide a method and apparatus for downloading streaming media files, which are beneficial to improving the downloading synchronism and playing performance of audio and video files.
In order to achieve the above purpose, the technical scheme provided by the invention is as follows:
a method for downloading a streaming media file, comprising:
when a fragment of a streaming media file needs to be downloaded, determining a first downloading granularity, downloading fragment description data of the fragment by taking the first downloading granularity as the data volume of single request downloading, and constructing a data frame index table based on the fragment description data;
And determining a second downloading granularity, and downloading the content data frames indicated by the data frame index table by taking the second downloading granularity as the data quantity of single-time request downloading.
Preferably, the determining the first download granularity includes:
setting the first downloading granularity as a preset fragment description data downloading granularity value;
or calculating to obtain the first downloading granularity according to the current bandwidth and the preset first granularity duration;
The determining the second download granularity includes:
Setting the second downloading granularity as a preset data frame downloading granularity value;
Or calculating to obtain the second downloading granularity according to the current bandwidth and the preset second granularity duration.
Preferably, the method further comprises:
In the downloading process, determining a target code rate matched with the current downloading speed in real time based on a monitoring result of the downloading speed; and if the target code rate is different from the code rate of the current download segment, switching the code rate of the requested download to the target code rate, and requesting the data to be downloaded according to the segment corresponding to the target code rate.
Preferably, the method further comprises:
when code rate switching occurs, loading the downloaded data corresponding to the switched code rate to a first decoder in a decoding stop state, and when a second decoder in a decoding start state finishes decoding a currently played decoding unit, switching the second decoder to the decoding stop state to stop the second decoder for decoding, and switching the first decoder to the decoding start state to start the first decoder for decoding.
The embodiment of the invention also provides a device for downloading the streaming media file, which comprises the following steps:
The first downloading unit is used for determining a first downloading granularity when the fragments of the streaming media file are required to be downloaded, downloading fragment description data of the fragments according to the first downloading granularity which is the data quantity of single request downloading, and constructing a data frame index table based on the fragment description data;
and the second downloading unit is used for determining a second downloading granularity, and downloading the content data frames indicated by the data frame index table by taking the second downloading granularity as the data quantity of single request downloading.
Preferably, the first downloading unit is specifically configured to determine the first downloading granularity, and includes: setting the first downloading granularity as a preset fragment description data downloading granularity value; or calculating to obtain the first downloading granularity according to the current bandwidth and the preset first granularity duration;
The second downloading unit is specifically configured to determine a second downloading granularity, and includes: setting the second downloading granularity as a preset data frame downloading granularity value; or calculating to obtain the second downloading granularity according to the current bandwidth and the preset second granularity duration.
Preferably, the apparatus further comprises:
The code rate switching unit is used for determining a target code rate matched with the current downloading speed in real time based on a monitoring result of the downloading speed in the downloading process; if the target code rate is different from the code rate of the current download segment, determining that the code rate switching is needed currently, triggering the first download unit and the second download unit, and requesting the data to be downloaded according to the segment corresponding to the target code rate.
Preferably, the apparatus further comprises:
And the decoding control unit is used for loading the downloaded data corresponding to the code rate after the code rate switching to a first decoder in a decoding stop state at present, switching the second decoder to the decoding stop state when the second decoder in a decoding start state finishes decoding the current played decoding unit so as to stop the second decoder from decoding, and switching the first decoder to the decoding start state so as to start the first decoder to decode.
The embodiment of the invention also discloses an electronic device for downloading the streaming media file, which comprises a processor and a memory;
the memory stores therein an application executable by the processor for causing the processor to perform the streaming media file downloading method as described above.
The embodiment of the invention also discloses a computer readable storage medium, wherein computer readable instructions are stored, and the computer readable instructions are used for executing the downloading method of the streaming media file.
In summary, in the downloading scheme of the streaming media file provided by the embodiment of the invention, for each segment of the streaming media file to be downloaded, the client side does not request to download the whole segment again, but segments each segment according to a certain downloading granularity, and requests to download the streaming media file in a smaller-granularity request downloading unit, so that the transmission time of single request downloading data can be greatly reduced by thinning the downloading granularity of the segment, and the downloading time of synchronous audio and video data can be reduced, so that the downloaded audio and video data can be timely played, thereby effectively improving the synchronicity of audio and video downloading, guaranteeing the fluency of video playing, and particularly effectively avoiding live broadcast streaming delay. In addition, the above scheme considers that the structure types of different functional data contained in the clip file are different, and the detachable basic data units of different structure types are different, specifically, for the clip description type data, the basic data unit is a bit, and for the actual media data, the basic data unit is a data frame, so that the rationality of downloading the clip is effectively ensured by respectively setting the downloading granularity (namely, the first downloading granularity and the second downloading granularity) for the data of different structure types by distinguishing the data of different structure types in the clip file.
Drawings
FIG. 1 is a schematic flow chart of a method according to an embodiment of the invention;
FIG. 2 is a schematic diagram showing the comparison of the effect of the segment segmentation request downloading and the whole segment request downloading of the prior art scheme;
fig. 3 is a schematic view of a device structure according to an embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the drawings and the embodiments, in order to make the objects, technical solutions and advantages of the present invention more apparent.
Fig. 1 is a flow chart of a method for downloading a streaming media file according to an embodiment of the present invention, as shown in fig. 1, where the embodiment mainly includes:
Step 101, when a fragment of a streaming media file needs to be downloaded, determining a first downloading granularity, downloading fragment description data of the fragment according to the first downloading granularity as a data volume of single request downloading, and constructing a data frame index table based on the fragment description data.
In this step, for each segment of the streaming media file, the client needs to control the data amount of the segment description data requested to be downloaded each time according to the first downloading granularity, and sequentially downloads the segment description data in the segment. In this way, by implementing the downloading of the fragment description data with a smaller request download granularity than the fragment, the download processing delay of the fragment description data can be reduced.
Here, each video clip file is composed of two parts of clip description data and a content data frame. The clip description data is the description and description information of the clip, and the content data frame is the media data to be decoded and played in the clip. For DASH segments, the segment description data is specifically moof structure data in the segments, and the content data frame is mdat structure data in the segments. The content data frame is made up of a number of data frames.
In practical application, the first downloading granularity may be determined according to a preset granularity value or in combination with the current bandwidth, which is specifically as follows:
The method comprises the following steps: and setting the first downloading granularity as a preset fragment description data downloading granularity value.
Here, when the size of the downloading of the fragment description data is too large, the amount of the downloading data of the single request is too large, and the advantages of downloading the fragment description data cannot be effectively exerted, whereas when the size of the downloading of the fragment description data is too small, the amount of the downloading data of the single request is too small, and the cost of the downloading request is too high, and specifically, a user or a person skilled in the art can set the appropriate size of the downloading of the fragment description data according to experience or actual downloading requirements based on the rules.
In view of the structural characteristics of the segment description data, it is preferable that the unit of the download granularity value of the segment description data is Byte in order to facilitate the cut download of the segment description data. For example, 500Byte may be set, but is not limited thereto.
The second method is as follows: and calculating to obtain the first downloading granularity according to the current bandwidth and the preset first granularity duration.
Specifically, a product of the current bandwidth and the first granularity duration may be calculated, resulting in a first download granularity.
Here, the first downloading granularity is calculated based on the current downloading bandwidth and the preset granularity duration, so that the downloading duration of data requested to be downloaded each time is the same as or close to the first granularity duration, the first granularity duration can be utilized, the data downloading duration of single request to be downloaded is controllable, further the fluency of fragment downloading and processing can be ensured, and the advantage of fine granularity cut downloading of fragment description data can be effectively exerted.
When the first granularity time is too long, the data quantity of the single request download is too much, and the advantages of downloading the fragments in a cut mode cannot be effectively exerted, otherwise, when the first granularity time is too long, the data quantity of the single request download is too little, and further the cost of the download request is too much. Specifically, the first granularity duration may be set to a proper value by a user or a person skilled in the art according to the network situation and the playing requirement of the actual application scenario, in combination with the above rule.
In step 101, in order to facilitate the downloading of the content data frames of the segments in further steps, a data frame index table needs to be constructed based on the segment description data. The data frame index table will include information about each media data frame in the corresponding segment. Thus, when the content data frames of the clips are downloaded subsequently, the data frames in the table can be downloaded sequentially according to the second downloading granularity based on the data frame index table. Specifically, when the completion of the download of the trunk structure data in the fragment description data is detected, the data frame index table can be constructed immediately based on the trunk structure data. The trunk structure (TRACK FRAGMENT Run Box) is used to describe a set of consecutive data frame information for the current segment, which gives specific information for all data frames in the segment including: positional offset in the file, data frame size, data frame duration, key frame flag, etc. The specific method for constructing the data frame index table is known to those skilled in the art, and will not be described herein.
Step 102, determining a second downloading granularity, and downloading the content data frames indicated by the data frame index table by taking the second downloading granularity as the data volume of single request downloading.
In this step, for each segment of the streaming media file, the client needs to control the content data amount of the segment requested to be downloaded each time according to the first downloading granularity, and sequentially cut off the actual content data frame of the segment to be downloaded. In this way, by downloading the content data frames of the segments with smaller request downloading granularity than the segments, the downloading and waiting processing time delay of the actual content data frames can be reduced, and the buffer data amount is reduced, so that the fluency of playing the streaming media file can be improved, and the storage cost can be reduced.
In practical application, the second downloading granularity may be determined according to a preset granularity value or in combination with the current bandwidth, and specifically as follows:
setting the second downloading granularity as a preset data frame downloading granularity value.
Here, when the data frame downloading granularity value is too large, the data volume of the single request downloading is too large, and the advantage of downloading the fragments cannot be effectively exerted, whereas when the data frame downloading granularity value is too small, the data volume of the single request downloading is too small, and further the cost of the downloading request is too high, specifically, a user or a person skilled in the art can set a proper data frame downloading granularity value according to experience or actual downloading requirements based on the rules.
Considering that the content data frame is a structure characteristic formed by a plurality of frames, preferably, in order to simplify the operation cost, the content data frame is convenient to be cut and downloaded, and the unit of the data frame downloading granularity value is a frame, namely a plurality of frames. Of course, the unit of the data frame download granularity value may also be set as Byte. When downloading is requested based on the data frame downloading granularity value, the data frame downloading granularity value is converted into the nearest data frame quantity based on the data quantity of the current data frame to be downloaded provided in the data frame index table, and the downloading of the content data is requested based on the quantity. Thus, the integrity of the data frame downloaded each time can be ensured, and the subsequent decoding processing is convenient.
In addition, in one embodiment, to facilitate subsequent decoding of the downloaded data, the data frame download granularity value may also be set based on the number of data frames in a single decoding unit, such that the number of data frames requested for download at a time is an integer multiple of the number of data frames in a single decoding unit.
And secondly, calculating to obtain the second downloading granularity according to the current bandwidth and the preset second granularity duration.
Specifically, the product of the current bandwidth and the second granularity duration may be calculated, resulting in a second download granularity.
In the second method, the second downloading granularity is dynamically set based on the current bandwidth, so that the data downloading duration of each request for downloading is the same as or close to the second granularity duration, the second granularity duration can be utilized, the data downloading duration of single request for downloading is controllable, further the smoothness of fragment downloading and processing can be ensured, and the advantage of fine granularity cut downloading of fragment description data is effectively exerted.
When the second granularity time is too long, the data volume of the single request download is too much, and the advantages of downloading the segment cut cannot be effectively exerted, whereas when the second granularity time is too long, the data volume of the single request download is too little, and further the cost of the download request is too much. Specifically, the second granularity duration may be set by a user or a person skilled in the art to a suitable value, such as 500ms, according to the network situation and playing requirement of the actual application scenario, but is not limited thereto.
In steps 101 and 102, when downloading data of each granularity is specifically requested, downloading data corresponding to a data section in a current segment is requested to a server based on an address of the current segment file and the data section corresponding to the currently requested data. The address of the clip file may be obtained by resolving an index file (e.g., MPD) in the streaming media file and constructing according to the resolving result, and the specific method is known to those skilled in the art, so that the description thereof will not be repeated.
With the steps 101 and 102, for each segment of the streaming media file that the client needs to download, the client does not request to download the entire segment again, but segments each segment according to a certain download granularity, and requests to download the streaming media file in a unit of downloading request with a smaller granularity. Fig. 2 shows a comparison diagram of the downloading request of the segment segmentation in the embodiment of the present invention and the downloading request of the whole segment in the existing scheme, as shown in fig. 2, the downloading granularity in the embodiment of the present invention is smaller, so that the transmission duration of the downloading data requested by a single time can be greatly reduced, and the downloading duration of the audio and video data to be synchronized can be reduced, so that the downloaded audio and video data can be decoded and played in time, thereby effectively improving the synchronicity of the audio and video downloading, guaranteeing the fluency of the video playing, and especially effectively avoiding the live broadcast start delay.
In one embodiment, considering that the network bandwidth is dynamically changed in the actual application, the code rate switching can be triggered timely according to the actually measured bandwidth in the downloading process, so that the code rate of the segment is matched with the actual bandwidth, namely, the segment file with high definition can be downloaded under the condition of large bandwidth, and the segment file with low definition can be downloaded under the condition of small bandwidth, thus, the streaming media file with higher playing quality can be obtained under the premise of ensuring the downloading speed, and the streaming media playing effect can be improved as much as possible. Specifically, the above object can be achieved by the following method:
in the downloading process of steps 101 and 102, determining a target code rate matched with the current downloading speed in real time based on a monitoring result of the downloading speed; and if the target code rate is different from the code rate of the current download segment, switching the code rate of the requested download to the target code rate, and requesting the data to be downloaded according to the segment corresponding to the target code rate.
It should be noted that, in order to meet different playing requirements of the user, for the same segment, different code rate data corresponding to different definitions are stored in the server. By adopting the method, if the code rate is required to be switched in the downloading process of the fragments, the new code rate data can be acquired according to timely switching, and the new code rate data can be acquired without waiting for the completion of the downloading of the whole current fragments.
In one embodiment, considering that in the actual downloading process, there may be a case that the server has not generated the requested data, at this time, the server may return a message of downloading failure to the client, and after receiving the downloading failure message, the client requests to download the corresponding data again.
In one embodiment, considering that when the code rate is switched, the decoder needs to reset the preprocessing for a new code rate, so that the decoding delay is increased and play is blocked, the method can reduce the code rate switching time by using a mode of cooperatively processing a plurality of decoders when the code rate is switched, and specifically can be implemented by adopting the following method:
when code rate switching occurs, loading the downloaded data corresponding to the switched code rate to a first decoder in a decoding stop state, and when a second decoder in a decoding start state finishes decoding a currently played decoding unit, switching the second decoder to the decoding stop state to stop the second decoder for decoding, and switching the first decoder to the decoding start state to start the first decoder for decoding.
In the above method, when the decoder is switched to the decoding stop state, the connection between the decoder and the display unit is disconnected, and when the decoder is switched to the decoding on state, the decoder is connected to the display unit.
By adopting the method, when the code rate switching occurs, the downloaded new code rate decoding unit data is preloaded into other decoders which do not start decoding, so that the preprocessing is reset in advance for the new code rate, and when the current decoder processes the old code rate decoding unit data, the decoder which has completed the data preloading is started to decode, so that the waiting time of the new code rate segment is reduced by utilizing the preloading of the decoding unit, the code rate switching time can be effectively reduced, and the influence of the code rate switching on the playing fluency is avoided.
In an actual streaming media playing scene, when a server side inserts new streaming media data (such as an advertisement stream) in a live stream, by adopting the method, the co-processing of a plurality of decoders can be utilized to realize the non-blocking insertion of the new streaming media. The specific process is as follows:
When a client receives a media index file (MPD) of a new stream media file inserted in a live stream by a server, analyzing the MPD to obtain a corresponding code rate, downloading the new stream media file according to the code rate, if the code rate is different from the code rate of current decoding data, loading the downloaded new stream media file to a first decoder in a decoding stop state, and switching a second decoder in a decoding start state to a decoding stop state when the second decoder in the decoding start state finishes decoding a current playing decoding unit so as to stop decoding by the second decoder, and switching the first decoder to the decoding start state so as to start the first decoder to decode.
Corresponding to the above method embodiment, the embodiment of the present invention further provides a device for downloading a streaming media file, where the device shown in fig. 3 includes:
The first downloading unit is used for determining a first downloading granularity when the fragments of the streaming media file are required to be downloaded, downloading fragment description data of the fragments according to the first downloading granularity which is the data quantity of single request downloading, and constructing a data frame index table based on the fragment description data;
and the second downloading unit is used for determining a second downloading granularity, and downloading the content data frames indicated by the data frame index table by taking the second downloading granularity as the data quantity of single request downloading.
In one embodiment, the first downloading unit is specifically configured to determine the first downloading granularity, and includes: setting the first downloading granularity as a preset fragment description data downloading granularity value; or calculating to obtain the first downloading granularity according to the current bandwidth and the preset first granularity duration;
The second downloading unit is specifically configured to determine a second downloading granularity, and includes: setting the second downloading granularity as a preset data frame downloading granularity value; or calculating to obtain the second downloading granularity according to the current bandwidth and the preset second granularity duration.
In one embodiment, the apparatus further comprises:
The code rate switching unit is used for determining a target code rate matched with the current downloading speed in real time based on a monitoring result of the downloading speed in the downloading process; if the target code rate is different from the code rate of the current download segment, determining that the code rate switching is needed currently, triggering the first download unit and the second download unit, and requesting the data to be downloaded according to the segment corresponding to the target code rate.
In one embodiment, the apparatus further comprises:
And the decoding control unit is used for loading the downloaded data corresponding to the code rate after the code rate switching to a first decoder in a decoding stop state at present, switching the second decoder to the decoding stop state when the second decoder in a decoding start state finishes decoding the current played decoding unit so as to stop the second decoder from decoding, and switching the first decoder to the decoding start state so as to start the first decoder to decode.
According to the above embodiment of the method for downloading the streaming media file, the embodiment of the application realizes a device for downloading the streaming media file, which comprises a processor and a memory; the memory stores therein an application executable by the processor for causing the processor to perform the streaming media file downloading method as described above. Specifically, a system or apparatus provided with a storage medium on which a software program code realizing the functions of any of the above embodiments is stored, and a computer (or CPU or MPU) of the system or apparatus may be caused to read out and execute the program code stored in the storage medium. Further, some or all of the actual operations may be performed by an operating system or the like operating on a computer based on instructions of the program code. The program code read out from the storage medium may also be written into a memory provided in an expansion board inserted into a computer or into a memory provided in an expansion unit connected to the computer, and then a CPU or the like mounted on the expansion board or the expansion unit may be caused to perform part or all of actual operations based on instructions of the program code, thereby realizing the functions of any of the above-described embodiments of the streaming media file downloading method.
The memory may be implemented as various storage media such as an electrically erasable programmable read-only memory (EEPROM), a Flash memory (Flash memory), a programmable read-only memory (PROM), and the like. A processor may be implemented to include one or more central processors or one or more field programmable gate arrays, where the field programmable gate arrays integrate one or more central processor cores. In particular, the central processor or central processor core may be implemented as a CPU or MCU.
Embodiments of the present application implement a computer program product comprising computer programs/instructions which, when executed by a processor, implement the steps of downloading a streaming media file as described above.
It should be noted that not all the steps and modules in the above processes and the structure diagrams are necessary, and some steps or modules may be omitted according to actual needs. The execution sequence of the steps is not fixed and can be adjusted as required. The division of the modules is merely for convenience of description and the division of functions adopted in the embodiments, and in actual implementation, one module may be implemented by a plurality of modules, and functions of a plurality of modules may be implemented by the same module, and the modules may be located in the same device or different devices.
The hardware modules in the various embodiments may be implemented mechanically or electronically. For example, a hardware module may include specially designed permanent circuits or logic devices (e.g., special purpose processors such as FPGAs or ASICs) for performing certain operations. A hardware module may also include programmable logic devices or circuits (e.g., including a general purpose processor or other programmable processor) temporarily configured by software for performing particular operations. As regards implementation of the hardware modules in a mechanical manner, either by dedicated permanent circuits or by circuits that are temporarily configured (e.g. by software), this may be determined by cost and time considerations.
In this document, "schematic" means "serving as an example, instance, or illustration," and any illustrations, embodiments described herein as "schematic" should not be construed as a more preferred or advantageous solution. For simplicity of the drawing, the parts relevant to the present invention are shown only schematically in the drawings, and do not represent the actual structure thereof as a product. Additionally, in order to simplify the drawing for ease of understanding, components having the same structure or function in some of the drawings are shown schematically with only one of them, or only one of them is labeled. In this document, "a" does not mean to limit the number of relevant portions of the present invention to "only one thereof", and "an" does not mean to exclude the case where the number of relevant portions of the present invention is "more than one". In this document, "upper", "lower", "front", "rear", "left", "right", "inner", "outer", and the like are used merely to indicate relative positional relationships between the relevant portions, and do not limit the absolute positions of the relevant portions.
The foregoing description is only of the preferred embodiments of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims (8)
1. A method for downloading a streaming media file, comprising:
For each fragment of a streaming media file, when the fragment needs to be downloaded, determining a first downloading granularity, sequentially downloading fragment description data in the fragment according to the first downloading granularity as the data quantity of single request downloading, and when the completion of the downloading of the trunk structure data in the fragment description data is detected, constructing a data frame index table based on the trunk structure data in the fragment description data; the data frame index table contains the relevant information of each content data frame in the fragment; the type of the streaming media file is dynamic adaptive streaming over HTTP (DASH), each segment of the streaming media file is composed of the segment description data and content data frames, the segment description data is descriptive description information of the segment, the content data frames are media data to be decoded and played in the segment, and the trunk structure data is used for describing a group of continuous data frame information of the current segment;
Determining a second downloading granularity, and sequentially cutting and downloading the content data frames indicated by the data frame index table according to the second downloading granularity as the data quantity of single-time request downloading;
the determining the first download granularity includes:
setting the first downloading granularity as a preset fragment description data downloading granularity value;
or calculating to obtain the first downloading granularity according to the current bandwidth and the preset first granularity duration;
The determining the second download granularity includes:
Setting the second downloading granularity as a preset data frame downloading granularity value;
Or calculating to obtain the second downloading granularity according to the current bandwidth and the preset second granularity duration.
2. The method according to claim 1, wherein the method further comprises:
In the downloading process, determining a target code rate matched with the current downloading speed in real time based on a monitoring result of the downloading speed; and if the target code rate is different from the code rate of the current download segment, switching the code rate of the requested download to the target code rate, and requesting the data to be downloaded according to the segment corresponding to the target code rate.
3. The method according to claim 1, wherein the method further comprises:
when code rate switching occurs, loading the downloaded data corresponding to the switched code rate to a first decoder in a decoding stop state, and when a second decoder in a decoding start state finishes decoding a currently played decoding unit, switching the second decoder to the decoding stop state to stop the second decoder for decoding, and switching the first decoder to the decoding start state to start the first decoder for decoding.
4. A streaming media file downloading apparatus, comprising:
A first downloading unit, configured to determine a first downloading granularity for each segment of a streaming media file when the segment needs to be downloaded, sequentially downloading segment description data in the segment with the first downloading granularity as a data amount of single request downloading, and when it is detected that downloading of trunk structure data in the segment description data is completed, constructing a data frame index table based on the trunk structure data in the segment description data; the data frame index table contains the relevant information of each content data frame in the fragment; the type of the streaming media file is dynamic adaptive streaming over HTTP (DASH), each segment of the streaming media file is composed of the segment description data and content data frames, the segment description data is descriptive description information of the segment, the content data frames are media data to be decoded and played in the segment, and the trunk structure data is used for describing a group of continuous data frame information of the current segment;
A second downloading unit, configured to determine a second downloading granularity, where the second downloading granularity is a data amount of a single request for downloading, and the second downloading granularity is a request downloading granularity smaller than the fragment, and sequentially cut down the content data frames indicated by the data frame index table;
The first downloading unit is specifically configured to determine the first downloading granularity, and includes: setting the first downloading granularity as a preset fragment description data downloading granularity value; or calculating to obtain the first downloading granularity according to the current bandwidth and the preset first granularity duration;
The second downloading unit is specifically configured to determine a second downloading granularity, and includes: setting the second downloading granularity as a preset data frame downloading granularity value; or calculating to obtain the second downloading granularity according to the current bandwidth and the preset second granularity duration.
5. The downloading device as claimed in claim 4, wherein the device further comprises:
The code rate switching unit is used for determining a target code rate matched with the current downloading speed in real time based on a monitoring result of the downloading speed in the downloading process; if the target code rate is different from the code rate of the current download segment, determining that the code rate switching is needed currently, triggering the first download unit and the second download unit, and requesting the data to be downloaded according to the segment corresponding to the target code rate.
6. The downloading device as claimed in claim 4, wherein the device further comprises:
And the decoding control unit is used for loading the downloaded data corresponding to the code rate after the code rate switching to a first decoder in a decoding stop state at present, switching the second decoder to the decoding stop state when the second decoder in a decoding start state finishes decoding the current played decoding unit so as to stop the second decoder from decoding, and switching the first decoder to the decoding start state so as to start the first decoder to decode.
7. An electronic device for downloading streaming media files, comprising a processor and a memory;
The memory stores therein an application executable by the processor for causing the processor to perform the streaming media file downloading method according to any one of claims 1 to 3.
8. A computer readable storage medium having stored therein computer readable instructions for performing the method of downloading a streaming media file according to any one of claims 1 to 3.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110980865.9A CN113691886B (en) | 2021-08-25 | 2021-08-25 | Downloading method and device of streaming media file |
PCT/KR2022/012065 WO2023027399A1 (en) | 2021-08-25 | 2022-08-12 | Method and device for downloading streaming media file |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110980865.9A CN113691886B (en) | 2021-08-25 | 2021-08-25 | Downloading method and device of streaming media file |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113691886A CN113691886A (en) | 2021-11-23 |
CN113691886B true CN113691886B (en) | 2024-05-07 |
Family
ID=78582524
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110980865.9A Active CN113691886B (en) | 2021-08-25 | 2021-08-25 | Downloading method and device of streaming media file |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN113691886B (en) |
WO (1) | WO2023027399A1 (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113691886B (en) * | 2021-08-25 | 2024-05-07 | 三星电子(中国)研发中心 | Downloading method and device of streaming media file |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP1670256A2 (en) * | 2004-12-10 | 2006-06-14 | Microsoft Corporation | A system and process for controlling the coding bit rate of streaming media data |
CN102073494A (en) * | 2010-12-30 | 2011-05-25 | 用友软件股份有限公司 | Method and device for managing cache data |
CN104768051A (en) * | 2015-03-06 | 2015-07-08 | 深圳市九洲电器有限公司 | Self-adaption switching method and system for multi-coding form program streams |
CN106231440A (en) * | 2016-07-22 | 2016-12-14 | 华为技术有限公司 | A kind of files in stream media burst method for down loading, device and terminal |
CN106792112A (en) * | 2016-12-07 | 2017-05-31 | 北京小米移动软件有限公司 | Video broadcasting method and device |
US10356159B1 (en) * | 2016-06-27 | 2019-07-16 | Amazon Technologies, Inc. | Enabling playback and request of partial media fragments |
CN111526089A (en) * | 2020-04-14 | 2020-08-11 | 北京交通大学 | Data fusion transmission and scheduling device based on variable-length granularity |
CN112104885A (en) * | 2020-09-09 | 2020-12-18 | 海看网络科技(山东)股份有限公司 | System and method for accelerating M3U8 initial playing speed in live broadcasting |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8379851B2 (en) * | 2008-05-12 | 2013-02-19 | Microsoft Corporation | Optimized client side rate control and indexed file layout for streaming media |
KR20170083641A (en) * | 2012-07-10 | 2017-07-18 | 브이아이디 스케일, 인크. | Quality-driven streaming |
US10270823B2 (en) * | 2015-02-10 | 2019-04-23 | Qualcomm Incorporated | Low latency video streaming |
KR101946471B1 (en) * | 2015-07-21 | 2019-02-11 | 주식회사 이노피아테크 | Apparatus and method for synchronizing video and audio |
CN112866730B (en) * | 2020-12-31 | 2022-09-13 | 广州博冠信息科技有限公司 | Streaming media data transmission method, device, system, electronic equipment and storage medium |
CN113691886B (en) * | 2021-08-25 | 2024-05-07 | 三星电子(中国)研发中心 | Downloading method and device of streaming media file |
-
2021
- 2021-08-25 CN CN202110980865.9A patent/CN113691886B/en active Active
-
2022
- 2022-08-12 WO PCT/KR2022/012065 patent/WO2023027399A1/en unknown
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP1670256A2 (en) * | 2004-12-10 | 2006-06-14 | Microsoft Corporation | A system and process for controlling the coding bit rate of streaming media data |
CN102073494A (en) * | 2010-12-30 | 2011-05-25 | 用友软件股份有限公司 | Method and device for managing cache data |
CN104768051A (en) * | 2015-03-06 | 2015-07-08 | 深圳市九洲电器有限公司 | Self-adaption switching method and system for multi-coding form program streams |
US10356159B1 (en) * | 2016-06-27 | 2019-07-16 | Amazon Technologies, Inc. | Enabling playback and request of partial media fragments |
CN106231440A (en) * | 2016-07-22 | 2016-12-14 | 华为技术有限公司 | A kind of files in stream media burst method for down loading, device and terminal |
CN106792112A (en) * | 2016-12-07 | 2017-05-31 | 北京小米移动软件有限公司 | Video broadcasting method and device |
CN111526089A (en) * | 2020-04-14 | 2020-08-11 | 北京交通大学 | Data fusion transmission and scheduling device based on variable-length granularity |
CN112104885A (en) * | 2020-09-09 | 2020-12-18 | 海看网络科技(山东)股份有限公司 | System and method for accelerating M3U8 initial playing speed in live broadcasting |
Also Published As
Publication number | Publication date |
---|---|
WO2023027399A1 (en) | 2023-03-02 |
CN113691886A (en) | 2021-11-23 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9961398B2 (en) | Method and device for switching video streams | |
US11622134B2 (en) | System and method for low-latency content streaming | |
US11825034B2 (en) | Bullet screen delivery method for live broadcast playback and live video bullet screen playback method | |
US9076493B2 (en) | Video processing method apparatus | |
WO2020155964A1 (en) | Audio/video switching method and apparatus, and computer device and readable storage medium | |
JP7182727B2 (en) | Method, apparatus and computer program for receiving media data of a session | |
WO2022095528A1 (en) | Video playback method and apparatus, device, and readable storage medium | |
WO2020155960A1 (en) | Video playback method and system, computer device, and computer readable storage medium | |
CN105187896A (en) | Multi-segment media file playing method and system | |
CN111726641A (en) | Live video playing processing method and device and server | |
JP2023520651A (en) | Media streaming method and apparatus | |
CN113691886B (en) | Downloading method and device of streaming media file | |
CN105187897B (en) | The media file span playback method and system more being segmented | |
WO2020155961A1 (en) | Video request method and system, and computer device and computer-readable storage medium | |
CN106331763B (en) | Method for seamlessly playing fragmented media file and device for implementing method | |
CN113079386B (en) | Video online playing method and device, electronic equipment and storage medium | |
CN112243136B (en) | Content playing method, video storage method and device | |
CN112118309A (en) | Audio translation method and system | |
US10863179B1 (en) | Overlapped rate control for high-quality segmented video encoding | |
CN113364728B (en) | Media content receiving method, device, storage medium and computer equipment | |
US20230239328A1 (en) | Computer implemented method for processing streaming requests and responses | |
CN110636348B (en) | Video playing method, device and system | |
US20230239534A1 (en) | Systems and methods for just in time transcoding of video on demand | |
US20240022792A1 (en) | Method for bandwidth switching by cmaf and dash clients using addressable resource index tracks and events | |
CN112887774A (en) | Method and device for playing content seamlessly |
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 |