CN115842928A - Video code rate switching method and device, computer equipment and storage medium - Google Patents

Video code rate switching method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN115842928A
CN115842928A CN202111101845.6A CN202111101845A CN115842928A CN 115842928 A CN115842928 A CN 115842928A CN 202111101845 A CN202111101845 A CN 202111101845A CN 115842928 A CN115842928 A CN 115842928A
Authority
CN
China
Prior art keywords
code rate
state
current
playing end
local buffer
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.)
Granted
Application number
CN202111101845.6A
Other languages
Chinese (zh)
Other versions
CN115842928B (en
Inventor
韩海旭
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202111101845.6A priority Critical patent/CN115842928B/en
Publication of CN115842928A publication Critical patent/CN115842928A/en
Application granted granted Critical
Publication of CN115842928B publication Critical patent/CN115842928B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application relates to a video code rate switching method, a video code rate switching device, computer equipment and a storage medium. The method relates to the technical field of video processing, and comprises the following steps: receiving a downloading code rate and a local buffer memory of a video stream which are reported periodically by a playing end when the video stream with a target code rate is played; judging the current network bandwidth state of a playing end based on the relative size relationship between the continuously reported downloading code rate and the target code rate; judging the current buffer state of the playing end based on the relative change of the continuously reported local buffer amount; when the current network bandwidth state and the current cache state meet the code rate grade pre-up-regulation condition about the video stream, determining the current estimated bandwidth of the playing end according to the downloading code rate, and indicating the playing end to play the video stream with the pre-up-regulation code rate when judging that the estimated network bandwidth state of the playing end meets the code rate grade pre-up-regulation condition based on the pre-up-regulation code rate and the current estimated bandwidth. By adopting the method, the balance between the video fluency and the video quality can be realized.

Description

Video code rate switching method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of cloud computing technologies, and in particular, to a video bitrate switching method and apparatus, a computer device, and a storage medium.
Background
With the development of computer technology and internet technology, video becomes one of important channels for people to obtain information, and video forms are more and more diverse, such as live video, online video and the like. At present, a complicated and changeable network environment brings great challenges to streaming media transmission and playing, and an adaptive code rate switching method for different network conditions becomes one of hot spots of streaming media technical research.
Current self-adaptation code rate switching mode is mostly through the present available bandwidth of aassessment stream pulling end, and then adjusts the video code rate and match current network situation, but bandwidth detection itself just has certain inaccuracy and error, and bandwidth detection can't accurately distinguish the change of bandwidth be sustainability or transient jitter simultaneously, leads to the code rate to switch frequently, when arousing that the video card is pause, still can reduce video quality.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a video bitrate switching method, apparatus, computer device and storage medium capable of achieving balance between video smoothness and video quality.
A video rate switching method comprises the following steps:
receiving a downloading code rate and a local buffer amount of a video stream, which are reported periodically by a playing end when the video stream with a target code rate is played, wherein the target code rate is one of a plurality of grades of transcoding code rates;
judging the current network bandwidth state of a playing end based on the relative size relationship between the continuously reported downloading code rate and the target code rate;
judging the current buffer state of a playing end based on the continuously reported variation and fluctuation amount between every two adjacent local buffer amounts in the local buffer amounts;
when the current network bandwidth state and the current cache state meet the code rate grade pre-up-regulation condition about the video stream, determining the current pre-estimated bandwidth of a playing end according to the continuously reported downloading code rate, and judging the pre-estimated network bandwidth state when the playing end plays the video stream with the pre-up-regulated code rate based on the relative size relation between the pre-up-regulated code rate after the target code rate is up-regulated and the current pre-estimated bandwidth;
and when the estimated network bandwidth state meets the code rate grade pre-up-regulation condition, indicating a playing end to play the video stream with the pre-up-regulation code rate.
A video bitrate switching apparatus, the apparatus comprising:
the device comprises a receiving module, a decoding module and a decoding module, wherein the receiving module is used for receiving a downloading code rate and a local buffer memory related to a video stream which is reported periodically by a playing end when the playing end plays the video stream with a target code rate, and the target code rate is one of a plurality of grades of transcoding code rates;
a network bandwidth state determination module, configured to determine a current network bandwidth state of a playing end based on a relative size relationship between the continuously reported download code rate and the target code rate;
the buffer state judging module is used for judging the current buffer state of the playing end based on the continuously reported variation and fluctuation amount between every two adjacent local buffer amounts in the local buffer amounts;
a pre-estimated network bandwidth state determination module, configured to determine a current pre-estimated bandwidth of a playing end according to the continuously reported download code rate when the current network bandwidth state and the current cache state meet a pre-up-adjustment condition of the code rate of the video stream, and determine the pre-estimated network bandwidth state when the playing end plays the video stream with the pre-up-adjusted code rate based on a relative size relationship between a pre-up-adjusted code rate after the target code rate is up-adjusted and the current pre-estimated bandwidth;
and the indicating module is used for indicating a playing end to play the video stream with the pre-up-regulation code rate when the pre-estimated network bandwidth state meets the code rate grade pre-up-regulation condition.
In one embodiment, the network bandwidth status determination module is further configured to: counting the total reporting times of continuous reporting and the reporting times of the reported downloading code rate larger than the expected code rate; the expected code rate is determined according to the target code rate; and judging the current network bandwidth state of the playing end according to the size relation between the reporting times and the total reporting times.
In one embodiment, the network bandwidth status determination module is further configured to: determining a video scene type currently corresponding to the video stream; acquiring a preset coefficient corresponding to the video scene type; and taking the product of the target code rate and the preset coefficient as the expected code rate.
In one embodiment, the network bandwidth status decision module is further configured to: when the reporting times are equal to the total reporting times, judging that the current network bandwidth state is an expected state; and when the reporting times are less than the total reporting times, judging that the current network bandwidth state is an unexpected state.
In one embodiment, the cache status determination module is further configured to: based on the continuously reported local buffer amounts, calculating the variation between every two adjacent local buffer amounts, and determining the current buffer sufficient state of the playing end according to the variation; calculating the fluctuation amount between every two adjacent local buffer amounts based on the continuously reported local buffer amounts, and determining the current buffer stable state of the playing end according to the fluctuation amount; and determining the current cache state of the playing end according to the current cache sufficient state and the current cache stable state.
In one embodiment, the cache status determination module is further configured to: determining the number of times of reaching the upper limit that the local buffer storage is greater than the upper limit value of the buffer storage and the number of times of reaching the lower limit that the local buffer storage is less than or equal to the lower limit value of the buffer storage in the total number of reports which are continuously reported; and determining the current sufficient cache state according to the variable quantity among the local cache quantities, the upper limit reaching times and the lower limit reaching times.
In one embodiment, the cache status determination module is further configured to: when the variation between every two adjacent local buffer quantities indicates that the continuously reported local buffer quantities gradually rise, or when the reaching upper limit times are equal to the total reporting times, the current buffer state is determined to be in a sufficient state; and when the variation between every two adjacent local buffer quantities indicates that the continuously reported local buffer quantities gradually decrease, or when the lower limit reaching times are equal to the total reporting times, judging that the current buffer state is an insufficient state.
In one embodiment, the cache status determination module is further configured to: when the average value of the fluctuation amount of the continuously reported local buffer amount is less than or equal to a preset threshold value, judging that the current buffer state of the playing end is a stable state; and when the average value of the fluctuation amount of the continuously reported local buffer amount is larger than a preset threshold value, judging that the current buffer state of the playing end is an unstable state.
In one embodiment, the cache status determination module is further configured to: when the later reported local buffer storage amount in the adjacent local buffer storage amounts is less than or equal to a preset upper limit value, determining the fluctuation amount between the adjacent local buffer storage amounts as the absolute value of the difference between the adjacent local buffer storage amounts; and when the later reported local buffer storage amount in the adjacent local buffer storage amounts is larger than a preset upper limit value, determining that the fluctuation amount between the adjacent local buffer storage amounts is zero.
In one embodiment, the predicted network bandwidth state determination module is further configured to: determining the maximum downloading code rate in the continuously reported downloading code rates; and taking the maximum downloading code rate as the current estimated bandwidth.
In one embodiment, the indication module is further configured to: acquiring a pre-up-regulation coefficient set for up-regulating the code rate grade of the video stream; determining a bandwidth threshold according to the pre-up-regulation coefficient and a pre-up-regulation code rate corresponding to the target code rate; and when the current estimated bandwidth is larger than the bandwidth threshold, judging that the estimated network bandwidth state of the playing end corresponding to the pre-up-regulation code rate meets the code rate grade pre-up-regulation condition.
In one embodiment, the forecast network bandwidth status determination module is further configured to: when the current network bandwidth state is an expected state and the current cache state is a sufficient state and a stable state, judging that the current network bandwidth state and the current cache state meet a code rate grade pre-up condition related to the video stream.
In one embodiment, the cache status determination module is further configured to: based on the continuously reported local buffer amounts, calculating the variation between every two adjacent local buffer amounts, and determining the current buffer sufficient state of the playing end according to the variation; the indication module is further configured to: when the current network bandwidth state is an unexpected state and/or the current cache state is an insufficient state, at least one of the current network bandwidth state and the current cache sufficient state is judged to meet a code rate grade pre-adjustment condition about the video stream, and the video stream of a pre-adjustment code rate corresponding to the target code rate is indicated to be played.
In one embodiment, the indication module is further configured to: and when the current network bandwidth state and the current cache state continuously preset times meet the code rate grade pre-up-regulation condition of the video stream and the estimated network bandwidth state meets the code rate grade pre-up-regulation condition each time, indicating a playing end to play the video stream with the pre-up-regulation code rate.
In one embodiment, the indication module is further configured to: generating a code rate grade up-regulation instruction corresponding to the playing end; transmitting the code rate grade up-regulation instruction to a video server; the code rate grade up-regulation instruction is used for indicating the video server to push the video stream with the pre-up-regulation code rate to a playing end.
A computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:
receiving a downloading code rate and a local buffer storage related to a video stream, which are periodically reported by a playing end when the video stream with a target code rate is played, wherein the target code rate is one of a plurality of grades of transcoding code rates;
judging the current network bandwidth state of a playing end based on the relative size relationship between the continuously reported downloading code rate and the target code rate;
judging the current buffer state of a playing end based on the continuously reported variation and fluctuation amount between every two adjacent local buffer amounts in the local buffer amounts;
when the current network bandwidth state and the current cache state meet the code rate grade pre-up-regulation condition about the video stream, determining the current estimated bandwidth of a playing end according to the continuously reported downloading code rate, and judging the estimated network bandwidth state when the playing end plays the video stream with the pre-up-regulation code rate based on the relative size relation between the pre-up-regulation code rate after the target code rate is up-regulated and the current estimated bandwidth;
and when the estimated network bandwidth state meets the code rate grade pre-up-regulation condition, indicating a playing end to play the video stream with the pre-up-regulation code rate.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
receiving a downloading code rate and a local buffer storage related to a video stream, which are periodically reported by a playing end when the video stream with a target code rate is played, wherein the target code rate is one of a plurality of grades of transcoding code rates;
judging the current network bandwidth state of a playing end based on the relative size relationship between the continuously reported downloading code rate and the target code rate;
judging the current buffer state of a playing end based on the continuously reported variation and fluctuation amount between every two adjacent local buffer amounts in the local buffer amounts;
when the current network bandwidth state and the current cache state meet the code rate grade pre-up-regulation condition about the video stream, determining the current pre-estimated bandwidth of a playing end according to the continuously reported downloading code rate, and judging the pre-estimated network bandwidth state when the playing end plays the video stream with the pre-up-regulated code rate based on the relative size relation between the pre-up-regulated code rate after the target code rate is up-regulated and the current pre-estimated bandwidth;
and when the estimated network bandwidth state meets the code rate grade pre-up-regulation condition, indicating a playing end to play the video stream with the pre-up-regulation code rate.
A computer program, the computer program comprising computer instructions, the computer instructions being stored in a computer-readable storage medium, a processor of a computer device reading the computer instructions from the computer-readable storage medium, the processor executing the computer instructions, so that the computer device performs the steps of the video bitrate switching method.
According to the video code rate switching method, the video code rate switching device, the computer equipment and the storage medium, when the playing end plays the video stream with the target code rate, the downloading code rate and the local buffer storage amount related to the video stream are reported regularly, and after the reported downloading code rate and the local buffer storage amount related to the video stream are received, on one hand, the current network bandwidth state of the playing end can be judged based on the relative size relation between the continuously reported downloading code rate and the target code rate, and on the other hand, the current buffer storage state of the playing end can be judged based on the relative change of the continuously reported local buffer storage amount. Then, when the current network bandwidth state and the current cache state meet the code rate grade pre-up condition about the video stream, the current estimated bandwidth of the playing end is determined based on the continuously reported download code rate, and when the estimated network bandwidth state when the video stream with the pre-up code rate is played by the playing end is judged to also meet the code rate grade pre-up condition according to the relative size relation between the pre-up code rate after the grade is up-adjusted to the target code rate and the current estimated bandwidth, the playing end is instructed to play the video stream with the pre-up code rate, so that the threshold of the video code rate up-adjusted by the playing end is improved by jointly judging the current network bandwidth state and the estimated network bandwidth state of the playing end and considering the cache state of the playing end, thereby reducing the influence caused by frequent code rate switching and realizing the balance between the video smoothness and the video quality.
Drawings
FIG. 1 is a diagram of an exemplary embodiment of a video bitrate switching method;
FIG. 2 is a diagram of an application environment of a video bitrate switching method in another embodiment;
FIG. 3 is a flowchart illustrating a video rate switching method according to an embodiment;
FIG. 4 is a schematic interface diagram of a video playback page in one embodiment;
FIG. 5 is a flowchart illustrating a video rate switching method according to another embodiment;
FIG. 6 is a diagram illustrating the determination of the current network bandwidth status of the playback end in one embodiment;
FIG. 7 is a diagram illustrating an embodiment of determining a current buffer fullness status of a playback end;
FIG. 8 is a diagram illustrating an embodiment of determining a current cache steady state of a playback end;
FIG. 9 is a flowchart illustrating a video rate switching method according to another embodiment;
FIG. 10 is a block diagram of an embodiment of a video bitrate switching apparatus;
FIG. 11 is a diagram illustrating an internal structure of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The video code rate switching method provided by the embodiment of the application relates to a Cloud technology (Cloud technology), which is a hosting technology for unifying series resources such as hardware, software, a network and the like in a wide area network or a local area network to realize calculation, storage, processing and sharing of data.
The cloud technology is based on the general names of network technology, information technology, integration technology, management platform technology, application technology and the like applied in the cloud computing business model, can form a resource pool, is used as required, and is flexible and convenient. Cloud computing technology will become an important support. Background services of the technical network system require a large amount of computing and storage resources, such as video websites, picture-like websites and more web portals. With the high development and application of the internet industry, each article may have its own identification mark and needs to be transmitted to a background system for logic processing, data in different levels are processed separately, and various industrial data need strong system background support and can only be realized through cloud computing.
The video code rate switching method provided by the embodiment of the application mainly relates to Cloud Computing (Cloud Computing) of a Cloud technology. Cloud computing refers to a delivery and use mode of an IT infrastructure, and refers to acquiring required resources in an on-demand and easily-extensible manner through a network; the generalized cloud computing refers to a delivery and use mode of a service, and refers to obtaining a required service in an on-demand and easily-extensible manner through a network. Such services may be IT and software, internet related, or other services. Cloud Computing is a product of development and fusion of traditional computers and Network Technologies, such as Grid Computing (Grid Computing), distributed Computing (distributed Computing), parallel Computing (Parallel Computing), utility Computing (Utility Computing), network Storage (Network Storage Technologies), virtualization (Virtualization), load balancing (Load Balance), and the like.
With the development of diversification of internet, real-time data stream and connecting equipment and the promotion of demands of search service, social network, mobile commerce, open collaboration and the like, cloud computing is rapidly developed. Different from the prior parallel distributed computing, the generation of cloud computing can promote the revolutionary change of the whole internet mode and the enterprise management mode in concept.
For example, in the embodiment of the present application, a video server receives an original video stream uploaded by a stream pushing end, converts the original video stream into video streams with multiple grades of transcoding code rates, and pushes the video stream with a target code rate to a playing end; and the video server receives the download code rate and the local buffer amount of the video stream which are periodically reported by the playing end when the video stream with the target code rate is played, when the current network bandwidth state and the buffer state of the playing end are judged to meet the code rate grade pre-up-regulation condition of the video stream based on the continuously reported download code rate and the local buffer amount, the current estimated bandwidth of the playing end is determined according to the continuously reported download code rate, and when the estimated network bandwidth state of the playing end is judged to meet the code rate grade pre-up-regulation condition based on the current estimated bandwidth and the pre-up-regulation code rate after the target code rate is up-regulated, the video stream with the pre-up-regulation code rate is pushed to the playing end.
The video code rate switching method provided by the embodiment of the application also relates to a block chain technology. The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a string of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, which is used for verifying the validity (anti-counterfeiting) of the information and generating a next block. The blockchain may include a blockchain underlying platform, a platform product services layer, and an application services layer.
For example, in the embodiment of the present application, the video server may be a block link point in a block chain network, the stream push end transmits an original video stream to the block chain node in the block chain network, and the play end pulls a video stream with a target bitrate from the block chain network for playing.
The video bitrate switching method provided by the present application can be applied to an application environment shown in fig. 1, where the stream pushing end 102 and the playing end 106 communicate with the video server 104 through a network, respectively. The stream pushing end 102 and the playing end 106 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, portable wearable devices, televisions, and the like. The video server 104 may be an online video server or a live video server. The video server 104 may be an independent physical server, or a server cluster or distributed system formed by a plurality of physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs, and big data and artificial intelligence platforms.
In one embodiment, the stream pushing end 102 collects and encodes the original video stream to generate an original video stream, and transmits the original video stream to the video server 104; the video server 104 receives an original video stream uploaded by the stream pushing terminal 102, converts the original video stream into video streams with multiple grades of transcoding code rates, and pushes the video stream with a target code rate to the playing terminal 106; the video server 104 receives a download code rate and a local buffer amount of a video stream, which are periodically reported by the playing end 106 when the video stream with a target code rate is played, determines that a current network bandwidth state and a cache state of the playing end 106 meet a code rate grade pre-up condition of the video stream based on the continuously reported download code rate and the local buffer amount, determines a current estimated bandwidth of the playing end according to the continuously reported download code rate, determines that the estimated network bandwidth state of the playing end 106 also meets the code rate grade pre-up condition based on the current estimated bandwidth and the pre-up code rate after the target code rate is up-shifted, pushes the video stream with the pre-up code rate to the playing end 106, and the playing end 106 plays the video stream with the pre-up code rate.
The video bitrate switching method provided by the present application can also be applied to an application environment as shown in fig. 2, where the evaluation server 108 communicates with the playing terminal 106 and the video server 104 through a network, respectively. The evaluation server 108 may be an independent physical server, or a server cluster or distributed system formed by a plurality of physical servers, or a cloud server providing basic cloud computing services such as cloud service, cloud database, cloud computing, cloud function, cloud storage, network service, cloud communication, middleware service, domain name service, security service, CDN, big data and artificial intelligence platform, and the like.
In one embodiment, the stream pushing end 102 collects and encodes the original video stream to generate an original video stream, and transmits the original video stream to the video server 104; the video server 104 receives an original video stream uploaded by the stream pushing terminal 102, converts the original video stream into video streams with multiple grades of transcoding code rates, and pushes the video stream with a target code rate to the playing terminal 106; the evaluation server 108 receives a download code rate and a local buffer amount of a video stream, which are periodically reported by the playing end 106 when the video stream with a target code rate is played, when it is judged that the current network bandwidth state and the buffer state of the playing end 106 meet a code rate grade pre-up-regulation condition of the video stream based on the continuously reported download code rate and the local buffer amount, the current estimated bandwidth of the playing end is determined according to the continuously reported download code rate, and when the estimated network bandwidth state of the playing end 106 is judged to also meet the code rate grade pre-up-regulation condition based on the current estimated bandwidth and the pre-up-regulation code rate after the target code rate is up-regulated, a code rate grade up-regulation instruction corresponding to the playing end 106 is generated, and the code rate grade up-regulation instruction is transmitted to the video server 104; in response to the code rate level up-regulation instruction, the video server 104 pushes the video stream with the pre-up-regulation code rate to the playing terminal 106, and the playing terminal 106 plays the video stream with the pre-up-regulation code rate.
In the video bitrate switching method provided in the embodiment of the present application, the execution main body may be the video bitrate switching device provided in the embodiment of the present application, or a terminal integrated with the video bitrate switching device, where the video bitrate switching device may be implemented in a hardware or software manner.
The video code rate switching method provided by the embodiment of the application can be applied to video playing scenes, such as online video playing scenes, live video playing scenes and the like.
In one embodiment, when a playing end plays a video stream, a video server or an evaluation server receives a download code rate and a local buffer storage amount of the video stream periodically reported by the playing end, determines a current network bandwidth state of the playing end based on a relative size relationship between the continuously reported download code rate and a target code rate, determines a current cache state of the playing end based on a variation and a fluctuation amount between two adjacent local buffer storage amounts in the continuously reported local buffer storage amount, determines a current estimated bandwidth of the playing end according to the continuously reported download code rate, determines an estimated network bandwidth state when the playing end plays the video stream with the preset up-regulation code rate based on a relative size relationship between a preset up-regulation code rate after the target code rate is up-regulated and the current estimated bandwidth, and controls the code rate switching when the playing end plays the video stream according to the current network bandwidth state, the current cache state and the estimated network bandwidth state.
In one embodiment, whether the playback end up-regulates the code rate grade is judged according to whether the current network bandwidth state, the current cache state and the estimated network bandwidth state of the playback end meet the code rate grade pre-up-regulation condition, and whether the playback end down-regulates the code rate grade is judged according to whether the current network bandwidth state and the current cache state of the playback end meet the code rate grade down-regulation condition.
For example, the video server or the evaluation server divides the current network bandwidth state of the playing end into an expected state and an unexpected state in advance, evaluates the current cache state of the playing end from two dimensions of a cache sufficient state and a cache stable state, divides the current cache state of the playing end into a sufficient state, an insufficient state, a stable state and an unstable state, and divides the estimated network bandwidth state of the playing end into an expected state and an unexpected state, then:
when the current network bandwidth state of the playing end is an expected state, the current cache state is an adequate state and a stable state, and the estimated network bandwidth state of the playing end corresponding to the pre-up-regulation code rate is an expected state, the current network bandwidth state, the current cache state and the estimated network bandwidth state of the playing end are judged to meet the code rate grade pre-up-regulation condition, the video stream code rate of the playing end is instructed to be up-regulated, and due to the fact that the threshold of up-regulation of the video code rate of the playing end is improved, influences caused by frequent code rate switching can be reduced, and balance between video smoothness and video quality is achieved.
When the current network bandwidth state of the playing end is an unexpected state and/or the current cache state is an insufficient state, judging that the current network bandwidth state and the current cache state of the playing end meet a code rate grade down-regulation condition, and indicating that the video stream code rate of the playing end is down-regulated, thereby realizing the dynamic regulation of the video code rate.
When at least one of the current network bandwidth state, the current cache state and the estimated network bandwidth state of the playing end does not meet the code rate grade pre-up-regulation condition and at least one of the current network bandwidth state and the current cache state does not meet the code rate grade pre-down-regulation condition, the playing end keeps playing the current code rate. For example, when the current network bandwidth state of the playing end is an expected state, and the current cache state is a sufficient state and an unstable state, the playing end keeps playing at the current code rate; for another example, when the current network bandwidth state of the playing end is an expected state, the current cache state is a sufficient state and a stable state, and the estimated network bandwidth state of the playing end corresponding to the pre-adjusted code rate is an unexpected state, the playing end keeps playing at the current code rate.
In an embodiment, as shown in fig. 3, a video bitrate switching method is provided, and this embodiment is mainly illustrated by applying the method to the video server 104 in fig. 1 or the evaluation server 108 in fig. 2, and includes the following steps:
step S302, receiving the downloading code rate and the local buffer storage of the video stream reported periodically by the playing end when playing the video stream with the target code rate, wherein the target code rate is one of the transcoding code rates of a plurality of grades.
The target code rate is the code rate of the current playing video stream of the playing end, and the playing code rate is in direct proportion to the video definition. The downloading code rate is the code rate of the playing end downloading the video stream from the video server. The code rate may reflect the amount of data transmitted per unit time when the data is transmitted. The local buffer amount may be a local buffer frame number when the playing end plays the video stream, and the like.
In a specific application scenario, a video server receives an original video stream corresponding to a target video identifier uploaded by a stream pushing end, and transcodes the original video stream in multiple grades to obtain a video stream with multiple transcoding code rates. And after the playing end enters the application program according to the operation of the user, starting to play the target video corresponding to the target video identifier in a user interaction interface provided by the application program. And the video server responds to a video stream pulling request which is sent by the playing end and corresponds to the target video identification, and selects a video stream with one code rate from the video streams with the plurality of transcoding code rates to push the video stream to the playing end. Optionally, the video server may determine the video stream bitrate pushed to the playing end according to factors such as the current network environment bandwidth of the playing end or the user definition requirement.
In one embodiment, after the playing terminal starts playing the target video, the downloading code rate and the local buffer amount of the video stream are reported to the video server or the evaluation server periodically, so that the video server or the evaluation server adaptively switches the playing code rate of the playing terminal. In other embodiments, after the playing end starts playing the target video, when a preset condition is met, the playing end triggers to report the download code rate and the local buffer amount of the video stream to the video server or the evaluation server periodically, where the preset condition may be that the playing time length reaches a preset time length, and the like. Or when the playing end plays the target video and receives the adaptive code rate switching instruction, triggering to report the downloading code rate and the local buffer amount of the video stream to the video server or the evaluation server regularly. For example, referring to fig. 4, fig. 4 shows an interface schematic diagram of a video playback page in one embodiment. It can be seen that the adaptive bitrate switching control 402 is shown in the video playing page, and the playing end can receive an adaptive bitrate switching instruction through the adaptive bitrate switching control 402.
In an embodiment, the target bitrate may be an initial playback bitrate when the playback end starts playing the target video, or may be a playback bitrate adjusted by the video server or the evaluation server.
In one embodiment, the video server pushes a video stream with a target code rate to the playing end, the playing end periodically reports the download code rate and the local buffer amount of the video stream to the video server or the evaluation server when playing the video stream with the target code rate, and the video server or the evaluation server accordingly obtains the download code rate and the local buffer amount of the video stream periodically reported by the playing end.
In one embodiment, when playing a video stream with a target code rate, a playing end reports a download code rate and a local buffer amount of the video stream to an evaluation server periodically, the video server reports a transcoding code rate of multiple grades of the video stream to the evaluation server, and the evaluation server thus obtains the download code rate and the local buffer amount of the video stream reported periodically by the playing end and the transcoding code rate of the multiple grades of the video stream reported by the video server.
In one embodiment, when playing a video stream with a target bitrate, the playing end reports the mean value of the download bitrate and the mean value of the local buffer amount of the video stream at preset time intervals to the video server or the evaluation server. In other embodiments, the playing end reports the most value of the download code rate and the most value of the local buffer amount of the video stream at a preset time interval to the video server or the evaluation server, where the most value is the maximum value or the minimum value. Or, the playing end reports the download code rate and the local buffer amount corresponding to a certain time point of the video stream within a preset time interval to the video server or the evaluation server, for example, the download code rate and the local buffer amount corresponding to the reported time point.
Step S304, based on the relative size relationship between the continuously reported download code rate and the target code rate, the current network bandwidth state of the playing terminal is judged.
The network bandwidth state is used for describing the bandwidth state of the network environment where the playing end is located.
It can be understood that the current network bandwidth state, the current estimated bandwidth, the current cache state, and the like are concepts of relative changes, and taking the current network bandwidth state as an example, the video server or the evaluation server obtains the latest "current network bandwidth state" of the playing end based on the relative size relationship between the download code rate and the target code rate reported by the next batch of consecutive preset times.
In an embodiment, the video server or the evaluation server may determine the current network bandwidth state of the playing terminal based on the relative size relationship between the download code rate reported by the continuous preset times and the target code rate, respectively. For example, the video server or the evaluation server counts the number of times of reporting that the download code rate is greater than the target code rate in the download code rates reported by consecutive preset times, determines that the current network bandwidth state is an expected state when the ratio of the number of times of reporting to the total number of times of reporting is greater than a preset ratio, and determines that the current network bandwidth state is an unexpected state when the ratio of the number of times of reporting to the total number of times of reporting is less than or equal to the preset ratio.
In an embodiment, the video server or the evaluation server may also determine a target download code rate from the download code rates reported in the consecutive preset times, and determine the current network bandwidth state of the playing terminal based on a relative magnitude relationship between the target download code rate and the target code rate, where the target download code rate may be a maximum download code rate, a minimum download code rate, or an average download code rate among the download code rates reported in the consecutive preset times.
In one embodiment, the video server or the evaluation server may preset more than one network bandwidth state, such as an expected state and an unexpected state. And setting corresponding preset conditions aiming at different network bandwidth states, and determining the current network bandwidth state of the playing end according to the preset conditions of the hit of the download code rate reported by the continuous preset times when the download code rate reported by the continuous preset times is actually obtained.
And step S306, judging the current buffer state of the playing end based on the variation and fluctuation amount between every two adjacent local buffer amounts in the continuously reported local buffer amounts.
In one embodiment, the video server or the evaluation server may evaluate the current buffer status of the playing end from two dimensions, i.e., from the sufficient buffer status and the stable buffer status. The current buffer memory sufficient state of the playing end is used for reflecting whether the local buffer memory frame number is sufficient enough or not so as to support the normal playing of the video without jamming. The current cache stable state of the playing end is used for reflecting whether the change of the local cache frame number is stable or not.
In an embodiment, the video server or the evaluation server may determine the current sufficient cache state and the current stable cache state of the playing end based on the continuously reported local cache amount, and determine the current cache state of the playing end according to the current sufficient cache state and the current stable cache state.
In one embodiment, the video server or the evaluation server may calculate a difference between two adjacent local buffer amounts as a variation based on the continuously reported local buffer amounts, and determine the current buffer sufficient state of the playing end according to the variation between the local buffer amounts. For example, the video server or the evaluation server counts the rising times of the variation between every two adjacent local buffer amounts, determines that the current buffer state is in a sufficient state when the ratio of the rising times to the total reporting times is greater than a preset ratio, and determines that the current buffer state is in an insufficient state when the ratio of the rising times to the total reporting times is less than or equal to the preset ratio. It can be understood that the video server or the evaluation server may also count the number of drops of the variation between every two adjacent local buffer storage amounts, and determine the current buffer state according to the ratio between the number of drops and the total number of reports.
In one embodiment, the video server or the evaluation server counts local buffer amounts reported for a preset number of times, and determines the current buffer sufficient state of the playing end according to at least one of the upper limit reaching times and the lower limit reaching times based on the upper limit reaching times that the continuously reported local buffer amounts are greater than the upper limit of the buffer amounts and the lower limit reaching times that the local buffer amounts are less than or equal to the lower limit of the buffer amounts. For example, when the ratio of the upper limit times to the total reporting times is greater than a preset ratio, the current cache state is determined to be in a sufficient state, and when the ratio of the upper limit times to the total reporting times is less than or equal to the preset ratio, the current cache state is determined to be in an insufficient state. It can be understood that the video server or the evaluation server may also determine the current buffer status according to the ratio between the lower limit times and the total number of reporting times.
In one embodiment, the video server or the evaluation server may determine the current buffer sufficiency state of the playing terminal according to at least one of the amount of change between the local buffer amounts, the number of times of reaching the upper limit, and the number of times of reaching the lower limit.
In one embodiment, the video server or the evaluation server may preset more than one cache sufficiency state, such as a sufficiency state and an insufficient state. And setting corresponding preset conditions for different sufficient cache states, and determining the current sufficient cache state of the playing end according to the hit preset conditions of the local cache amount reported by the continuous preset times when the local cache amount reported by the continuous preset times is actually obtained.
In one embodiment, the video server or the evaluation server calculates an absolute value of a difference between local buffer amounts reported two times in adjacent reports as a fluctuation amount based on the local buffer amounts reported in the preset times, and determines the current buffer stable state of the playing end according to the fluctuation amount between the local buffer amounts. For example, when the average value of the fluctuation amount of the continuously reported local buffer amount is less than or equal to a preset threshold, it is determined that the current buffer state of the playing end is a stable state, and when the average value of the fluctuation amount of the continuously reported local buffer amount is greater than the preset threshold, it is determined that the current buffer state of the playing end is an unstable state. The preset threshold value can be set according to the actual video frame buffer stability requirement.
In one embodiment, the video server or the evaluation server may preset more than one cache stable state, such as a stable state and a non-stable state. And setting corresponding preset conditions aiming at different cache stable states, and determining the current cache stable state of the playing end according to the hit preset conditions of the local cache amount reported by the continuous preset times when the local cache amount reported by the continuous preset times is actually obtained.
Step S308, when the current network bandwidth state and the current cache state meet the code rate grade pre-up-regulation condition about the video stream, determining the current estimated bandwidth of the playing end according to the continuously reported downloading code rate, and judging the estimated network bandwidth state when the playing end plays the video stream with the pre-up-regulation code rate based on the relative size relationship between the pre-up-regulation code rate after the target code rate is up-regulated and the current estimated bandwidth.
The predicted bandwidth is a bandwidth prediction result of a network environment where the playing end is located. The bandwidth reflects the amount of data that can be transferred per unit time at the time of data transmission. The pre-up-regulation code rate is determined according to the target code rate. The video server or the evaluation server may use the transcoding code rate corresponding to the target code rate after the target code rate is adjusted up to the preset file as the preset up-adjusting code rate, where the preset file may be a first file or the like.
In one embodiment, when the current network bandwidth state is an expected state and the current buffer state is a sufficient state and a stable state, the current network bandwidth state and the current buffer state are determined to satisfy a bitrate level pre-up condition on the video stream.
In one embodiment, the video server or the evaluation server determines the maximum download code rate in the continuously reported download code rates; and taking the maximum downloading code rate as the current estimated bandwidth.
In one embodiment, the video server or the evaluation server takes the continuous preset times as a reporting batch, counts a maximum download code rate in download code rates reported by the continuous preset times, takes the maximum download code rate as a current estimated bandwidth, and can be represented by the following formula:
Eb k =Max(Br i )0<i<S
wherein Eb k Representing the current estimated bandwidth of a playing end, and k represents the grade of a target code rate; br i Representing the downloading code rate reported for the ith time; s represents the total number of reporting times.
In this embodiment, the maximum download code rate in the download code rates reported in the consecutive preset times is used as the current estimated bandwidth, that is, the periodic maximum download code rate is used as the bandwidth evaluation basis, so that the current real upper limit of the bandwidth can be accurately reflected.
In one embodiment, the video server or the evaluation server may preset more than one predicted network bandwidth state, such as an expected state and an unexpected state. And setting corresponding preset conditions aiming at different estimated network bandwidth states, and determining the estimated network bandwidth state of the playing end according to the preset conditions hit by the current estimated bandwidth when the current estimated bandwidth of the playing end is actually obtained.
In one embodiment, the video server or the evaluation server determines the estimated network bandwidth state of the playing end corresponding to the pre-adjusted code rate based on the relative size relationship between the current estimated bandwidth and the pre-adjusted code rate. For example, when the current estimated bandwidth is greater than the pre-adjusted code rate, the estimated network bandwidth state of the playing end corresponding to the pre-adjusted code rate is determined to be an expected state, and when the current estimated bandwidth is less than or equal to the pre-adjusted code rate, the estimated network bandwidth state of the playing end corresponding to the pre-adjusted code rate is determined to be an unexpected state.
In one embodiment, when the estimated network bandwidth state corresponding to the pre-upturn code rate at the playing end is an expected state, it is determined that the estimated network bandwidth state corresponding to the pre-upturn code rate at the playing end satisfies the code rate level pre-upturn condition.
In one embodiment, a video server or an evaluation server acquires a pre-up-regulation coefficient set for up-regulating a code rate grade of a video stream; determining a bandwidth threshold according to the pre-up-regulation coefficient and the pre-up-regulation code rate corresponding to the target code rate; when the current estimated bandwidth is larger than the bandwidth threshold, the estimated network bandwidth state of the playing end corresponding to the pre-up code rate is judged to be an expected state, and when the current estimated bandwidth is smaller than or equal to the bandwidth threshold, the estimated network bandwidth state of the playing end corresponding to the pre-up code rate is judged to meet the pre-up condition of the code rate grade, which can be represented by the following formula:
Figure BDA0003270941540000161
wherein, status ept The estimated network bandwidth state of the playing end corresponding to the pre-adjusted code rate is represented; exp denotes the expected state, uexp denotes the unexpected state; eb k Representing the current estimated bandwidth of a playing end; k represents the level of the target code rate, vr k+1 Representing the pre-up-regulation code rate with the grade of k + 1; epsilon represents a pre-up-regulation coefficient, and can be taken as a value according to practical application, for example, 0.7; epsilon Vr k+1 Indicating a bandwidth threshold.
In an embodiment, referring to fig. 5, fig. 5 is a flowchart illustrating a video bitrate switching method in an embodiment. It can be seen that, when the playing end plays a video stream, the video server or the evaluation server receives the video stream parameters periodically reported by the playing end, judges the current network bandwidth state and the buffer state of the playing end according to the preset continuously reported video stream parameters, determines the current estimated bandwidth of the playing end when the current network bandwidth state and the buffer state meet the code rate grade pre-up-regulation condition, judges the estimated network bandwidth state of the playing end corresponding to the pre-up code rate based on the current estimated bandwidth, and instructs the playing end to play the video stream with the pre-up code rate when the estimated network bandwidth state also meets the code rate grade pre-up-regulation condition.
Step S310, when the estimated network bandwidth state meets the code rate grade pre-up-regulation condition, the playing end is instructed to play the video stream with the pre-up-regulation code rate.
In one embodiment, instructing the playing end to play the video stream with the pre-adjusted bitrate includes: generating a code rate grade up-regulation instruction corresponding to the playing end; transmitting a code rate grade up-regulation instruction to a video server; the code rate grade up-regulation instruction is used for indicating the video server to push the video stream with the pre-up-regulation code rate to the playing end.
In one embodiment, when the evaluation server determines that the playing end can play the video stream with the pre-up-regulation code rate, the evaluation server generates a code rate grade up-regulation instruction corresponding to the playing end, and transmits the code rate grade up-regulation instruction to the video server to instruct the video server to push the video stream with the pre-up-regulation code rate to the playing end.
In the video code rate switching method, when the playing end plays the video stream with the target code rate, the downloading code rate and the local buffer memory amount of the video stream are reported regularly, and after the reported downloading code rate and the local buffer memory amount of the video stream are received, on one hand, the current network bandwidth state of the playing end can be judged based on the relative size relation between the continuously reported downloading code rate and the target code rate, and on the other hand, the current buffer memory state of the playing end can be judged based on the relative change of the continuously reported local buffer memory amount. Then, when the current network bandwidth state and the current cache state meet the code rate grade pre-up-regulation condition of the video stream, the current pre-estimated bandwidth of the playing end is determined based on the continuously reported download code rate, and when the pre-estimated network bandwidth state when the playing end plays the video stream with the pre-up-regulation code rate also meets the code rate grade pre-up-regulation condition according to the relative size relation between the pre-up-regulation code rate after the target code rate is up-regulated and the current pre-estimated bandwidth, the playing end can be instructed to play the video stream with the pre-up-regulation code rate.
In one embodiment, the determining the current network bandwidth state of the playing terminal based on the relative size relationship between the continuously reported download code rate and the target code rate includes: counting the total reporting times of continuous reporting and the reporting times of the reported downloading code rate larger than the expected code rate; the expected code rate is determined according to the target code rate; and judging the current network bandwidth state of the playing end according to the size relationship between the reporting times and the total reporting times.
In one embodiment, the video server or the evaluation server determines an expected code rate according to a current target code rate of the playing end, where the expected code rate is used to determine whether a download code rate reported by the playing end reaches a current expectation, so as to further determine a current network bandwidth state of the playing end according to a determination result of the download code rate.
In one embodiment, the step of determining the expected code rate comprises: and acquiring a preset coefficient, and taking the product of the target code rate and the preset coefficient as an expected code rate. The preset coefficient can be set according to practical application, such as 0.7, 0.8, etc.
In one embodiment, the step of determining the expected code rate comprises: determining a video scene type corresponding to the video stream currently; acquiring a preset coefficient corresponding to the video scene type; the product of the target code rate and the preset coefficient is used as the expected code rate.
In one embodiment, the video server or evaluation server may preset more than one video scene type, such as a relatively moving scene and a relatively still scene. Corresponding preset coefficients are set for different video scene types, for example, the preset coefficient corresponding to a relatively moving scene may be 0.8, and the preset coefficient corresponding to a relatively static scene may be 0.7.
In one embodiment, when the playing end plays a video stream with a target code rate, the video server periodically reports a video scene type related to the video stream to the evaluation server, and the evaluation server obtains the video scene type currently corresponding to the video stream.
In this embodiment, the preset coefficient is set to obtain the expected code rate capable of accurately distinguishing the expected download code rate from the unexpected download code rate, so as to improve the accuracy of judging the current network bandwidth state of the playing terminal.
In one embodiment, referring to fig. 6, a schematic diagram of determining a current network bandwidth state of a playing end in one embodiment is shown in fig. 6. The video server or the evaluation server takes the continuous preset times as a reporting batch, counts the number of times of reporting that the download code rate is greater than the expected code rate in the download code rate of the continuous preset times, and determines the current network bandwidth state of the playing end according to the size relationship between the number of times of reporting and the total number of times of reporting corresponding to the continuous preset times.
In one embodiment, the video server or the evaluation server counts the number of times of reporting that the download code rate is greater than the expected download code rate in the continuous preset number of reports, and can be represented by the following formula:
Figure BDA0003270941540000191
Figure BDA0003270941540000192
wherein, num bri Representing the reporting times that the downloading code rate is greater than the expected code rate in S reports; valbri represents the statistical result of the number of times of the ith report; br i Representing the downloading code rate reported for the ith time; vr k Representing the target code rate, k representing the grade of the target code rate,
Figure BDA0003270941540000193
represents a predetermined factor, is greater than or equal to>
Figure BDA0003270941540000194
Representing the expected code rate.
In one embodiment, a video server or an evaluation server counts the number of times of reporting that a downloading code rate is greater than an expected code rate in continuous preset times of reporting, and when the ratio of the number of times of reporting to the total number of times of reporting is greater than a preset ratio, the current network bandwidth state is determined to be an expected state; and when the ratio of the reporting times to the total reporting times is smaller than or equal to a preset ratio, judging that the current network bandwidth state is an unexpected state.
In one embodiment, a video server or an evaluation server counts the number of times of reporting that a downloading code rate is greater than an expected code rate in downloading code rates reported by continuous preset times, and when the number of times of reporting is equal to the total number of times of reporting, it is indicated that the downloading code rates reported by the continuous preset times all reach expectations, and the current network bandwidth state is determined to be an expected state; when the reporting times are less than the total reporting times, the downloading code rate which does not reach the expectation exists in the downloading code rates reported by the continuous preset times, and the current network bandwidth state is judged to be the unexpected state. This can be expressed by the following formula:
Figure BDA0003270941540000195
wherein Status bwt The current network bandwidth state of the playing end is represented; num bri Representing the reporting times that the downloading code rate is greater than the expected code rate in S reports; s represents the total reporting times; exp denotes the expected state and uexp denotes the unexpected state.
In this embodiment, when the number of reporting times that the download code rate is greater than the expected code rate is equal to the total number of reporting times, the current network bandwidth state is determined to be the expected state, which can improve the determination standard that the current network bandwidth state of the playing terminal reaches the expected state, and reduce video quality while avoiding video jamming caused by subsequent frequent code rate switching.
In an embodiment, the video server or the evaluation server may also count the number of times that the download code rate is less than or equal to the expected code rate in the download code rates reported by the consecutive preset times, and determine the current network bandwidth state of the playing terminal according to the number of times of reporting, for example, determine the current network bandwidth state of the playing terminal according to a size relationship between the number of times of reporting and the total number of times of reporting corresponding to the consecutive preset times of reporting.
In one embodiment, the video server or the evaluation server counts the number of times of reporting that the download code rate is less than or equal to the expected code rate in the download code rates reported by the continuous preset times, when the number of times of reporting is zero, the download code rates reported by the continuous preset times are all expected, and the video server or the evaluation server determines that the current network bandwidth state is an expected state; when the reporting times are more than zero, the downloading code rate which does not reach the expected downloading code rate exists in the downloading code rates reported for the continuous preset times, and the video server or the evaluation server determines that the current network bandwidth state is an unexpected state.
In this embodiment, when the number of reporting times that the download code rate is less than or equal to the expected code rate is zero, the current network bandwidth state is determined to be the expected state, which can improve the determination standard that the current network bandwidth state of the playing terminal reaches the expected state, and reduce the video quality while avoiding video jamming caused by subsequent frequent code rate switching.
In one embodiment, determining the current buffer sufficiency state of the playing terminal according to the variation includes: determining the number of times of reaching the upper limit that the local buffer storage is greater than the upper limit value of the buffer storage and the number of times of reaching the lower limit that the local buffer storage is less than or equal to the lower limit value of the buffer storage in the total number of reports which are continuously reported; and determining the current sufficient cache state according to the variable quantity, the upper limit reaching times and the lower limit reaching times among the local cache quantities.
The upper buffer amount limit and the lower buffer amount limit may be set according to the actual video playing fluency requirement, for example, the upper buffer amount limit may be 200 frames, and the lower buffer amount limit may be 10 frames.
In one embodiment, referring to fig. 7, fig. 7 is a schematic diagram illustrating a determination of a current buffer sufficiency state of a playing end in one embodiment. The video server or the evaluation server can be seen to report the continuous preset times as a report batch, calculate the variation between the local buffer amounts between two adjacent reports based on the local buffer amounts reported by the continuous preset times, count the number of times of reaching the upper limit of the local buffer amount and the number of times of reaching the lower limit of the local buffer amount, wherein the number of times of reaching the upper limit is greater than the upper limit of the buffer amount, and the number of times of reaching the lower limit is less than or equal to the lower limit of the buffer amount in the local buffer amounts reported by the continuous preset times, and determine the current buffer sufficient state of the playing end according to the variation between the local buffer amounts, the number of times of reaching the upper limit and the number of times of reaching the lower limit.
In one embodiment, the video server or the evaluation server counts the number of times of reaching the upper limit reported by the consecutive preset times, which can be expressed by the following formula:
Figure BDA0003270941540000211
Figure BDA0003270941540000212
wherein, CN vc The number of times of reaching the upper limit that the local buffer amount is greater than the upper limit value of the buffer amount in the S times of reporting is shown;
Figure BDA0003270941540000213
representing the statistical result of the number of reaching the upper limit reported for the ith time; vci represents the local buffer storage amount reported at the ith time; c T Indicates the upper limit of the buffer amount.
In one embodiment, the video server or the evaluation server counts the number of times of reaching the lower limit reported by the consecutive preset times, which can be expressed by the following formula:
Figure BDA0003270941540000214
Figure BDA0003270941540000215
wherein, FN vc The number of times of reaching the lower limit that the local buffer amount is less than or equal to the lower limit of the buffer amount in S times of reporting is represented; psi (vc) i ) Representing the statistical result of the number of reaching the lower limit reported in the ith time; vci represents the local buffer storage amount reported at the ith time; f T The lower limit of the buffer amount is shown.
In one embodiment, when the upper limit number of times is equal to the total number of reporting times, the current cache state is determined to be in a sufficient state, when the lower limit number of times is equal to the total number of reporting times, the current cache state is determined to be in an insufficient state, and other situations are determined to be in a normal state.
In one embodiment, when the variation between two adjacent local buffer storage amounts indicates that the continuously reported local buffer storage amounts gradually increase, the current buffer storage state is determined to be in a sufficient state, when the variation between two adjacent local buffer storage amounts indicates that the continuously reported local buffer storage amounts gradually decrease, the current buffer storage state is determined to be in an insufficient state, and other cases are determined to be in a normal state.
In one embodiment, the video server or the evaluation server counts the rising times and the falling times of the variation between two adjacent local buffer amounts, which can be expressed by the following formula:
Figure BDA0003270941540000221
Figure BDA0003270941540000222
wherein, δ (vc) i+1 -vc i ) And δ (vc) i -vc i+1 ) The calculation can be made by the following formula:
Figure BDA0003270941540000223
wherein, IN vc Representing the rising times of the variable quantity between every two adjacent local buffer quantities in the S-time report; vc i Local buffer volume vc representing the ith report i+1 The local buffer amount reported in the (i + 1) th time is represented; DN vc Representing the descending times of the variable quantity between every two adjacent local buffer storage quantities in the S times of reporting; t represents a variation threshold, and may be, for example, 0 to 3.
In one embodiment, determining the current buffer sufficiency state according to the variation among the local buffer amounts, the upper limit reaching times and the lower limit reaching times comprises: when the variation between every two adjacent local buffer quantities indicates that the continuously reported local buffer quantities gradually rise, or when the upper limit times are equal to the total reporting times, the current buffer state is judged to be in a sufficient state; when the variation between every two adjacent local buffer quantities indicates that the continuously reported local buffer quantities gradually decrease, or when the lower limit times are equal to the total reporting times, the current buffer state is judged to be an insufficient state; the other cases are determined as normal states. This can be expressed by the following formula:
Figure BDA0003270941540000224
wherein Status bwt Indicating the current buffer memory sufficient state of the playing end; s represents the total reporting times; exp indicates a sufficient state, uexp indicates an insufficient state, and Nor indicates a normal state; CN vc The number of times of reaching the upper limit that the local buffer amount is greater than the upper limit value of the buffer amount in the S times of reporting is shown; FN (FN) vc The number of times of reaching the lower limit that the local buffer amount is less than or equal to the lower limit value of the buffer amount in the S times of reporting is represented; IN vc Representing the rising times of the variable quantity between every two adjacent local buffer quantities in the S-time report; DN vc And the number of times of reduction of the variation between every two adjacent local buffer storage amounts in the S-time report is represented.
It can be understood that, in the local buffer amount reported by the video server or the evaluation server for the consecutive preset times, the number of times that the local buffer amount is less than or equal to the upper limit of the buffer amount and the number of times that the local buffer amount is greater than the lower limit of the buffer amount may also be counted, and the current buffer sufficient state of the playing end is determined according to at least one of the variation among the local buffer amounts, the number of times that the local buffer amount is not greater than the lower limit of the buffer amount.
In this embodiment, when the variation between two adjacent local buffer amounts indicates that the continuously reported local buffer amounts gradually increase, or when the upper limit number of times is equal to the total reporting number of times, the current buffer state is determined to be in a sufficient state, which can improve the determination standard that the current buffer sufficient state of the playing end reaches the expectation, and avoid video blocking caused by subsequent frequent bit rate switching, thereby reducing the video quality.
In one embodiment, calculating the fluctuation amount between every two adjacent local buffer amounts based on the continuously reported local buffer amounts includes: when the later reported local buffer storage amount in the adjacent local buffer storage amounts is less than or equal to a preset upper limit value, determining the fluctuation amount between the adjacent local buffer storage amounts as the absolute value of the difference between the adjacent local buffer storage amounts; and when the later reported local buffer storage amount in the adjacent local buffer storage amounts is larger than a preset upper limit value, determining that the fluctuation amount between the adjacent local buffer storage amounts is zero.
The preset upper limit value can be set according to the actual video frame buffer stability requirement.
In an embodiment, referring to fig. 8, fig. 8 is a schematic diagram illustrating a determination of a current buffer steady state of a playing end in an embodiment. It can be seen that the video server or the evaluation server uses the continuous preset times as a reporting batch, determines a calculation mode of the fluctuation amount according to the size of the local buffer amount reported later in the adjacent local buffer amounts, and then determines the current buffer stable state of the playing end according to the size relationship between the fluctuation amount average value among the local buffer amounts and the preset threshold value.
In an embodiment, when the later reported local buffer amount is less than or equal to the preset upper limit, it is determined that the fluctuation amount between adjacent local buffer amounts is an absolute value of a difference between adjacent local buffer amounts, and when the later reported local buffer amount is greater than the preset upper limit, it is determined that the fluctuation amount between adjacent local buffer amounts is zero, which can be represented by the following formula:
Figure BDA0003270941540000231
/>
wherein, the delta vcm represents the mth fluctuation amount in the batch report; vci represents the local buffer amount reported at the ith time, vc i-1 The local buffer amount reported in the i-1 st time is represented; th max Indicating a preset upper limit value.
In one embodiment, the average value of the fluctuation amount may be represented by the following formula:
Figure BDA0003270941540000241
wherein the content of the first and second substances,
Figure BDA0003270941540000242
representing the average value of fluctuation amount among local buffer amounts; n represents the amount of fluctuation; Δ vc m And the m-th fluctuation amount in the N total fluctuation amounts reported in the batch is shown.
In an embodiment, when the average value of the fluctuation amounts of the continuously reported local buffer amounts is less than or equal to a preset threshold, it is determined that the current buffer state of the playing end is a stable state, and when the average value of the fluctuation amounts of the continuously reported local buffer amounts is greater than the preset threshold, it is determined that the current buffer state of the playing end is an unstable state, which can be represented by the following formula:
Figure BDA0003270941540000243
wherein SV represents the current buffer stable state of the playing end; exp denotes steady state, unExp denotes non-steady state;
Figure BDA0003270941540000244
representing the average value of fluctuation quantity among local buffer quantities; th vc Represents a preset threshold, and may take a value of 20 frames, for example.
In this embodiment, when the average value of the fluctuation amounts of the continuously reported local buffer amounts is less than or equal to the preset threshold, the current buffer state of the playing end is determined to be a stable state, which can improve the determination standard that the current buffer state of the playing end reaches the expected value, and reduce the video quality while avoiding video blocking caused by subsequent frequent bit rate switching.
In one embodiment, the method further comprises: and when the current network bandwidth state and the current cache state continuously preset times meet the code rate grade pre-up-regulation condition of the video stream and the network bandwidth state is estimated to meet the code rate grade pre-up-regulation condition each time, indicating the playing end to play the video stream with the pre-up-regulation code rate.
In one embodiment, the video server or the evaluation server reports the continuous preset times as a reporting batch, and when the current network bandwidth states of the continuous preset batch are all expected states, the current cache states are all sufficient states and stable states, and the estimated network bandwidth state corresponding to the pre-code-up rate at each playing end is all expected states, the playing end is instructed to play the video stream with the pre-code-up rate.
In this embodiment, the threshold for adjusting the video code rate at the playing end is increased, and the influence caused by frequent code rate switching is reduced.
In one embodiment, the method further comprises: based on the continuously reported local buffer amount, calculating the variation between every two adjacent local buffer amounts, and determining the current buffer sufficient state of the playing end according to the variation; and when at least one of the current network bandwidth state and the current cache sufficient state meets the code rate grade pre-adjustment condition related to the video stream, indicating the playing end to play the video stream with the pre-adjustment code rate corresponding to the target code rate.
The pre-modulation code rate is determined according to the target code rate. The video server or the evaluation server may lower the target code rate by a preset file, and then the corresponding transcoding code rate is used as a preset lower code rate, and the preset file may be a first file and the like.
In one embodiment, when the current network bandwidth state is an unexpected state and/or the current cache state is an insufficient state, it is determined that at least one of the current network bandwidth state and the current cache sufficient state meets a bitrate level pre-adjustment condition, thereby ensuring smooth playing of a video.
In an embodiment, as shown in fig. 9, a video bitrate switching method is provided, which can be applied to an online video playing scene and a live video playing scene, and this embodiment is mainly illustrated by applying the method to the video server 104 in fig. 1 or the evaluation server 108 in fig. 2, and includes the following steps:
step S902, receiving a download code rate and a local buffer amount of a video stream that are periodically reported by a playing end when playing the video stream with a target code rate, where the target code rate is one of a plurality of grades of transcoding code rates.
Step S904, counting the total reporting times of continuous reporting and the reporting times of the reporting downloading code rate larger than the expected code rate, wherein the expected code rate is determined according to the target code rate; when the reporting times are equal to the total reporting times, judging that the current network bandwidth state is an expected state; and when the reporting times are less than the total reporting times, judging that the current network bandwidth state is an unexpected state.
Step S906, calculating the variation between every two adjacent local buffer storage quantities based on the continuously reported local buffer storage quantities; determining the number of times of reaching the upper limit that the local buffer storage is greater than the upper limit value of the buffer storage and the number of times of reaching the lower limit that the local buffer storage is less than or equal to the lower limit value of the buffer storage in the total number of reports which are continuously reported; when the variation between every two adjacent local buffer quantities indicates that the continuously reported local buffer quantities gradually rise, or when the upper limit times are equal to the total reporting times, the current buffer state is judged to be in a sufficient state; and when the variation between every two adjacent local buffer quantities indicates that the continuously reported local buffer quantities gradually decrease, or when the lower limit times are equal to the total reporting times, judging that the current buffer state is an insufficient state.
Step S908, when the local buffer amount reported later in the adjacent local buffer amounts is less than or equal to the preset upper limit, determining the fluctuation amount between the adjacent local buffer amounts as the absolute value of the difference between the adjacent local buffer amounts; when the later reported local buffer storage amount in the adjacent local buffer storage amounts is larger than a preset upper limit value, determining that the fluctuation amount between the adjacent local buffer storage amounts is zero; when the fluctuation mean value of the continuously reported local buffer amount is less than or equal to a preset threshold value, judging that the current buffer state of the playing end is a stable state; and when the average value of the fluctuation amount of the continuously reported local buffer amount is larger than a preset threshold value, judging that the current buffer state of the playing end is an unstable state.
Step S910, when the current network bandwidth state is the expected state and the current cache state is the sufficient state and the stable state, determining the maximum download code rate in the continuously reported download code rates, and using the maximum download code rate as the current estimated bandwidth.
Step S912, obtaining a pre-adjustment coefficient set for adjusting the level of the code rate of the video stream, determining a bandwidth threshold according to the pre-adjustment coefficient and the pre-adjustment code rate corresponding to the target code rate, and when the current estimated bandwidth is greater than the bandwidth threshold, determining that the estimated network bandwidth state of the playing end corresponding to the pre-adjustment code rate is an expected state.
Step S914, when the current network bandwidth status is continuously preset to be the expected status, the current buffer status is continuously preset to be the sufficient status and the stable status, and the estimated network bandwidth status is the expected status each time, the playing end is instructed to play the video stream with the pre-adjusted bitrate.
In one embodiment, when the current network bandwidth state is an unexpected state and/or the current cache state is an insufficient state, the playing end is instructed to play the video stream with the preset bitrate.
It can be understood that when the current network bandwidth state, the current cache state and the estimated network bandwidth state of the playing end do not meet the condition that the code rate can be adjusted up, and the current network bandwidth state and the current cache state of the playing end do not meet the condition that the code rate can be adjusted down, the playing end keeps playing the current code rate.
In an embodiment, a video code rate switching method is provided, which mainly includes steps of S1 video stream parameter reporting, S2 prediction bandwidth and dual bandwidth state determination, S3 buffer area state determination, and S4 video code rate adaptive adjustment, and the following description will give an example.
S1, video stream parameter reporting:
the video stream parameter reporting mainly comprises two aspects: (1) After the video server transcodes the original video stream in multiple grades, each video stream respectively corresponds to a transcoding code rate; (2) When playing video stream, the playing end plays video stream at intervals of T 0 Reporting T 0 The download code rate and the local buffer frame number of the buffer area.
S2, judging the estimated bandwidth and the double-bandwidth state:
(1) Judgment of current network bandwidth state of playing end
The evaluation server divides the network bandwidth state of the playing end into an expected state and an unexpected state, and evaluates the current network bandwidth state of the playing end based on the relative relationship between the downloading code rate reported for S times and the currently played target code rate:
Figure BDA0003270941540000271
Figure BDA0003270941540000272
wherein, num bri Representing the reporting times that the downloading code rate is greater than the expected code rate in S reports; valbri represents the statistical result of the number of times of the ith report; br i Representing the downloading code rate reported for the ith time; vr k Representing the target code rate, and k represents the grade of the target code rate;
Figure BDA0003270941540000273
representing a preset coefficient, wherein the preset coefficient corresponding to a relative motion scene can be 0.8, and the preset coefficient corresponding to a relative static scene can be 0.7; />
Figure BDA0003270941540000274
Representing the expected code rate.
Figure BDA0003270941540000275
Wherein Status bwt Representing the current network bandwidth state of the playing terminal; num bri Representing the reporting times that the downloading code rate is greater than the expected code rate in S reports; s represents the total reporting times; exp denotes the expected state and uexp denotes the unexpected state.
(2) Calculating the current evaluation bandwidth of the playing end
The video server converts an original video stream into a video stream with a plurality of grades of transcoding code rates, the grade of a target code rate of the video stream played by a playing end is k, and an evaluation server uses the maximum downloading code rate in the latest S reports as an estimated bandwidth corresponding to the target code rate:
Eb k =Max(Br i )0<i<S
wherein Eb k Representing the current estimated bandwidth of a playing end, and k represents the grade of a target code rate; br i Representing the downloading code rate reported for the ith time; and S represents the total reporting times.
(3) Pre-estimated network bandwidth state judgment of playing end
If the code rate can be adjusted up according to the current network bandwidth state and the cache region state of the playing end, the pre-estimation server judges the pre-estimation network bandwidth state after the code rate is adjusted up by the playing end:
Figure BDA0003270941540000281
wherein Status ept Representing the estimated network bandwidth state of the playing end corresponding to the pre-adjusted code rate; exp denotes the expected state, uexp denotes the unexpected state; eb k Representing the current estimated bandwidth of a playing end; k represents the level of the target code rate, vr k+1 Representing the pre-up-regulation code rate with the grade of k + 1; epsilon represents a pre-up-regulation coefficient, and can be taken as a value according to practical application, for example, 0.7; epsilon Vr k+1 Indicating a bandwidth threshold. S3 cache status determination
The evaluation server measures the cache state from both the sufficiency and stability dimensions.
(1) Sufficiency refers to whether the number of local buffer frames is sufficient to support normal playing of video without being stuck.
The evaluation server divides the state of the buffer area of the playing end into a sufficient state, an insufficient state and a normal state.
Firstly, the evaluation server counts the continuous rising times and the continuous falling times based on the local cache frame number reported by the continuous S times:
Figure BDA0003270941540000282
Figure BDA0003270941540000283
wherein, δ (vc) i+1 -vc i ) And δ (vc) i -vc i+1 ) The calculation can be made by the following formula:
Figure BDA0003270941540000284
wherein, IN vc Representing the rising times of the variable quantity between every two adjacent local buffer quantities in the S-time report; vc i Local buffer volume vc representing the ith report i+1 The local buffer amount reported in the (i + 1) th time is represented; DN vc Representing the descending times of the variable quantity between every two adjacent local buffer storage quantities in the S times of reporting; t represents a variation threshold, and may be, for example, 0 to 3.
Then, the evaluation server counts the number of times of reaching the upper limit and the number of times of reaching the lower limit based on the number of local cache frames reported for S times continuously:
Figure BDA0003270941540000285
Figure BDA0003270941540000291
wherein, CN vc The number of times of reaching the upper limit that the local buffer amount is greater than the upper limit value of the buffer amount in the S times of reporting is shown;
Figure BDA0003270941540000292
representing the statistical result of the number of reaching the upper limit reported for the ith time; vci represents the local buffer storage amount reported at the ith time; c T The buffer amount upper limit value is shown.
Figure BDA0003270941540000293
Figure BDA0003270941540000294
Wherein, FN vc The number of times of reaching the lower limit that the local buffer amount is less than or equal to the lower limit value of the buffer amount in the S times of reporting is represented; psi (vc) i ) Representing the statistical result of the number of reaching the lower limit reported in the ith time; vci represents the local buffer storage amount reported at the ith time; f T The lower limit of the buffer amount is shown.
And finally, determining the current buffer sufficient state of the playing end according to the continuous rising times, the continuous falling times, the reaching upper limit times and the reaching lower limit times:
Figure BDA0003270941540000295
wherein Status bwt Indicating the current buffer memory sufficient state of the playing end; s represents the total reporting times; exp indicates a sufficient state, uexp indicates an insufficient state, and Nor indicates a normal state; CN vc The number of times of reaching the upper limit that the local buffer amount is greater than the upper limit value of the buffer amount in the S times of reporting is shown; FN (FN) device vc The number of times of reaching the lower limit that the local buffer amount is less than or equal to the lower limit value of the buffer amount in the S times of reporting is represented; IN vc Representing the rising times of the variable quantity between every two adjacent local buffer quantities in the S-time report; DN vc And the number of times of reduction of the variation between every two adjacent local buffer storage amounts in the S-time report is represented.
(2) The stability refers to whether the change of the number of local cache frames is stable.
And the evaluation server divides the state of the buffer area of the playing end into a stable state and an unstable state.
Firstly, the evaluation server counts the fluctuation amount of the local cache frame numbers reported twice based on the local cache frame numbers reported for S times continuously:
Figure BDA0003270941540000301
wherein, Δ vc m Representing the mth fluctuation amount in the batch report; vc i Represents the local buffer amount, vc, of the ith report i-1 The local buffer amount reported in the i-1 st time is represented; th max Indicating a preset upper limit value.
Then, the evaluation server calculates the average value of the fluctuation amount in the continuous S reports:
Figure BDA0003270941540000302
wherein the content of the first and second substances,
Figure BDA0003270941540000303
representing the average value of fluctuation quantity among local buffer quantities; n represents the amount of fluctuation; Δ vc m And the m-th fluctuation amount in the N total fluctuation amounts reported in the batch is shown.
And finally, determining the current cache stable state of the playing end according to the size relation between the fluctuation quantity average value and a preset threshold value:
Figure BDA0003270941540000304
wherein SV represents the current buffer stable state of the playing end; exp denotes steady state, unExp denotes non-steady state;
Figure BDA0003270941540000305
representing the average value of fluctuation quantity among local buffer quantities; th vc Indicating a preset threshold, which may take the value of 20 frames, for example.
S4 video code rate self-adaptive adjustment
The evaluation server takes the continuous S times of reports as a reporting batch, when the current network bandwidth states of the continuous multiple batches are all expected states, the current cache area states are all sufficient states and stable states, and the playing end is correspondingly adjusted up by oneWhen the estimated network bandwidth states of the gear code rates are all expected states, indicating that the video stream code rate is from the k gear code rate Vr k Code rate Vr adjusted to k +1 gear k+1
When the current network bandwidth state is an unexpected state and/or the current cache region state is an insufficient state, the evaluation server indicates that the video stream code rate is the k-gear code rate Vr k Down-regulated to k-1 gear code rate Vr k-1 Therefore, the fluency of video playing is guaranteed.
According to the video code rate switching method, when the playing end plays the video stream with the target code rate, the downloading code rate and the local buffer storage amount of the video stream are reported regularly, and after the reported downloading code rate and the local buffer storage amount of the video stream are received, on one hand, the current network bandwidth state of the playing end can be judged based on the relative size relation between the continuously reported downloading code rate and the target code rate, and on the other hand, the current buffer storage state of the playing end can be judged based on the relative change of the continuously reported local buffer storage amount. Then, when the current network bandwidth state and the current cache state meet the code rate grade pre-up-regulation condition about the video stream, the current estimated bandwidth of the playing end is determined based on the continuously reported download code rate, and when the estimated network bandwidth state when the playing end plays the video stream with the pre-up-regulation code rate also meets the code rate grade pre-up-regulation condition according to the relative size relation between the pre-up-regulation code rate after the grade is up-regulated to the target code rate and the current estimated bandwidth, the playing end can be instructed to play the video stream with the pre-up-regulation code rate, so that the current network bandwidth state and the network bandwidth state of the playing end are jointly determined, and the cache state of the playing end is considered, so that the threshold of the video code rate up-regulation at the playing end is improved, the influence caused by frequent code rate switching is reduced, and the balance between the video smoothness and the video quality is realized.
It should be understood that, although the steps in the above-described flowcharts are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a part of the steps in the above flowcharts may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of performing the steps or stages is not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a part of the steps or stages in other steps.
In one embodiment, as shown in fig. 10, there is provided a video bitrate switching apparatus, which may be a part of a computer device using a software module or a hardware module, or a combination of the two modules, and the apparatus specifically includes: a receiving module 1002, a network bandwidth status determining module 1004, a buffer status determining module 1006, a pre-estimated network bandwidth status determining module 1008, and an indicating module 1010, wherein:
a receiving module 1002, configured to receive a download code rate and a local buffer amount related to a video stream, which are periodically reported by a playing end when playing a video stream with a target code rate, where the target code rate is one of multiple transcoding code rates;
a network bandwidth state determination module 1004, configured to determine a current network bandwidth state of the playing end based on a relative size relationship between a continuously reported download code rate and a target code rate;
a buffer status determination module 1006, configured to determine a current buffer status of the playing end based on a variation and a fluctuation amount between every two adjacent local buffer quantities in the continuously reported local buffer quantities;
the estimated network bandwidth state determination module 1008 is configured to determine a current estimated bandwidth of the playing end according to a continuously reported download code rate when the current network bandwidth state and the current cache state meet a code rate grade pre-up-regulation condition about the video stream, and determine the estimated network bandwidth state when the playing end plays the video stream with the pre-up-regulation code rate based on a relative size relationship between the pre-up-regulation code rate after the target code rate is up-regulated and the current estimated bandwidth;
the indicating module 1010 is configured to indicate the playing end to play the video stream with the pre-adjusted bitrate when the pre-estimated network bandwidth state meets the bitrate level pre-up condition.
In one embodiment, the network bandwidth status determination module 1004 is further configured to: counting the total reporting times of continuous reporting and the reporting times of the reported downloading code rate larger than the expected code rate; the expected code rate is determined according to the target code rate; and judging the current network bandwidth state of the playing end according to the size relationship between the reporting times and the total reporting times.
In one embodiment, the network bandwidth status determination module 1004 is further configured to: determining a video scene type corresponding to the video stream currently; acquiring a preset coefficient corresponding to the video scene type; the product of the target code rate and the preset coefficient is used as the expected code rate.
In one embodiment, the network bandwidth status determination module 1004 is further configured to: when the reporting times are equal to the total reporting times, judging that the current network bandwidth state is an expected state; and when the reporting times are less than the total reporting times, judging that the current network bandwidth state is an unexpected state.
In one embodiment, the cache status determination module 1006 is further configured to: based on the continuously reported local buffer amounts, calculating the variation between every two adjacent local buffer amounts, and determining the current buffer sufficient state of the playing end according to the variation; calculating the fluctuation amount between every two adjacent local buffer amounts based on the continuously reported local buffer amounts, and determining the current buffer stable state of the playing end according to the fluctuation amount; and determining the current cache state of the playing end according to the current cache sufficient state and the current cache stable state.
In one embodiment, the cache status determination module 1006 is further configured to: determining the number of times of reaching the upper limit that the local buffer storage is greater than the upper limit value of the buffer storage and the number of times of reaching the lower limit that the local buffer storage is less than or equal to the lower limit value of the buffer storage in the total number of reports which are continuously reported; and determining the current sufficient cache state according to the variable quantity, the upper limit reaching times and the lower limit reaching times among the local cache quantities.
In one embodiment, the cache status determination module 1006 is further configured to: when the variation between every two adjacent local buffer quantities indicates that the continuously reported local buffer quantities gradually rise, or when the upper limit times are equal to the total reporting times, the current buffer state is judged to be in a sufficient state; and when the variation between every two adjacent local buffer quantities indicates that the continuously reported local buffer quantities gradually decrease, or when the lower limit times are equal to the total reporting times, judging that the current buffer state is an insufficient state.
In one embodiment, the cache status determination module 1006 is further configured to: when the average value of the fluctuation amount of the continuously reported local buffer amount is less than or equal to a preset threshold value, judging that the current buffer state of the playing end is a stable state; and when the average value of the fluctuation amount of the continuously reported local buffer amount is larger than a preset threshold value, judging that the current buffer state of the playing end is an unstable state.
In one embodiment, the cache status determination module 1006 is further configured to: when the later reported local buffer storage amount in the adjacent local buffer storage amounts is less than or equal to a preset upper limit value, determining the fluctuation amount between the adjacent local buffer storage amounts as the absolute value of the difference between the adjacent local buffer storage amounts; and when the later reported local buffer storage amount in the adjacent local buffer storage amounts is larger than a preset upper limit value, determining that the fluctuation amount between the adjacent local buffer storage amounts is zero.
In one embodiment, the predicted network bandwidth status determination module 1008 is further configured to: determining the maximum download code rate in the continuously reported download code rates; and taking the maximum downloading code rate as the current estimated bandwidth.
In one embodiment, the indication module 1010 is further configured to: acquiring a pre-up-regulation coefficient set for up-regulating the code rate grade of a video stream; determining a bandwidth threshold according to the pre-up-regulation coefficient and the pre-up-regulation code rate corresponding to the target code rate; and when the current estimated bandwidth is larger than the bandwidth threshold, judging that the estimated network bandwidth state of the playing end corresponding to the pre-up code rate meets the code rate grade pre-up condition.
In one embodiment, the predicted network bandwidth status determination module 1008 is further configured to: and when the current network bandwidth state is an expected state and the current cache state is a sufficient state and a stable state, judging that the current network bandwidth state and the current cache state meet the code rate grade pre-up-regulation condition of the video stream.
In one embodiment, the cache status determination module 1006 is further configured to: based on the continuously reported local buffer amount, calculating the variation between every two adjacent local buffer amounts, and determining the current buffer sufficient state of the playing end according to the variation; the indication module 1010 is further configured to: when the current network bandwidth state is an unexpected state and/or the current cache state is an insufficient state, judging that at least one of the current network bandwidth state and the current cache sufficient state meets a code rate grade pre-adjustment condition related to the video stream, and indicating to play the video stream with the pre-adjustment code rate corresponding to the target code rate.
In one embodiment, the indication module 1010 is further configured to: and when the current network bandwidth state and the current cache state continuously preset times meet the code rate grade pre-up-regulation condition of the video stream and the network bandwidth state is estimated to meet the code rate grade pre-up-regulation condition each time, indicating the playing end to play the video stream with the pre-up-regulation code rate.
In one embodiment, the indication module 1010 is further configured to: generating a code rate grade up-regulation instruction corresponding to the playing end; transmitting a code rate grade up-regulation instruction to a video server; the code rate grade up-regulation instruction is used for indicating the video server to push the video stream with the pre-up-regulation code rate to the playing end.
For specific limitations of the video bitrate switching device, reference may be made to the above limitations of the video bitrate switching method, which is not described herein again. All or part of the modules in the video bitrate switching device can be realized by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In the video code rate switching device, when the playing end plays the video stream with the target code rate, the downloading code rate and the local buffer memory amount of the video stream are reported regularly, and after the reported downloading code rate and the local buffer memory amount of the video stream are received, on one hand, the current network bandwidth state of the playing end can be judged based on the relative size relation between the continuously reported downloading code rate and the target code rate, and on the other hand, the current buffer memory state of the playing end can be judged based on the relative change of the continuously reported local buffer memory amount. Then, when the current network bandwidth state and the current cache state meet the code rate grade pre-up-regulation condition about the video stream, the current estimated bandwidth of the playing end is determined based on the continuously reported download code rate, and when the estimated network bandwidth state when the playing end plays the video stream with the pre-up-regulation code rate also meets the code rate grade pre-up-regulation condition according to the relative size relation between the pre-up-regulation code rate after the grade is up-regulated to the target code rate and the current estimated bandwidth, the playing end can be instructed to play the video stream with the pre-up-regulation code rate, so that the current network bandwidth state and the network bandwidth state of the playing end are jointly determined, and the cache state of the playing end is considered, so that the threshold of the video code rate up-regulation at the playing end is improved, the influence caused by frequent code rate switching is reduced, and the balance between the video smoothness and the video quality is realized.
In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as shown in fig. 11. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer device is used for storing video code rate switching data. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a video bitrate switching method.
Those skilled in the art will appreciate that the architecture shown in fig. 11 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is further provided, which includes a memory and a processor, the memory stores a computer program, and the processor implements the steps of the above method embodiments when executing the computer program.
In an embodiment, a computer-readable storage medium is provided, in which a computer program is stored which, when being executed by a processor, carries out the steps of the above-mentioned method embodiments.
In one embodiment, a computer program product or computer program is provided that includes computer instructions stored in a computer readable storage medium. The computer instructions are read by a processor of a computer device from a computer-readable storage medium, and the computer instructions are executed by the processor to cause the computer device to perform the steps in the above-mentioned method embodiments.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above may be implemented by hardware instructions of a computer program, which may be stored in a non-volatile computer-readable storage medium, and when executed, may include the processes of the embodiments of the methods described above. Any reference to memory, storage, database or other medium used in the embodiments provided herein can include at least one of non-volatile and volatile memory. Non-volatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical storage, or the like. Volatile Memory can include Random Access Memory (RAM) or external cache Memory. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), for example.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (18)

