Video stream parameter generation method and video stream parameter adjustment method

By dynamically calculating the effective bandwidth ratio of the video stream and generating the target video stream parameters, the balance problem between video quality and smoothness in weak network environments is solved, achieving a stable and high-quality live broadcast experience.

CN120640073APending Publication Date: 2025-09-12SHANGHAI BILIBILI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510822177.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-18
Publication Date
2025-09-12

AI Technical Summary

Technical Problem

In a weak network environment, existing technologies find it difficult to find a balance between ensuring video quality and playback smoothness, resulting in frequent frame drops and freezes in live video, and failing to meet users' demand for high-quality live broadcasts.

Method used

By obtaining the communication protocol and data packet parameter characteristics, the effective bandwidth ratio of the video stream is dynamically calculated, the target video stream parameters are generated, and real-time adjustment of the video stream parameters is achieved.

Benefits of technology

It achieves real-time perception and adaptive adjustment of network status, ensuring smooth video playback and retaining picture details to the greatest extent, providing a stable and high-quality user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120640073A_ABST
    Figure CN120640073A_ABST
Patent Text Reader

Abstract

The invention provides a video stream parameter generation method and a video stream parameter adjustment method, and the video stream parameter adjustment method comprises the steps: obtaining a communication protocol for a communication channel, and obtaining a parameter feature of a data packet of a video stream corresponding to the communication protocol; determining an effective bandwidth proportion of the video stream based on the communication protocol and the parameter characteristics of the data packet; generating a target result based on a pre-generated effective bandwidth proportion threshold and the effective bandwidth proportion; and generating a target video stream parameter corresponding to the target result according to a preset video stream parameter generation rule.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method for generating and adjusting video stream parameters. Background Art

[0002] This section is intended to provide a background or context to the embodiments of the present application that are recited in the claims. Nothing herein is admitted to be prior art by virtue of its inclusion in this section.

[0003] In weak network environments, uplink bandwidth resources are extremely limited, making it difficult to support the bitrate requirements of live streaming services. This is especially true when live streaming outdoors on mobile devices. Due to factors such as complex and changing environments and signal obstruction, network quality can easily fluctuate, leading to frequent frame drops and freezes in the live stream, severely impacting the user viewing experience.

[0004] Currently, the industry's common approach to addressing these issues is to simply lower the bitrate to maintain smooth live streaming. However, this approach, which simply lowers the bitrate to a preset value, has significant drawbacks. On the one hand, if the bitrate is set too low, significant loss of video detail and color will occur, resulting in a significant degradation in image quality. On the other hand, if the bitrate is set too high, smooth video transmission cannot be guaranteed under poor network conditions. Furthermore, mobile networks are highly dynamic, and network bandwidth can fluctuate dramatically at any time. This makes it difficult for a preset bitrate solution to balance video quality and playback smoothness throughout the live broadcast, making it difficult to meet user demands for high-quality live streaming.

[0005] Based on this, the present application urgently needs to propose a video stream parameter generation method and a video stream parameter adjustment method that can solve the above technical problems. Summary of the Invention

[0006] Various aspects of the present application provide a video stream parameter generation method and a video stream parameter generation method for accurately, efficiently, dynamically and in real time adjusting the video stream parameters of video stream variables.

[0007] In one aspect of the present application, a method for generating video stream parameters is provided. The method generates target video stream parameters using video stream variables corresponding to a video stream, wherein the video stream is transmitted via a communication channel. The method comprises:

[0008] Acquire a communication protocol for the communication channel, and acquire parameter characteristics of a data packet of the video stream corresponding to the communication protocol;

[0009] Determining an effective bandwidth ratio of the video stream based on the communication protocol and parameter characteristics of the data packet;

[0010] Generate a target result based on a pre-generated effective bandwidth ratio threshold and the effective bandwidth ratio;

[0011] Generate target video stream parameters corresponding to the target result according to preset video stream parameter generation rules.

[0012] Furthermore, the determining of the effective bandwidth ratio of the video stream based on the communication protocol and the parameter characteristics of the data packet includes: obtaining an effective bandwidth ratio calculation rule corresponding to the communication protocol; determining the effective bandwidth ratio of the video stream according to the effective bandwidth ratio calculation rule based on the parameter characteristics of the data packet; wherein the communication protocol includes at least one of the RTMP communication protocol and the SRT communication protocol.

[0013] Furthermore, the effective bandwidth ratio of the video stream is determined based on the parameter characteristics of the data packet in accordance with the effective bandwidth ratio calculation rule, including: when the communication protocol is the RTMP communication protocol, determining the ratio of the number of successfully sent packets of the data packet and the number of sent packets as the effective bandwidth ratio of the video stream; when the communication protocol is the SRT communication protocol, determining the ratio of the number of retransmitted packets of the data packet and the number of sent packets, and then determining the difference between the ratio and 1 as the effective bandwidth ratio of the video stream; the parameter characteristics include at least the number of successfully sent packets, the number of sent packets and the number of retransmitted packets.

[0014] Furthermore, the method also includes: obtaining the communication protocol; when the communication protocol is the SRT communication protocol, obtaining the current bit rate of the video stream and the maximum uplink bandwidth of the communication channel, and determining the ratio of the current bit rate and the maximum uplink bandwidth as the pre-generated effective bandwidth ratio threshold.

[0015] Furthermore, generating a target result based on a pre-generated effective bandwidth ratio threshold and the effective bandwidth ratio includes: obtaining the effective bandwidth ratio threshold corresponding to the communication protocol; determining a first result of the effective bandwidth ratio and the effective bandwidth ratio threshold, then monitoring the effective bandwidth ratio for a preset period of time to determine a target effective bandwidth ratio; determining a second result of the target effective bandwidth ratio and the effective bandwidth ratio threshold; if the first result is the same as the second result, generating a target result; wherein, the target result is upgraded or downgraded.

[0016] Furthermore, based on the target result, target video stream parameters are generated according to preset video stream parameter generation rules, including: if the target result is an upgrade, obtaining the current bit rate of the initial video stream parameters of the video stream, its initial bit rate and a pre-generated upgrade iteration threshold; based on the pre-generated upgrade iteration threshold, dividing the difference between the current bit rate and the initial bit rate to determine the upgrade step; generating target video stream parameters based on the upgrade step and the initial video stream parameters; the initial video stream parameters include initial bit rate, initial frame rate, minimum frame rate, current frame rate and current bit rate.

[0017] Furthermore, based on the target result, target video stream parameters are generated according to preset video stream parameter generation rules, including: if the target result is an upgrade, obtaining the current bit rate and the effective bandwidth ratio of the initial video stream parameters of the video stream; determining the upgrade step based on the current bit rate and the effective bandwidth ratio; generating target video stream parameters based on the upgrade step and the initial video stream parameters; the initial video stream parameters include initial bit rate, initial frame rate, minimum frame rate, current frame rate and current bit rate.

[0018] Furthermore, generating target video stream parameters based on the upgrade step and the initial video stream parameters includes: obtaining an iterative upgrade result after performing an iterative upgrade on the current bit rate based on the upgrade step; when the iterative upgrade result is an upgrade, generating video stream parameters based on the upgrade step and the initial video stream parameters; otherwise, stopping generating target video stream parameters.

