CN108668146B - Method and equipment for adjusting streaming media code rate - Google Patents
Method and equipment for adjusting streaming media code rate Download PDFInfo
- Publication number
- CN108668146B CN108668146B CN201710190142.2A CN201710190142A CN108668146B CN 108668146 B CN108668146 B CN 108668146B CN 201710190142 A CN201710190142 A CN 201710190142A CN 108668146 B CN108668146 B CN 108668146B
- Authority
- CN
- China
- Prior art keywords
- code rate
- fragment
- candidate
- server
- cache
- 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
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/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
- 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
- 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/10—Protocols in which an application is distributed across nodes in the network
- H04L67/104—Peer-to-peer [P2P] networks
- H04L67/1074—Peer-to-peer [P2P] networks for supporting data block transmission mechanisms
- H04L67/1078—Resource delivery mechanisms
- H04L67/108—Resource delivery mechanisms characterised by resources being split in blocks or fragments
-
- 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/239—Interfacing the upstream path of the transmission network, e.g. prioritizing client content requests
- H04N21/2393—Interfacing the upstream path of the transmission network, e.g. prioritizing client content requests involving handling client requests
-
- 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/24—Monitoring of processes or resources, e.g. monitoring of server load, available bandwidth, upstream requests
- H04N21/2402—Monitoring of the downstream path of the transmission network, e.g. bandwidth available
-
- 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/60—Network 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/63—Control 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/643—Communication protocols
-
- 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
Landscapes
- Engineering & Computer Science (AREA)
- Signal Processing (AREA)
- Multimedia (AREA)
- Computer Networks & Wireless Communication (AREA)
- Databases & Information Systems (AREA)
- Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)
- Information Transfer Between Computers (AREA)
Abstract
A method and device for adjusting the code rate of streaming media can include: a server receives a resource request of a terminal device, wherein the resource request comprises a smooth code rate and the cache duration of a cache region of the terminal device, and the smooth code rate is a code rate matched with the download rate of a current video film source downloaded by the terminal device; the server determines a target fragment from a video fragment source to be played currently by the terminal equipment, and sends the target fragment to the terminal equipment, wherein the code rate of the target fragment is smaller than the smooth code rate, and the predicted downloading time length of the target fragment is smaller than the cache time length. By adopting the scheme, the server can provide fragments adaptive to the terminal equipment for the terminal equipment in real time, and the playing continuity of the streaming media is ensured.
Description
Technical Field
The present application relates to the field of live video processing technologies, and in particular, to a method and a device for adjusting a streaming media bitrate.
Background
In internet and multimedia technology application, a user can acquire videos online from the internet through video playing terminal equipment such as a smart television, a mobile phone and the like, and because the videos acquired from the internet are transmitted through a public network, when network transmission speed jitters due to the phenomena of network jitter, large network delay fluctuation and the like, the terminal equipment needs to continuously buffer the videos, so that video pictures are continuously blocked. At present, the adaptive streaming media transmission technology is mainly adopted, and in an adaptive transmission system, a server compiles the same video into different code rates and cuts the video into a plurality of fragments. In the transmission process of the video stream, the resource bit rate can be dynamically adjusted according to factors such as network bandwidth, cache size and the like to provide the video stream transmission rate adaptive to the current network state for the terminal equipment, so that the optimal playing experience can be achieved when the network environment is poor. The terminal device may request the server for the fragments with different code rates, for example, after calculating the smooth code rate according to the code rate of the current network bandwidth and the local cache, the terminal device requests the server to download the fragments with the code rate close to the smooth code rate, thereby realizing the dynamic code rate switching.
However, the smooth code rate value calculated by the terminal device and the actual code rate error of the actually downloaded playing fragment are very large, so that the playing cache of the client is underloaded, the playing is paused, and the user experience is affected. Because the current mainstream film source encoder adopts a VBR mode to perform media encoding, namely the media code rate of a film source is not fixed, and the media code rate in a film source code rate description file issued by a server is the average code rate of a fragment. The client compares the calculated smooth code rate with the average code rate of the fragments, and if the smooth code rate is greater than the average code rate, the client performs code rate up-cutting (i.e. code rate increase), so as to obtain the fragments with higher code rates from the server. However, if the actual code rate of the original segment is much higher than the average code rate, the client performs the up-cut, so that the situation that the segment is not downloaded after the cache data of the client is exhausted occurs, and finally the playing is jammed, and after the playing is jammed, the client may be triggered to perform the code rate down-cut, so that the up-cut is performed after the down-cut, and the up-cut and the down-cut are both jammed, which may be called as a ping-pong effect.
Disclosure of Invention
The application provides a method and equipment for adjusting streaming media code rate, which can solve the problem of ping-pong effect when a self-adaptive streaming media transmission technology is adopted to carry out live video in the prior art.
A first aspect of the present application provides a method for adjusting a bitrate of streaming media, where the method includes:
the method comprises the steps that the terminal equipment sends a resource request to a server after calculating a smooth code rate, wherein the resource request mainly comprises the smooth code rate and the cache duration of a cache region of the terminal equipment, the smooth code rate is a code rate matched with the download rate of a video film source currently downloaded by the terminal equipment, the smooth code rate can adapt to the current bandwidth and is the optimal ideal code rate for playing the video film source by the current terminal equipment, and the phenomenon of pause can not occur when the terminal equipment plays a video by using the smooth code rate.
After receiving a resource request of a terminal device, a server can find a video film source to be played currently by the terminal device in a database, then determine a target fragment from the video film source to be played currently by the terminal device, and then send the target fragment to the terminal device. And the code rate of the target fragment is smaller than the smooth code rate, and the predicted downloading time length of the target fragment is smaller than the cache time length.
In the existing mechanism, the client can only compare the smooth code rate with the average code rate of the fragments, and finally the ping-pong effect of code rate switching is caused. Compared with the existing mechanism, the method and the device have the advantages that the server determines the target fragment from the video fragment source after receiving the resource request which is sent by the terminal device and comprises the smooth code rate and the cache duration, and then the server sends the target fragment to the terminal device. It can be seen that, because the code rate of the target segment sent to the terminal device by the server is smaller than the smooth code rate, and the predicted downloading duration of the target segment is smaller than the cache duration, the target segment finally sent to the terminal device meets the current smooth playing condition, the segment adapted to the terminal device can be provided for the terminal device in real time, the playing continuity of the streaming media is ensured, the problem of playing jam caused by dynamic code rate switching in the playing process of the streaming media can be reduced, and the network bandwidth resource is utilized to the maximum extent.
In some possible designs, the server determines a target segment from a video source to be currently played by the terminal device, and a specific process of sending the target segment to the terminal device may refer to the following operations 1 to 3:
1. the server selects a candidate code rate from a code rate set, wherein the code rate set refers to a set of code rates lower than the smooth code rate in a fragmentation information set, the fragmentation information set comprises fragmentation information of at least two fragments, the at least two fragments belong to the same video fragment source to be played currently, and the fragmentation information comprises a fragment size and a fragment code rate.
Optionally, the code rate set may be indicated by indication information carried by the resource request, or the code rate set may be a set of code rates selected by the server from the fragmentation information set according to the smooth code rate. The following are described separately:
(a) the code rate set is provided by the terminal equipment
Before sending a resource request, the terminal equipment can acquire the fragment information set from the server, then calculate a smooth code rate, compare the smooth code rate with each code rate in the fragment information set, finally determine a code rate set with a code rate lower than the smooth code rate, and finally carry information indicating the code rate set or the code rate set in the resource request.
Therefore, the terminal device provides the code rate set for the server, and the code rate set only needs to be traversed when the server side determines the target fragment. Of course, if the server determines the above code rate set, in (a), if the code rate set is directly provided by the terminal device, the server does not need to compare the code rate set with the fragmentation information set. Therefore, by adopting the scheme, the operation amount of the server can be effectively reduced, the operation efficiency is further improved, and finally the server can be quickly positioned to the target fragment.
(b) Code rate set is provided by a server
If the code rate set is determined by the server, the server can determine the code rate set only by the smooth code rate acquired from the terminal device, and the mode of determining the code rate set by the server is the same as that of the terminal device, which is not described herein again.
After the server determines the code rate set, the target fragment can be determined by traversing the code rate set, and by reducing the search range of the code rates, when the target fragment is determined, the smooth code rate does not need to be traversed once with each code rate in the fragment information set, and only the code rates in the code rate set need to be traversed. Therefore, by adopting the scheme, the operation amount of the server can be effectively reduced, the operation efficiency is further improved, and finally the server can be quickly positioned to the target fragment.
2. After selecting a candidate code rate from a code rate set, the server may obtain a predicted downloading duration of the candidate fragment according to an average rate and a fragment size of a target fragment corresponding to the candidate code rate, where the average rate is an average rate of a current downloading fragment of the terminal device. Optionally, the average rate may be carried in the resource request, or may be obtained by statistics of the server.
3. After the predicted downloading time length of the candidate fragment is obtained, the server judges whether the predicted downloading time length of the candidate fragment is greater than the cache time length, if the predicted downloading time length is greater than the cache time length, the server selects a code rate with a code rate lower than that of the candidate fragment from the code rate set as the candidate code rate, and repeats the operations of calculating the predicted downloading time length of the candidate fragment and judging whether the predicted downloading time length of the candidate fragment is greater than the cache time length until the candidate fragment with the predicted downloading time length less than the cache time length is found.
Correspondingly, if the predicted downloading time length of the candidate fragment is smaller than the cache time length, the server sends the candidate fragment as the target fragment to the terminal device.
In some possible designs, when a plurality of terminal devices request a server for video slice source resources at the same time, in order to reduce the judgment time length on the server side, if the predicted download time length of the candidate slices is greater than the cache time length, the server may directly select at least one slice which belongs to the same video slice source as the candidate slices and has a lower code rate than the candidate slices from the video slice sources to be played by the terminal devices. And then, the server sends a request response to the terminal equipment, wherein the request response carries a download address of the fragment which belongs to the same video fragment source as the candidate fragment and has a code rate lower than that of the candidate fragment, so that the terminal equipment can directly download the fragment. Optionally, the request response may carry a download address of the segment with the lowest code rate in the video source to which the candidate segment belongs, so that it is ensured that the terminal device side can smoothly play the segment. By the processing mechanism, the response of the server side to the plurality of terminal devices can be further optimized, so that the processing efficiency of the server can be improved, and meanwhile, the waiting time of the terminal device side is reduced.
In some possible designs, the resource request further includes a field for indicating whether the server switches to a rate adaptation mode, which may be a dynamic-request (dynamic-request) in one embodiment. If the value of the dynamic-request indication is 1, it indicates that the code rate adaptive mode is currently adopted, then the server needs to perform dynamic code rate switching, and can identify the current fragment most matched with the download rate of the terminal device through the first two extended headers of the resource request, and return the fragment to the terminal device. If the value of the dynamic-request indication is 0, it indicates that the code rate adaptation mode is not currently used (for example, the user manually closes the code rate adaptation function on the client of the terminal device), then the server does not need to perform dynamic code rate switching after receiving the resource request.
In some possible designs, in order to improve the accuracy of determining the target segment on the server side, it is necessary to consider the cache consumption of the cache region of the terminal device during the period when the terminal device sends the resource request to the server to calculate the predicted download duration of the candidate segment. Therefore, the terminal device may carry a field indicating a cache offset in the resource request, where the cache offset is an estimated value of cache consumption of a cache region of the terminal device during a period from the time when the terminal device sends the resource request to the time when the server receives the resource request. The estimated value may be an empirical value, or may be dynamically calculated by the terminal device according to the current play rate, and the specific application is not limited, so that the server may subtract the cache offset when comparing the predicted download duration with the cache duration.
A second aspect of the present application provides a method for adjusting a bitrate of streaming media, the method comprising:
the method comprises the steps that a terminal device obtains a current smooth code rate and a fragment information set, wherein the smooth code rate is a code rate matched with a downloading rate of a current video fragment source downloaded by the terminal device, the fragment information set comprises fragment information of at least two fragments, the at least two fragments belong to the same video fragment source to be played currently, and the fragment information comprises a fragment size and a fragment code rate;
the terminal equipment determines a target code rate from the fragment information set and sends a resource request to the server, wherein the target code rate is smaller than the smooth code rate, the predicted downloading duration of the target fragment corresponding to the target code rate is smaller than the current cache duration of a cache region of the terminal equipment, and the resource request is used for requesting to download the target fragment corresponding to the target code rate.
In the existing mechanism, the client can only compare the smooth code rate with the average code rate of the fragments, and finally the ping-pong effect of code rate switching is caused. Compared with the existing mechanism, in the scheme provided by the application, after the terminal equipment acquires the smooth code rate and the fragment information set, the target code rate smaller than the smooth code rate can be selected from the fragment information set, and when the predicted downloading duration of the target fragment corresponding to the selected target code rate is determined to be smaller than the current cache duration, the target code rate is indicated to be suitable for the current bandwidth, so that the terminal equipment can carry the target code rate in a resource request and send the resource request to the server, and finally the suitable target fragment is obtained. The method has the advantages that the terminal equipment can accurately judge whether the target fragment corresponding to the target code rate calculated by the server meets the current smooth playing condition or not by comparing the predicted downloading time length and the cache time length of the target fragment, so that the server can provide the fragment adaptive to the terminal equipment for the terminal equipment in real time, the playing continuity of the streaming media is ensured, the problem of playing jam caused by dynamic code rate switching in the playing process of the streaming media can be reduced, and the network bandwidth resource is utilized to the maximum extent.
In some possible designs, after the terminal device obtains the current smooth code rate and the fragment information set, before the terminal device determines the target code rate from the fragment information set, the terminal device may further determine a code rate set lower than the smooth code rate from the fragment information set, after the code rate set is determined, the terminal device may determine the target fragment, and by reducing the search range of the code rate, when the target fragment is determined, the smooth code rate does not need to traverse each code rate in the fragment information set respectively, and only the code rate in the code rate set needs to be traversed. Therefore, by adopting the scheme, the calculation amount can be effectively reduced, and the calculation efficiency can be improved.
In some possible designs, the determining, by the terminal device, a target code rate from the fragmentation information set, and sending the resource request to the server may include:
and the terminal equipment selects a candidate code rate from the code rate set, and then obtains the predicted downloading duration of the candidate fragment according to the fragment size of the candidate fragment corresponding to the candidate code rate and the average rate.
After the predicted downloading duration of the candidate fragment is obtained, the terminal equipment judges whether the predicted downloading duration of the candidate fragment is greater than the cache duration, if the predicted downloading duration of the candidate fragment is greater than the cache duration, the code rate lower than the candidate fragment is selected from the fragment set as the candidate code rate, and the operations of calculating the predicted downloading duration of the candidate fragment and judging whether the predicted downloading duration of the candidate fragment is greater than the cache duration are repeatedly executed until the target code rate corresponding to the candidate fragment of which the predicted downloading duration is less than the cache duration is found.
And if the predicted downloading duration of the candidate fragment is less than the cache duration, taking the candidate code rate as the target code rate, and sending the resource request to the server, wherein the resource request is used for requesting to download the target fragment corresponding to the target code rate.
In some possible designs, the target segment may be determined by the server instead of the terminal device determining the target segment by itself, and then the terminal device needs to provide the server with parameters related to determining the target segment. Specifically, after selecting a code rate smaller than the smoothing code rate from the fragmentation information set, the terminal device may send another resource request to the server, where the another resource request may include the smoothing code rate and a buffer duration of the terminal device buffer.
And then, after receiving the other resource request, the server selects a code rate smaller than the smooth code rate from the fragment information set, and when the predicted downloading duration of the fragment corresponding to the selected code rate is determined to be smaller than the current cache duration of the cache region of the terminal equipment, the server sends the fragment of which the predicted downloading duration is smaller than the cache duration to the terminal equipment.
For the server, how to determine the specific operation of the target segment according to another resource request sent by the terminal device may refer to the technical solution described in the first aspect, which is not described herein again.
It should be noted that, for whether the terminal device determines the target segment or the server determines the target segment, the terminal device may preferentially determine the target segment, so that the operation load of the server may be effectively reduced, and the accuracy of determining the target segment matched with the actual download rate may also be improved. The terminal equipment can actively execute the operation of determining the target code rate; or when the user closes the code rate dynamic switching function, providing operation parameters for the server, and finally determining the target fragment by the server; or, regardless of whether the user closes the code rate dynamic switching function, the terminal device can actively provide the operation parameters for the server, and finally the server determines the target fragment; of course, the other resource request may be sent to the server when the terminal device cannot correctly determine the target code rate.
Optionally, in order to reduce the operation of the server, the terminal device may further carry, in the another resource request, information for indicating a code rate set lower than the smooth code rate in the fragment information set, so that the server may determine, in a small range, the candidate code rate, reduce the number of times of determining whether the predicted download duration of the candidate fragment is smaller than the cache duration, and finally enable the server to quickly locate the target fragment.
Optionally, the another resource request further includes an average rate of currently downloaded segments of the terminal device, where the average rate is used for the server to calculate the predicted download duration of the segments.
Optionally, in consideration of that the cache of the cache region of the terminal device may have some consumption during the period from the time when the terminal device sends the another resource request to the time when the server calculates the predicted download duration of the candidate segment, in order to improve the accuracy of determining the target segment at the server side, the cache consumption of the cache region of the terminal device in the period needs to be considered. Therefore, the terminal device may carry a field indicating a cache offset in the another resource request, where the cache offset is an estimated value of cache consumption of the terminal device in a cache region during a period from when the another resource request is sent by the terminal device to when the server receives the another resource request. The estimated value may be an empirical value, or may be dynamically calculated by the terminal device according to the current play rate, and the specific application is not limited, so that the server may subtract the cache offset when comparing the predicted download duration with the cache duration.
A third aspect of the present application provides a server having a function of implementing the method for adjusting a bitrate of streaming media corresponding to the first aspect. The functions can be realized by hardware, and the functions can also be realized by executing corresponding software by hardware. The hardware or software includes one or more modules corresponding to the above functions, which may be software and/or hardware.
In one possible design, the server may include:
the system comprises a receiving and sending module, a processing module and a processing module, wherein the receiving and sending module is used for receiving a resource request of terminal equipment, the resource request comprises a smooth code rate and the cache duration of a cache region of the terminal equipment, and the smooth code rate is a code rate matched with the download rate of a current video film source downloaded by the terminal equipment;
and the processing module is used for determining a target fragment from a video fragment source to be played currently by the terminal equipment, and sending the target fragment to the terminal equipment through the transceiver module, wherein the code rate of the target fragment is less than the smooth code rate, and the predicted downloading time length of the target fragment is less than the cache time length.
Optionally, the processing module is specifically configured to:
selecting a candidate code rate from a code rate set, wherein the code rate set refers to a set of code rates lower than the smooth code rate in a fragmentation information set, the fragmentation information set comprises fragmentation information of at least two fragments, the at least two fragments belong to the same video fragment source to be played currently, and the fragmentation information comprises the size of the fragments and the code rate of the fragments;
obtaining the predicted downloading duration of the candidate fragments according to the average rate and the fragment size of the target fragments corresponding to the candidate code rates, wherein the average rate is the average rate of the current downloading fragments of the terminal equipment;
judging whether the predicted downloading duration of the candidate fragment is greater than the cache duration, if so, selecting a code rate with a code rate lower than that of the candidate fragment from the code rate set as the candidate code rate;
and if the predicted downloading time length of the candidate fragment is less than the cache time length, the candidate fragment is used as the target fragment and is sent to the terminal equipment through the transceiver module.
Optionally, the code rate set is indicated by indication information carried by the resource request, or the code rate set is a set of code rates selected by the server from the fragmentation information set according to the smooth code rate.
Optionally, the average rate is carried in the resource request, or is obtained by statistics of the server.
Optionally, the processing module is further configured to:
and if the predicted downloading time length of the candidate fragment is greater than the cache time length, sending a request response to the terminal equipment through the transceiver module, wherein the request response carries a downloading address of the fragment which belongs to the same video fragment source as the candidate fragment and has a code rate lower than that of the candidate fragment.
Optionally, the resource request further includes a field for indicating whether the server switches to the code rate adaptation mode, and/or the resource request further includes a field for indicating a buffer offset, where the buffer offset is an estimated value of buffer consumption of the terminal device buffer during a period from the terminal device sending the resource request to the server receiving the resource request.
In another possible design, the server includes:
at least one processor, memory, and transceiver;
wherein the memory is configured to store program code, and the processor is configured to call the program code in the memory to:
receiving a resource request of terminal equipment through the transceiver, wherein the resource request comprises a smooth code rate and the cache duration of a cache region of the terminal equipment, and the smooth code rate is a code rate matched with the download rate of a current video film source downloaded by the terminal equipment;
and determining a target fragment from a video fragment source to be played currently by the terminal equipment, and sending the target fragment to the terminal equipment through the transceiver, wherein the code rate of the target fragment is less than the smooth code rate, and the predicted downloading time length of the target fragment is less than the cache time length.
Optionally, the processor is specifically configured to:
selecting a candidate code rate from a code rate set, wherein the code rate set refers to a set of code rates lower than the smooth code rate in a fragmentation information set, the fragmentation information set comprises fragmentation information of at least two fragments, the at least two fragments belong to the same video fragment source to be played currently, and the fragmentation information comprises the size of the fragments and the code rate of the fragments;
obtaining the predicted downloading duration of the candidate fragments according to the average rate and the fragment size of the target fragments corresponding to the candidate code rates, wherein the average rate is the average rate of the current downloading fragments of the terminal equipment;
judging whether the predicted downloading duration of the candidate fragment is greater than the cache duration, if so, selecting a code rate with a code rate lower than that of the candidate fragment from the code rate set as the candidate code rate;
and if the predicted downloading time length of the candidate fragment is less than the cache time length, the candidate fragment is taken as the target fragment by the transceiver and is sent to the terminal equipment.
Optionally, the code rate set is indicated by indication information carried by the resource request, or the code rate set is a set of code rates selected by the server from the fragmentation information set according to the smooth code rate.
Optionally, the average rate is carried in the resource request, or is obtained by statistics of the server.
Optionally, the processor is further configured to:
and if the predicted downloading time length of the candidate fragment is greater than the cache time length, sending a request response to the terminal equipment through the transceiver, wherein the request response carries a downloading address of the fragment which belongs to the same video fragment source as the candidate fragment and has a code rate lower than that of the candidate fragment.
Optionally, the resource request further includes a field for indicating whether the server switches to the code rate adaptation mode, and/or the resource request further includes a field for indicating a buffer offset, where the buffer offset is an estimated value of buffer consumption of the terminal device buffer during a period from the terminal device sending the resource request to the server receiving the resource request.
A fourth aspect of the present application provides a terminal device having a function of implementing the method for adjusting a bitrate of a streaming media corresponding to the second aspect. The functions can be realized by hardware, and the functions can also be realized by executing corresponding software by hardware. The hardware or software includes one or more modules corresponding to the above functions, which may be software and/or hardware.
In one possible design, the terminal device may include:
the terminal equipment comprises a receiving and sending module and a slicing information collection, wherein the receiving and sending module is used for acquiring a current smooth code rate and a slicing information collection, the smooth code rate is a code rate matched with a downloading rate of a current video slice source downloaded by the terminal equipment, the slicing information collection comprises slicing information of at least two slices, the at least two slices belong to the same video slice source to be played currently, and the slicing information comprises a slice size and a slicing code rate;
and the processing module is used for determining a target code rate from the fragment information set acquired by the transceiver module, and sending a resource request to the server through the transceiver module, wherein the target code rate is less than the smooth code rate, the predicted downloading duration of the target fragment corresponding to the target code rate is less than the current caching duration of the terminal equipment cache region, and the resource request is used for requesting to download the target fragment corresponding to the target code rate.
Optionally, after the transceiver module obtains the current smooth code rate and the fragmentation information set, and before determining the target code rate from the fragmentation information set, the processing module is further configured to:
and determining a code rate set lower than the smooth code rate from the slicing information set.
Optionally, the processing module is specifically configured to:
selecting a candidate code rate from the set of code rates;
obtaining the predicted downloading duration of the candidate fragments according to the fragment size of the candidate fragments corresponding to the candidate code rate and the average rate;
judging whether the predicted downloading duration of the candidate fragment is greater than the cache duration, if so, selecting a code rate lower than the candidate fragment from the fragment set as the candidate code rate;
and if the predicted downloading duration of the candidate fragment is less than the cache duration, taking the candidate code rate as the target code rate, and sending the resource request to the server through the transceiver module, wherein the resource request is used for requesting to download the target fragment corresponding to the target code rate.
In another possible design, the terminal device includes:
at least one processor, memory, and transceiver;
wherein the memory is configured to store program code, and the processor is configured to call the program code in the memory to:
acquiring a current smooth code rate and a fragment information set through the transceiver, wherein the smooth code rate is a code rate matched with a downloading rate of a current video fragment source downloaded by the terminal equipment, the fragment information set comprises fragment information of at least two fragments, the at least two fragments belong to the same video fragment source to be played currently, and the fragment information comprises a fragment size and a fragment code rate;
determining a target code rate from the fragment information set acquired by the transceiver, and sending a resource request to the server by the transceiver, wherein the target code rate is smaller than the smooth code rate, the predicted downloading duration of a target fragment corresponding to the target code rate is smaller than the current cache duration of a terminal equipment cache region, and the resource request is used for requesting to download the target fragment corresponding to the target code rate.
Optionally, after the transceiver acquires the current smooth code rate and the slicing information set, before determining the target code rate from the slicing information set, the processor is further configured to:
and determining a code rate set lower than the smooth code rate from the slicing information set.
Optionally, the processing processor is specifically configured to:
selecting a candidate code rate from the set of code rates;
obtaining the predicted downloading duration of the candidate fragments according to the fragment size of the candidate fragments corresponding to the candidate code rate and the average rate;
judging whether the predicted downloading duration of the candidate fragment is greater than the cache duration, if so, selecting a code rate lower than the candidate fragment from the fragment set as the candidate code rate;
and if the predicted downloading duration of the candidate fragment is less than the cache duration, taking the candidate code rate as the target code rate, and sending the resource request to the server through the transceiver, wherein the resource request is used for requesting to download the target fragment corresponding to the target code rate.
Yet another aspect of the present application provides a computer-readable storage medium having stored therein instructions, which when executed on a computer, cause the computer to perform the method of the above-described aspects.
Compared with the prior art, in the scheme provided by the application, the server determines the target fragment from the video fragment source after receiving the resource request including the smooth code rate and the cache duration sent by the terminal device, and then the server sends the target fragment to the terminal device. It can be seen that, because the code rate of the target segment sent to the terminal device by the server is smaller than the smooth code rate, and the predicted downloading duration of the target segment is smaller than the cache duration, the target segment finally sent to the terminal device meets the current smooth playing condition, the segment adapted to the terminal device can be provided for the terminal device in real time, the playing continuity of the streaming media is ensured, the problem of playing jam caused by dynamic code rate switching in the playing process of the streaming media can be reduced, and the network bandwidth resource is utilized to the maximum extent.
Drawings
Fig. 1 is a schematic diagram of a network topology according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart of adjusting the bitrate of the streaming media according to the embodiment of the invention;
fig. 3 is another schematic flow chart illustrating adjusting a bitrate of streaming media according to an embodiment of the invention;
fig. 4 is another schematic flow chart illustrating adjusting a bitrate of streaming media according to an embodiment of the invention;
FIG. 5 is a schematic flow chart illustrating adjusting a bitrate of streaming media according to an embodiment of the invention;
fig. 6 is a schematic structural diagram of an apparatus for adjusting a bitrate of a streaming media according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of an entity apparatus for performing an apparatus for adjusting a bitrate of a streaming media according to an embodiment of the present invention.
Detailed Description
The terms "first," "second," and the like in the description and in the claims of the present application and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that the embodiments described herein may be practiced otherwise than as specifically illustrated or described herein. Furthermore, the terms "comprise," "include," and "have," and any variations thereof, are intended to cover non-exclusive inclusions, such that a process, method, system, article, or apparatus that comprises a list of steps or modules is not necessarily limited to those steps or modules expressly listed, but may include other steps or modules not expressly listed or inherent to such process, method, article, or apparatus, the division of modules presented herein is merely a logical division that may be implemented in a practical application in a further manner, such that a plurality of modules may be combined or integrated into another system, or some features may be omitted, or not implemented, and such that couplings or direct couplings or communicative coupling between each other as shown or discussed may be through some interfaces, indirect couplings or communicative coupling between modules may be electrical or other similar forms, this application is not intended to be limiting. The modules or sub-modules described as separate components may or may not be physically separated, may or may not be physical modules, or may be distributed in a plurality of circuit modules, and some or all of the modules may be selected according to actual needs to achieve the purpose of the present disclosure.
The application provides a method and equipment for adjusting the code rate of streaming media, which can be used in the technical field of live broadcast. The details will be described below. Fig. 1 is a network topology diagram of streaming media transmission, where a server stores various video sources, each of which includes multiple segments with different code rates, and the server may be used to create a client, configure various information of the client, and process various requests for the client on a terminal device, and may also be used to store operation data of a user using the client. The terminal equipment is provided with the client, and can respond to various operation instructions of the user aiming at the client and interact with the server.
In the application, the terminal device may send a resource request to the server to request the fragments with different code rates, and then play the fragments on the client installed on the terminal device.
In particular, the server according to the present application may be a proxy server, a web server, or the like. The terminal device referred to in this application may refer to a device that provides voice and/or data connectivity to a user, a handheld device having wireless connection capability, or other processing device connected to a wireless modem. A wireless terminal, which may be a mobile terminal such as a mobile phone (or a "cellular" phone) and a computer having a mobile terminal, for example, a portable, pocket, hand-held, computer-included or vehicle-mounted mobile device, may communicate with one or more core networks via a Radio Access Network (RAN). Examples of such devices include Personal Communication Service (PCS) phones, cordless phones, Session Initiation Protocol (SIP) phones, Wireless Local Loop (WLL) stations, and Personal Digital Assistants (PDA). A wireless Terminal may also be referred to as a system, a Subscriber Unit (Subscriber Unit), a Subscriber Station (Subscriber Station), a Mobile Station (Mobile), a Remote Station (Remote Station), an Access Point (Access Point), a Remote Terminal (Remote Terminal), an Access Terminal (Access Terminal), a User Terminal (User Terminal), a Terminal Device, a User Agent (User Agent), a User Device (User Device), or a User Equipment (User Equipment).
When the adaptive streaming media transmission technology is adopted to carry out live broadcast video, the accuracy of the code rate to be switched selected by the client is not high, and a ping-pong effect of code rate switching can be generated. In order to solve the technical problems, the application mainly provides the following technical scheme:
the first scheme is as follows: and the server predicts whether the code rate of the selected fragment to be downloaded is finished before the buffer memory in the buffer memory is consumed according to the smooth code rate and the buffer memory duration of the buffer memory provided by the terminal equipment and the average rate of the current downloaded fragment of the terminal equipment.
Scheme II: after the smooth code rate and the average rate are calculated by the terminal equipment, whether the code rate of the selected fragment to be downloaded is completely downloaded before the buffer memory in the buffer memory area is completely consumed or not is automatically predicted.
Through the first scheme and the second scheme, the problem of ping-pong effect during live video playing can be solved, the accuracy of dynamic code rate switching and the continuity and stability of playing fragments of the terminal equipment are improved, the first scheme and the second scheme can be alternatively carried out, and the application is not limited specifically.
It can be understood that the server and the terminal device in the present application may be referred to as a device for adjusting a streaming media bitrate, where the device may be disposed at a device end, and in some scenarios, the device may also be disposed in the terminal device as a client having a function of adjusting the streaming media bitrate.
Referring to fig. 2, the following method for adjusting a streaming media bitrate provided by the present application is illustrated from the perspective of determining a target segment by a server, where an embodiment of the method mainly includes:
201. and the terminal equipment calculates the smooth code rate and the cache duration of the current terminal equipment cache region.
The smooth code rate is a code rate matched with the downloading rate of the current video film source downloaded by the terminal equipment, the smooth code rate can adapt to the current bandwidth and is the optimal ideal code rate for playing the video film source by the current terminal equipment, and the terminal equipment cannot generate a pause phenomenon when playing videos by using the smooth code rate.
The buffer duration refers to the remaining data buffer capacity in the buffer area of the current terminal device, and may also be referred to as data duration, playable duration or data buffer amount. It should be noted that, in the present application, a HyperText Transfer Protocol (HTTP) may be used as a Protocol for requesting to download a fragment in a resource request, and a terminal device may send an HTTP GET request to a server, where the HTTP GET request may carry two extension header fields: avg-download-rate (representing the average rate of downloading fragments by the current terminal device), and buffer-length (representing the buffer duration of the buffer of the current terminal device). The cache data in the cache region of the terminal device in the application refers to video data of a video film source currently played by the client.
202. The terminal device sends a resource request to the server.
The resource request mainly comprises a smooth code rate and the cache duration of the terminal equipment cache region.
203. And the server receives a resource request of the terminal equipment and finds a video film source to be played currently by the terminal equipment in the database.
204. And the server determines a target fragment from the video source to be played currently by the terminal equipment and then sends the target fragment to the terminal equipment.
And the code rate of the target fragment is smaller than the smooth code rate, and the predicted downloading time length of the target fragment is smaller than the cache time length.
205. And the terminal equipment receives the target fragment sent by the server.
In the existing mechanism, the client can only compare the smooth code rate with the average code rate of the fragments, and finally the ping-pong effect of code rate switching is caused. Compared with the existing mechanism, the method and the device have the advantages that the server determines the target fragment from the video fragment source after receiving the resource request which is sent by the terminal device and comprises the smooth code rate and the cache duration, and then the server sends the target fragment to the terminal device. It can be seen that, because the code rate of the target segment sent to the terminal device by the server is smaller than the smooth code rate, and the predicted downloading duration of the target segment is smaller than the cache duration, the target segment finally sent to the terminal device meets the current smooth playing condition, the segment adapted to the terminal device can be provided for the terminal device in real time, the playing continuity of the streaming media is ensured, the problem of playing jam caused by dynamic code rate switching in the playing process of the streaming media can be reduced, and the network bandwidth resource is utilized to the maximum extent.
Optionally, in some embodiments of the present invention, in consideration of the operation complexity and the operation load of the server, before determining the target segment, the server may further obtain a code rate set to improve the operation efficiency. In some embodiments, the set of code rates may be indicated by indication information carried by the resource request, or the set of code rates may be a set of code rates selected by the server from the set of fragmented information according to the smooth code rate. The following are described separately:
(a) the code rate set is provided by the terminal equipment
Before sending a resource request, the terminal equipment can acquire the fragment information set from the server, then calculate a smooth code rate, compare the smooth code rate with each code rate in the fragment information set, finally determine a code rate set with a code rate lower than the smooth code rate, and finally carry information indicating the code rate set or the code rate set in the resource request.
Therefore, the terminal device provides the code rate set for the server, and the code rate set only needs to be traversed when the server side determines the target fragment. Of course, if the server determines the above code rate set, in (a), if the code rate set is directly provided by the terminal device, the server does not need to compare the code rate set with the fragmentation information set. Therefore, by adopting the scheme, the operation amount of the server can be effectively reduced, the operation efficiency is further improved, and finally the server can be quickly positioned to the target fragment.
(b) Code rate set is provided by a server
If the code rate set is determined by the server, the server can determine the code rate set only by the smooth code rate acquired from the terminal device, and the mode of determining the code rate set by the server is the same as that of the terminal device, which is not described herein again.
After the server determines the code rate set, the target fragment can be determined by traversing the code rate set, and by reducing the search range of the code rates, when the target fragment is determined, the smooth code rate does not need to be traversed once with each code rate in the fragment information set, and only the code rates in the code rate set need to be traversed. Therefore, by adopting the scheme, the operation amount of the server can be effectively reduced, the operation efficiency is further improved, and finally the server can be quickly positioned to the target fragment.
After obtaining the code rate set, the server may start to perform an operation of determining a target segment, and in step 204, the server determines the target segment from the video source to be currently played by the terminal device, and a specific process of sending the target segment to the terminal device may refer to the operations described in the following 1 to 3.
1. The server can select a candidate code rate from a code rate set, wherein the code rate set refers to a set of code rates lower than the smooth code rate in a fragmentation information set, the fragmentation information set comprises fragmentation information of at least two fragments, the at least two fragments belong to the same video fragment source to be played currently, and the fragmentation information comprises a fragment size and a fragment code rate.
2. After selecting a candidate code rate from a code rate set, the server may obtain a predicted downloading duration of the candidate fragment according to an average rate and a fragment size of a target fragment corresponding to the candidate code rate, where the average rate is an average rate of a current downloading fragment of the terminal device. Optionally, the average rate may be carried in the resource request, or may be obtained by statistics of the server.
3. After the predicted downloading time length of the candidate fragment is obtained, the server judges whether the predicted downloading time length of the candidate fragment is larger than the cache time length, if the predicted downloading time length is larger than the cache time length, the server selects a code rate with a code rate lower than that of the candidate fragment from the code rate set as the candidate code rate, repeats the operation of selecting the candidate code rate, calculates the predicted downloading time length of the candidate fragment and judges whether the predicted downloading time length of the candidate fragment is larger than the cache time length until the candidate fragment with the predicted downloading time length smaller than the cache time length is found.
Correspondingly, if the predicted downloading time length of the candidate fragment is smaller than the cache time length, the server sends the candidate fragment as the target fragment to the terminal device.
Therefore, in the application, after receiving a resource request which is sent by a terminal device and comprises a smooth code rate and a cache duration, a server can select a candidate code rate which is smaller than the smooth code rate from a code rate set, and when it is determined that the predicted download duration of a candidate fragment corresponding to the selected candidate code rate is smaller than the current cache duration of a cache region of the terminal device, the server sends the candidate fragment to the terminal device as a target fragment. The visible server can accurately judge whether the fragment requested to be switched by the terminal equipment meets the current smooth playing condition by comparing the predicted downloading time length and the cache time length of the candidate fragment, can provide the fragment adapted to the terminal equipment for the terminal equipment in real time, ensures the playing continuity of the streaming media, can also reduce the problem of playing jam caused by dynamic code rate switching in the playing process of the streaming media, and utilizes the network bandwidth resources to the maximum extent.
Optionally, in some embodiments of the present invention, when a plurality of terminal devices request a server for video source resources at the same time, in order to reduce the determination duration on the server side, if the predicted download duration of the candidate segment is greater than the cache duration, the server may directly select, from the video sources to be played by the terminal devices, at least one segment that belongs to the same video source as the candidate segment and has a lower code rate than the candidate segment. And then, the server sends a request response to the terminal equipment, wherein the request response carries a download address of the fragment which belongs to the same video fragment source as the candidate fragment and has a code rate lower than that of the candidate fragment, so that the terminal equipment can directly download the fragment. Optionally, the request response may carry a download address of the segment with the lowest code rate in the video source to which the candidate segment belongs, so that it is ensured that the terminal device side can smoothly play the segment. By the processing mechanism, the response of the server side to the plurality of terminal devices can be further optimized, so that the processing efficiency of the server can be improved, and meanwhile, the waiting time of the terminal device side is reduced.
Optionally, in some inventive embodiments, the resource request further includes a field for indicating whether the server switches to the rate adaptation mode, and in an implementation, the field may be a dynamic-request (dynamic-request). If the value of the dynamic-request indication is 1, it indicates that the code rate adaptive mode is currently adopted, then the server needs to perform dynamic code rate switching, and can identify the current fragment most matched with the download rate of the terminal device through the first two extended headers of the resource request, and return the fragment to the terminal device. If the value of the dynamic-request indication is 0, it indicates that the code rate adaptation mode is not currently used (for example, the user manually closes the code rate adaptation function on the client of the terminal device), then the server does not need to perform dynamic code rate switching after receiving the resource request.
Optionally, in some embodiments of the present invention, in order to improve the accuracy of determining the target segment at the server side, it is further necessary to consider the cache consumption of the cache region of the terminal device in a period when the terminal device sends a resource request to the server to calculate the predicted download duration of the candidate segment, because some consumption may exist in the cache region of the terminal device. Therefore, the terminal device may carry a field indicating a cache offset in the resource request, where the cache offset is an estimated value of cache consumption of a cache region of the terminal device during a period from the time when the terminal device sends the resource request to the time when the server receives the resource request. The estimated value may be an empirical value, or may be dynamically calculated by the terminal device according to the current play rate, and the specific application is not limited, so that the server may subtract the cache offset when comparing the predicted download duration with the cache duration.
For ease of understanding, fig. 3 of the present application also provides a detailed flow chart, which specifically operates as follows:
on the side of the terminal device, the terminal device downloads a fragment information set corresponding to a video fragment source from a server, then calculates a code rate of a next fragment to be played, and sends a resource request for downloading the fragment to the server, where the resource request carries the calculated code rate of the next fragment to be played and may also carry a header field dynamic-switch for indicating whether to switch a dynamic adaptive mode, and the value of the dynamic-switch may be 1 or 0.
On the server side, after receiving the resource request sent by the terminal device, the server judges whether the fragment switching is needed according to the fact that the resource request is dynamic-switch. When the value of the dynamic-switch is 1, entering the operation of judging whether the fragment switching calculation is needed, if so, calculating the fragment needing to be returned to the terminal equipment by the server, and after calculating the needed fragment, sending the fragment to the terminal equipment so that the terminal equipment puts the received fragment into a play cache region to wait for playing. If the operation of fragment switching calculation is not required, the server can directly read the corresponding fragment content from the database according to the resource request, and then the fragment is sent to the terminal equipment, so that the terminal equipment puts the received fragment into a play cache region to wait for playing.
When the value of dynamic-switch is 0, the resource request is ignored.
Referring to fig. 4, the following method for adjusting a streaming media bitrate provided by the present application is exemplified from the perspective of determining a target segment by a terminal device, where the terminal device is provided with a client, and the client can be used to play a downloaded video, and an embodiment of the method mainly includes:
401. the terminal equipment acquires the current smooth code rate and the fragment information set corresponding to the video source to be played currently.
And the smooth code rate is matched with the downloading rate of the current downloading video film source of the terminal equipment. The smooth code rate may be calculated depending on parameters such as the code rate of the current network bandwidth and the fullness state of the buffer of the terminal device, or other new parameters may be added based on the calculation in the existing mechanism, which is not limited in the present application.
The fragment information set comprises fragment information of at least two fragments, the at least two fragments belong to the same video source to be played currently, and the fragment information comprises fragment size and fragment code rate. The fragment information set may be obtained from a server, or may be obtained through other approaches, for example, an email, a short message, or a network database, and the specific obtaining approach is not limited in this application.
The segment information set can be called a Media Description file, a segment source code rate list and the like, if the segments of the video segment source are transmitted based on Dynamic Adaptive Streaming over HTTP (Dynamic Adaptive Streaming over HTTP, DASH for short), the downloaded segment information set is a Media Presentation Description (MPD) file, after the terminal device acquires the MPD file, the terminal device can acquire the related information of the video by analyzing the MPD file, and then the corresponding segments can be acquired by segments by using HTTP request; if the fragments of the video source are transmitted based on a hypertext transfer protocol Live Streaming (HTTP Live Streaming, HLS for short), the downloaded fragment information set is an m3u8 file. For example, a certain streaming media may support a video with 2 bit rates, where the video with each bit rate includes 3 segments, and then the segment information of the segments with various bit rates included in the segment information set may be presented through a table, as shown in table 1 below:
code rate | Size of the slice |
Code rate 1(2Mbps) | Slice 1(30000Byte) |
Slice 2(25000Byte) | |
Slice 3(32000Byte) | |
Code rate 2(4Mbps) | Slice 1(50000Byte) |
Slice 2(60000Byte) | |
Slice 3(55000Byte) |
TABLE 1
402. And the terminal equipment determines the target code rate from the fragment information set.
And the target code rate is smaller than the smooth code rate, and the predicted downloading duration of the target fragment corresponding to the target code rate is smaller than the current caching duration of the terminal equipment cache region.
403. And the terminal equipment sends the resource request to the server.
The resource request is used for requesting to download the target fragment corresponding to the target code rate, and the target code rate can be indicated in the resource request.
404. And the server issues the target fragments to the terminal equipment.
405. And the terminal equipment receives the target fragment sent by the server.
In the existing mechanism, the client can only compare the smooth code rate with the average code rate of the fragments, and finally the ping-pong effect of code rate switching is caused. Compared with the existing mechanism, in the scheme provided by the application, on one hand, after the terminal equipment acquires the smooth code rate and the fragment information set, the terminal equipment can select the target code rate smaller than the smooth code rate from the fragment information set, and when the predicted downloading duration of the target fragment corresponding to the selected target code rate is determined to be smaller than the current cache duration, the target code rate is indicated to be suitable for the current bandwidth, so that the terminal equipment can carry the target code rate in a resource request and send the resource request to the server, and finally the suitable target fragment is obtained. The method has the advantages that the terminal equipment can accurately judge whether the target fragment corresponding to the target code rate calculated by the server meets the current smooth playing condition or not by comparing the predicted downloading time length and the cache time length of the target fragment, so that the server can provide the fragment adaptive to the terminal equipment for the terminal equipment in real time, the playing continuity of the streaming media is ensured, the problem of playing jam caused by dynamic code rate switching in the playing process of the streaming media can be reduced, and the network bandwidth resource is utilized to the maximum extent.
On the other hand, considering that the fluctuation of the network bandwidth, the consumption of the local cache duration and other factors all affect the current smooth code rate, and even if the calculated smooth code rate is sent to the server and the server determines that the target fragment needs to consume the operation duration, in the operation process of the server, the smooth code rate which is possibly provided for the server currently may not be suitable for the network bandwidth of the current terminal device side, so that the target code rate determined by the server according to the smooth code rate and the cache duration may be inaccurate, and particularly under the condition that the network bandwidth is reduced, the target code rate calculated by the server is substantially higher than the smooth code rate newly calculated by the terminal device side at this time. Therefore, the target fragment finally determined by the server may be inaccurate, and the playback pause phenomenon may occur on the terminal device side. In the application, the terminal device determines the target segment, and since the smooth code rate is dynamically calculated by the terminal device, the smooth code rate calculated by the terminal device can represent the actual smooth code rate of the current network bandwidth adaptive to the playing of the terminal device. Therefore, the terminal device can effectively eliminate the inaccuracy caused by the network fluctuation phenomenon which can occur during the transmission to the server.
Optionally, in some embodiments of the present invention, after the terminal device obtains the current smooth code rate and the fragment information set, before the terminal device determines the target code rate from the fragment information set, the terminal device may further determine a code rate set lower than the smooth code rate from the fragment information set, after the code rate set is determined, the terminal device may determine the target fragment, and by narrowing a search range of the code rate, when determining the target fragment, the smooth code rate does not need to traverse each code rate in the fragment information set separately, and only the code rate in the code rate set needs to be traversed. Therefore, by adopting the scheme, the calculation amount can be effectively reduced, and the calculation efficiency can be improved.
After obtaining the code rate set, the terminal device determines a target code rate from the fragmentation information set, and sends the resource request to the server, which may include:
and the terminal equipment selects a candidate code rate from the code rate set, and then obtains the predicted downloading duration of the candidate fragment according to the fragment size of the candidate fragment corresponding to the candidate code rate and the average rate.
After the predicted downloading duration of the candidate fragment is obtained, the terminal equipment judges whether the predicted downloading duration of the candidate fragment is greater than the cache duration, if the predicted downloading duration of the candidate fragment is greater than the cache duration, the code rate lower than the candidate fragment is selected from the fragment set as the candidate code rate, and the operations of calculating the predicted downloading duration of the candidate fragment and judging whether the predicted downloading duration of the candidate fragment is greater than the cache duration are repeatedly executed until the target code rate corresponding to the candidate fragment of which the predicted downloading duration is less than the cache duration is found.
And if the predicted downloading duration of the candidate fragment is less than the cache duration, taking the candidate code rate as the target code rate, and sending the resource request to the server, wherein the resource request is used for requesting to download the target fragment corresponding to the target code rate.
For example, the buffer duration of the current buffer area of the terminal device is Q, the calculated smoothing code rate is 3 megabits per second (hereinafter, referred to as "Million bits per second"), the average rate of the current downloaded segments of the terminal device is P bytes per second, and the code rates supported by the video source are 1Mbps, 2Mbps, and 4Mbps, respectively. The code rate which meets the smooth playing of the terminal equipment in the video source is 1Mbps and 2Mbps, wherein the code rate which is closest to the smooth code rate is 2Mbps, and then the 2Mbps can be selected as the target code rate. Then, the terminal device queries that the size of the segment corresponding to 2Mbps is X according to the segment information set, and then the predicted download duration of the segment 1 calculated by the terminal device is T, where T is X/P. If T is less than or equal to Q, that is, the terminal device is indicated that the cache of the cache area is not exhausted in the process of downloading the fragment, the terminal device can download the fragment. If T is larger than or equal to Q, namely the terminal equipment downloads the fragment, the cache of the cache area is exhausted in the process of downloading the fragment, the terminal equipment does not download the fragment, then returns to the operation of selecting the candidate code rate again, judges whether T is smaller than Q, and the code rate selected each time later is lower than the candidate code rate selected last time until the fragment meeting T is smaller than or equal to Q is found.
For ease of understanding, fig. 5 of the present application also provides a detailed flow chart, which specifically operates as follows:
on the side of the terminal equipment, the terminal equipment downloads a fragment information set corresponding to a video fragment source from a server, calculates a smooth code rate, and then selects a code rate closest to the smooth code rate from the fragment information set as a candidate code rate (namely, calculates the code rate of the next fragment to be played).
Then, the terminal device finds the size X of the segment to be downloaded from the segment information set according to the candidate code rate, and calculates the predicted download duration T of the segment according to the average rate P and the size X of the segment, where T is X/P.
After T is calculated, the T is compared with the current cache data quantity Q of the terminal equipment, if the T is less than or equal to Q, the currently selected fragment can be played smoothly by the terminal equipment, so that the terminal equipment can directly send the code rate of the fragment to a server to download the fragment, and the continuity of playing the fragment is guaranteed.
If T is larger than or equal to Q, the currently selected fragment cannot guarantee smooth playing of the terminal equipment, so the terminal equipment needs to select a code rate which is one level lower than the previously selected code rate from the code rate list, recalculate the predicted downloading time, judge the size relation of T and Q, and send the code rate of the fragment meeting smooth playing to the server to download the fragment after finding the fragment with the T smaller than or equal to Q.
Optionally, in some embodiments of the present invention, in addition to the target segment determined by the terminal device itself, the target segment may also be determined by the server, and then the terminal device needs to provide the server with parameters related to the target segment determination. Specifically, after selecting a code rate smaller than the smoothing code rate from the fragmentation information set, the terminal device may send another resource request to the server, where the another resource request may include the smoothing code rate and a buffer duration of the terminal device buffer.
And then, after receiving the other resource request, the server selects a code rate smaller than the smooth code rate from the fragment information set, and when the predicted downloading duration of the fragment corresponding to the selected code rate is determined to be smaller than the current cache duration of the cache region of the terminal equipment, the server sends the fragment of which the predicted downloading duration is smaller than the cache duration to the terminal equipment.
For the server, how to determine the specific operation of the target segment according to another resource request sent by the terminal device may refer to the technical solution described in the first aspect, which is not described herein again.
It should be noted that, for whether the terminal device determines the target segment or the server determines the target segment, the terminal device may preferentially determine the target segment, so that the operation load of the server may be effectively reduced, and the accuracy of determining the target segment matched with the actual download rate may also be improved. The terminal equipment can actively execute the operation of determining the target code rate; or when the user closes the code rate dynamic switching function, providing operation parameters for the server, and finally determining the target fragment by the server; or, regardless of whether the user closes the code rate dynamic switching function, the terminal device can actively provide the operation parameters for the server, and finally the server determines the target fragment; of course, the other resource request may be sent to the server when the terminal device cannot correctly determine the target code rate.
Optionally, in order to reduce the operation of the server, the terminal device may further carry, in the another resource request, information for indicating a code rate set lower than the smooth code rate in the fragment information set, so that the server may determine, in a small range, the candidate code rate, reduce the number of times of determining whether the predicted download duration of the candidate fragment is smaller than the cache duration, and finally enable the server to quickly locate the target fragment.
Optionally, the another resource request further includes an average rate of currently downloaded segments of the terminal device, where the average rate is used for the server to calculate the predicted download duration of the segments.
Optionally, in consideration of that the cache of the cache region of the terminal device may have some consumption during the period from the time when the terminal device sends the another resource request to the time when the server calculates the predicted download duration of the candidate segment, in order to improve the accuracy of determining the target segment at the server side, the cache consumption of the cache region of the terminal device in the period needs to be considered. Therefore, the terminal device may carry a field indicating a cache offset in the another resource request, where the cache offset is an estimated value of cache consumption of the terminal device in a cache region during a period from when the another resource request is sent by the terminal device to when the server receives the another resource request. The estimated value may be an empirical value, or may be dynamically calculated by the terminal device according to the current play rate, and the specific application is not limited, so that the server may subtract the cache offset when comparing the predicted download duration with the cache duration.
The features of the smoothing code rate, the average rate, the buffering duration, the predicted downloading duration, the resource request, and the like, which are described in any of fig. 2 to fig. 5, and any description related to the features are also applicable to the embodiments corresponding to fig. 6 in the present application, and the following similar parts are not described again.
In the above description, a method for adjusting a bitrate of streaming media in the present application is described, and an apparatus (including a server and a terminal device) for adjusting a bitrate of streaming media is described below, where the server and the terminal device have structures shown in fig. 6, and the following description is separately provided.
Referring to fig. 6, the server may include:
the receiving and sending module is used for receiving a resource request of the terminal equipment, wherein the resource request comprises a smooth code rate and the cache duration of a cache region of the terminal equipment, and the smooth code rate is a code rate matched with the download rate of the current video film source downloaded by the terminal equipment.
And the processing module is used for determining a target fragment from a video fragment source to be played currently by the terminal equipment, and sending the target fragment to the terminal equipment through the transceiver module, wherein the code rate of the target fragment is less than the smooth code rate, and the predicted downloading time length of the target fragment is less than the cache time length.
In the embodiment of the invention, after the transceiver module receives the resource request which is sent by the terminal equipment and comprises the smooth code rate and the cache duration, the target fragment is determined from the video fragment source, and then the processing module sends the target fragment to the terminal equipment. It can be seen that, because the code rate of the target segment sent to the terminal device by the server is smaller than the smooth code rate, and the predicted downloading duration of the target segment is smaller than the cache duration, the target segment finally sent to the terminal device meets the current smooth playing condition, the segment adapted to the terminal device can be provided for the terminal device in real time, the playing continuity of the streaming media is ensured, and the problem of playing jam caused by dynamic code rate switching in the playing process of the streaming media can be reduced.
Optionally, the processing module is specifically configured to:
selecting a candidate code rate from a code rate set, wherein the code rate set refers to a set of code rates lower than the smooth code rate in a fragmentation information set, the fragmentation information set comprises fragmentation information of at least two fragments, the at least two fragments belong to the same video fragment source to be played currently, and the fragmentation information comprises the size of the fragments and the code rate of the fragments;
obtaining the predicted downloading duration of the candidate fragments according to the average rate and the fragment size of the target fragments corresponding to the candidate code rates, wherein the average rate is the average rate of the current downloading fragments of the terminal equipment;
judging whether the predicted downloading duration of the candidate fragment is greater than the cache duration, if so, selecting a code rate with a code rate lower than that of the candidate fragment from the code rate set as the candidate code rate;
and if the predicted downloading time length of the candidate fragment is less than the cache time length, the candidate fragment is used as the target fragment and is sent to the terminal equipment through the transceiver module.
Optionally, the code rate set is indicated by indication information carried by the resource request, or the code rate set is a set of code rates selected by the server from the fragmentation information set according to the smooth code rate.
Optionally, the average rate is carried in the resource request, or is obtained by statistics of the server.
Optionally, the processing module is further configured to:
and if the predicted downloading time length of the candidate fragment is greater than the cache time length, sending a request response to the terminal equipment through the transceiver module, wherein the request response carries a downloading address of the fragment which belongs to the same video fragment source as the candidate fragment and has a code rate lower than that of the candidate fragment.
Optionally, the resource request further includes a field for indicating whether the server switches to the code rate adaptation mode, and/or the resource request further includes a field for indicating a buffer offset, where the buffer offset is an estimated value of buffer consumption of the terminal device buffer during a period from the terminal device sending the resource request to the server receiving the resource request.
Referring to fig. 6, the terminal device may include:
the terminal equipment comprises a receiving and sending module and a slicing information collection, wherein the receiving and sending module is used for acquiring a current smooth code rate and a slicing information collection, the smooth code rate is a code rate matched with a downloading rate of a current video slice source downloaded by the terminal equipment, the slicing information collection comprises slicing information of at least two slices, the at least two slices belong to the same video slice source to be played currently, and the slicing information comprises a slice size and a slicing code rate;
and the processing module is used for determining a target code rate from the fragment information set acquired by the transceiver module, and sending a resource request to the server through the transceiver module, wherein the target code rate is less than the smooth code rate, the predicted downloading duration of the target fragment corresponding to the target code rate is less than the current caching duration of the terminal equipment cache region, and the resource request is used for requesting to download the target fragment corresponding to the target code rate.
In the embodiment of the invention, after the smooth code rate and the fragment information set are obtained by the transceiver module, the processing module can select the target code rate smaller than the smooth code rate from the fragment information set, and when the processing module determines that the predicted downloading duration of the target fragment corresponding to the selected target code rate is smaller than the current cache duration, the processing module indicates that the target code rate is suitable for the current bandwidth, so that the processing module can carry the target code rate in a resource request through the transceiver module and send the resource request to the server to finally obtain the suitable target fragment. The method has the advantages that the terminal equipment can accurately judge whether the target fragment corresponding to the target code rate calculated by the server meets the current smooth playing condition or not by comparing the predicted downloading time length and the cache time length of the target fragment, so that the server can provide the fragment adaptive to the terminal equipment for the terminal equipment in real time, the playing continuity of the streaming media is ensured, and the problem of playing jam caused by dynamic code rate switching in the playing process of the streaming media can be reduced.
Optionally, after the transceiver module obtains the current smooth code rate and the fragmentation information set, and before determining the target code rate from the fragmentation information set, the processing module is further configured to:
and determining a code rate set lower than the smooth code rate from the slicing information set.
Optionally, the processing module is specifically configured to:
selecting a candidate code rate from the set of code rates;
obtaining the predicted downloading duration of the candidate fragments according to the fragment size of the candidate fragments corresponding to the candidate code rate and the average rate;
judging whether the predicted downloading duration of the candidate fragment is greater than the cache duration, if so, selecting a code rate lower than the candidate fragment from the fragment set as the candidate code rate;
and if the predicted downloading duration of the candidate fragment is less than the cache duration, taking the candidate code rate as the target code rate, and sending the resource request to the server through the transceiver module, wherein the resource request is used for requesting to download the target fragment corresponding to the target code rate.
It should be noted that, in each embodiment corresponding to fig. 6 of the present application, the entity device corresponding to the transceiver module may be a transceiver, and the entity device corresponding to the processing module may be a processor. Each device shown in fig. 6 may have a structure as shown in fig. 7, when one of the devices has the structure as shown in fig. 7, the processor and the transceiver in fig. 7 implement the same or similar functions of the processing module and the transceiver module provided in the device embodiment corresponding to the device, and the memory in fig. 7 stores program codes that the processor needs to call when executing the method for adjusting the bitrate of the streaming media. The processor may be configured to perform the operations described in steps 201 to 204 in the embodiment corresponding to fig. 2, perform the operations described in the embodiment corresponding to fig. 3, perform the operations described in steps 401 to 404 in the embodiment corresponding to fig. 4, and perform the operations described in the embodiment corresponding to fig. 5, which may specifically refer to any of the embodiments shown in fig. 2 to fig. 5. .
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the system, the apparatus and the module described above may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is merely a logical division, and in actual implementation, there may be other divisions, for example, multiple modules or components may be combined or integrated into another system, or some features may be omitted, or not implemented. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or modules, and may be in an electrical, mechanical or other form.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical modules, may be located in one place, or may be distributed on a plurality of network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present application may be integrated into one processing module, or each of the modules may exist alone physically, or two or more modules are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may be stored in a computer readable storage medium.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product.
The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can store or a data storage device, such as a server, a data center, etc., that is integrated with one or more available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
The technical solutions provided by the present application are introduced in detail, and the present application applies specific examples to explain the principles and embodiments of the present application, and the descriptions of the above examples are only used to help understand the method and the core ideas of the present application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.
Claims (18)
1. A method for adjusting a bitrate of streaming media, the method comprising:
a server receives a resource request of a terminal device, wherein the resource request comprises a smooth code rate and the cache duration of a cache region of the terminal device, and the smooth code rate is a code rate matched with the download rate of a current video film source downloaded by the terminal device; the resource request further comprises a field indicating a cache offset, wherein the cache offset is an estimated value of cache consumption of a cache region of the terminal equipment during the period from the time when the terminal equipment sends the resource request to the time when the server receives the resource request;
and the server determines a target fragment from a video fragment source to be played currently by the terminal equipment, and sends the target fragment to the terminal equipment, wherein the code rate of the target fragment is less than the smooth code rate, and the predicted downloading time length of the target fragment is less than the value obtained by subtracting the cache offset from the cache time length.
2. The method according to claim 1, wherein the server determines a target segment from a video source to be currently played by the terminal device, and sends the target segment to the terminal device, including:
the server selects a candidate code rate from a code rate set, wherein the code rate set refers to a set of code rates lower than the smooth code rate in a fragmentation information set, the fragmentation information set comprises fragmentation information of at least two fragments, the at least two fragments belong to the same video fragment source to be played currently, and the fragmentation information comprises a fragment size and a fragment code rate;
the server obtains the predicted downloading duration of the candidate fragments according to the average rate and the fragment size of the target fragments corresponding to the candidate code rates, wherein the average rate is the average rate of the current downloading fragments of the terminal equipment;
the server judges whether the predicted downloading duration of the candidate fragment is greater than the cache duration, and if the predicted downloading duration is greater than the cache duration, the code rate with the code rate lower than that of the candidate fragment is selected from the code rate set to serve as the candidate code rate;
and if the predicted downloading time length of the candidate fragment is less than the cache time length, the server sends the candidate fragment as the target fragment to the terminal equipment.
3. The method of claim 2, wherein the set of code rates is indicated by indication information carried by the resource request, or wherein the set of code rates is a set of code rates selected by the server from the set of fragmented information according to the smooth code rate.
4. A method according to claim 2 or 3, wherein the average rate is carried in the resource request or is statistically derived by the server.
5. The method according to any one of claims 2-4, further comprising:
and if the predicted downloading time length of the candidate fragment is greater than the cache time length, the server sends a request response to the terminal equipment, wherein the request response carries the downloading address of the fragment which belongs to the same video fragment source as the candidate fragment and has a code rate lower than that of the candidate fragment.
6. The method according to claim 1 or 2, wherein the resource request further comprises a field for indicating whether the server switches to a rate adaptation mode.
7. A method for adjusting a bitrate of streaming media, the method comprising:
the method comprises the steps that a terminal device obtains a current smooth code rate and a fragment information set, wherein the smooth code rate is a code rate matched with a downloading rate of a current video fragment source downloaded by the terminal device, the fragment information set comprises fragment information of at least two fragments, the at least two fragments belong to the same video fragment source to be played currently, and the fragment information comprises a fragment size and a fragment code rate;
the terminal equipment determines a target code rate from the fragment information set and sends a resource request to a server, wherein the target code rate is smaller than the smooth code rate, the predicted downloading duration of a target fragment corresponding to the target code rate is smaller than the value obtained by subtracting the cache offset from the current cache duration of a cache region of the terminal equipment, and the resource request is used for requesting to download the target fragment corresponding to the target code rate; the cache offset is an estimated value of cache consumption of a cache region of the terminal device during a period from the time when the terminal device sends the resource request to the server to the time when the server receives the resource request.
8. The method according to claim 7, wherein after the terminal device obtains the current smooth code rate and the slice information set, and before the terminal device determines the target code rate from the slice information set, the method further comprises:
and the terminal equipment determines a code rate set lower than the smooth code rate from the fragmentation information set.
9. The method according to claim 8, wherein the terminal device determines a target code rate from the set of fragmentation information and sends a resource request to the server, comprising:
the terminal equipment selects a candidate code rate from the code rate set;
the terminal equipment obtains the predicted downloading duration of the candidate fragments according to the fragment size and the average rate of the candidate fragments corresponding to the candidate code rate;
the terminal equipment judges whether the predicted downloading duration of the candidate fragment is greater than the cache duration, and if the predicted downloading duration of the candidate fragment is greater than the cache duration, the code rate lower than the candidate fragment is selected from a fragment set to serve as the candidate code rate;
and if the predicted downloading duration of the candidate fragment is less than the cache duration, taking the candidate code rate as the target code rate, and sending the resource request to the server, wherein the resource request is used for requesting to download the target fragment corresponding to the target code rate.
10. A server, characterized in that the server comprises:
a transceiver module, configured to receive a resource request of a terminal device, where the resource request includes a smooth code rate and a cache duration of a cache region of the terminal device, the smooth code rate is a code rate that matches a download rate at which the terminal device currently downloads a video film source, and the resource request further includes a field indicating a cache offset, where the cache offset is an estimated value of cache consumption of the cache region of the terminal device during a period from when the terminal device sends the resource request to when the transceiver module receives the resource request;
and the processing module is used for determining a target fragment from a video fragment source to be played currently by the terminal equipment, and sending the target fragment to the terminal equipment through the transceiver module, wherein the code rate of the target fragment is smaller than the smooth code rate, and the predicted downloading time length of the target fragment is smaller than the value obtained by subtracting the cache offset from the cache time length.
11. The server according to claim 10, wherein the processing module is specifically configured to:
selecting a candidate code rate from a code rate set, wherein the code rate set refers to a set of code rates lower than the smooth code rate in a fragmentation information set, the fragmentation information set comprises fragmentation information of at least two fragments, the at least two fragments belong to the same video fragment source to be played currently, and the fragmentation information comprises the size of the fragments and the code rate of the fragments;
obtaining the predicted downloading duration of the candidate fragments according to the average rate and the fragment size of the target fragments corresponding to the candidate code rates, wherein the average rate is the average rate of the current downloading fragments of the terminal equipment;
judging whether the predicted downloading duration of the candidate fragment is greater than the cache duration, if so, selecting a code rate with a code rate lower than that of the candidate fragment from the code rate set as the candidate code rate;
and if the predicted downloading time length of the candidate fragment is less than the cache time length, the candidate fragment is used as the target fragment and is sent to the terminal equipment through the transceiver module.
12. The server according to claim 11, wherein the set of code rates is indicated by indication information carried by the resource request, or wherein the set of code rates is a set of code rates selected by the server from the set of fragmented information according to the smoothing code rate.
13. The server according to claim 11 or 12, wherein the average rate is carried in the resource request or statistically derived by the server.
14. The server according to any of claims 11-13, wherein the processing module is further configured to:
and if the predicted downloading time length of the candidate fragment is greater than the cache time length, sending a request response to the terminal equipment through the transceiver module, wherein the request response carries a downloading address of the fragment which belongs to the same video fragment source as the candidate fragment and has a code rate lower than that of the candidate fragment.
15. The server according to claim 10 or 11, wherein the resource request further comprises a field for indicating whether the server switches to a rate adaptation mode.
16. A terminal device, characterized in that the terminal device comprises:
the terminal equipment comprises a receiving and sending module and a slicing information collection, wherein the receiving and sending module is used for acquiring a current smooth code rate and a slicing information collection, the smooth code rate is a code rate matched with a downloading rate of a current video slice source downloaded by the terminal equipment, the slicing information collection comprises slicing information of at least two slices, the at least two slices belong to the same video slice source to be played currently, and the slicing information comprises a slice size and a slicing code rate;
a processing module, configured to determine a target code rate from the fragment information set acquired by the transceiver module, and send a resource request to a server through the transceiver module, where the target code rate is smaller than the smooth code rate, a predicted downloading duration of a target fragment corresponding to the target code rate is smaller than a value obtained by subtracting a cache offset from a current cache duration of a cache region of the terminal device, and the resource request is used to request to download the target fragment corresponding to the target code rate; the cache offset is an estimated value of cache consumption of the terminal device cache region during a period from the time when the transceiver module sends the resource request to the time when the server receives the resource request.
17. The terminal device of claim 16, wherein the processing module, after the transceiver module obtains the current smoothing code rate and the set of slice information, before determining a target code rate from the set of slice information, is further configured to:
and determining a code rate set lower than the smooth code rate from the slicing information set.
18. The terminal device of claim 17, wherein the processing module is specifically configured to:
selecting a candidate code rate from the set of code rates;
obtaining the predicted downloading duration of the candidate fragments according to the fragment size and the average rate of the candidate fragments corresponding to the candidate code rate;
judging whether the predicted downloading time length of the candidate fragment is greater than the cache time length, if the predicted downloading time length of the candidate fragment is greater than the cache time length, selecting a code rate lower than the candidate fragment from a fragment set as the candidate code rate;
and if the predicted downloading duration of the candidate fragment is less than the cache duration, taking the candidate code rate as the target code rate, and sending the resource request to the server through the transceiver module, wherein the resource request is used for requesting to download the target fragment corresponding to the target code rate.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710190142.2A CN108668146B (en) | 2017-03-27 | 2017-03-27 | Method and equipment for adjusting streaming media code rate |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710190142.2A CN108668146B (en) | 2017-03-27 | 2017-03-27 | Method and equipment for adjusting streaming media code rate |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108668146A CN108668146A (en) | 2018-10-16 |
CN108668146B true CN108668146B (en) | 2021-07-16 |
Family
ID=63786362
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710190142.2A Active CN108668146B (en) | 2017-03-27 | 2017-03-27 | Method and equipment for adjusting streaming media code rate |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108668146B (en) |
Families Citing this family (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111787336B (en) * | 2019-04-04 | 2022-05-20 | 杭州海康威视数字技术股份有限公司 | Code rate switching method and device |
CN110149560B (en) * | 2019-06-05 | 2021-11-16 | 亦非云互联网技术(上海)有限公司 | Player optimization method and system based on HLS protocol, storage medium and terminal |
CN110267100B (en) * | 2019-07-12 | 2022-01-25 | 北京达佳互联信息技术有限公司 | Code rate switching method and device for FLV (flash video), electronic equipment and storage medium |
CN110460875A (en) * | 2019-08-05 | 2019-11-15 | 北京达佳互联信息技术有限公司 | A kind of switching method of video code rate, device, electronic equipment and storage medium |
CN110996038B (en) * | 2019-11-19 | 2020-11-10 | 清华大学 | Adaptive code rate adjusting method for multi-person interactive live broadcast |
CN113573062B (en) * | 2020-04-29 | 2023-12-29 | 华为技术有限公司 | Traffic shaping method and device and electronic equipment |
CN112153428B (en) * | 2020-11-04 | 2022-07-12 | 上海连尚网络科技有限公司 | Video processing method and device |
CN112637631B (en) * | 2020-12-17 | 2022-04-26 | 清华大学 | Code rate determining method and device, electronic equipment and storage medium |
CN113316005A (en) * | 2021-04-20 | 2021-08-27 | 新华三技术有限公司 | Method for adjusting video code rate and communication system |
Citations (7)
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 |
CN104320424A (en) * | 2014-11-20 | 2015-01-28 | 三星电子(中国)研发中心 | Streaming media fragmentation downloading method and device |
CN105100876A (en) * | 2015-08-28 | 2015-11-25 | 北京奇艺世纪科技有限公司 | Streaming media playing method and device |
CN105744342A (en) * | 2016-01-28 | 2016-07-06 | 腾讯科技(深圳)有限公司 | Data transmission method and device for mobile terminal |
CN106028085A (en) * | 2016-06-14 | 2016-10-12 | 浙江工业大学 | DASH-based multi-client-side code rate self-adaption and oscillation compensation method |
CN106162229A (en) * | 2015-04-10 | 2016-11-23 | 北京大学 | Improve smooth code check adaptive approach and the device of fairness |
CN106303704A (en) * | 2016-08-19 | 2017-01-04 | 上海交通大学 | A kind of DASH flow medium live system based on proxy server and method |
-
2017
- 2017-03-27 CN CN201710190142.2A patent/CN108668146B/en active Active
Patent Citations (7)
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 |
CN104320424A (en) * | 2014-11-20 | 2015-01-28 | 三星电子(中国)研发中心 | Streaming media fragmentation downloading method and device |
CN106162229A (en) * | 2015-04-10 | 2016-11-23 | 北京大学 | Improve smooth code check adaptive approach and the device of fairness |
CN105100876A (en) * | 2015-08-28 | 2015-11-25 | 北京奇艺世纪科技有限公司 | Streaming media playing method and device |
CN105744342A (en) * | 2016-01-28 | 2016-07-06 | 腾讯科技(深圳)有限公司 | Data transmission method and device for mobile terminal |
CN106028085A (en) * | 2016-06-14 | 2016-10-12 | 浙江工业大学 | DASH-based multi-client-side code rate self-adaption and oscillation compensation method |
CN106303704A (en) * | 2016-08-19 | 2017-01-04 | 上海交通大学 | A kind of DASH flow medium live system based on proxy server and method |
Also Published As
Publication number | Publication date |
---|---|
CN108668146A (en) | 2018-10-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108668146B (en) | Method and equipment for adjusting streaming media code rate | |
US10455404B2 (en) | Quality of experience aware multimedia adaptive streaming | |
KR102544991B1 (en) | User Equipment and Media Streaming Network Secondary Node | |
US9401968B2 (en) | Method and apparatus for enabling pre-fetching of media | |
US10924577B2 (en) | Fractional pre-delivery of content to user devices for uninterrupted playback | |
CN110933517B (en) | Code rate switching method, client and computer readable storage medium | |
US20150381755A1 (en) | Cache manifest for efficient peer assisted streaming | |
JP7309825B2 (en) | Multiple protocol prediction and in-session adaptation in video streaming | |
US10856015B2 (en) | Method for operating a cache arranged along a transmission path between client terminals and at least one server, and corresponding cache | |
CN112672227B (en) | Service processing method, device, node and storage medium based on edge node | |
WO2013097184A1 (en) | Service distribution method, device and system | |
KR101402923B1 (en) | Server and method for managing contents to be distributed to cache device, and the cache device | |
EP3777202B1 (en) | Service descriptions for multimedia streaming | |
Hung et al. | An Effective Segment Pre-Fetching for Short-Form Video Streaming | |
TW201542013A (en) | Method for obtaining network information by a client terminal configured for receiving a multimedia content divided into segments | |
TW201532427A (en) | Method for obtaining network information by a client terminal configured for receiving a multimedia content divided into segments | |
KR20150046623A (en) | Method and apparatus for servicing video based on network quality | |
WO2017145781A1 (en) | Pacing control device, pacing control method, and program | |
TW201542014A (en) | Method for obtaining network information by a client terminal configured for receiving a multimedia content divided into segments | |
TW201532426A (en) | Method for obtaining network information by a client terminal configured for receiving a multimedia content divided into segments |
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 |