1. A video rate switching method, the method comprising:
receiving a downloading code rate and a local buffer storage related to a video stream, which are periodically reported by a playing end when the video stream with a target code rate is played, wherein the target code rate is one of a plurality of grades of transcoding code rates;
judging the current network bandwidth state of a playing end based on the relative size relationship between the continuously reported downloading code rate and the target code rate;
judging the current buffer state of a playing end based on the continuously reported variation and fluctuation amount between every two adjacent local buffer amounts in the local buffer amounts;
when the current network bandwidth state and the current cache state meet the code rate grade pre-up-regulation condition about the video stream, determining the current estimated bandwidth of a playing end according to the continuously reported downloading code rate, and judging the estimated network bandwidth state when the playing end plays the video stream with the pre-up-regulation code rate based on the relative size relation between the pre-up-regulation code rate after the target code rate is up-regulated and the current estimated bandwidth;
and when the estimated network bandwidth state meets the code rate grade pre-up-regulation condition, indicating a playing end to play the video stream with the pre-up-regulation code rate.
2. The method of claim 1, wherein the determining a current network bandwidth state of a playing end based on a relative size relationship between the continuously reported download code rate and the target code rate comprises:
counting the total reporting times of continuous reporting and the reporting times of the reported downloading code rate larger than the expected code rate; the expected code rate is determined according to the target code rate;
and judging the current network bandwidth state of the playing end according to the size relationship between the reporting times and the total reporting times.
3. The method of claim 2, wherein the step of determining the expected code rate comprises:
determining a video scene type currently corresponding to the video stream;
acquiring a preset coefficient corresponding to the video scene type;
and taking the product of the target code rate and the preset coefficient as the expected code rate.
4. The method of claim 2, wherein the determining the current network bandwidth state of the playing end according to the size relationship between the reporting times and the total reporting times comprises:
when the reporting times are equal to the total reporting times, judging that the current network bandwidth state is an expected state;
and when the reporting times are less than the total reporting times, judging that the current network bandwidth state is an unexpected state.
5. The method according to claim 1, wherein the determining a current buffer status of a playing end based on a variation and a fluctuation between two adjacent local buffer amounts in the continuously reported local buffer amounts comprises:
based on the continuously reported local buffer amounts, calculating the variation between every two adjacent local buffer amounts, and determining the current buffer sufficient state of the playing end according to the variation;
calculating the fluctuation amount between every two adjacent local buffer amounts based on the continuously reported local buffer amounts, and determining the current buffer stable state of the playing end according to the fluctuation amount;
and determining the current cache state of the playing end according to the current cache sufficient state and the current cache stable state.
6. The method according to claim 5, wherein the determining the current buffer sufficiency state of the playing end according to the variation comprises:
determining the number of times of reaching the upper limit that the local buffer storage is greater than the upper limit value of the buffer storage and the number of times of reaching the lower limit that the local buffer storage is less than or equal to the lower limit value of the buffer storage in the total number of reports which are continuously reported;
and determining the current sufficient cache state according to the variable quantity among the local cache quantities, the upper limit reaching times and the lower limit reaching times.
7. The method of claim 6, wherein the determining the current buffer sufficiency status according to the amount of change between the local buffer amounts, the upper bound number of times, and the lower bound number of times comprises:
when the variation between every two adjacent local buffer quantities indicates that the continuously reported local buffer quantities gradually rise, or when the reaching upper limit times are equal to the total reporting times, the current buffer state is determined to be in a sufficient state;
and when the variation between every two adjacent local buffer quantities indicates that the continuously reported local buffer quantities gradually decline, or when the lower limit reaching times are equal to the total reporting times, judging that the current buffer state is an insufficient state.
8. The method according to claim 5, wherein the determining a current buffer steady state of the playing end according to the fluctuation amount comprises:
when the average value of the fluctuation amount of the continuously reported local buffer amount is less than or equal to a preset threshold value, judging that the current buffer state of the playing end is a stable state;
and when the average value of the fluctuation amount of the continuously reported local buffer amount is larger than a preset threshold value, judging that the current buffer state of the playing end is an unstable state.
9. The method of claim 8, wherein the calculating the fluctuation amount between two adjacent local buffer amounts based on the continuously reported local buffer amounts comprises:
when the later reported local buffer storage amount in the adjacent local buffer storage amounts is less than or equal to a preset upper limit value, determining the fluctuation amount between the adjacent local buffer storage amounts as the absolute value of the difference between the adjacent local buffer storage amounts;
and when the later reported local buffer storage amount in the adjacent local buffer storage amounts is larger than a preset upper limit value, determining that the fluctuation amount between the adjacent local buffer storage amounts is zero.
10. The method of claim 1, wherein the determining the current estimated bandwidth of the playing end according to the continuously reported download code rate comprises:
determining the maximum downloading code rate in the continuously reported downloading code rates;
and taking the maximum downloading code rate as the current estimated bandwidth.
11. The method of claim 1, further comprising:
acquiring a pre-up-regulation coefficient set for up-regulating the code rate grade of the video stream;
determining a bandwidth threshold according to the pre-up-regulation coefficient and a pre-up-regulation code rate corresponding to the target code rate;
and when the current estimated bandwidth is larger than the bandwidth threshold, judging that the estimated network bandwidth state of the playing end corresponding to the pre-up-regulation code rate meets the code rate grade pre-up-regulation condition.
12. The method of claim 1, further comprising:
when the current network bandwidth state is an expected state and the current cache state is a sufficient state and a stable state, judging that the current network bandwidth state and the current cache state meet a code rate grade pre-up condition related to the video stream.
13. The method of claim 1, further comprising:
based on the continuously reported local buffer amounts, calculating the variation between every two adjacent local buffer amounts, and determining the current buffer sufficient state of the playing end according to the variation;
when the current network bandwidth state is an unexpected state and/or the current cache state is an insufficient state, at least one of the current network bandwidth state and the current cache sufficient state is judged to meet a code rate grade pre-adjustment condition about the video stream, and the video stream of a pre-adjustment code rate corresponding to the target code rate is indicated to be played.
14. The method according to any one of claims 1 to 13, wherein the instructing a playing end to play the video stream with the pre-bitrate, comprises:
generating a code rate grade up-regulation instruction corresponding to the playing end;
transmitting the code rate grade up-regulation instruction to a video server; the code rate grade up-regulation instruction is used for indicating the video server to push the video stream with the pre-up-regulation code rate to a playing end.
15. An apparatus for video bitrate switching, the apparatus comprising:
the receiving module is used for receiving a downloading code rate and a local buffer storage amount of a video stream which are reported periodically by a playing end when the video stream with a target code rate is played, wherein the target code rate is one of transcoding code rates of a plurality of grades;
a network bandwidth state determination module, configured to determine a current network bandwidth state of a playing end based on a relative size relationship between the continuously reported download code rate and the target code rate;
the buffer state judging module is used for judging the current buffer state of the playing end based on the continuously reported variation and fluctuation amount between every two adjacent local buffer amounts in the local buffer amounts;
a pre-estimated network bandwidth state determination module, configured to determine a current pre-estimated bandwidth of a playing end according to the continuously reported download code rate when the current network bandwidth state and the current cache state meet a pre-up-adjustment condition of the code rate of the video stream, and determine the pre-estimated network bandwidth state when the playing end plays the video stream with the pre-up-adjusted code rate based on a relative size relationship between a pre-up-adjusted code rate after the target code rate is up-adjusted and the current pre-estimated bandwidth;
and the indicating module is used for indicating a playing end to play the video stream with the pre-up-regulation code rate when the pre-estimated network bandwidth state meets the code rate grade pre-up-regulation condition.
16. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method of any of claims 1 to 14.
17. A computer-readable storage medium, storing a computer program, characterized in that the computer program, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 14.
18. A computer program product comprising a computer program, characterized in that the computer program realizes the steps of the method of any one of claims 1 to 14 when executed by a processor.
CN202111101845.6A 2021-09-18 2021-09-18 Video code rate switching method, device, computer equipment and storage medium Active CN115842928B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111101845.6A CN115842928B (en) 2021-09-18 2021-09-18 Video code rate switching method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111101845.6A CN115842928B (en) 2021-09-18 2021-09-18 Video code rate switching method, device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN115842928A true CN115842928A (en) 2023-03-24
CN115842928B CN115842928B (en) 2024-03-12