[0019] Furthermore, generating target video stream parameters based on the upgrade step size and the initial video stream parameters includes: generating a target frame rate based on the upgrade step size and the initial video stream parameters; and generating a target bit rate based on the target frame rate.

[0020] Furthermore, a target frame rate is generated based on the upgrade step and the initial video stream parameters, including: determining a fifth parameter based on the ratio of the initial bit rate to the initial frame rate; determining a sixth parameter based on the sum of the current bit rate and the upgrade step; determining a seventh parameter based on the ratio of the sixth parameter to the fifth parameter; and determining the maximum value of the seventh parameter and the minimum frame rate as the target frame rate.

[0021] Furthermore, generating a target bit rate based on the target frame rate includes: determining an eighth parameter based on the target frame rate and the fifth parameter; and determining a minimum value of the sixth parameter and the eighth parameter as the target bit rate.

[0022] Furthermore, target video stream parameters are generated corresponding to the target result according to preset video stream parameter generation rules, including: if the target result is downgrade, determining the current target result as the nth target result, and obtaining the n-1th target result; if the n-1th target result is upgrade, obtaining the n-2th video stream parameters generated corresponding to the n-2th target result; and determining the video stream parameters of the current target result as the n-2th video stream parameters.

[0023] Furthermore, generating target video stream parameters corresponding to the target result according to a preset video stream parameter generation rule also includes: if the n-1th target result is degradation, obtaining the effective bandwidth ratio of the video stream in m window periods and the maximum uplink bandwidth of the communication channel; obtaining a weighted average of the effective bandwidth ratios of m window periods, and determining the product of the weighted average and the maximum uplink bandwidth as the evaluation bit rate; obtaining the initial bit rate, initial frame rate and minimum frame rate of the video stream, and determining the target frame rate based on the initial bit rate, the initial frame rate, the minimum frame rate and the target bit rate; determining the target bit rate based on the initial bit rate and the evaluation bit rate; the target video stream parameters include the target bit rate and the target frame rate.

[0024] Furthermore, the initial bit rate, initial frame rate and minimum frame rate of the video stream are obtained, and the target frame rate is determined based on the initial bit rate, the initial frame rate, the minimum frame rate and the target bit rate, including: determining a first parameter based on the product of the initial frame rate and the minimum frame rate; determining a second parameter based on the ratio of the initial bit rate to the first parameter; determining a third parameter based on the difference between the initial bit rate and the evaluated bit rate; when the third parameter is greater than the second parameter, determining the target frame rate based on the initial bit rate, the second parameter and the evaluated bit rate; when the third parameter is not greater than the second parameter, determining the minimum frame rate as the target frame rate.

[0025] Further, determining a target bit rate based on the initial bit rate and the evaluated bit rate includes: when the third parameter is greater than the second parameter, obtaining the target frame rate, and determining the target bit rate based on the target frame rate, the initial bit rate, and the evaluated bit rate; when the third parameter is not greater than the second parameter, determining the evaluated bit rate as the target bit rate.

[0026] Furthermore, when the third parameter is greater than the second parameter, determining the target frame rate based on the initial bit rate, the second parameter and the evaluated bit rate includes: when the third parameter is greater than the second parameter, determining a fourth parameter based on the ratio of the initial bit rate to the second parameter; and determining the target frame rate based on the ratio of the evaluated bit rate to the fourth parameter.

[0027] Another aspect of the present application further provides a method for adjusting video stream parameters, the method comprising:

[0028] Get the video stream variables to be adjusted and the target video stream parameters;

[0029] Determining a time point of a previous adjustment of a video stream parameter as a target time point, and if a time interval between a current time point and the target time point exceeds a preset time interval, adjusting the video stream parameter to be adjusted to the target video stream parameter;

[0030] The target video stream parameters are generated based on the video stream parameter generation method described above.

[0031] Furthermore, the method also includes: if the time interval between the current time point and the target time point does not exceed a preset time interval, obtaining the target video stream parameters corresponding to the specific time point, and adjusting the video stream parameters to be adjusted to the target video stream parameters; wherein, the specific time point is later than the target time point, and the time interval between the specific time point and the target time point is not less than the preset time interval.

[0032] In another aspect of the present application, a video stream parameter generation apparatus is provided for generating target video stream parameters corresponding to video stream variables of a video stream, wherein the video stream is transmitted via a communication channel, the apparatus comprising:

[0033] a first acquiring unit, configured to acquire a communication protocol for the communication channel, and acquire parameter characteristics of a data packet of the video stream corresponding to the communication protocol;

[0034] A first determining unit, configured to determine an effective bandwidth ratio of the video stream based on the communication protocol and parameter characteristics of the data packet;

[0035] The first generating unit is configured to generate a target result based on a pre-generated effective bandwidth ratio threshold and the effective bandwidth ratio; and is further configured to generate target video stream parameters corresponding to the target result according to a preset video stream parameter generation rule.

[0036] In another aspect of the present application, a video stream parameter adjustment device is provided, characterized in that the device includes:

[0037] A second acquiring unit is used to acquire the video stream variables to be adjusted and the target video stream parameters;

[0038] a second determining and adjusting unit, configured to determine a time point of a previous adjustment of the video stream parameters as a target time point, and adjust the video stream parameters to be adjusted to the target video stream parameters if a time interval between the current time point and the target time point exceeds a preset time interval;

[0039] Wherein, the target video stream parameters are generated based on the video stream parameter generation device as described above.

[0040] In another aspect of the present application, an electronic device is provided, comprising:

[0041] at least one processor; and

[0042] a memory communicatively coupled to the at least one processor;

[0043] The memory stores instructions that can be executed by the at least one processor. The instructions are executed by the at least one processor to enable the at least one processor to perform the method described above.

[0044] In another aspect of the present application, a computer-readable medium is provided, on which computer program instructions are stored. The computer program instructions can be executed by a processor to implement the method described above.

[0045] In another aspect of the present application, a computer program product is provided, comprising a computer program, wherein the computer program implements the above method when executed by a processor.

[0046] The video stream parameter generation method proposed in this application includes: obtaining a communication protocol for the communication channel, obtaining parameter characteristics of the data packet of the video stream corresponding to the communication protocol; determining the effective bandwidth ratio of the video stream based on the communication protocol and the parameter characteristics of the data packet; generating a target result based on a pre-generated effective bandwidth ratio threshold and the effective bandwidth ratio; and generating target video stream parameters corresponding to the target result according to a preset video stream parameter generation rule. Based on the above-mentioned video stream parameter generation method, at least the following beneficial effects are achieved:

[0047] First, it enables real-time awareness of network status: By continuously and accurately monitoring the streaming and packet delivery, it analyzes key indicators such as packet loss rate and latency jitter in real time, allowing for rapid identification of subtle changes in network status. Once a network degradation trend is detected, the algorithm can initiate a response within milliseconds. Compared to traditional preset bitrate solutions, this can detect network anomalies in advance, creating a critical time window for adjusting video stream parameters.

