Video quality evaluation method, sending code rate dynamic tuning method, device and system
By evaluating the transmission quality and image quality of the video stream in the WebRTC SFU architecture and dynamically adjusting the bit rate, the problem of failing to consider video image quality in the existing technology is solved, and the efficiency and flexibility of WebRTC technology in video transmission are achieved.
Patent Information
- Application Number
- CN202410649707.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-23
- Publication Date
- 2024-09-24
AI Technical Summary
Existing WebRTC technology fails to fully consider video image quality when controlling video Qos, resulting in inaccurate bit rate adjustment, waste of traffic, and inability to adapt to the needs of different image quality scenarios.
Using the video quality assessment method based on WebRtc SFU architecture, by obtaining the video stream, evaluating the transmission quality and image quality, calculating the transmission quality assessment score and image quality assessment score, and dynamically adjusting the sending bit rate to achieve the optimal bit rate and optimal image quality. .
It achieves the optimal bit rate and optimal image quality in scenarios with different image quality requirements, improves the flexibility and efficiency of WebRTC technology in video transmission, reduces bandwidth waste and video freezes, and provides a smoother video experience.
Smart Images

Figure CN118695049A
Abstract
Description
Technical Field
[0001] The present invention relates to a communication network, and in particular to a video quality assessment method based on a WebRtc SFU architecture, a method, a device and a system for dynamically adjusting a transmission bit rate. Background Art
[0002] WebRTC technology is widely used in fields such as low-latency live video and video surveillance. It has two main transmission topologies: peer-to-peer (P2P) and SFU (Selective Forwarding Unit). Peer-to-peer video is a way of directly establishing a communication channel between two or more terminals for data transmission. This method does not require transfer through a server and can directly transmit audio and video data between terminals. SFU is a server architecture used in multi-person video calls. Its function is to receive the video stream of each participant and then selectively forward it to other participants. Unlike the peer-to-peer method, in SFU mode, all data streams will be transferred through the SFU server.
[0003] To maintain a smooth and stable audio and video transmission, it is necessary to ensure the real-time transmission of audio and video data with as low latency and packet loss as possible, and to ensure clear images.
[0004] WebRTC technology has been widely used in low-latency live video and video surveillance. For video QoS control, it uses two main methods: (1) Delay-based congestion control algorithm: This algorithm is implemented by the data receiver. The receiver needs to record the arrival time and size of each data packet and calculate the delay change between each data packet to determine the current network congestion. Finally, the receiver will feed back the bitrate estimate to the sender through RTCP feedback. (2) Packet loss-based congestion control algorithm: This algorithm is implemented by the data sender. The sender obtains packet loss information from the RTCP RR packets periodically sent by the receiver and calculates the RTT to estimate the bitrate.
[0005] However, these two methods do not refer to the real-time video image quality information when performing QoS bitrate control, and do not fully consider the video image quality information. In addition, in practice, there are the following problems: First, the bitrate is often adjusted to the maximum available bandwidth of the data link, resulting in traffic waste. Second, in scenarios where low, medium, and high levels of image quality are required, it is impossible to adjust the optimal bitrate by setting the image quality target value. Summary of the invention
[0006] The technical problem to be solved by the present invention is to address the above-mentioned deficiencies in the prior art and propose a video quality assessment method, a method for dynamically adjusting the transmission bit rate, a device and a system based on the WebRtcSFU architecture. The assessment method can comprehensively consider and assess the quality of video images so as to achieve the optimal bit rate and optimal image quality in different image quality requirement scenarios, thereby making the application of WebRTC technology in video transmission more flexible and efficient.
[0007] In a first aspect, the present invention provides a video quality assessment method based on a WebRtc SFU architecture, the method comprising the following steps:
[0008] Step S1: obtaining a video stream within a preset period, wherein the video stream within the preset period is obtained from a streaming media server based on a WebRtc SFU architecture;
[0009] Step S2: Evaluate the transmission quality of the video stream within a preset period to obtain a transmission quality evaluation score; and,
[0010] Evaluate the image quality of the video stream within a preset period to obtain an image quality evaluation score;
[0011] Among them, the transmission quality of the video stream within the preset period is evaluated based on the difference between the received video data packets and the lost video data packets; the image quality of the video stream within the preset period is evaluated based on the difference between the expected value of the video image quality and the actual value of the video image quality.
[0012] Furthermore, the transmission quality of the video stream within the preset period is evaluated.
[0013] The steps include:
[0014] Step A1: according to the video stream in the preset period, counting the number of RTP packets actually received in the preset period, and counting the number of packets lost in the preset period;
[0015] Step A2: Counting the number of RTP messages repaired within a preset period; and calculating the repair weight according to the number of RTP messages actually received within the preset period;
[0016] The calculation formula of the repair weight is shown in formula (1):
[0017]
[0018] Among them, RepairedWeight represents the repair weight;
[0019] Repaired is the number of RTP messages repaired within the preset period;
[0020] Received is the number of RTP messages actually received within the preset period;
[0021] Step A3: Calculate the number of RTP packets actually lost within a preset period according to the repair weight. The calculation formula is shown in formula (2):
[0022] Lost real =Lost 初始 -Repaired*RepairedWeight (2)
[0023] Among them, Lost real Indicates the number of packets actually lost within the preset period;
[0024] Lost 初始 is the number of RTP packets initially lost;
[0025] Step A4: Calculate the ratio of the number of received messages to the number of actually lost messages according to the number of RTP messages actually lost within a preset period;
[0026] The calculation formula for the ratio of the number of received messages to the number of actually lost messages is as shown in formula (3):
[0027] DeliveredRatio=(Received-Lost real ) / Received (3)
[0028] Step A5: Calculate the transmission quality evaluation score β according to the ratio of the number of received messages to the number of actually lost messages, thereby evaluating the transmission quality of the video stream within a preset period;
[0029] The calculation formula of the transmission quality evaluation score β is shown in formula (4):
[0030] β=rount(deliveredRatio 4 *10.0) (4)
[0031] Among them, rount() is the rounding function.
[0032] Furthermore, the image quality of the video stream within a preset period is evaluated to obtain an image quality evaluation score, which specifically includes the following steps:
[0033] Step B1: Calculate the image quality parameter θ according to the expected value of the video image quality and the actual value of the video image quality;
[0034] The calculation formula of the image quality parameter θ is shown in formula (5):
[0035]
[0036] Among them, real_width is the current screen width;
[0037] real_height is the current screen height;
[0038] real_fps is the current video frame rate;
[0039] expect_width is the expected screen width;
[0040] expect_height is the expected screen height;
[0041] expect_fps is the expected video frame rate;
[0042] Step B2: Calculate the image quality evaluation score α according to the image quality parameter θ;
[0043] The calculation formula of the image quality evaluation score α is shown in formula (6):
[0044] α=tan(θ*0.3)*10 (6)
[0045] Among them, tan() is the tangent function.
[0046] In a second aspect, the present invention provides a method for dynamically optimizing a video transmission bit rate based on a WebRtc SFU architecture, the method comprising the following steps:
[0047] Step A1: adopting the video quality assessment method based on the WebRtc SFU architecture described in the first aspect to evaluate the target video stream within the observation period, and obtain a transmission quality assessment score β and a picture quality assessment score α of the target video stream;
[0048] Step A2: Determine whether the transmission quality evaluation score β falls within a first preset interval:
[0049] If it is determined that the transmission quality evaluation score β does not fall within the first preset interval, adjusting the video transmission bit rate until the transmission quality evaluation score β falls within the first preset interval;
[0050] Step A3: Determine whether the image quality evaluation score α of the target video stream falls within a second preset interval:
[0051] If it is determined that the image quality evaluation score α of the target video stream does not fall within the second preset interval, the video transmission bit rate is adjusted until the image quality evaluation score α falls within the second preset interval.
[0052] Furthermore, after step A3, the method further comprises step A4;
[0053] Step A4: fine-tune the sending bit rate so that the sending bit rate is reduced by the fine-tuning ratio, thereby making the sending bit rate approach the optimal bit rate and saving traffic.
[0054] In a third aspect, the present invention provides a video quality assessment device based on a WebRtc SFU architecture, the device comprising:
[0055] An acquisition unit, used for acquiring a video stream within a preset period, wherein the video stream within the preset period is acquired from a streaming media server based on the WebRtcSFU architecture;
[0056] A first evaluation unit, connected to the acquisition unit, is used to evaluate the transmission quality of the video stream within a preset period to obtain a transmission quality evaluation score;
[0057] A second evaluation unit, connected to the acquisition unit, is used to evaluate the image quality of the video stream within a preset period to obtain an image quality evaluation score;
[0058] Among them, the transmission quality of the video stream within the preset period is evaluated based on the difference between the received video data packets and the lost video data packets; the image quality of the video stream within the preset period is evaluated based on the difference between the expected value of the video image quality and the actual value of the video image quality.
[0059] Furthermore, the first evaluation unit includes:
[0060] A first processing module is used to count the number of RTP messages actually received within the preset period, the number of messages lost within the preset period, and the number of RTP messages repaired within the preset period according to the video stream within the preset period;
[0061] A first calculation module, connected to the first processing module, for calculating a repair weight according to the number of RTP messages actually received within a preset period;
[0062] The calculation formula of the repair weight is as follows:
[0063]
[0064] Among them, RepairedWeight represents the repair weight;
[0065] Repaired is the number of RTP messages repaired within the preset period;
[0066] Received is the number of RTP messages actually received within the preset period;
[0067] The second calculation module is connected to the first calculation module and is used to calculate the number of RTP messages actually lost within a preset period according to the repair weight. The calculation formula is as follows:
[0068] Lost real =Lost 初始 -Repaired*RepairedWeight;
[0069] Among them, Lost real Indicates the number of packets actually lost within the preset period;
[0070] Lost 初始 is the number of RTP packets initially lost;
[0071] A third calculation module, connected to the second calculation module, for calculating the ratio of the number of received messages to the number of actually lost messages according to the number of RTP messages actually lost within a preset period;
[0072] The calculation formula for the ratio of the number of received messages to the number of actually lost messages is as follows:
[0073] DeliveredRatio=(Received-Lost real ) / Received;
[0074] A fourth calculation module, connected to the third calculation module, is used to calculate a transmission quality evaluation score β according to the ratio of the number of received messages to the number of actually lost messages, so as to evaluate the transmission quality of the video stream within a preset period;
[0075] The calculation formula of the transmission quality assessment score β is as follows:
[0076] β=rount(deliveredRatio 4 *10.0);
[0077] Among them, rount() is the rounding function.
[0078] Furthermore, the second evaluation unit includes:
[0079] A fifth calculation module, used to calculate a picture quality parameter θ according to an expected video quality value and an actual video quality value;
[0080] The calculation formula of the image quality parameter θ is as follows:
[0081]
[0082] Among them, real_width is the current screen width;
[0083] real_height is the current screen height;
[0084] real_fps is the current video frame rate;
[0085] expect_width is the expected screen width;
[0086] expect_height is the expected screen height;
[0087] expect_fps is the expected video frame rate;
[0088] a sixth calculation module, connected to the fifth calculation module, and configured to calculate an image quality evaluation score α according to the image quality parameter θ;
[0089] The calculation formula of the image quality evaluation score α is as follows:
[0090] α=tan(θ*0.3)*10;
[0091] Among them, tan() is the tangent function.
[0092] In a fourth aspect, the present invention provides a video transmission bit rate dynamic tuning system based on the WebRtc SFU architecture.
[0093] The system comprises:
[0094] The video quality assessment device based on the WebRtc SFU architecture according to the third aspect;
[0095] A first determination device, connected to the video quality assessment device, for determining whether the transmission quality assessment score β falls within a first preset interval;
[0096] a first adjustment device, connected to the first determination device, for adjusting the video transmission bit rate when the first determination device determines that the transmission quality evaluation score β does not fall within the first preset interval, until the transmission quality evaluation score β falls within the first preset interval;
[0097] A second determination device, connected to the first determination device, for determining whether the image quality evaluation score α of the target video stream falls within a second preset interval after the first determination device determines that the transmission quality evaluation score β falls within the first preset interval;
[0098] The second adjustment device is connected to the second determination device, and is used to adjust the video sending bit rate when the second determination device determines that the image quality evaluation score α of the target video stream does not fall within the second preset interval, until the image quality evaluation score α falls within the second preset interval.
[0099] Furthermore, the system further comprises:
[0100] The fine-tuning device is connected to the second adjusting device and is used to fine-tune the sending code rate so that the sending code rate is reduced by a fine-tuning ratio, thereby making the sending code rate approach the optimal code rate and saving traffic.
[0101] Beneficial effects of the present invention:
[0102] 1. The present invention can comprehensively consider and evaluate the video image quality so as to achieve the optimal bit rate and optimal image quality in different image quality requirement scenarios, thereby making the application of WebRTC technology in video transmission more flexible and efficient.
[0103] 2. The video quality assessment method based on the WebRTC SFU architecture of the present invention comprehensively considers the evaluation of transmission quality and image quality. Transmission quality evaluates the packet loss in the transmission of video data packets, and image quality evaluation evaluates the difference between the actual image quality performance of the video and the expected value. Through comprehensive evaluation, the transmission and image quality of the video can be understood more accurately.
[0104] 3. The present invention is based on the WebRTC SFU architecture, which itself supports real-time communication, and video quality evaluation can also be performed under real-time requirements. Video streams within a preset period can be obtained and evaluated in a timely manner, thereby achieving timely performance monitoring and optimization.
[0105] 4. The present invention obtains video streams from a streaming media server based on the WebRTC SFU architecture. The video quality assessment method can directly obtain the original data of the transmission, thereby more accurately assessing the transmission quality and image quality of the video, and serving as a reference for subsequent optimization and adjustment.
[0106] 5. The video quality evaluation method of the present invention is based on the difference between the received video data packets and the lost video data packets, and the difference between the actual value and the expected value of the video quality. These evaluation processes are objective and can quantify the transmission quality and image quality of the video with specific scores, so as to understand the video performance more intuitively.
[0107] 6. The present invention makes a judgment based on whether the transmission quality evaluation score and the image quality evaluation score fall within a preset range, and adjusts the bit rate accordingly. Through adaptive adjustment, the bit rate can be dynamically adjusted according to changes in network conditions and device performance to provide the best video quality and user experience.
[0108] 7. The present invention dynamically adjusts the video transmission bit rate, and the system can accurately control the bit rate according to the transmission quality and image quality evaluation. In this way, it can maximize the use of bandwidth and resources while ensuring the quality of the video, and improve the efficiency of the overall system.
[0109] 8. The present invention can provide the best video quality and user experience according to network conditions and image quality requirements. By adjusting the bit rate to adapt to network conditions, it can reduce adverse effects such as video freezes and delays, and provide a smoother and clearer video transmission and viewing experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0110] Figure 1 Schematic diagram of a method for dynamically optimizing video transmission bit rate based on a WebRtc SFU architecture in an embodiment of the present invention;
[0111] Figure 2 A schematic diagram of image quality evaluation score values in an embodiment of the present invention;
[0112] Figure 3 Schematic diagram of a video quality assessment method based on a WebRtc SFU architecture in an embodiment of the present invention;
[0113] Figure 4 Schematic diagram of a video quality assessment device based on WebRtc SFU architecture in an embodiment of the present invention;
[0114] Wherein, the reference numerals are: 10, acquisition unit, 20, first evaluation unit, 30, second evaluation unit. DETAILED DESCRIPTION
[0115] In order to enable those skilled in the art to better understand the technical solution of the present invention, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.
[0116] It should be understood that the specific embodiments and drawings described herein are only used to explain the present invention rather than to limit the present invention.
[0117] It can be understood that, in the absence of conflict, the various embodiments of the present invention and the various features in the embodiments can be combined with each other.
[0118] It can be understood that, for the convenience of description, the drawings of the present invention only show the parts related to the present invention, while the parts irrelevant to the present invention are not shown in the drawings.
[0119] It can be understood that each unit and module involved in the embodiments of the present invention may correspond to only one physical structure, or may be composed of multiple physical structures, or multiple units and modules may be integrated into one physical structure.
[0120] It can be understood that, without conflict, the functions and steps marked in the flowcharts and block diagrams of the present invention may occur in an order different from that marked in the drawings.
[0121] It is understood that the flowcharts and block diagrams of the present invention illustrate the possible architectures, functions, and operations of the systems, devices, equipment, and methods according to the various embodiments of the present invention. Each box in the flowchart or block diagram may represent a unit, module, program segment, or code, which contains executable instructions for implementing the specified functions. Moreover, each box or combination of boxes in the block diagram and flowchart may be implemented by a hardware-based system that implements the specified functions, or may be implemented by a combination of hardware and computer instructions.
[0122] It can be understood that the units and modules involved in the embodiments of the present invention can be implemented by software or hardware. For example, the units and modules can be located in a processor.
[0123] Embodiment 1:
[0124] like Figure 3 As shown, this embodiment provides a video quality assessment method based on the WebRtc SFU architecture, and the method includes the following steps:
[0125] Step S1: obtaining a video stream within a preset period, wherein the video stream within the preset period is obtained from a streaming media server based on the WebRtc SFU architecture.
[0126] WebRTC SFU architecture refers to the Selective Forwarding Unit (SFU) architecture based on WebRTC (Web Real-Time Communication) technology. In WebRTC, SFU is usually used to build real-time audio and video communication services, especially in multi-party conferences or group chat scenarios.
[0127] The WebRTC SFU architecture mainly includes the following components:
[0128] (1) Signaling Server: A server responsible for coordinating the establishment of connections, transmission of media descriptions, and other necessary information between communication endpoints. Through the signaling server, clients can exchange information such as Session Description Protocol (SDP) to establish a point-to-point connection or join a conference.
[0129] (2) Selective Forwarding Unit (SFU): SFU is a relay server that receives audio and video streams from all endpoints participating in a conference and selectively forwards specific streams to other endpoints as needed. SFU does not decode or encode media streams, but simply forwards data packets, alleviating the pressure on media processing.
[0130] (3) Client: The terminal device that participates in audio or video calls or conferences. It can be a desktop browser, mobile application, or other device that supports the WebRTC protocol.
[0131] Under the SFU architecture, when multiple participants join a conference, the audio and video streams of each participant will be sent to the SFU server. The SFU selectively forwards the audio and video streams of a specific participant to other participants as needed, thereby achieving multi-party real-time communication. This approach effectively reduces the burden on the client and bandwidth requirements, and improves the efficiency and stability of communication.
[0132] Step S2: Evaluate the transmission quality of the video stream within a preset period to obtain a transmission quality evaluation score; and evaluate the image quality of the video stream within the preset period to obtain an image quality evaluation score.
[0133] The transmission quality of the video stream within the preset period is evaluated based on the difference between the received video data packets and the lost video data packets; the image quality of the video stream within the preset period is evaluated based on the difference between the expected value of the video image quality and the actual value of the video image quality.
[0134] As a specific implementation method, evaluating the transmission quality of the video stream within a preset period specifically includes the following steps:
[0135] Step A1: According to the video stream in the preset period, the number of RTP messages actually received in the preset period is counted, and the number of messages lost in the preset period is counted.
[0136] Step A2: Counting the number of RTP messages repaired within a preset period; and calculating the repair weight according to the number of RTP messages actually received within the preset period;
[0137] The calculation formula of the repair weight is shown in formula (1):
[0138]
[0139] Among them, RepairedWeight represents the repair weight;
[0140] Repaired is the number of RTP messages repaired within the preset period;
[0141] Received is the number of RTP packets actually received within the preset period.
[0142] Step A3: Calculate the number of RTP packets actually lost within a preset period according to the repair weight. The calculation formula is shown in formula (2):
[0143] Lost real =Lost 初始-Repaired*RepairedWeight (2)
[0144] Among them, Lost real Indicates the number of packets actually lost within the preset period;
[0145] Lost 初始 The number of RTP packets initially lost.
[0146] Step A4: Calculate the ratio of the number of received messages to the number of actually lost messages according to the number of RTP messages actually lost within a preset period;
[0147] The calculation formula for the ratio of the number of received messages to the number of actually lost messages is as shown in formula (3):
[0148] DeliveredRatio=(Received-Lost real ) / Received (3).
[0149] Step A5: Calculate the transmission quality evaluation score β according to the ratio of the number of received messages to the number of actually lost messages, thereby evaluating the transmission quality of the video stream within a preset period;
[0150] The calculation formula of the transmission quality evaluation score β is shown in formula (4):
[0151] β=rount(deliveredRatio 4 *10.0) (4)
[0152] Among them, rount() is the rounding function.
[0153] The specific calculation process of the transmission quality evaluation score β is as follows:
[0154] Assume that the number of RTP packets actually received within the preset period is received = 1000;
[0155] Assume that the number of RTP packets lost within a preset period is Lost (initial) = 50;
[0156] Assume that the number of RTP packets repaired within the preset period is Repaired = 20;
[0157] Substitute the formula to calculate the repair weight RepairedWeight
[0158]
[0159] Then calculate the number of RTP packets actually lost within the preset period Lost real :
[0160] Lost real =Lost 初始 -Repaired*RepairedWeight
[0161] =50-20*0.9222≈31.556
[0162] Then calculate the ratio of the number of received messages to the number of actually lost messages, DeliveredRatio:
[0163] DeliveredRatio=(Received-Lost real ) / Received
[0164] (1000-31.556) / 1000≈0.9684;
[0165] Finally, the transmission quality assessment score β is calculated:
[0166] β=rount(deliveredRatio 4 *10.0)=round(8.701)≈9;
[0167] Therefore, the transmission quality evaluation score β is 9.
[0168] As a specific implementation method, the image quality of the video stream within a preset period is evaluated to obtain an image quality evaluation score, which specifically includes the following steps:
[0169] Step B1: Calculate the image quality parameter θ according to the expected value of the video image quality and the actual value of the video image quality;
[0170] The calculation formula of the image quality parameter θ is shown in formula (5):
[0171]
[0172] Among them, real_width is the current screen width;
[0173] real_height is the current screen height;
[0174] real_fps is the current video frame rate;
[0175] expect_width is the expected screen width;
[0176] expect_height is the expected screen height;
[0177] expect_fps is the expected video frame rate;
[0178] Step B2: Calculate the image quality evaluation score α according to the image quality parameter θ;
[0179] The calculation formula of the image quality evaluation score α is shown in formula (6):
[0180] α=tan(θ*0.3)*10 (6)
[0181] Among them, tan() is the tangent function.
[0182] The specific calculation process of the image quality evaluation score α is as follows:
[0183] Assume the following values:
[0184] real_width = 1280;
[0185] real_height = 720;
[0186] real_fps = 30;
[0187] expect_width = 1920;
[0188] expect_height = 1080;
[0189] expect_fps = 30;
[0190] Substituting the values into the formula:
[0191]
[0192] =((1280*720*30) / (1920*1080*30)-1)*10A=((27648000) / (62208000)-1)*10A=(0.444444-1)*10A=-0.55556*10A=-5.5556
[0194] Therefore, according to the given values, the value of the image quality parameter θ is -5.5556.
[0195] Then substitute the image quality parameter θ into the formula to calculate the image quality evaluation score:
[0196] α=tan(θ*0.3)*10
[0197] =tan(-5.5556*0.3)*10≈-14.69;
[0198] Therefore, the image quality evaluation score α is approximately -14.69.
[0199] Embodiment 2:
[0200] like Figure 1As shown, this embodiment provides a method for dynamically optimizing the video transmission bit rate based on the WebRtc SFU architecture, and the method includes the following steps:
[0201] Step A1: adopting the video quality assessment method based on the WebRtc SFU architecture described in the first aspect to evaluate the target video stream within the observation period, and obtain a transmission quality assessment score β and a picture quality assessment score α of the target video stream;
[0202] Step A2: Determine whether the transmission quality evaluation score β falls within a first preset interval:
[0203] If it is determined that the transmission quality evaluation score β does not fall within the first preset interval, adjusting the video transmission bit rate until the transmission quality evaluation score β falls within the first preset interval;
[0204] Step A3: Determine whether the image quality evaluation score α of the target video stream falls within a second preset interval:
[0205] If it is determined that the image quality evaluation score α of the target video stream does not fall within the second preset interval, the video transmission bit rate is adjusted until the image quality evaluation score α falls within the second preset interval.
[0206] Step A4: fine-tune the sending bit rate so that the sending bit rate is reduced by the fine-tuning ratio, thereby making the sending bit rate approach the optimal bit rate and saving traffic.
[0207] The specific implementation process is as follows:
[0208] 1. Transmission quality assessment score β:
[0209] The SFU server continuously and periodically observes and counts the RTP data packets from the external video source, and obtains the following variables that change with the period. The observation period is preset to a fixed value based on experience, usually 5 seconds. A high score indicates good quality, and a low score indicates poor quality.
[0210] Expected: The number of RTP packets expected to be received in the current interval.
[0211] received: The number of RTP packets actually received in the current interval.
[0212] repaired: The number of RTP packets repaired in the current interval.
[0213] retransmitted: The number of RTP packets retransmitted in the current interval.
[0214] lost: The number of RTP packets lost in the current interval.
[0215] The calculation method of the transmission quality assessment score β is:
[0216] If expected is 0, meaning no packets are expected, then set the score to 10 and return.
[0217] Calculate the number of lost RTP packets: If the number of packets expected to be received is less than the number of packets actually received, it is considered that no packets are lost and lost is set to 0. Otherwise, lost is set to expected-received.
[0218] Abnormal parameter adjustment: If the number of repaired messages is greater than the number of lost messages, and if SFU has RTX (message retransmission mechanism), the number of repaired messages is set to the number of lost messages (that is, the number of repaired messages must be less than or equal to the number of lost messages); if RTX does not exist, the number of lost messages is set to the number of repaired messages (that is, the number of lost messages must be less than or equal to the number of repaired messages).
[0219] Calculate the repair weight repairedWeight: Calculate the fourth power of the repair weight based on the ratio of the number of repaired messages to the number of received messages. The formula is:
[0220]
[0221] The number of lost RTP packets needs to be updated to the new value minus the number of repaired packets multiplied by the repair weight, that is, the actual number of lost packets: lost = lost-repaired*
[0222] repairedWeight;
[0223] like Figure 2 As shown in the figure, the transmission score is calculated based on the ratio of the number of received messages to the adjusted number of lost messages. The score is the fourth power of the ratio multiplied by 10, and then rounded to the nearest integer, ranging from 0 to 10. The specific formula is:
[0224]
[0225] β=[deliveredRatio 4 ×10.0].
[0226] 2. Image quality evaluation score α
[0227] This coefficient is an important indicator that reflects the gap between the expected and actual video quality, and its value range is between -10 and 10. When the coefficient is less than 0, it means that the actual quality is lower than the expected quality; conversely, when the coefficient is greater than 0, it means that the actual quality is higher than the expected quality.
[0228] The following variables are the picture parameters obtained by the SFU server by periodically sampling the input video frames. Here, the sampling period is preset to a fixed value based on experience, usually 5 seconds.
[0229] real_width: Current screen width (dots).
[0230] real_height: Current screen height (points).
[0231] real_fps: Current video frame rate.
[0232] expect_width: Expected screen width.
[0233] expect_height: Expected screen height.
[0234] expect_fps: Expected video frame rate.
[0235] By calculating the product of the screen area and frame rate of the current video and comparing it with the product of the screen area and frame rate of the expected video, we get a ratio. Then, we subtract 1 from this ratio and multiply it by 10 to get a parameter θ. It is a real number that can be positive or negative. When it is negative, it means that the picture quality is low; when it is positive, it indicates that the picture quality is high. Since this parameter is a linear value, we need to smooth it through function operations. The tangent function has the characteristic of converting linear values into smooth curves. By applying the tangent function, we can map the value of the parameter to the range of -10 to 10, thus obtaining a smoother and easier to understand evaluation indicator. The specific formula is as follows:
[0236]
[0237] α=tan(θ*0.3)*10.
[0238] 3. Dynamic adjustment strategy of video transmission bit rate:
[0239] In the initial stage, a transmission bit rate is set for the remote video source, such as 100 kbps, to start video transmission. On the SFU server, an observation period is set, such as 5 seconds, and at the beginning of each period, the β value and α value of the input video stream are calculated.
[0240] (1) If the β value falls within the interval [0,8], it reflects that the current packet loss is serious and the transmission quality is poor. Therefore, the remote video source will be notified to reduce the transmission bit rate by 15%.
[0241] (2) If β falls in the interval (8,10], it means that the current transmission quality is good, so continue to observe the α value.
[0242] (3) When α is less than -2, it means that the video quality is lower than the preset quality, and we will increase the sending bit rate by 10% accordingly. Conversely, if α is greater than 2, it means that the video quality is higher than the preset quality, and we will reduce the sending bit rate by 10%.
[0243] (4) When the α value falls within the interval of (-2, 2), it means that the video quality roughly matches the preset image quality. At this time, in order to approach the optimal bit rate and save traffic, the sending bit rate will be fine-tuned and reduced by 5%.
[0244] Embodiment 3:
[0245] like Figure 4 As shown, this embodiment provides a video quality assessment device based on the WebRtc SFU architecture, the device comprising:
[0246] An acquisition unit 10 is used to acquire a video stream within a preset period, where the video stream within the preset period is acquired from a streaming media server based on a WebRtc SFU architecture;
[0247] A first evaluation unit 20, connected to the acquisition unit 10, is used to evaluate the transmission quality of the video stream within a preset period to obtain a transmission quality evaluation score;
[0248] The second evaluation unit 30 is connected to the acquisition unit 10 and is used to evaluate the image quality of the video stream within a preset period to obtain an image quality evaluation score;
[0249] Among them, the transmission quality of the video stream within the preset period is evaluated based on the difference between the received video data packets and the lost video data packets; the image quality of the video stream within the preset period is evaluated based on the difference between the expected value of the video image quality and the actual value of the video image quality.
[0250] As a specific implementation, the first evaluation unit 20 includes:
[0251] A first processing module is used to count the number of RTP messages actually received within the preset period, the number of messages lost within the preset period, and the number of RTP messages repaired within the preset period according to the video stream within the preset period;
[0252] A first calculation module, connected to the first processing module, for calculating a repair weight according to the number of RTP messages actually received within a preset period;
[0253] The calculation formula of the repair weight is as follows:
[0254]
[0255] Among them, RepairedWeight represents the repair weight;
[0256] Repaired is the number of RTP messages repaired within the preset period;
[0257] Received is the number of RTP messages actually received within the preset period;
[0258] The second calculation module is connected to the first calculation module and is used to calculate the number of RTP messages actually lost within a preset period according to the repair weight. The calculation formula is as follows:
[0259] Lost real =Lost 初始 -Repaired*RepairedWeight;
[0260] Among them, Lost real Indicates the number of packets actually lost within the preset period;
[0261] Lost 初始 is the number of RTP packets initially lost;
[0262] A third calculation module, connected to the second calculation module, for calculating the ratio of the number of received messages to the number of actually lost messages according to the number of RTP messages actually lost within a preset period;
[0263] The calculation formula for the ratio of the number of received messages to the number of actually lost messages is as follows:
[0264] DeliveredRatio=(Received-Lost real ) / Received;
[0265] A fourth calculation module, connected to the third calculation module, is used to calculate a transmission quality evaluation score β according to the ratio of the number of received messages to the number of actually lost messages, so as to evaluate the transmission quality of the video stream within a preset period;
[0266] The calculation formula of the transmission quality assessment score β is as follows:
[0267] β=rount(deliveredRatio 4 *10.0);
[0268] Among them, rount() is the rounding function.
[0269] As a specific implementation, the second evaluation unit 30 includes:
[0270] A fifth calculation module, used to calculate a picture quality parameter θ according to an expected video quality value and an actual video quality value;
[0271] The calculation formula of the image quality parameter θ is as follows:
[0272]
[0273] Among them, real_width is the current screen width;
[0274] real_height is the current screen height;
[0275] real_fps is the current video frame rate;
[0276] expect_width is the expected screen width;
[0277] expect_height is the expected screen height;
[0278] expect_fps is the expected video frame rate;
[0279] a sixth calculation module, connected to the fifth calculation module, and configured to calculate an image quality evaluation score α according to the image quality parameter θ;
[0280] The calculation formula of the image quality evaluation score α is as follows:
[0281] α=tan(θ*0.3)*10;
[0282] Among them, tan() is the tangent function.
[0283] Embodiment 4:
[0284] This embodiment provides a video transmission bit rate dynamic tuning system based on the WebRtc SFU architecture.
[0285] The system comprises:
[0286] The video quality assessment device based on the WebRtc SFU architecture described in Example 3;
[0287] A first determination device, connected to the video quality assessment device, for determining whether the transmission quality assessment score β falls within a first preset interval;
[0288] a first adjustment device, connected to the first determination device, for adjusting the video transmission bit rate when the first determination device determines that the transmission quality evaluation score β does not fall within the first preset interval, until the transmission quality evaluation score β falls within the first preset interval;
[0289] A second determination device, connected to the first determination device, for determining whether the image quality evaluation score α of the target video stream falls within a second preset interval after the first determination device determines that the transmission quality evaluation score β falls within the first preset interval;
[0290] a second adjustment device connected to the second determination device, and configured to adjust the video transmission bit rate when the second determination device determines that the image quality evaluation score α of the target video stream does not fall within the second preset interval, until the image quality evaluation score α falls within the second preset interval;
[0291] The fine-tuning device is connected to the second adjusting device and is used to fine-tune the sending code rate so that the sending code rate is reduced by a fine-tuning ratio, thereby making the sending code rate approach the optimal code rate and saving traffic.
[0292] It is to be understood that the above embodiments are merely exemplary embodiments used to illustrate the principles of the present invention, but the present invention is not limited thereto. For those of ordinary skill in the art, various modifications and improvements can be made without departing from the spirit and essence of the present invention, and these modifications and improvements are also considered to be within the scope of protection of the present invention.
Claims
1. A video quality assessment method based on WebRtc SFU architecture, characterized in that: The method comprises the following steps: Step S1: obtaining a video stream within a preset period, wherein the video stream within the preset period is obtained from a streaming media server based on a WebRtc SFU architecture; Step S2: Evaluate the transmission quality of the video stream within a preset period to obtain a transmission quality evaluation score; and, Evaluate the image quality of the video stream within a preset period to obtain an image quality evaluation score; Among them, the transmission quality of the video stream within the preset period is evaluated based on the difference between the received video data packets and the lost video data packets; the image quality of the video stream within the preset period is evaluated based on the difference between the expected value of the video image quality and the actual value of the video image quality.
2. The video quality assessment method based on WebRtc SFU architecture according to claim 1 is characterized in that: The transmission quality of the video stream within a preset period is evaluated, specifically including the following steps: Step A1: according to the video stream in the preset period, counting the number of RTP packets actually received in the preset period, and counting the number of packets lost in the preset period; Step A2: Counting the number of RTP messages repaired within a preset period; and calculating the repair weight according to the number of RTP messages actually received within the preset period; The calculation formula of the repair weight is shown in formula (1): Among them, RepairedWeight represents the repair weight; Repaired is the number of RTP messages repaired within the preset period; Received is the number of RTP messages actually received within the preset period; Step A3: Calculate the number of RTP packets actually lost within a preset period according to the repair weight. The calculation formula is shown in formula (2): Lost real =Lost 初始 -Repaired*RepairedWeight (2) Among them, Lost real Indicates the number of packets actually lost within the preset period; Lost 初始 is the number of RTP packets initially lost; Step A4: Calculate the ratio of the number of received messages to the number of actually lost messages according to the number of RTP messages actually lost within a preset period; The calculation formula for the ratio of the number of received messages to the number of actually lost messages is as shown in formula (3): DeliveredRatio=(Received-Lost real ) / Received (3) Step A5: Calculate the transmission quality evaluation score β according to the ratio of the number of received messages to the number of actually lost messages, thereby evaluating the transmission quality of the video stream within a preset period; The calculation formula of the transmission quality evaluation score β is shown in formula (4): β=round(deliveredRatio 4 *10.0) (4) Among them, rount() is the rounding function.
3. The video quality assessment method based on WebRtc SFU architecture according to claim 1 is characterized in that: The image quality of the video stream within a preset period is evaluated to obtain an image quality evaluation score, which specifically includes the following steps: Step B1: Calculate the image quality parameter θ according to the expected value of the video image quality and the actual value of the video image quality; The calculation formula of the image quality parameter θ is shown in formula (5): Among them, real_width is the current screen width; real_height is the current screen height; real_fps is the current video frame rate; expect_width is the expected screen width; expect_height is the expected screen height; expect_fps is the expected video frame rate; Step B2: Calculate the image quality evaluation score α according to the image quality parameter θ; The calculation formula of the image quality evaluation score α is shown in formula (6): α=tan(θ*0.3)*10 (6) Among them, tan() is the tangent function.
4. A method for dynamically optimizing video transmission bit rate based on WebRtc SFU architecture, characterized in that: The method comprises the following steps: Step A1: adopting the video quality assessment method based on the WebRtc SFU architecture as described in any one of claims 1 to 3 to evaluate the target video stream within the observation period, and obtain the transmission quality assessment score β and the image quality assessment score α of the target video stream; Step A2: Determine whether the transmission quality evaluation score β falls within a first preset interval: If it is determined that the transmission quality evaluation score β does not fall within the first preset interval, adjusting the video transmission bit rate until the transmission quality evaluation score β falls within the first preset interval; Step A3: Determine whether the image quality evaluation score α of the target video stream falls within a second preset interval: If it is determined that the image quality evaluation score α of the target video stream does not fall within the second preset interval, the video transmission bit rate is adjusted until the image quality evaluation score α falls within the second preset interval.
5. The method for dynamically optimizing the video transmission bit rate based on the WebRtc SFU architecture according to claim 4 is characterized in that: After step A3, the method further comprises step A4; Step A4: fine-tune the sending bit rate so that the sending bit rate is reduced by the fine-tuning ratio, thereby making the sending bit rate approach the optimal bit rate and saving traffic.
6. A video quality assessment device based on WebRtc SFU architecture, characterized in that: The device comprises: An acquisition unit, used for acquiring a video stream within a preset period, wherein the video stream within the preset period is acquired from a streaming media server based on a WebRtc SFU architecture; A first evaluation unit, connected to the acquisition unit, is used to evaluate the transmission quality of the video stream within a preset period to obtain a transmission quality evaluation score; A second evaluation unit, connected to the acquisition unit, is used to evaluate the image quality of the video stream within a preset period to obtain an image quality evaluation score; Among them, the transmission quality of the video stream within the preset period is evaluated based on the difference between the received video data packets and the lost video data packets; the image quality of the video stream within the preset period is evaluated based on the difference between the expected value of the video image quality and the actual value of the video image quality.
7. The video quality assessment device based on WebRtc SFU architecture according to claim 6, characterized in that: The first evaluation unit comprises: A first processing module is used to count the number of RTP messages actually received within the preset period, the number of messages lost within the preset period, and the number of RTP messages repaired within the preset period according to the video stream within the preset period; A first calculation module, connected to the first processing module, for calculating a repair weight according to the number of RTP messages actually received within a preset period; The calculation formula of the repair weight is as follows: Among them, RepairedWeight represents the repair weight; Repaired is the number of RTP messages repaired within the preset period; Received is the number of RTP messages actually received within the preset period; The second calculation module is connected to the first calculation module and is used to calculate the number of RTP messages actually lost within a preset period according to the repair weight. The calculation formula is as follows: Lost real =Lost 初始 -Repaired*RepairedWeight; Among them, Lost real Indicates the number of packets actually lost within the preset period; Lost 初始 is the number of RTP packets initially lost; A third calculation module, connected to the second calculation module, for calculating the ratio of the number of received messages to the number of actually lost messages according to the number of RTP messages actually lost within a preset period; The calculation formula for the ratio of the number of received messages to the number of actually lost messages is as follows: DeliveredRatio=(Received-Lost real ) / Received; A fourth calculation module, connected to the third calculation module, is used to calculate a transmission quality evaluation score β according to the ratio of the number of received messages to the number of actually lost messages, so as to evaluate the transmission quality of the video stream within a preset period; The calculation formula of the transmission quality assessment score β is as follows: β=round(deliveredRatio 4 *10.0); Among them, rount() is the rounding function.
8. The video quality assessment device based on WebRtc SFU architecture according to claim 6, characterized in that: The second evaluation unit comprises: A fifth calculation module, used to calculate a picture quality parameter θ according to an expected video quality value and an actual video quality value; The calculation formula of the image quality parameter θ is as follows: Among them, real_width is the current screen width; real_height is the current screen height; real_fps is the current video frame rate; expect_width is the expected screen width; expect_height is the expected screen height; expect_fps is the expected video frame rate; a sixth calculation module, connected to the fifth calculation module, and configured to calculate an image quality evaluation score α according to the image quality parameter θ; The calculation formula of the image quality evaluation score α is as follows: α=tan(θ*0.3)*10; Among them, tan() is the tangent function.
9. A video transmission bit rate dynamic tuning system based on WebRtc SFU architecture, characterized in that: The system comprises: The video quality assessment device based on the WebRtc SFU architecture according to any one of claims 6 to 8; A first determination device, connected to the video quality assessment device, for determining whether the transmission quality assessment score β falls within a first preset interval; a first adjustment device, connected to the first determination device, for adjusting the video transmission bit rate when the first determination device determines that the transmission quality evaluation score β does not fall within the first preset interval, until the transmission quality evaluation score β falls within the first preset interval; A second determination device, connected to the first determination device, for determining whether the image quality evaluation score α of the target video stream falls within a second preset interval after the first determination device determines that the transmission quality evaluation score β falls within the first preset interval; The second adjustment device is connected to the second determination device, and is used to adjust the video sending bit rate when the second determination device determines that the image quality evaluation score α of the target video stream does not fall within the second preset interval, until the image quality evaluation score α falls within the second preset interval.
10. The video transmission bit rate dynamic tuning system based on WebRtc SFU architecture according to claim 9 is characterized in that: The system further comprises: The fine-tuning device is connected to the second adjusting device and is used to fine-tune the sending code rate so that the sending code rate is reduced by a fine-tuning ratio, thereby making the sending code rate approach the optimal code rate and saving traffic.