Family

ID=85575196

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111101845.6A Active CN115842928B (en) 2021-09-18 2021-09-18 Video code rate switching method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115842928B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116962757A (en) * 2023-09-20 2023-10-27 腾讯科技(深圳)有限公司 Video code rate grade determining method and device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108924667A (en) * 2018-08-03 2018-11-30 阳雨哲 A kind of maximized available bandwidth adaptive video fragment request method of support QoE
CN109040855A (en) * 2018-09-03 2018-12-18 重庆邮电大学 A kind of wireless DASH streaming media bit rate smooth adaptive transmission method
CN109803169A (en) * 2019-01-25 2019-05-24 烽火通信科技股份有限公司 The method and system of multichannel multicast are realized based on network bandwidth
CN110248247A (en) * 2019-06-12 2019-09-17 深圳市大数据研究院 Embedded dynamic video control method for playing back and device based on network throughput
CN111225209A (en) * 2018-11-23 2020-06-02 北京字节跳动网络技术有限公司 Video data plug flow method, device, terminal and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108924667A (en) * 2018-08-03 2018-11-30 阳雨哲 A kind of maximized available bandwidth adaptive video fragment request method of support QoE
CN109040855A (en) * 2018-09-03 2018-12-18 重庆邮电大学 A kind of wireless DASH streaming media bit rate smooth adaptive transmission method
CN111225209A (en) * 2018-11-23 2020-06-02 北京字节跳动网络技术有限公司 Video data plug flow method, device, terminal and storage medium
CN109803169A (en) * 2019-01-25 2019-05-24 烽火通信科技股份有限公司 The method and system of multichannel multicast are realized based on network bandwidth
CN110248247A (en) * 2019-06-12 2019-09-17 深圳市大数据研究院 Embedded dynamic video control method for playing back and device based on network throughput

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116962757A (en) * 2023-09-20 2023-10-27 腾讯科技(深圳)有限公司 Video code rate grade determining method and device, electronic equipment and storage medium
CN116962757B (en) * 2023-09-20 2023-12-12 腾讯科技(深圳)有限公司 Video code rate grade determining method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN115842928B (en) 2024-03-12