[0048] Secondly, it can adaptively adjust the bitrate and frame rate of the video stream: Based on real-time network status, it accurately calculates the optimal streaming bitrate that the current network can support. In scenarios with limited network conditions, it prioritizes maintaining the minimum frame rate of the video stream. At the same time, by dynamically adjusting the bitrate, it ensures that the data volume of each frame remains high, effectively avoiding image quality issues such as blurring and color blocking. Compared with traditional fixed bitrate solutions, the subjective image quality score of the video is significantly improved under the same network bandwidth.

[0049] Then, intelligent detection and recovery are effectively implemented: when the streaming quality is detected to have reached an excellent level, detective bitrate and frame rate recovery / upgrade operations are automatically performed. By adjusting the video stream parameters in a small, gradual manner, the video clarity and frame rate are gradually improved without affecting the current video smoothness, achieving a smooth transition from smooth to high-definition, meeting users' demand for a high-quality live streaming experience.

[0050] To sum up, the video stream parameter generation method proposed in this application can ensure the smooth playback of video images in a complex mobile network environment, while retaining the video details and color expression to the greatest extent, providing users with a stable and high-quality video viewing experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] In order to more clearly illustrate the technical solutions in the embodiments of the present application, a brief introduction will be given below to the drawings required for use in the embodiments or descriptions of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0052] Other features, objects and advantages of the present application will become more apparent upon reading the detailed description of non-limiting embodiments made with reference to the following drawings:

[0053] Figure 1 A flowchart of a method for generating video stream parameters according to an embodiment of the present application is provided;

[0054] Figure 2 A schematic diagram of a process for generating target video stream parameters corresponding to the target result according to a preset video stream parameter generation rule provided in an embodiment of the present application;

[0055] Figure 3 A flowchart of a method for adjusting video stream parameters provided by an embodiment of the present application;

[0056] Figure 4 A schematic diagram of a device for generating video stream parameters according to an embodiment of the present application;

[0057] Figure 5 A schematic diagram of the structure of a video stream parameter adjustment device provided in one embodiment of the present application;

[0058] Figure 6 A schematic diagram of the structure of an electronic device suitable for implementing the solution in the embodiments of the present application;

[0059] The same or similar reference numerals in the drawings represent the same or similar components. DETAILED DESCRIPTION

[0060] To make the purpose, technical solutions, and advantages of the embodiments of this application more clear, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0061] In a typical configuration of the present application, the terminal and the equipment of the service network each include one or more processors (CPUs), input / output interfaces, network interfaces and memories.

[0062] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.

[0063] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology for information storage. The information can be computer program instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc-read only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission medium that can be used to store information that can be accessed by a computing device.

[0064] An embodiment of the present application provides a method for generating video stream parameters. The method generates target video stream parameters using video stream variables corresponding to a video stream. The method includes:

[0065] Acquire a communication protocol for the communication channel, and acquire parameter characteristics of a data packet of the video stream corresponding to the communication protocol;

[0066] Determining an effective bandwidth ratio of the video stream based on the communication protocol and parameter characteristics of the data packet;

[0067] Generate a target result based on a pre-generated effective bandwidth ratio threshold and the effective bandwidth ratio;

[0068] Generate target video stream parameters corresponding to the target result according to preset video stream parameter generation rules.

[0069] In actual scenarios, the execution subject of this method can be a user device, or a device formed by integrating a user device and a network device through a network, or an application running on the above device. The user device includes but is not limited to various terminal devices such as computers, mobile phones, tablets, smart watches, and bracelets. The network device includes but is not limited to network hosts, single network servers, multiple network server sets, or cloud computing-based computer collections, which can be used to implement some processing functions when setting an alarm. Here, the cloud is composed of a large number of hosts or network servers based on cloud computing (Cloud Computing), where cloud computing is a type of distributed computing, a virtual computer composed of a group of loosely coupled computers.

[0070] Example 1

[0071] Figure 1 The following is a processing flow of a method for generating video stream parameters provided by an embodiment of the present application, which is used to generate target video stream parameters corresponding to video stream variables of a video stream. The method includes at least the following processing steps:

[0072] Step S101: Acquire a communication protocol for the communication channel, and acquire parameter characteristics of a data packet of the video stream corresponding to the communication protocol;

[0073] Step S102: determining the effective bandwidth ratio of the video stream based on the communication protocol and parameter characteristics of the data packet;

[0074] Step S103: Generate a target result based on a pre-generated effective bandwidth ratio threshold and the effective bandwidth ratio;

[0075] Step S104: Generate target video stream parameters corresponding to the target result according to preset video stream parameter generation rules.

[0076] The video stream parameter generation method proposed in this embodiment builds a cross-layer optimization mechanism from the network layer to the application layer through a four-layer processing chain of communication protocol analysis - data packet feature extraction - effective bandwidth calculation - dynamic parameter generation, thereby achieving refined matching of video stream parameters with network resources.

[0077] In one embodiment, the method further includes: obtaining a target video stream parameter generation request; wherein the target video stream parameter generation request includes: obtaining the interaction status between the push end and the playback end; when the push is successful, generating a target video stream parameter generation request; wherein the video stream parameters include bit rate and frame rate.

[0078] Specifically, the streaming end, which can also be called the sending end, is usually the device used by the anchor, such as mobile phones, cameras and other hardware, with corresponding live broadcast software. This end is responsible for collecting video and audio data, and after encoding processing, pushes the data to the server according to a certain protocol (such as RTMP, HLS, etc.), while running the algorithm to monitor the streaming packet sending situation, evaluate the network status and dynamically adjust the bit rate and frame rate. The playback end, which can also be called the receiving end, is the device used by the audience to watch the live broadcast, including mobile phones, computers, smart TVs, etc. The playback end pulls the audio and video data sent by the streaming end from the server, decodes it, and plays it for the user to watch. The so-called bit rate refers to the number of frames displayed per unit time (the unit time is generally in seconds), which determines the smoothness of the video; the frame rate refers to the amount of data transmitted or stored per unit time (such as 6Mbps), which directly affects the video clarity and file size.

[0079] In one embodiment, the video stream parameter generation method as described above may be executed after obtaining the target video stream parameters, or the target video stream parameter generation request may be obtained after obtaining the communication protocol for the communication channel and before obtaining the parameter characteristics of the data packet of the video stream corresponding to the communication protocol; that is, after obtaining the target video stream parameter generation request, the communication protocol for the communication channel is obtained, or, after obtaining the target video stream parameter generation request, the parameter characteristics of the data packet of the video stream are obtained corresponding to the communication protocol.

[0080] In one embodiment, obtaining parameter characteristics of the data packet of the video stream according to the corresponding communication protocol also includes: obtaining parameter characteristics of the data packet of the video stream according to the corresponding communication protocol according to a preset duration, wherein the preset duration can be 2 GOPs (wherein 1 GOP is a video segment consisting of continuous I frames, P frames, and B frames). It should be understood that this application does not limit the size of the preset duration, and those skilled in the art can make reasonable choices based on actual application scenarios and actual needs.

