CN109769125B - Dynamic adjustment method for streaming media code rate, media server and transcoding server - Google Patents
Dynamic adjustment method for streaming media code rate, media server and transcoding server Download PDFInfo
- Publication number
- CN109769125B CN109769125B CN201811486482.0A CN201811486482A CN109769125B CN 109769125 B CN109769125 B CN 109769125B CN 201811486482 A CN201811486482 A CN 201811486482A CN 109769125 B CN109769125 B CN 109769125B
- Authority
- CN
- China
- Prior art keywords
- code rate
- streaming media
- downloading
- current
- speed value
- 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
Landscapes
- Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)
Abstract
The embodiment of the invention provides a dynamic adjustment method of a streaming media code rate, a media server and a transcoding server, wherein the method comprises the following steps: receiving streaming media encapsulation data sent by a transcoding server; the streaming media encapsulation data carries a streaming media code rate; determining a download rate value required for playing the streaming media packaging data according to the streaming media packaging data in a preset time period adjacent to the current moment; determining the current downloading network speed value according to all downloading speed values and the streaming media code rate; and determining the resetting code rate of the streaming media according to the comparison result of the current downloading network speed value and the code rate of the streaming media, and sending the resetting code rate to the transcoding server. The media server executes the method; the transcoding server performs another method. The method, the media server and the transcoding server provided by the embodiment of the invention can shorten the switching delay time of different stream media code rates and can dynamically adjust the stream media code rates.
Description
Technical Field
The embodiment of the invention relates to the technical field of streaming media, in particular to a dynamic adjustment method of streaming media code rate, a media server and a transcoding server.
Background
With the development of internet technology, more and more users play streaming media through network players, such as watching videos and listening to audios.
In the prior art, most players play real-time media streams by adopting the following process, firstly interact with a media server, start downloading media data after the interaction is completed, then place the media data in a play buffer area, a decoder takes out the data from the play buffer area for decoding, and send the data to a display card and an audio card for rendering and playing after the decoding is completed. When the client terminal has the factors of suddenly slowing down the network speed and the like, the data in the playing buffer area of the client terminal can be continuously reduced, the code rate switching is not carried out until the data exists, and at the moment, the decoder does not have the data to decode, and only waiting is carried out, so that the switching delay time of different streaming media code rates is too long.
Therefore, how to avoid the above-mentioned defects can shorten the switching delay time of different streaming media code rates, and dynamically adjust the streaming media code rate, which becomes a problem to be solved urgently.
Disclosure of Invention
Aiming at the problems in the prior art, the embodiment of the invention provides a dynamic adjustment method for a streaming media code rate, a media server and a transcoding server.
In a first aspect, an embodiment of the present invention provides a method for dynamically adjusting a bitrate of streaming media, where the method includes:
receiving streaming media encapsulation data sent by a transcoding server; the streaming media encapsulation data carries a streaming media code rate;
determining a download rate value required for playing the streaming media packaging data according to the streaming media packaging data in a preset time period adjacent to the current moment;
determining the current downloading network speed value according to all downloading speed values and the streaming media code rate;
and determining a reset code rate of the stream media code rate according to a comparison result of the current downloading network speed value and the stream media code rate, and sending the reset code rate to the transcoding server so that the transcoding server updates stream media encapsulation data according to the reset code rate.
In a second aspect, an embodiment of the present invention further provides a method for dynamically adjusting a bitrate of streaming media, where the method includes:
receiving a reset code rate sent by a media server;
and updating the streaming media encapsulation data according to the reset code rate.
In a third aspect, an embodiment of the present invention further provides a media server, where the media server includes:
the receiving unit is used for receiving streaming media encapsulation data sent by the transcoding server; the streaming media encapsulation data carries a streaming media code rate;
a first determining unit, configured to determine, in a preset time period adjacent to a current time, a download rate value required for playing the streaming media encapsulation data according to the streaming media encapsulation data;
a second determining unit, configured to determine a current downloading network speed value according to all downloading speed values and the streaming media code rate;
and the third determining unit is used for determining the reset code rate of the stream media code rate according to the comparison result of the current downloading network speed value and the stream media code rate, and sending the reset code rate to the transcoding server so that the transcoding server updates the stream media encapsulation data according to the reset code rate.
In a fourth aspect, an embodiment of the present invention provides an electronic device, including: a first processor, a first memory, and a first bus, wherein,
the first processor and the first memory are communicated with each other through the first bus;
the first memory stores program instructions executable by the first processor, the first processor invoking the program instructions to perform a method comprising:
receiving streaming media encapsulation data sent by a transcoding server; the streaming media encapsulation data carries a streaming media code rate;
determining a download rate value required for playing the streaming media packaging data according to the streaming media packaging data in a preset time period adjacent to the current moment;
determining the current downloading network speed value according to all downloading speed values and the streaming media code rate;
and determining a reset code rate of the stream media code rate according to a comparison result of the current downloading network speed value and the stream media code rate, and sending the reset code rate to the transcoding server so that the transcoding server updates stream media encapsulation data according to the reset code rate.
In a fifth aspect, an embodiment of the present invention provides a non-transitory computer-readable storage medium, including:
the non-transitory computer readable storage medium stores computer instructions that cause the computer to perform a method comprising:
receiving streaming media encapsulation data sent by a transcoding server; the streaming media encapsulation data carries a streaming media code rate;
determining a download rate value required for playing the streaming media packaging data according to the streaming media packaging data in a preset time period adjacent to the current moment;
determining the current downloading network speed value according to all downloading speed values and the streaming media code rate;
and determining a reset code rate of the stream media code rate according to a comparison result of the current downloading network speed value and the stream media code rate, and sending the reset code rate to the transcoding server so that the transcoding server updates stream media encapsulation data according to the reset code rate.
In a sixth aspect, an embodiment of the present invention further provides a transcoding server, where the transcoding server includes:
the receiving module is used for receiving the reset code rate sent by the media server;
and the updating module is used for updating the streaming media encapsulation data according to the reset code rate.
In a seventh aspect, an embodiment of the present invention provides an electronic device, including: a second processor, a second memory, and a second bus, wherein,
the second processor and the second memory complete mutual communication through the second bus;
the second memory stores program instructions executable by the second processor, the second processor invoking the program instructions to perform the method of:
receiving a reset code rate sent by a media server;
and updating the streaming media encapsulation data according to the reset code rate.
In an eighth aspect, an embodiment of the present invention provides a non-transitory computer-readable storage medium, including:
the non-transitory computer readable storage medium stores computer instructions that cause the computer to perform a method comprising:
receiving a reset code rate sent by a media server;
and updating the streaming media encapsulation data according to the reset code rate.
The dynamic adjustment method for the stream media code rate, the media server and the transcoding server provided by the embodiment of the invention can shorten the switching delay time of different stream media code rates and dynamically adjust the stream media code rate by determining the current downloading network speed value in advance and reasonably determining the resetting code rate of the stream media code rate according to the current downloading network speed value and the stream media code rate.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
Fig. 1 is a schematic flow chart of a method for dynamically adjusting a streaming media code rate according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of dynamic adjustment of a streaming media bit rate according to an embodiment of the present invention;
FIG. 3 is a flow chart illustrating a method for dynamically adjusting a bit rate of streaming media according to another embodiment of the present invention;
FIG. 4 is a flow chart illustrating a method for dynamically adjusting a bit rate of streaming media according to another embodiment of the present invention;
FIG. 5 is a diagram illustrating a media server according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of a transcoding server according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a schematic flow chart of a method for dynamically adjusting a streaming media bitrate according to an embodiment of the present invention, and as shown in fig. 1, the method for dynamically adjusting a streaming media bitrate according to an embodiment of the present invention includes the following steps:
s101: receiving streaming media encapsulation data sent by a transcoding server; the streaming media encapsulation data carries a streaming media code rate.
Specifically, a media server receives streaming media encapsulation data sent by a transcoding server; the streaming media encapsulation data carries a streaming media code rate. Fig. 2 is a schematic diagram illustrating dynamic adjustment of a streaming media bitrate according to an embodiment of the present invention, and as shown in fig. 2, a transcoding server 101 sends transcoded streaming media encapsulation data to a media server 107 through a network module 106. The streaming media code rate may be a streaming media code rate that is not reset, or may be a streaming media code rate that is reset. After receiving the streaming media encapsulation data, the media server 107 can provide a media service to the outside. The player 200 sends a play request to the media server 107 by requesting play 201; the media server 107 provides the player with streaming media encapsulation data over link 202; when the client corresponding to the player starts to download data, the download rate calculation module 108 starts to work, and calculates the current download network speed value of the client.
S102: and determining a download rate value required for playing the streaming media packaging data according to the streaming media packaging data in a preset time period adjacent to the current time.
Specifically, the media server determines a download rate value required for playing the streaming media encapsulation data according to the streaming media encapsulation data in a preset time period adjacent to the current time. In order to calculate the current downloading network speed value, a downloading speed value required for playing the streaming media encapsulation data needs to be determined, the downloading speed value can be understood as a sampling speed value sampled every other sampling period, a preset time period can be set according to the actual situation, a preset time period adjacent to the current time can be understood as an adjacent preset time period before the current time, and can be selected as 2 minutes, and if the current time is 9:00:00, the adjacent preset time period to the current time is 2 minutes corresponding to 8:58: 00-9: 00: 00. The download rate value may be calculated according to the following equation:
wherein bitrate is(t')Representing the value of the download rate at time t', Q representing an increasing function, the argument of which isThe dependent variable is bitrate(t')T represents one sampling time at which buf is transmitted, t ' represents the next sampling time at which buf is continuously transmitted after t, (b) (t) represents the accumulated amount of streaming media encapsulation data that has been transmitted at time t, and b (t ') represents the accumulated amount of streaming media encapsulation data that has been transmitted at time t '.
The difference between two consecutive download rates is represented by bitdiff, i.e.:
bitdiff(t')={bitrate(t')-bitrate(t)}
the download rate value may also be calculated according to the following equation:
where n represents a calculation for calculating each of the different bandwidths separatelyThe number of times of downloading rate value is further calculated by the mean value calculation modeFor accuracy, other parameters can refer to the above description and are not repeated.
S103: and determining the current downloading network speed value according to all the downloading speed values and the streaming media code rate.
Specifically, the media server determines the current downloading network speed value according to all downloading speed values and the streaming media code rate. The method specifically comprises the following steps:
and respectively obtaining the maximum download rate value, the minimum download rate value and the average value of all download rate values in all download rate values. I.e. all the above-mentioned bitrate(t')To obtain a maximum download rate value, e.g. ofWherein t'1Representing the time corresponding to the maximum download rate value; all the above bitrate(t')To obtain a minimum download rate value, e.g. asWherein t'2Representing the time corresponding to the minimum download rate value; all the above bitrate(t')Get the average value of
And determining the current downloading network speed value according to the calculation result of the time difference between the moment corresponding to the maximum downloading speed value and the minimum downloading speed value and the current moment, the average value and the streaming media code rate. The method specifically comprises the following steps:
and respectively calculating a first time difference between the moment corresponding to the maximum downloading rate value and the current moment and a second time difference between the moment corresponding to the minimum downloading rate value and the current moment. With reference to the above example, 9:00:00 and t 'are calculated'1A first time difference T1 therebetween; calculate 9:00:00 and t'2A second time difference T2 between.
If the first time difference is smaller than the second time difference, the average value is compared with the second time differenceAnd taking the difference of the preset percentages of the streaming media code rates as the current downloading network speed value. The preset percentage can be set independently according to actual conditions, and can be selected to be 5%. If T1 is less than T2, the moment corresponding to the current download net speed value (i.e. 9:00:00) is away from the moment corresponding to the maximum download speed value (i.e. T'1) More recently, it indicates that the current downloading network speed is in a descending trend, so that the current downloading network speed value should be smaller than the average valueCan be used as an average valueAnd subtracting (5% multiplied by the streaming media code rate) to obtain the current downloading network speed value.
And if the first time difference is judged to be larger than the second time difference, taking the sum of the average value and the preset percentage of the streaming media code rate as the current downloading network speed value. If T1 is greater than T2, the time corresponding to the current download network speed value (i.e. 9:00:00) is away from the time corresponding to the minimum download speed value (i.e. T'2) More recently, it indicates that the current downloading network speed is in an ascending trend, so the current downloading network speed value should be larger than the average valueCan be used as an average valuePlus (5% × streaming media code rate) as the current download network speed value. The method and the device can determine the current downloading network speed value as early as possible by pre-judging the rising or falling trend of the current downloading network speed in advance, thereby quickly determining the resetting code rate of the streaming media code rate, further shortening the switching delay time of different streaming media code rates, and avoiding the condition that a player is in a waiting display state or cannot decode playing contents and the like caused by overlong switching delay time in the prior art.
S103: and determining a reset code rate of the stream media code rate according to a comparison result of the current downloading network speed value and the stream media code rate, and sending the reset code rate to the transcoding server so that the transcoding server updates stream media encapsulation data according to the reset code rate.
Specifically, the media server determines a reset code rate of the streaming media code rate according to a comparison result of the current downloading network speed value and the streaming media code rate, and sends the reset code rate to the transcoding server, so that the transcoding server updates streaming media encapsulation data according to the reset code rate. The method can specifically comprise the following steps:
and if the judgment shows that the code rate of the streaming media is less than or equal to the current downloading network speed value, determining not to reset the code rate. That is, if the streaming media code rate is less than or equal to the current downloading network speed value of the client, the code rate is not reset.
And if the judgment result shows that the streaming media code rate is larger than the current downloading network speed value, directly determining the reset code rate as the current downloading network speed value.
Examples are as follows: if the streaming media code rate is 500Kb/s and the current downloading network speed value is 300Kb/s, the resetting code rate is directly determined to be 300 Kb/s.
The dynamic adjustment method for the stream media code rate provided by the embodiment of the invention can shorten the switching delay time of different stream media code rates and dynamically adjust the stream media code rate by determining the current downloading network speed value in advance and reasonably determining the resetting code rate of the stream media code rate according to the current downloading network speed value and the stream media code rate.
On the basis of the foregoing embodiment, the determining a bit rate resetting for the bit rate of the streaming media according to the comparison result between the current internet speed value and the bit rate of the streaming media includes:
and if the judgment shows that the code rate of the streaming media is less than or equal to the current downloading network speed value, determining not to reset the code rate.
Specifically, if the media server judges that the stream media code rate is less than or equal to the current downloading network speed value, the media server determines not to reset the code rate. Reference may be made to the above embodiments, which are not described in detail.
And if the judgment result shows that the streaming media code rate is larger than the current downloading network speed value, directly determining the reset code rate as the current downloading network speed value.
Specifically, if the media server judges that the streaming media code rate is larger than the current downloading network speed value, the media server directly determines the reset code rate as the current downloading network speed value. Reference may be made to the above embodiments, which are not described in detail.
The dynamic adjustment method for the stream media code rate provided by the embodiment of the invention can further shorten the switching delay time of different stream media code rates and dynamically adjust the stream media code rate by reasonably determining the reset code rate.
On the basis of the above embodiment, the determining the current downloading network rate value according to all the downloading rate values and the streaming media code rate includes:
and respectively obtaining the maximum download rate value, the minimum download rate value and the average value of all download rate values in all download rate values.
Specifically, the media server obtains a maximum download rate value, a minimum download rate value, and an average value of all download rate values, respectively, among all download rate values. Reference may be made to the above embodiments, which are not described in detail.
And determining the current downloading network speed value according to the calculation result of the time difference between the moment corresponding to the maximum downloading speed value and the minimum downloading speed value and the current moment, the average value and the streaming media code rate.
Specifically, the media server determines a current downloading network speed value according to a calculation result of a time difference between a time corresponding to the maximum downloading speed value and the minimum downloading speed value and the current time, the average value and the streaming media code rate. Reference may be made to the above embodiments, which are not described in detail.
The dynamic adjustment method for the stream media code rate provided by the embodiment of the invention can further shorten the switching delay time of different stream media code rates and dynamically adjust the stream media code rate by reasonably downloading the network speed value at present.
On the basis of the foregoing embodiment, determining the current downloading network speed value according to the calculation result of the time difference between the current time and the time corresponding to the maximum downloading rate value and the minimum downloading rate value, the average value, and the streaming media code rate includes:
and respectively calculating a first time difference between the moment corresponding to the maximum downloading rate value and the current moment and a second time difference between the moment corresponding to the minimum downloading rate value and the current moment.
Specifically, the media server calculates a first time difference between the time corresponding to the maximum download rate value and the current time, and a second time difference between the time corresponding to the minimum download rate value and the current time, respectively. Reference may be made to the above embodiments, which are not described in detail.
And if the first time difference is smaller than the second time difference, taking the difference between the average value and the preset percentage of the streaming media code rate as the current downloading network speed value.
Specifically, if the media server determines that the first time difference is smaller than the second time difference, the media server uses a difference between the average value and a preset percentage of the streaming media code rate as the current downloading network speed value. Reference may be made to the above embodiments, which are not described in detail.
And if the first time difference is judged to be larger than the second time difference, taking the sum of the average value and the preset percentage of the streaming media code rate as the current downloading network speed value.
Specifically, if the media server determines that the first time difference is greater than the second time difference, the media server takes the sum of the average value and a preset percentage of the streaming media code rate as the current downloading network speed value. Reference may be made to the above embodiments, which are not described in detail.
The dynamic adjustment method for the stream media code rate provided by the embodiment of the invention can further shorten the switching delay time of different stream media code rates and dynamically adjust the stream media code rate by reasonably downloading the network speed value at present.
Fig. 3 is a schematic flow chart of a method for dynamically adjusting a streaming media bitrate according to another embodiment of the present invention, and as shown in fig. 3, the method for dynamically adjusting a streaming media bitrate provided by the embodiment of the present invention includes the following steps:
s301: and receiving the reset code rate sent by the media server.
Specifically, the transcoding server receives the reset code rate sent by the media server. Reference may be made to the reset bitrate 109 in fig. 2, i.e. the reset bitrate 109 is sent from the media server to the transcoding server.
S302: and updating the streaming media encapsulation data according to the reset code rate.
Specifically, the transcoding server updates streaming media encapsulation data according to the reset code rate. The streaming media encapsulation data is cached in advance by taking GOP as a unit, and correspondingly, the method specifically comprises the following steps:
and after the current GOP coding is determined to be finished, reading the streaming media packaging data from the cache, and updating the streaming media packaging data read from the cache according to the reset code rate. The gop (group of pictures) strategy affects the coding quality: a GOP means a group of pictures, and one GOP is a group of consecutive pictures. Further, the method specifically comprises the following steps:
adjusting coding parameters according to the reset code rate;
and updating the streaming media encapsulation data read from the cache through the adjusted encoding parameters. A brief description of the method performed in the transcoding server is given with reference to fig. 2:
the stream pushing client 100 pushes the video data to the transcoding server 101, or the transcoding server 101 pulls the data to the stream pushing client 100, and the transcoding server 101 can receive the data by adopting any one of the two modes; after receiving the data, the transcoding server 101 first parses the data to obtain media data encoding parameters, for example: the protocol used is the hls protocol, the encapsulation of files uses mpeg, the encoding of video uses 264, the encoding of audio uses aac, etc.; then the decoding module 102 starts to work and decodes the received data; the decoded data can be buffered, that is, the decoded data is buffered by the GOP103, the decoded data is buffered by taking the GOP as a unit, the encoding module 105 encodes the data in the GOP103 buffer by using the encoding parameter adjusted by the setting encoding parameter 104, and the data is read by taking the GOP as a unit when being acquired; when the coding parameters 104 are set again, the coding module 105 can adjust the coding parameters after the data coding of the current GOP is completed, so as to update the code rate of the coded output, and then send the updated streaming media encapsulation data to the media server 107; the updated streaming media encapsulation data carries the reset streaming media code rate (i.e. the code rate of the updated encoding output).
The dynamic adjustment method for the stream media code rate provided by the embodiment of the invention updates the stream media encapsulation data by resetting the code rate, and can dynamically adjust the stream media code rate.
On the basis of the above embodiment, the streaming media encapsulation data is cached in advance by taking a GOP as a unit; correspondingly, the updating streaming media encapsulation data according to the reset code rate includes:
and after the current GOP coding is determined to be finished, reading the streaming media packaging data from the cache, and updating the streaming media packaging data read from the cache according to the reset code rate.
Specifically, after determining that the current GOP coding is finished, the transcoding server reads the streaming media encapsulation data from the cache, and updates the streaming media encapsulation data read from the cache according to the reset code rate. Reference may be made to the above embodiments, which are not described in detail.
The dynamic adjustment method for the stream media code rate provided by the embodiment of the invention can further dynamically adjust the stream media code rate.
On the basis of the foregoing embodiment, the updating the streaming media encapsulation data read from the buffer according to the reset code rate includes:
and adjusting coding parameters according to the reset code rate.
Specifically, the transcoding server adjusts the coding parameters according to the reset code rate. Reference may be made to the above embodiments, which are not described in detail.
And updating the streaming media encapsulation data read from the cache through the adjusted encoding parameters.
Specifically, the transcoding server updates the streaming media encapsulation data read from the cache by the adjusted encoding parameters. Reference may be made to the above embodiments, which are not described in detail.
The dynamic adjustment method for the stream media code rate provided by the embodiment of the invention can further dynamically adjust the stream media code rate.
FIG. 4 is a flow chart illustrating a method for dynamically adjusting a bit rate of streaming media according to another embodiment of the present invention; the method steps shown in fig. 4 can refer to the description of the above embodiments, and are not repeated.
Fig. 5 is a schematic structural diagram of a media server according to an embodiment of the present invention, and as shown in fig. 5, an embodiment of the present invention provides a media server, which includes a receiving unit 501, a first determining unit 502, a second determining unit 503, and a third determining unit 504, where:
the receiving unit 501 is configured to receive streaming media encapsulation data sent by a transcoding server; the streaming media encapsulation data carries a streaming media code rate; the first determining unit 502 is configured to determine, in a preset time period adjacent to the current time, a download rate value required for playing the streaming media encapsulation data according to the streaming media encapsulation data; the second determining unit 503 is configured to determine a current downloading network speed value according to all downloading speed values and the streaming media code rate; the third determining unit 504 is configured to determine a reset code rate of the streaming media code rate according to a comparison result between the current downloading network speed value and the streaming media code rate, and send the reset code rate to the transcoding server, so that the transcoding server updates streaming media encapsulation data according to the reset code rate.
Specifically, the receiving unit 501 is configured to receive streaming media encapsulation data sent by a transcoding server; the streaming media encapsulation data carries a streaming media code rate; the first determining unit 502 is configured to determine, in a preset time period adjacent to the current time, a download rate value required for playing the streaming media encapsulation data according to the streaming media encapsulation data; the second determining unit 503 is configured to determine a current downloading network speed value according to all downloading speed values and the streaming media code rate; the third determining unit 504 is configured to determine a reset code rate of the streaming media code rate according to a comparison result between the current downloading network speed value and the streaming media code rate, and send the reset code rate to the transcoding server, so that the transcoding server updates streaming media encapsulation data according to the reset code rate.
The media server provided by the embodiment of the invention can shorten the switching delay time of different stream media code rates and dynamically adjust the stream media code rate by determining the current downloading network speed value in advance and reasonably determining the resetting code rate of the stream media code rate according to the current downloading network speed value and the stream media code rate.
The media server provided in the embodiment of the present invention may be specifically configured to execute the processing flow of each of the method embodiments, and the functions of the media server are not described herein again, and refer to the detailed description of the method embodiments.
Fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention, and as shown in fig. 6, the electronic device includes: a first processor (processor)601, a first memory (memory)602, and a first bus 603;
the first processor 601 and the first memory 602 complete communication with each other through a first bus 603;
the first processor 601 is configured to call program instructions in the first memory 602 to perform the methods provided by the above-mentioned method embodiments, for example, including: receiving streaming media encapsulation data sent by a transcoding server; the streaming media encapsulation data carries a streaming media code rate; determining a download rate value required for playing the streaming media packaging data according to the streaming media packaging data in a preset time period adjacent to the current moment; determining the current downloading network speed value according to all downloading speed values and the streaming media code rate; and determining a reset code rate of the stream media code rate according to a comparison result of the current downloading network speed value and the stream media code rate, and sending the reset code rate to the transcoding server so that the transcoding server updates stream media encapsulation data according to the reset code rate.
The present embodiment discloses a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions which, when executed by a computer, enable the computer to perform the method provided by the above-mentioned method embodiments, for example, comprising: receiving streaming media encapsulation data sent by a transcoding server; the streaming media encapsulation data carries a streaming media code rate; determining a download rate value required for playing the streaming media packaging data according to the streaming media packaging data in a preset time period adjacent to the current moment; determining the current downloading network speed value according to all downloading speed values and the streaming media code rate; and determining a reset code rate of the stream media code rate according to a comparison result of the current downloading network speed value and the stream media code rate, and sending the reset code rate to the transcoding server so that the transcoding server updates stream media encapsulation data according to the reset code rate.
The present embodiments provide a non-transitory computer-readable storage medium storing computer instructions that cause the computer to perform the methods provided by the above method embodiments, for example, including: receiving streaming media encapsulation data sent by a transcoding server; the streaming media encapsulation data carries a streaming media code rate; determining a download rate value required for playing the streaming media packaging data according to the streaming media packaging data in a preset time period adjacent to the current moment; determining the current downloading network speed value according to all downloading speed values and the streaming media code rate; and determining a reset code rate of the stream media code rate according to a comparison result of the current downloading network speed value and the stream media code rate, and sending the reset code rate to the transcoding server so that the transcoding server updates stream media encapsulation data according to the reset code rate.
Fig. 7 is a schematic structural diagram of a transcoding server according to an embodiment of the present invention, and as shown in the drawing, an embodiment of the present invention provides a transcoding server, which includes a receiving module 701 and an updating module 702, where:
the receiving module 701 is configured to receive a reset code rate sent by a media server; the updating module 702 is configured to update streaming media encapsulation data according to the reset code rate.
Specifically, the receiving module 701 is configured to receive a reset code rate sent by the media server; the updating module 702 is configured to update streaming media encapsulation data according to the reset code rate.
The transcoding server provided by the embodiment of the invention updates the streaming media encapsulation data by resetting the code rate, and can dynamically adjust the code rate of the streaming media.
The transcoding server provided in the embodiment of the present invention may be specifically configured to execute the processing flows of the above method embodiments, and the functions of the transcoding server are not described herein again, and reference may be made to the detailed description of the above method embodiments.
Fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present invention, and as shown in fig. 8, the electronic device includes: a second processor (processor)801, a second memory (memory)802, and a second bus 803;
the second processor 801 and the second memory 802 complete communication with each other through a second bus 803;
the second processor 801 is configured to call program instructions in the second memory 802 to perform the methods provided by the above-mentioned method embodiments, for example, including: receiving a reset code rate sent by a media server; and updating the streaming media encapsulation data according to the reset code rate.
The present embodiment discloses a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions which, when executed by a computer, enable the computer to perform the method provided by the above-mentioned method embodiments, for example, comprising: receiving a reset code rate sent by a media server; and updating the streaming media encapsulation data according to the reset code rate.
The present embodiments provide a non-transitory computer-readable storage medium storing computer instructions that cause the computer to perform the methods provided by the above method embodiments, for example, including: receiving a reset code rate sent by a media server; and updating the streaming media encapsulation data according to the reset code rate.
Those of ordinary skill in the art will understand that: all or part of the steps for implementing the method embodiments may be implemented by hardware related to program instructions, and the program may be stored in a computer readable storage medium, and when executed, the program performs the steps including the method embodiments; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
The above-described embodiments of the electronic device and the like are merely illustrative, where the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may also be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only used for illustrating the technical solutions of the embodiments of the present invention, and are not limited thereto; although embodiments of the present invention have been described in detail with reference to the foregoing embodiments, those skilled in the art will understand that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.
Claims (10)
1. A method for dynamically adjusting a streaming media code rate is characterized by comprising the following steps:
receiving streaming media encapsulation data sent by a transcoding server; the streaming media encapsulation data carries a streaming media code rate;
determining a download rate value required for playing the streaming media packaging data according to the streaming media packaging data in a preset time period adjacent to the current moment;
determining the current downloading network speed value according to all downloading speed values and the streaming media code rate;
determining a reset code rate of the stream media code rate according to a comparison result of the current downloading network speed value and the stream media code rate, and sending the reset code rate to the transcoding server so that the transcoding server updates stream media encapsulation data according to the reset code rate;
the determining the resetting code rate of the stream media code rate according to the comparison result of the current downloading network speed value and the stream media code rate comprises the following steps:
if the judgment shows that the streaming media code rate is smaller than or equal to the current downloading network speed value, determining not to reset the code rate;
if the stream media code rate is judged to be larger than the current downloading network speed value, directly determining the reset code rate as the current downloading network speed value;
the determining the current downloading network speed value according to all the downloading speed values and the streaming media code rate comprises the following steps:
respectively obtaining a maximum downloading rate value, a minimum downloading rate value and an average value of all downloading rate values from all downloading rate values;
determining a current downloading network speed value according to the calculation result of the time difference between the moment corresponding to the maximum downloading speed value and the minimum downloading speed value and the current moment, the average value and the streaming media code rate;
determining a current downloading network speed value according to the calculation result of the time difference between the time corresponding to the maximum downloading speed value and the minimum downloading speed value and the current time, the average value and the streaming media code rate, wherein the determining comprises:
respectively calculating a first time difference between the moment corresponding to the maximum downloading rate value and the current moment and a second time difference between the moment corresponding to the minimum downloading rate value and the current moment;
if the first time difference is smaller than the second time difference, the difference between the average value and the preset percentage of the streaming media code rate is used as the current downloading network speed value;
and if the first time difference is judged to be larger than the second time difference, taking the sum of the average value and the preset percentage of the streaming media code rate as the current downloading network speed value.
2. The method of claim 1, comprising:
receiving a reset code rate sent by a media server;
and updating the streaming media encapsulation data according to the reset code rate.
3. The method according to claim 2, wherein the streaming media encapsulation data is buffered in units of GOPs in advance; correspondingly, the updating streaming media encapsulation data according to the reset code rate includes:
and after the current GOP coding is determined to be finished, reading the streaming media packaging data from the cache, and updating the streaming media packaging data read from the cache according to the reset code rate.
4. The method of claim 3, wherein the updating the streaming media encapsulation data read from the buffer according to the reset code rate comprises:
adjusting coding parameters according to the reset code rate;
and updating the streaming media encapsulation data read from the cache through the adjusted encoding parameters.
5. The method of claim 1, wherein the transcoding server comprises:
the receiving module is used for receiving the reset code rate sent by the media server;
and the updating module is used for updating the streaming media encapsulation data according to the reset code rate.
6. A media server, comprising:
the receiving unit is used for receiving streaming media encapsulation data sent by the transcoding server; the streaming media encapsulation data carries a streaming media code rate;
a first determining unit, configured to determine, in a preset time period adjacent to a current time, a download rate value required for playing the streaming media encapsulation data according to the streaming media encapsulation data;
a second determining unit, configured to determine a current downloading network speed value according to all downloading speed values and the streaming media code rate;
determining a current download network speed value, comprising:
respectively obtaining a maximum downloading rate value, a minimum downloading rate value and an average value of all downloading rate values from all downloading rate values;
determining a current downloading network speed value according to the calculation result of the time difference between the moment corresponding to the maximum downloading speed value and the minimum downloading speed value and the current moment, the average value and the streaming media code rate;
determining a current downloading network speed value according to the calculation result of the time difference between the time corresponding to the maximum downloading speed value and the minimum downloading speed value and the current time, the average value and the streaming media code rate, wherein the determining comprises:
respectively calculating a first time difference between the moment corresponding to the maximum downloading rate value and the current moment and a second time difference between the moment corresponding to the minimum downloading rate value and the current moment;
if the first time difference is smaller than the second time difference, the difference between the average value and the preset percentage of the streaming media code rate is used as the current downloading network speed value;
if the first time difference is judged to be larger than the second time difference, taking the sum of the average value and a preset percentage of the streaming media code rate as the current downloading network speed value;
a third determining unit, configured to determine a reset code rate of the streaming media code rate according to a comparison result between the current downloading network speed value and the streaming media code rate, and send the reset code rate to the transcoding server, so that the transcoding server updates streaming media encapsulation data according to the reset code rate;
determining a resetting code rate of the streaming media code rate, comprising:
if the judgment shows that the streaming media code rate is smaller than or equal to the current downloading network speed value, determining not to reset the code rate;
and if the judgment result shows that the streaming media code rate is larger than the current downloading network speed value, directly determining the reset code rate as the current downloading network speed value.
7. An electronic device, comprising: a first processor, a first memory, and a first bus, wherein:
the first processor and the first memory are communicated with each other through the first bus;
the first memory stores program instructions executable by the first processor, the first processor invoking the program instructions to perform the method of claim 1.
8. A non-transitory computer-readable storage medium storing computer instructions that cause a computer to perform the method of claim 1.
9. An electronic device, comprising: a second processor, a second memory, and a second bus, wherein:
the second processor and the second memory complete mutual communication through the second bus;
the second memory stores program instructions executable by the second processor, the second processor invoking the program instructions to perform the method of any of claims 2 to 4.
10. A non-transitory computer-readable storage medium storing computer instructions that cause a computer to perform the method of any one of claims 2 to 4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811486482.0A CN109769125B (en) | 2018-12-06 | 2018-12-06 | Dynamic adjustment method for streaming media code rate, media server and transcoding server |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811486482.0A CN109769125B (en) | 2018-12-06 | 2018-12-06 | Dynamic adjustment method for streaming media code rate, media server and transcoding server |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109769125A CN109769125A (en) | 2019-05-17 |
CN109769125B true CN109769125B (en) | 2021-06-15 |
Family
ID=66450616
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811486482.0A Active CN109769125B (en) | 2018-12-06 | 2018-12-06 | Dynamic adjustment method for streaming media code rate, media server and transcoding server |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109769125B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110267100B (en) * | 2019-07-12 | 2022-01-25 | 北京达佳互联信息技术有限公司 | Code rate switching method and device for FLV (flash video), electronic equipment and storage medium |
CN113141524B (en) * | 2020-01-17 | 2023-09-29 | 北京达佳互联信息技术有限公司 | Resource transmission method, device, terminal and storage medium |
EP4124049A4 (en) * | 2020-04-26 | 2023-03-22 | Huawei Technologies Co., Ltd. | Method and apparatus for adjusting streaming media parameter dynamic adaptive network |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040240390A1 (en) * | 2003-05-30 | 2004-12-02 | Vidiator Enterprises Inc. | Method and apparatus for dynamic bandwidth adaptation |
CN101778104A (en) * | 2009-12-29 | 2010-07-14 | 常州中流电子科技有限公司 | System and method for playing stream media by using self-adaption bandwidth |
CN105451099B (en) * | 2014-08-19 | 2019-01-01 | 北京大学 | Video code rate method of adjustment and device |
CN106993199A (en) * | 2017-04-28 | 2017-07-28 | 暴风集团股份有限公司 | A kind of method and system of real-time video transcoding |
-
2018
- 2018-12-06 CN CN201811486482.0A patent/CN109769125B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN109769125A (en) | 2019-05-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111135569B (en) | Cloud game processing method and device, storage medium and electronic equipment | |
CN109769125B (en) | Dynamic adjustment method for streaming media code rate, media server and transcoding server | |
US8997160B2 (en) | Variable bit video streams for adaptive streaming | |
US9060207B2 (en) | Adaptive video streaming over a content delivery network | |
CN106688239B (en) | Method for downloading video, apparatus and system | |
CN105163134A (en) | Video coding parameter setting method, device and video coding device for live video | |
CN110121100B (en) | Method, device, terminal and computer readable storage medium for downloading media file | |
CN106162214B (en) | Method for video coding and net cast client | |
AU2012207151A1 (en) | Variable bit video streams for adaptive streaming | |
EP2903219A1 (en) | Method, player and terminal for selecting code stream segmentations based on stream media | |
CN105451099B (en) | Video code rate method of adjustment and device | |
CN111886875B (en) | Method and server for transmitting media content through network | |
EP3142381A1 (en) | Network video playing method and device | |
TW201521394A (en) | Method for distributing available bandwidth of a network amongst ongoing traffic sessions run by devices of the network, corresponding device | |
CN106105145B (en) | Method for operating a buffer arranged along a transmission path between a client terminal and at least one server, and corresponding buffer | |
JP2020521212A (en) | Method and apparatus for determining experience quality of VR multimedia | |
KR20150062745A (en) | Apparatus and methdo for virtualization service | |
WO2016118668A1 (en) | Multiple protocol media streaming | |
CN113490055A (en) | Data processing method and device | |
JP2016059037A (en) | Method and client terminal for receiving multimedia content split into at least two successive segments, and corresponding computer program product and computer readable medium | |
CN113411643A (en) | Video quality optimization method, system, electronic equipment and storage medium | |
CN105245562A (en) | Method for operating a cache arranged along a transmission path between client terminals and at least one server, and corresponding cache | |
CN114245196B (en) | Screen recording and stream pushing method and device, electronic equipment and storage medium | |
CN111617466A (en) | Method and device for determining coding format and method for realizing cloud game | |
CN114268830A (en) | Cloud director synchronization method, device, equipment and storage medium |
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 |