Similar Documents

Publication Publication Date Title
Yu et al. QoE-driven dynamic adaptive video streaming strategy with future information
EP2825972B1 (en) Predictive adaptive media streaming
US20170026713A1 (en) System and Method for Dynamic Adaptive Video Streaming Using Model Predictive Control
US10659832B1 (en) Dynamic bitrate selection for streaming media
CN103155580B (en) The adaptive video stream of different quality rank
US20160057064A1 (en) Deadline driven content delivery
CN103004190B (en) Video stream
Zahran et al. OSCAR: An optimized stall-cautious adaptive bitrate streaming algorithm for mobile networks
US9313243B2 (en) Video streaming over data networks
CN111093094A (en) Video transcoding method, device and system, electronic equipment and readable storage medium
US8848785B2 (en) Compact cumulative bit curves
US9571871B2 (en) Method for delivering video content encoded at one or more quality levels over a data network
CN115842928A (en) Video code rate switching method and device, computer equipment and storage medium
CN114040257B (en) Self-adaptive video stream transmission playing method, device, equipment and storage medium
US9525641B1 (en) Facilitating buffer wait time determination based on device- or entity-related conditions
US20070110168A1 (en) Method for generating high quality, low delay video streaming
KR101051709B1 (en) Data transmission method and device
JP2017076892A (en) Buffer size-deciding device, system, buffer size-deciding method, video data reproducing method and program
CN108924665B (en) Method and device for reducing video playing delay, computer equipment and storage medium
JP6517342B2 (en) Delivery rate selection device, delivery rate selection method, and program
US11245935B1 (en) Managing supplemental content in content delivery systems
US11057448B2 (en) Method for receiving adaptive streaming service
US20240163511A1 (en) Method and apparatus for receiving adaptive media streaming and adaptive media streaming system
US11412283B1 (en) System and method for adaptively streaming video
Hu et al. Scene aware smooth playout control for portable media players over random VBR channels

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
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40083843

Country of ref document: HK

GR01 Patent grant
GR01 Patent grant