[0081] In one embodiment, determining the effective bandwidth ratio of the video stream based on the communication protocol and the parameter characteristics of the data packet includes: obtaining an effective bandwidth ratio calculation rule corresponding to the communication protocol; determining the effective bandwidth ratio of the video stream according to the effective bandwidth ratio calculation rule based on the parameter characteristics of the data packet; wherein the communication protocol includes at least one of the RTMP communication protocol and the SRT communication protocol.

[0082] Specifically, in video streaming, the differences in the characteristics of different communication protocols place different requirements on how to calculate the effective bandwidth ratio. The RTMP communication protocol is based on the TCP protocol and does not have a native retransmission mechanism. Therefore, the streaming end needs to independently perform data statistics. The statistics include the total number of encoded output packets received by the sending queue, the cumulative number of successfully sent packets, and the cumulative number of lost packets. The SRT communication protocol is based on the UDP protocol and supports forward error correction and automatic retransmission mechanisms. Its data indicators use the internal statistical results of the protocol, specifically covering the total number of packets sent, the number of retransmitted packets, the number of lost packets, and the number of packets successfully sent for the first time.

[0083] Since the data statistics of these two communication protocols are completely different, this application has developed a method for determining the effective bandwidth ratio that matches different communication protocols. For the RTMP protocol, the calculation of the effective bandwidth ratio is based on the ratio of the number of successfully sent packets to the total number of packets independently counted by the streaming end; for the SRT protocol, the effective bandwidth ratio is calculated based on the ratio of the number of successfully sent packets for the first time to the total number of sent packets. This differentiated calculation method can accurately and efficiently determine the effective bandwidth ratio, thereby providing a reliable basis for the accurate generation of video stream parameters.

[0084] Specifically, in the RTMP communication protocol, the number of packets sent and received refers specifically to the number of packets received by the sending queue as encoded output, which is used as the basis for calculating the effective bandwidth ratio. Under the automatic retransmission mechanism of the SRT communication protocol, when a sent packet does not receive an ACK confirmation from the receiving end in a timely manner, the packet will be actively retransmitted. In the case of insufficient bandwidth or network transmission packet loss, some packets will be actively retransmitted, and these retransmitted packets will also be counted in the total number of packets sent. Therefore, the calculation of the effective bandwidth ratio of the SRT protocol needs to take into account the number of packets successfully sent for the first time to eliminate the impact of retransmitted packets on bandwidth occupancy and more accurately reflect the actual effective bandwidth usage.

[0085] In one embodiment, the effective bandwidth ratio of the video stream is determined based on the parameter characteristics of the data packet and the effective bandwidth ratio calculation rule, including: when the communication protocol is the RTMP communication protocol, determining the ratio of the number of successfully sent packets of the data packet and the number of sent packets as the effective bandwidth ratio of the video stream; when the communication protocol is the SRT communication protocol, after determining the ratio of the number of retransmitted packets of the data packet and the number of sent packets, determining the difference between the ratio and 1 as the effective bandwidth ratio of the video stream; the parameter characteristics include at least the number of successfully sent packets, the number of sent packets and the number of retransmitted packets.

[0086] Furthermore, the method also includes: obtaining the communication protocol; when the communication protocol is the SRT communication protocol, obtaining the current bit rate of the video stream and the maximum uplink bandwidth of the communication channel, and determining the ratio of the current bit rate and the maximum uplink bandwidth as the pre-generated effective bandwidth ratio threshold.

[0087] Specifically, when the communication protocol is the RTMP communication protocol, the pre-generated effective bandwidth ratio threshold is determined by configuring the downgrade threshold. When the communication protocol is the SRT communication protocol, the pre-generated effective bandwidth ratio threshold is dynamically determined based on the current bit rate and the maximum uplink bandwidth of the communication channel.

[0088] Specifically, when the communication protocol is the SRT communication protocol, the method for dynamically determining the pre-generated effective bandwidth ratio threshold includes: assuming the current bitrate is set to 5M and the SRT maximum uplink bandwidth is set to 8M, then the effective bandwidth ratio threshold is 5 / 8 = 62.5%; when the current bitrate is degraded to 3M, the effective bandwidth ratio threshold is adjusted to 3 / 8 = 37.5%. It should be understood that the determination and adjustment of the pre-generated effective bandwidth ratio threshold is mainly based on the number of retransmission packets, the total number of packets sent, the current actual set bitrate, and the SRT maximum uplink bandwidth.

[0089] In actual application scenarios, the determination of the effective bandwidth ratio threshold is also limited by other parameter characteristics that are not directly involved in the calculation, such as network type (mobile, Wi-Fi), RTT delay, etc., which are used to distinguish scenarios and assist in judgment.

[0090] In one embodiment, Figure 2 As shown, generating a target result based on a pre-generated effective bandwidth ratio threshold and the effective bandwidth ratio includes: obtaining the effective bandwidth ratio threshold corresponding to the communication protocol; determining a first result of the effective bandwidth ratio and the effective bandwidth ratio threshold, then monitoring the effective bandwidth ratio for a preset time period to determine a target effective bandwidth ratio; determining a second result of the target effective bandwidth ratio and the effective bandwidth ratio threshold; if the first result is the same as the second result, generating a target result; wherein the target result is upgraded or downgraded.

[0091] Specifically, monitoring the effective bandwidth ratio for a preset time to determine the target effective bandwidth ratio also includes: monitoring the effective bandwidth ratio for n windows to determine the target bandwidth ratio, where the monitoring time of each window is m seconds; the preset time is equal to n*m seconds; and determining the second result of the target effective bandwidth ratio and the effective bandwidth ratio threshold includes: obtaining the second result once after each window is monitored.

[0092] Specifically, if the monitoring duration of a window is set to 3 seconds and the number of windows is set to 5, the actual window duration is 3*5=15 seconds. That is, a target effective bandwidth ratio is determined every 3 seconds / per window. If the second result determined in each window is the same as the first result, the target result is considered to have been generated (i.e., the first result is determined to be the target result, and the upgrade or downgrade is performed according to the first result). However, if the second result determined in any window is inconsistent with the first result, the target result is not generated.

[0093] In one embodiment, the method further includes: assuming that the total number of windows is b, when it is determined in the bath window that the second result is different from the first result, then exiting the monitoring of the target effective bandwidth ratio, where a is less than b.

[0094] In one embodiment, the method further includes: when the first result and the second result are different, obtaining the effective bandwidth ratio of each window, determining the final effective bandwidth ratio after weighted calculation based on the effective bandwidth ratio of a preset duration, and determining whether to upgrade or downgrade based on the ratio of the final effective bandwidth ratio to a pre-generated effective bandwidth ratio threshold.

[0095] In one embodiment, target video stream parameters are generated based on the target result according to preset video stream parameter generation rules, including: if the target result is an upgrade, obtaining the current bit rate of the initial video stream parameters of the video stream, its initial bit rate and a pre-generated upgrade iteration threshold; dividing the difference between the current bit rate and the initial bit rate based on the pre-generated upgrade iteration threshold to determine the upgrade step; generating target video stream parameters based on the upgrade step and the initial video stream parameters; the initial video stream parameters include initial bit rate, initial frame rate, minimum frame rate, current frame rate and current bit rate.

[0096] In one embodiment, a fixed upgrade step strategy can be used to determine the upgrade step, and target video stream parameters can be generated based on the upgrade step and the initial video stream parameters; specifically, the upgrade step is determined by dividing the difference between the current bit rate and the initial bit rate based on the preset pre-generated upgrade iteration threshold, including: the number of divided upgrade steps is multiple, and the multiple upgrade steps constitute an arithmetic progression.

[0097] Specifically, assuming that the target result is an upgrade, and it is confirmed that the already downgraded video stream parameters of the video stream variables need to be upgraded (i.e., the current bit rate is less than the initial bit rate), technical personnel in this field hope to restore the initial bit rate through 4 upgrades based on the actual application scenario. Set the initial bit rate to 5M and the current bit rate to 2M, then divide the step size into 0.3M, 0.6M, 0.9M, and 1.2M. Use 0.3M for the first upgrade. After the upgrade, if it is confirmed that the upgrade can still be continued, use 0.6M to continue the upgrade, and so on... If it is found that the upgrade conditions are not met during the upgrade process, it is considered that the upgrade is over, and the upgrade step size will be re-divided for the next upgrade.

[0098] In one embodiment, target video stream parameters are generated based on the target result according to preset video stream parameter generation rules, including: if the target result is an upgrade, obtaining the current bit rate and the effective bandwidth ratio of the initial video stream parameters of the video stream; determining the upgrade step based on the current bit rate and the effective bandwidth ratio; generating target video stream parameters based on the upgrade step and the initial video stream parameters; the initial video stream parameters include initial bit rate, initial frame rate, minimum frame rate, current frame rate and current bit rate.

[0099] In one embodiment, the generating target video stream parameters based on the upgrade step and the initial video stream parameters includes: obtaining an iterative upgrade result after performing an iterative upgrade on the current bit rate based on the upgrade step; when the iterative upgrade result is an upgrade, generating video stream parameters based on the upgrade step and the initial video stream parameters; otherwise, stopping generating target video stream parameters.

[0100] In one embodiment, generating target video stream parameters based on the upgrade step size and the initial video stream parameters includes: generating a target frame rate based on the upgrade step size and the initial video stream parameters; and generating a target bit rate based on the target frame rate.

[0101] Specifically, different effective bandwidth ratios correspond to different upgrade step sizes. For example, if the initial bit rate is set to 5M and the effective bandwidth ratio exceeds 80%, the upgrade step size can be set to 5% of the initial bit rate. If the effective bandwidth ratio exceeds 90%, the upgrade step size can be set to 10% of the initial bit rate. If the effective bandwidth ratio exceeds 95%, the upgrade step size can be set to 15% of the initial bit rate. It should be understood that this application does not limit the specific value of the upgrade step size, and those skilled in the art can make reasonable choices based on actual application scenarios and actual needs. However, although this application does not impose mandatory requirements on the setting of the specific value of the upgrade step size, the upgrade step size is not set randomly, but is creatively selected by technical personnel based on the upgrade strategy expectations. For example, when the upgrade process is expected to be smoother, the upgrade step size can be set to be relatively smaller. When the upgrade process is expected to be completed in a shorter time, the upgrade step size can be set to be relatively larger.

[0102] In one embodiment, generating a target frame rate based on the upgrade step and the initial video stream parameters includes: determining a fifth parameter based on the ratio of the initial bit rate to the initial frame rate; determining a sixth parameter based on the sum of the current bit rate and the upgrade step; determining a seventh parameter based on the ratio of the sixth parameter to the fifth parameter; and determining the maximum value of the seventh parameter and the minimum frame rate as the target frame rate.

[0103] Furthermore, generating a target bit rate based on the target frame rate includes: determining an eighth parameter based on the target frame rate and the fifth parameter; and determining a minimum value of the sixth parameter and the eighth parameter as the target bit rate.

[0104] Specifically, assuming that the initial bit rate is configured to be 6M, the initial frame rate is 30 frames, the minimum frame rate is set to 15 frames, the current bit rate is 2M, the frame rate is 15 frames, and the current upgrade step is 0.3M, then after the upgrade, set_fps (target frame rate) = max(15, (2+0.3) / 0.2) = 15, set_bitrate (target bit rate) = min(2+0.3, set_fps*0.2) = 2.3.

[0105] Assume that the initial bit rate is 6M, the initial frame rate is 30 frames, the minimum frame rate is set to 15 frames, the current bit rate is 2M, the frame rate is 15 frames, and the current upgrade step is 1.2M. Then after the upgrade, set_fps (target frame rate) = max(15, (2+1.2) / 0.2) = 16, set_bitrate (target bit rate) = min(2+1.2, set_fps*0.2) = 3.2.

[0106] In one embodiment, target video stream parameters are generated corresponding to the target result according to preset video stream parameter generation rules, including: if the target result is downgrade, determining the current target result as the nth target result, and obtaining the n-1th target result; if the n-1th target result is upgrade, obtaining the n-2th video stream parameters generated corresponding to the n-2th target result; and determining the video stream parameters of the current target result as the n-2th video stream parameters.

[0107] That is, after the video stream parameters are upgraded and adjusted upward, if it is detected that the video stream parameters need to be downgraded, the video stream parameters before the upgrade are obtained, and the video stream parameters before the upgrade are directly determined to adjust the current video stream parameters.

[0108] Furthermore, generating target video stream parameters corresponding to the target result according to a preset video stream parameter generation rule also includes: if the n-1th target result is degradation, obtaining the effective bandwidth ratio of the video stream in m window periods and the maximum uplink bandwidth of the communication channel; obtaining a weighted average of the effective bandwidth ratios of m window periods, and determining the product of the weighted average and the maximum uplink bandwidth as the evaluation bit rate; obtaining the initial bit rate, initial frame rate and minimum frame rate of the video stream, and determining the target frame rate based on the initial bit rate, the initial frame rate, the minimum frame rate and the target bit rate; determining the target bit rate based on the initial bit rate and the evaluation bit rate; the target video stream parameters include the target bit rate and the target frame rate.

[0109] Specifically, when the bandwidth is insufficient, the data packets sent by the streaming end will not receive ACK in time or fail to be sent due to network congestion. At this time, these packets will be violently retransmitted until the data volume of the sent data packets reaches the set bandwidth. For example, the window period is 3, the window sliding step within the window period is 1, the maximum uplink bandwidth is set to 8M, and the results of the effective bandwidth ratio calculated 3 times are b1, b2, and b3, then t = (b1*1+b2*2+b3*3) / (1+2+3), and the evaluated bit rate (EBR) = t*8M; it should be understood that this application does not limit the size of the window period and the setting of the sliding step, and those skilled in the art can make reasonable choices based on actual application scenarios and actual application requirements.

[0110] Specifically, the initial bitrate is set to 6M, the initial frame rate is set to 30 frames, the minimum frame rate is set to 15 frames, and the degradation bitrate threshold is set to 3M. When the degradation bitrate is higher than 3M, the frame rate is set to set_fps = floor(EBR / (6 / 3)), and the bitrate is set to set_bitrate = set_fps*(6 / 3). When the degradation bitrate is lower than 3M, the target frame rate is set to 15 frames, and the target bitrate is set to the estimated bitrate. The degradation bitrate threshold is determined according to "(6 / 30*15)", EBR represents the estimated bitrate, and the degradation bitrate is the third parameter.

[0111] In one embodiment, an initial bit rate, an initial frame rate, and a minimum frame rate of the video stream are obtained, and a target frame rate is determined based on the initial bit rate, the initial frame rate, the minimum frame rate, and the target bit rate, including: determining a first parameter based on the product of the initial frame rate and the minimum frame rate; determining a second parameter based on the ratio of the initial bit rate to the first parameter; determining a third parameter based on the difference between the initial bit rate and the evaluated bit rate; when the third parameter is greater than the second parameter, determining the target frame rate based on the initial bit rate, the second parameter, and the evaluated bit rate; and when the third parameter is not greater than the second parameter, determining the minimum frame rate as the target frame rate.

[0112] In one embodiment, determining the target bit rate based on the initial bit rate and the evaluated bit rate includes: when the third parameter is greater than the second parameter, obtaining the target frame rate, and determining the target bit rate based on the target frame rate, the initial bit rate, and the evaluated bit rate; when the third parameter is not greater than the second parameter, determining the evaluated bit rate as the target bit rate.

[0113] In one embodiment, when the third parameter is greater than the second parameter, determining the target frame rate based on the initial bit rate, the second parameter and the evaluated bit rate includes: when the third parameter is greater than the second parameter, determining a fourth parameter based on the ratio of the initial bit rate to the second parameter; and determining the target frame rate based on the ratio of the evaluated bit rate to the fourth parameter.

[0114] It should be understood that the generation rules of the video stream parameters proposed in this embodiment (upgrading or downgrading the video stream parameters) belong to detection behavior, that is, under normal circumstances, when the bit rate is degraded, the effective bandwidth ratio will be restored to a standard that exceeds the degradation threshold (that is, the effective bandwidth ratio after degradation will be less than the pre-generated effective bandwidth ratio threshold); based on the pre-determined / configured effective bandwidth threshold for video stream parameter upgrade, when it is monitored that the current effective bandwidth ratio exceeds the pre-determined / configured effective bandwidth threshold, the upgrade process will be entered (that is, the process of upgrading and adjusting the video stream parameters). When generating video stream parameters in actual application scenarios, other indicators will also be referred to. For example, taking SRT as an example, it will refer to whether RTT is relatively low, whether the current bandwidth evaluated by SRT (generally small) exceeds the currently set bit rate, the SRT sending buffer accumulation size, and the number of data packets being sent. However, it should be understood that the effective bandwidth ratio is a necessary condition for the adjustment of video stream parameters, and other parameter characteristics are optional conditions.

[0115] In summary, the video stream parameter generation method proposed in this embodiment dynamically evaluates the network's carrying capacity and changing trends for the current streaming configuration by monitoring streaming transmission data in real time. Specifically, the system continuously analyzes the parameter characteristics of data packets during the streaming process (such as those related to key indicators such as packet loss rate and delay jitter) to accurately estimate the optimal streaming bitrate that the current network can stably support.

[0116] When network conditions change, the system prioritizes maintaining the minimum frame rate of the video stream, flexibly adjusting the bitrate based on this to ensure that the data volume of each frame remains within a reasonable range. This ensures that image clarity and detail are maintained to the greatest extent possible during network fluctuations, avoiding image quality degradation. When it detects a significant improvement in network quality and a high level of streaming stability, the system will employ a probing strategy to gradually restore the bitrate and frame rate, achieving a smooth upgrade from smooth to high-definition video quality and providing users with a superior viewing experience.

[0117] Example 2

[0118] Figure 3 The following is a processing flow of a method for adjusting video stream parameters provided by an embodiment of the present application. The method includes at least the following processing steps:

[0119] Step S201: Obtain the video stream variables to be adjusted and the target video stream parameters;

[0120] Step S202: determining the time point of the previous adjustment of the video stream parameters as the target time point, and if the time interval between the current time point and the target time point exceeds a preset time interval, adjusting the video stream parameters to be adjusted to the target video stream parameters;

[0121] The target video stream parameters are generated based on the video stream parameter generation method described in Example 1.

[0122] Specifically, the time point of the previous adjustment of the video stream parameters is determined to be the target time point. If the time interval between the current time point and the target time point exceeds the preset time interval, the video stream parameters to be adjusted are adjusted to the target video stream parameters; that is, after the video stream parameters are upgraded or downgraded, there will be a certain period of upgrade cooling and downgrade cooling to prevent the frame rate and bit rate from being updated too frequently. It should be understood that this application does not limit the length of the cooling time (i.e., the time interval as described above), and those skilled in the art can make a reasonable choice based on the actual application scenario and actual needs.

[0123] In one embodiment, the method further includes: if the time interval between the current time point and the target time point does not exceed a preset time interval, obtaining the target video stream parameters corresponding to the specific time point, and adjusting the video stream parameters to be adjusted to the target video stream parameters; wherein, the specific time point is later than the target time point, and the time interval between the specific time point and the target time point is not less than the preset time interval.

[0124] Specifically, if the target time point is set to 13:50 and the current time point is 14:50, then the specific time point is later than 13:50, or even later than 14:50; assuming the preset time interval is 3 hours, the specific time point is 16:30.

[0125] In one embodiment, in the process from the target time point to the specific time point, the video stream parameter generation method based on Example 1 can continuously generate target video stream parameters. When it is determined that the time has reached the specific time point, the target video stream parameters at the specific time point are obtained, and then the video stream variables to be adjusted are adjusted to the target video stream parameters according to the video stream parameter adjustment method.

[0126] In one embodiment, in the process from the target time point to the specific time point, the target video stream parameters may not be generated based on the video stream parameter generation method described in Example 1 (that is, when it is determined that the current time is still in the time cooling period, the target video stream parameters may not be generated, and the time interval from the target time point to the specific time point is defined as the time cooling period). When it is determined that the current time is no longer in the time cooling period, that is, the time has reached the specific time point, the target video stream parameters are generated based on the video stream parameter generation method described in Example 1. At this time, the target video stream parameters defined and generated are the target video stream parameters corresponding to the specific time point.

[0127] In one embodiment, before obtaining the video stream variables to be adjusted and the target video stream parameters, the method further includes: responding to a video stream parameter adjustment request. Specifically, obtaining the video stream variables to be adjusted and the target video stream parameters is performed after the video stream parameter adjustment request is received, thereby reducing system resource usage and avoiding adverse effects on system processing performance. The video stream parameter adjustment request can be generated after the target video stream parameters are generated.

[0128] Example 3

[0129] Figure 4 The following is a schematic diagram showing the structure of a video stream parameter generation device provided in an embodiment of the present application. The device includes at least the following units:

[0130] a first acquiring unit, configured to acquire a communication protocol for the communication channel, and acquire parameter characteristics of a data packet of the video stream corresponding to the communication protocol;

[0131] A first determining unit, configured to determine an effective bandwidth ratio of the video stream based on the communication protocol and parameter characteristics of the data packet;

[0132] The first generating unit is configured to generate a target result based on a pre-generated effective bandwidth ratio threshold and the effective bandwidth ratio; and is further configured to generate target video stream parameters corresponding to the target result according to a preset video stream parameter generation rule.

[0133] Example 4

[0134] like Figure 5 As shown, this embodiment provides a video stream parameter adjustment device, the device comprising:

[0135] A second acquiring unit is used to acquire the video stream variables to be adjusted and the target video stream parameters;

[0136] a second determining and adjusting unit, configured to determine a time point of a previous adjustment of the video stream parameters as a target time point, and adjust the video stream parameters to be adjusted to the target video stream parameters if a time interval between the current time point and the target time point exceeds a preset time interval;

[0137] The target video stream parameters are generated based on the video stream parameter generation device as described in the third embodiment.

[0138] Example 5

[0139] Based on the same inventive concept, an electronic device is also provided in an embodiment of the present application. The method corresponding to the electronic device may be the method for generating video stream parameters and the method for adjusting video stream parameters in the aforementioned embodiment, and the principle of solving the problem is similar to that of the method. The electronic device provided in an embodiment of the present application includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the methods and / or technical solutions of the aforementioned multiple embodiments of the present application.

[0140] The electronic device may be a user device, or a device formed by integrating a user device and a network device via a network, or an application running on the above device. The user device includes but is not limited to various terminal devices such as computers, mobile phones, tablets, smart watches, and bracelets. The network device includes but is not limited to network hosts, single network servers, multiple network server sets, or cloud computing-based computer collections, and can be used to implement some of the processing functions when setting an alarm. Here, the cloud is composed of a large number of hosts or network servers based on cloud computing (Cloud Computing). Cloud computing is a type of distributed computing, a virtual computer composed of a group of loosely coupled computers.

[0141] Figure 6 The structure of an electronic device suitable for implementing the method and / or technical solution in the embodiment of the present application is shown. The device 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 502 or the program loaded from the storage part 508 into the random access memory (RAM) 503. Various programs and data required for system operation are also stored in the RAM 503. The CPU 501, ROM 502 and RAM 503 are connected to each other through a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0142] The following components are connected to the I / O interface 505: an input section 506 including a keyboard, a mouse, a touch screen, a microphone, an infrared sensor, etc.; an output section 507 including devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), an LED display, an OLED display, etc., and a speaker; a storage section 508 including one or more computer-readable media such as a hard disk, an optical disk, a magnetic disk, a semiconductor memory, etc.; and a communication section 509 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet.

[0143] In particular, the methods and / or embodiments in the embodiments of the present application can be implemented as computer software programs. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes program code for executing the method shown in the flowchart. When the computer program is executed by the central processing unit (CPU) 501, the above-mentioned functions defined in the method of the present application are performed.

[0144] Example 6

[0145] Another embodiment of the present application further provides a computer-readable storage medium having computer program instructions stored thereon, which can be executed by a processor to implement the methods and / or technical solutions of any one or more embodiments of the present application.

[0146] Specifically, the present embodiment can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination thereof. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device.

[0147] A computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. This propagated data signal may take a variety of forms, including, but not limited to, electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0148] Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0149] Computer program code for performing the operations of the present application can be written in one or more programming languages, or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (e.g., through the Internet using an Internet service provider).

[0150] The flow chart or block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the equipment, methods and computer program products according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, program segment or a part of code, and the module, program segment or a part of code include one or more executable instructions for realizing the logical function of the specification. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented with a dedicated system for hardware that performs the function or operation of the specification, or can be implemented with a combination of dedicated hardware and computer instructions.

[0151] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described systems, devices and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0152] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or page components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0153] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0154] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0155] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) or a processor to perform some steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., various media that can store program code.

[0156] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

[0157] The relevant data involved in the embodiments of this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data strictly comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0158] Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices recited in a device claim may also be implemented by a single unit or device through software or hardware. Terms such as "first" and "second" are used to indicate names and do not imply any particular order.

Claims

1. A method for generating video stream parameters, characterized in that: Generating target video stream parameters using video stream variables for a corresponding video stream, the video stream being transmitted via a communication channel, the method comprising: Acquire a communication protocol for the communication channel, and acquire parameter characteristics of a data packet of the video stream corresponding to the communication protocol; Determining an effective bandwidth ratio of the video stream based on the communication protocol and parameter characteristics of the data packet; Generate a target result based on a pre-generated effective bandwidth ratio threshold and the effective bandwidth ratio; Generate target video stream parameters corresponding to the target result according to preset video stream parameter generation rules.

2. The method for generating video stream parameters according to claim 1, wherein: The determining the effective bandwidth proportion of the video stream based on the communication protocol and parameter characteristics of the data packet includes: Obtaining a calculation rule for effective bandwidth ratio corresponding to the communication protocol; Determining the effective bandwidth ratio of the video stream according to the effective bandwidth ratio calculation rule based on the parameter characteristics of the data packet; The communication protocol includes at least one of the RTMP communication protocol and the SRT communication protocol.

3. The method for generating video stream parameters according to claim 2, wherein: The determining, based on the parameter characteristics of the data packet and in accordance with the effective bandwidth ratio calculation rule, of the effective bandwidth ratio of the video stream includes: When the communication protocol is the RTMP communication protocol, determining the ratio of the number of successfully sent packets of the data packet and the number of sent packets as the effective bandwidth ratio of the video stream; When the communication protocol is the SRT communication protocol, after determining the ratio of the number of retransmitted packets of the data packet to the number of sent packets, determining the difference between the ratio and 1 as the effective bandwidth ratio of the video stream; The parameter characteristics include at least the number of successfully sent packets, the number of sent packets and the number of retransmitted packets.

4. The method for generating video stream parameters according to claim 1, wherein: The method further comprises: obtaining the communication protocol; When the communication protocol is the SRT communication protocol, the current bit rate of the video stream and the maximum uplink bandwidth of the communication channel are obtained, and the ratio of the current bit rate to the maximum uplink bandwidth is determined as the pre-generated effective bandwidth ratio threshold.

5. The method for generating video stream parameters according to claim 4, wherein: Generating a target result based on a pre-generated effective bandwidth ratio threshold and the effective bandwidth ratio includes: Obtaining an effective bandwidth ratio threshold corresponding to the communication protocol; Determine a first result of the effective bandwidth ratio and the effective bandwidth ratio threshold, and then monitor the effective bandwidth ratio for a preset time period to determine a target effective bandwidth ratio; Determine a second result of the target effective bandwidth ratio and the effective bandwidth ratio threshold; If the first result is the same as the second result, generating a target result; Wherein, the target result is upgraded or downgraded.

6. The method for generating video stream parameters according to claim 5, wherein: Generating target video stream parameters based on the target result according to preset video stream parameter generation rules, including: If the target result is an upgrade, obtaining the current bit rate of the initial video stream parameters of the video stream, its initial bit rate, and a pre-generated upgrade iteration threshold; Determining an upgrade step by dividing a difference between the current bit rate and the initial bit rate based on the pre-generated upgrade iteration threshold; Generate target video stream parameters based on the upgrade step size and the initial video stream parameters; The initial video stream parameters include initial bit rate, initial frame rate, minimum frame rate, current frame rate and current bit rate.

7. The method for generating video stream parameters according to claim 5, wherein: Generating target video stream parameters based on the target result according to preset video stream parameter generation rules, including: If the target result is an upgrade, obtaining the current bit rate of the initial video stream parameters of the video stream and the effective bandwidth ratio; Determining an upgrade step size based on the current bit rate and the effective bandwidth ratio; Generate target video stream parameters based on the upgrade step size and the initial video stream parameters; The initial video stream parameters include initial bit rate, initial frame rate, minimum frame rate, current frame rate and current bit rate.

8. The method for generating video stream parameters according to claim 7, wherein: The generating target video stream parameters based on the upgrade step size and the initial video stream parameters includes: Performing an iterative upgrade on the current bit rate based on the upgrade step size and obtaining an iterative upgrade result; When the iterative upgrade result is an upgrade, generating video stream parameters based on the upgrade step size and the initial video stream parameters; Otherwise, stop generating the target video stream parameters.

9. The method for generating video stream parameters according to claims 6 to 7, characterized in that: Generating target video stream parameters based on the upgrade step size and the initial video stream parameters includes: Generating a target frame rate based on the upgrade step size and the initial video stream parameters; A target bit rate is generated based on the target frame rate.

10. The method for generating video stream parameters according to claim 9, wherein: Generating a target frame rate based on the upgrade step size and the initial video stream parameters includes: determining a fifth parameter based on a ratio of the initial bit rate to the initial frame rate; Based on the sum of the current bit rate and the upgrade step size as a sixth parameter; determining a seventh parameter based on a ratio of the sixth parameter to the fifth parameter; The maximum value of the seventh parameter and the minimum frame rate is determined to be the target frame rate.

11. The method for generating video stream parameters according to claim 10, wherein: Generating a target bit rate based on the target frame rate includes: determining an eighth parameter based on the target frame rate and the fifth parameter; The minimum value of the sixth parameter and the eighth parameter is determined to be the target bit rate.

12. The method for generating video stream parameters according to claim 5, wherein: Generating target video stream parameters corresponding to the target result according to a preset video stream parameter generation rule includes: If the target result is downgraded, determine the current target result as the nth target result, and obtain the n-1th target result; If the n-1th target result is an upgrade, obtaining the n-2th video stream parameter generated corresponding to the n-2th target result; The video stream parameter of the current target result is determined to be the n-2th video stream parameter.

13. The method for generating video stream parameters according to claim 12, wherein: Generating target video stream parameters corresponding to the target result according to a preset video stream parameter generation rule also includes: If the target result for the (n-1)th time is degradation, obtaining the effective bandwidth ratio of the video stream in the m window periods and the maximum uplink bandwidth of the communication channel; Obtain a weighted average of the effective bandwidth proportions of the m window periods, and determine the product of the weighted average and the maximum uplink bandwidth as the evaluation bit rate; Obtaining an initial bit rate, an initial frame rate, and a minimum frame rate of the video stream, and determining a target frame rate based on the initial bit rate, the initial frame rate, the minimum frame rate, and the target bit rate; determining a target bit rate based on the initial bit rate and the estimated bit rate; The target video stream parameters include a target bit rate and a target frame rate.

14. The method for generating video stream parameters according to claim 13, wherein: Obtaining an initial bit rate, an initial frame rate, and a minimum frame rate of the video stream, and determining a target frame rate based on the initial bit rate, the initial frame rate, the minimum frame rate, and the target bit rate, including: determining a first parameter based on a product of the initial frame rate and the minimum frame rate; determining a second parameter based on a ratio of the initial bit rate to the first parameter; determining a third parameter based on a difference between the initial bit rate and the estimated bit rate; When the third parameter is greater than the second parameter, determining the target frame rate based on the initial bit rate, the second parameter, and the evaluated bit rate; When the third parameter is not greater than the second parameter, the minimum frame rate is determined to be the target frame rate.

15. The method for generating video stream parameters according to claim 14, wherein: Determining a target bit rate based on the initial bit rate and the estimated bit rate includes: When the third parameter is greater than the second parameter, the target frame rate is obtained, and a target bit rate is determined based on the target frame rate, the initial bit rate, and the evaluated bit rate; When the third parameter is not greater than the second parameter, the estimated bit rate is determined to be the target bit rate.

16. The method for generating video stream parameters according to claim 15, wherein: When the third parameter is greater than the second parameter, determining the target frame rate based on the initial bit rate, the second parameter, and the evaluated bit rate includes: When the third parameter is greater than the second parameter, determining a fourth parameter based on a ratio of the initial bit rate to the second parameter; The target frame rate is determined based on a ratio of the estimated bit rate and the fourth parameter.

17. A method for adjusting video stream parameters, characterized in that: The method comprises: Get the video stream variables to be adjusted and the target video stream parameters; Determining a time point of a previous adjustment of a video stream parameter as a target time point, and if a time interval between a current time point and the target time point exceeds a preset time interval, adjusting the video stream parameter to be adjusted to the target video stream parameter; The target video stream parameters are generated based on the video stream parameter generation method according to any one of claims 1 to 16.

18. The method for adjusting video stream parameters according to claim 17, wherein: The method further comprises: If the time interval between the current time point and the target time point does not exceed the preset time interval, obtaining the target video stream parameters corresponding to the specific time point, and adjusting the video stream parameters to be adjusted to the target video stream parameters; The specific time point is later than the target time point, and the time interval between the specific time point and the target time point is not less than the preset time interval.

19. A video stream parameter generation device, characterized in that: Generating target video stream parameters using video stream variables for a corresponding video stream, the video stream being transmitted via a communication channel, the apparatus comprising: a first acquiring unit, configured to acquire a communication protocol for the communication channel, and acquire parameter characteristics of a data packet of the video stream corresponding to the communication protocol; A first determining unit, configured to determine an effective bandwidth ratio of the video stream based on the communication protocol and parameter characteristics of the data packet; The first generating unit is configured to generate a target result based on a pre-generated effective bandwidth ratio threshold and the effective bandwidth ratio; and is further configured to generate target video stream parameters corresponding to the target result according to a preset video stream parameter generation rule.

20. A video stream parameter adjustment device, characterized in that: The device comprises: A second acquiring unit is used to acquire the video stream variables to be adjusted and the target video stream parameters; a second determining and adjusting unit, configured to determine a time point of a previous adjustment of the video stream parameters as a target time point, and adjust the video stream parameters to be adjusted to the target video stream parameters if a time interval between the current time point and the target time point exceeds a preset time interval; Wherein, the target video stream parameters are generated based on the video stream parameter generation device described in claim 19.

21. An electronic device, comprising: at least one processor; as well as A memory communicatively connected to the at least one processor; characterized in that The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 18.

22. A computer readable medium having computer program instructions stored thereon, characterized in that: The computer program instructions are executable by a processor to implement the method according to any one of claims 1 to 18.

23. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 18 is implemented.