Video data playing method and device, computer equipment and readable storage medium

By dynamically adjusting the video resolution and bit rate, the problem of poor user experience of RTSP streaming media transmission in complex network environments is solved, and efficient bandwidth utilization and smooth video playback are achieved.

CN119484896APending Publication Date: 2025-02-18CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411781099.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-05
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

The existing RTSP streaming media transmission technology is difficult to dynamically adjust the video resolution and code rate in complex network environments, resulting in poor user experience, low bandwidth utilization efficiency, and lack of real-time bandwidth detection and adjustment mechanisms.

Method used

By receiving media stream information sent by the server, identifying the connection parameter information corresponding to multiple video resolutions, obtaining the current network parameters, and dynamically adjusting the video resolution and code rate according to the network conditions to realize video transmission matching the current network parameters.

Benefits of technology

It realizes automatic adjustment of video resolution and code rate under different network conditions, improves the smoothness and continuity of video playback, enhances the robustness of the playback system, and improves the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119484896A_ABST
    Figure CN119484896A_ABST
Patent Text Reader

Abstract

The invention relates to a video data playing method and device, computer equipment and a readable storage medium. The method comprises the following steps: receiving media stream information sent by a server; if the connection parameter information corresponding to the plurality of video resolutions respectively is identified from the media stream information, acquiring a current network parameter; sending an establishment request carrying the current network parameter to a server, so that the server selects a target video resolution based on the current network parameter and establishes a connection with the client based on the connection parameter information corresponding to the target video resolution; receiving a data packet sent by the server through the established connection, wherein the resolution of video data in the data packet is the same as the resolution of the target video; and analyzing the video data in the data packet and playing a video corresponding to the video data. By adopting the method, the video resolution of the real-time video can be dynamically adjusted according to the network condition, so that the video playing quality is improved.
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 and apparatus for playing video data, a computer device, a computer-readable storage medium, and a computer program product. Background Art

[0002] With the development of computer technology, video playback technology has emerged. Through this technology, users can watch videos on different types of terminals (such as various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices). The playback of videos is determined by the network environment where the terminal is located. However, the network environment is complex and unstable, so how to play videos under various network conditions is an urgent problem to be solved. Summary of the invention

[0003] Based on this, it is necessary to provide a method, device, computer equipment, computer-readable storage medium and computer program product for playing video data that can dynamically adjust the video resolution of real-time video according to network conditions to address the above technical problems.

[0004] In a first aspect, the present application provides a method for playing video data, comprising:

[0005] Receive media stream information sent by the server;

[0006] If connection parameter information corresponding to multiple video resolutions is identified from the media stream information, the current network parameters are obtained;

[0007] Sending a connection request carrying current network parameters to the server, so that the server selects a target video resolution based on the current network parameters and establishes a connection with the client based on connection parameter information corresponding to the target video resolution;

[0008] receiving a data packet sent by the server through the established connection, wherein the resolution of the video data in the data packet is the same as the target video resolution;

[0009] Parse the video data in the data packet and play the video corresponding to the video data.

[0010] In one embodiment, the step of obtaining current network parameters includes:

[0011] Obtaining data packet information of a target data packet within a preset time period before the current moment;

[0012] Obtaining a data transmission amount within a preset time period based on the data packet information, and obtaining a data transmission time of a target data packet within the preset time period based on the data packet information;

[0013] The current network parameters corresponding to the current moment are obtained based on the ratio of the data transmission amount to the data transmission time.

[0014] In one embodiment, the step of obtaining the data transmission time of the target data packet within a preset time period based on the data packet information includes:

[0015] Obtaining a first receiving time of receiving a first target data packet within a preset time period;

[0016] Obtaining a second receiving time of the last target data packet received within a preset time period;

[0017] The data transmission time is obtained based on the difference between the first receiving time and the second receiving time.

[0018] In one embodiment, the step of obtaining current network parameters includes:

[0019] Obtaining data packet information of a target data packet within a preset time period before the current moment;

[0020] Based on the data packet information, the round trip delay and packet loss rate of the data packet in the preset time period are obtained;

[0021] The current network parameters at the current moment are obtained based on the round-trip delay and packet loss rate of the data packet.

[0022] In one embodiment, the method further comprises:

[0023] Monitor network parameters;

[0024] If it is monitored that the current network parameters have changed and the change meets the target condition, the played timestamp of the currently played audio is obtained, and a setup request carrying the changed network parameters is sent to the server, so that the server selects the target video resolution based on the changed network parameters and establishes a connection with the client based on the connection parameter information corresponding to the target video resolution; receives a data packet sent by the server through the established connection; parses the video data in the data packet and plays the video corresponding to the video data starting from the played timestamp;

[0025] If it is detected that the change of the current network parameters does not meet the target condition, the data packets generated by the server continue to be received based on the current target video stream session.

[0026] In one embodiment, the step of monitoring that the current network parameter changes and the change meets the target condition further includes:

[0027] Obtaining a resolution matching the changed network parameter based on connection parameter information corresponding to the plurality of video resolutions, wherein the parameter information includes a correspondence between the resolution and the network parameter;

[0028] If the resolution corresponding to the changed network parameters is inconsistent with the resolution corresponding to the current network parameters, it is determined that the change meets the target condition.

[0029] In a second aspect, the present application further provides a video data playback device, comprising:

[0030] A pre-configuration module, used for receiving media stream information sent by a server;

[0031] A network module, configured to obtain current network parameters if connection parameter information corresponding to a plurality of video resolutions is identified from the media stream information;

[0032] A connection module, used to send a connection request carrying current network parameters to a server, so that the server selects a target video resolution based on the current network parameters and establishes a connection with the client based on connection parameter information corresponding to the target video resolution;

[0033] An interaction module, used for receiving a data packet sent by the server through the established connection, wherein the resolution of the video data in the data packet is the same as the target video resolution;

[0034] The playing module is used to parse the video data in the data packet and play the video corresponding to the video data.

[0035] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0036] Receive media stream information sent by the server;

[0037] If connection parameter information corresponding to multiple video resolutions is identified from the media stream information, the current network parameters are obtained;

[0038] Sending a connection request carrying current network parameters to the server, so that the server selects a target video resolution based on the current network parameters and establishes a connection with the client based on connection parameter information corresponding to the target video resolution;

[0039] receiving a data packet sent by the server through the established connection, wherein the resolution of the video data in the data packet is the same as the target video resolution;

[0040] Parse the video data in the data packet and play the video corresponding to the video data.

[0041] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the following steps are implemented:

[0042] Receive media stream information sent by the server;

[0043] If connection parameter information corresponding to multiple video resolutions is identified from the media stream information, the current network parameters are obtained;

[0044] Sending a connection request carrying current network parameters to the server, so that the server selects a target video resolution based on the current network parameters and establishes a connection with the client based on connection parameter information corresponding to the target video resolution;

[0045] receiving a data packet sent by the server through the established connection, wherein the resolution of the video data in the data packet is the same as the target video resolution;

[0046] Parse the video data in the data packet and play the video corresponding to the video data.

[0047] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:

[0048] Receive media stream information sent by the server;

[0049] If connection parameter information corresponding to multiple video resolutions is identified from the media stream information, the current network parameters are obtained;

[0050] Sending a connection request carrying current network parameters to the server, so that the server selects a target video resolution based on the current network parameters and establishes a connection with the client based on connection parameter information corresponding to the target video resolution;

[0051] receiving a data packet sent by the server through the established connection, wherein the resolution of the video data in the data packet is the same as the target video resolution;

[0052] Parse the video data in the data packet and play the video corresponding to the video data.

[0053] The above-mentioned video data playback method, device, computer equipment, computer-readable storage medium and computer program product, the client receives the media stream information sent by the server, if the client identifies the connection parameter information corresponding to multiple video resolutions from the media stream, it means that the server supports the transmission of multiple video data with different resolutions. In this way, the client can play the video with the adapted resolution based on the network condition to make full use of the network bandwidth. In order to obtain the network condition of the client, the client can obtain the current network parameters, send the establishment request carrying the current network parameters to the server, so that the server selects the target video resolution based on the current network parameters and establishes a connection with the client based on the connection parameter information corresponding to the target video resolution, the established connection is used to transmit the video with the target video resolution, the client receives the data packet sent by the server through the established connection, and then parses the data packet to obtain the video data and plays the video corresponding to the video data, because the data packet encapsulates the video data of the target video resolution, so the resolution of the played video is the target video resolution, so that the video with the video resolution adapted to the current network condition can be broadcast, the video resolution can be automatically increased when the network condition is good, and high-definition picture quality can be provided, and the resolution can be automatically reduced when the network condition is poor, to ensure the continuity and smoothness of the video playback, thereby improving the robustness of the playback system. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0055] FIG1 is a diagram showing an application environment of a method for playing video data in one embodiment;

[0056] FIG2 is a schematic diagram of a flow chart of a method for playing video data in one embodiment;

[0057] FIG3 is a schematic diagram of the interaction logic between a client and a server in one embodiment;

[0058] FIG4 is a structural block diagram of a device for playing video data in one embodiment;

[0059] FIG5 is a diagram showing the internal structure of a computer device in one embodiment;

[0060] FIG. 6 is a diagram showing the internal structure of a computer device in another embodiment. DETAILED DESCRIPTION

[0061] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0062] In the field of streaming media transmission, with the rapid development of Internet technology and the gradual popularization of bandwidth resources, the transmission and playback of video content through the network has become an important part of modern life. However, the complexity and instability of the network environment pose a severe challenge to the transmission quality of streaming media. Especially in the application of RTSP technology, how to achieve a smooth viewing experience under various network conditions is still a problem that the industry needs to solve urgently.

[0063] Currently, RTSP is widely used in real-time streaming media transmission, especially in video surveillance, video conferencing and online live broadcasting. As an application layer protocol, RTSP is mainly used to establish and control multimedia sessions. It is often used in conjunction with RTP and RTCP to achieve the transmission and quality control of media data.

[0064] In actual applications, RTSP clients and servers manage sessions through a series of control commands (such as PLAY, PAUSE, TEARDOWN, etc.), and transmit actual video and audio data through RTP. However, the traditional RTSP implementation has the following major problems and shortcomings:

[0065] 1. Fixed bit rate and resolution:

[0066] Existing RTSP streaming media transmission usually uses fixed bit rate and resolution for encoding and transmission, and lacks the ability to dynamically adapt to network conditions. When the network condition is good, users can enjoy a high-quality video experience; but when the network condition deteriorates, due to the lack of a dynamic adjustment mechanism, the user experience will be significantly reduced, and problems such as freezes, blurred images, or playback interruptions will occur.

[0067] 2. Low bandwidth utilization efficiency:

[0068] In the fixed bit rate and resolution mode, the network bandwidth utilization efficiency is low. When the network bandwidth is sufficient, the excess bandwidth cannot be fully utilized to improve the video quality; and when the network bandwidth is tight, the bit rate cannot be effectively reduced to ensure the continuous playback of the video.

[0069] 3. Lack of real-time bandwidth detection and adjustment mechanism:

[0070] The existing RTSP implementation lacks real-time bandwidth detection and adaptive adjustment mechanisms, and cannot dynamically adjust according to real-time changes in network bandwidth. This results in poor robustness of video transmission and poor user experience in complex network environments.

[0071] Based on the above technical status and the defects of existing products, there are mainly the following practical problems:

[0072] 1. Poor network adaptability:

[0073] Traditional RTSP streaming media transmission has poor adaptability to the network environment and cannot make real-time adjustments based on changes in network bandwidth, resulting in poor user experience when the network fluctuates greatly.

[0074] 2. Unstable playback experience:

[0075] When network conditions are not ideal, video streams with fixed bitrates and resolutions often experience problems such as playback interruptions and long buffering times, and cannot provide a stable and smooth viewing experience.

[0076] 3. Waste of resources and quality loss:

[0077] The transmission mode with fixed bit rate and resolution cannot be optimized according to the actual bandwidth utilization, resulting in the waste of bandwidth resources or loss of video quality.

[0078] In summary, the existing RTSP technology faces many problems and defects in the process of streaming media transmission, such as poor network adaptability, unstable playback experience, resource waste and quality loss. In order to solve or improve the above problems, the present application proposes the following embodiments.

[0079] The video data playback method provided in the embodiment of the present application can be applied to the application environment shown in Figure 1. Among them, the client 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. The client 102 communicates with the server 104 based on the RTSP transmission protocol. RTSP (Real-Time Streaming Protocol) is a network protocol used to control the real-time transmission of multimedia data streams on a streaming media server, and aims to provide a mechanism for controlling media stream transmission. The client 102 can send a request (such as a DESCRIBE request) to the server to obtain the description information of the media stream, and in response to the acquisition request, the server sends the media stream information to the client. Among them, the media stream information is usually stored in an SDP (Session Description Protocol) file. The SDP file is provided in a text format and contains detailed information about the media session, such as media type, format, transmission address and time. The detailed information of the media session is parameter information used to establish a media session connection. If the media stream information includes connection parameter information corresponding to multiple video resolutions, that is, the server 104 supports video transmission with multiple different resolutions, the client 102 can obtain the current network parameters to determine the target video resolution and the corresponding connection parameter information based on the current network status. After the client 102 obtains the current network parameters, it can send the current network parameters to the server 104 through a setup request (SETUP request), so that the server establishes a session connection with the client in response to the setup request. After the session is established, the resolution corresponding to the video data in the data packet transmitted through the session connection is the target resolution, so the resolution of the video corresponding to the video data played by the client 102 matches the current network parameters. In this way, the resolution and bit rate of the played video are automatically adjusted based on the network status. Among them, the terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car devices, projection devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The head mounted device may be a virtual reality (VR) device, an augmented reality (AR) device, smart glasses, etc. The server 104 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.

[0080] In an exemplary embodiment, as shown in FIG2 , a method for playing video data is provided, which is described by taking the method applied to the client in FIG1 as an example, and includes the following steps S202 to S210. Among them:

[0081] Step S202: receiving media stream information sent by the server.

[0082] The client and server in the embodiment of the present application control the transmitted media stream based on the RTSP transmission protocol. Among them, through the RTSP transmission protocol, the client can request the server to start or stop sending the media stream; the client can control the playback of the media stream, including play, pause, fast forward and fast rewind, etc.; the client can select different media streams, such as different video quality or audio tracks; the client can request a specific time point or media segment; and the continuous interaction between the client and the server can be managed. Specifically, the RTSP transmission protocol establishes a session and initializes the media stream transmission parameters through the SETUP request. The RTSP transmission protocol starts playing the media stream through the PLAY request. The RTSP transmission protocol pauses the playing media stream through the PAUSE request. The RTSP transmission protocol terminates the media stream transmission and releases the session resources through the TEARDOWN request. The RTSP transmission protocol starts recording the media stream through the RECORD request. The RTSP transmission protocol sends description information from the client to the server through the ANNOUNCE request. The RTSP transmission protocol queries the parameters of the media stream through the GET_PARAMETER request. The RTSP transmission protocol sets the parameters of the media stream through the SET_PARAMETER request. The RTSP transport protocol transmits the description information of the media stream through the DESCRIBE request. The description information of the media stream is used to describe the multimedia session. The description information of the media stream includes, for example, the media type, format, transmission address and time.

[0083] The media stream information of this step is the description information of the above media stream, which is included in the SDP file and sent from the server to the client. The media stream information can be used to establish a session connection between the client and the server. A session connection is a logical connection established in network communication to maintain a continuous communication state between two or more network entities (such as a client and a server). The session connections corresponding to different video resolutions may be different. That is, when the video resolution changes due to changes in network parameters, the corresponding session connection also switches accordingly.

[0084] Step S204: if connection parameter information corresponding to a plurality of video resolutions is identified from the media stream information, the current network parameters are obtained.

[0085] Existing RTSP streaming media transmission usually uses fixed bit rate and resolution for encoding and transmission. In this case, the media stream information sent by the server to the client only includes connection parameter information corresponding to one video resolution. This can easily lead to problems such as the video not being able to play in a higher definition when the network condition is good, and the video being stuck, blurred, or interrupted when the network condition is poor.

[0086] In this embodiment, in order to enable the video played by the client to overcome the above defects, the media stream information sent by the server to the client includes connection parameter information corresponding to multiple video resolutions. It can be understood that the server has pre-stored video data corresponding to each video resolution and bit rate, that is, the server supports sending video data with different resolutions and bit rates to the client. In this case, the resolution of the video played on the client can be switched. In order to improve the user experience, the switching between videos with different resolutions is determined based on the network conditions. Therefore, the client needs to obtain the current network parameters. Among them, network parameters are used to describe various metrics and technical characteristics of network performance and configuration. For example, network bandwidth, delay, throughput, packet loss rate, network capacity, etc. Among them, network bandwidth: the ability of the network to transmit data in unit time. Delay: the time required for data to be transmitted from the source to the destination, including propagation delay, processing delay, queuing delay and transmission delay. Throughput: the rate at which the network can actually transmit data. Packet loss rate: the ratio of data packets lost during transmission. In the case of network congestion or poor quality, the packet loss rate will increase. Network capacity: the maximum amount of data that can be processed when the network is not congested.

[0087] Optionally, the step of obtaining current network parameters includes: obtaining data packet information of a target data packet within a preset time period before the current moment; obtaining a data transmission volume within the preset time period based on the data packet information, and obtaining a data transmission time of the target data packet within the preset time period based on the data packet information; and obtaining the current network parameters corresponding to the current moment based on a ratio of the data transmission volume to the data transmission time.

[0088] Optionally, the data transmission time may be determined by the difference between the reception time of the first target data packet and the reception time of the last target data packet received by the client within the preset time period. The data volume may be determined by the size of the data packets received by the client within the preset time period.

[0089] Step S206: Send a connection request carrying the current network parameters to the server, so that the server selects a target video resolution based on the current network parameters and establishes a connection with the client based on the connection parameter information corresponding to the target video resolution.

[0090] The target video resolution is matched with the current network parameters. In the server, the correspondence between the current network parameters and the target video resolution can be stored. For example, the current network parameters are based on the network bandwidth. When the network bandwidth is less than or equal to 2000kbps, the target video resolution is determined to be 480p; when the network bandwidth is greater than 2000kbps and less than or equal to 4000kbps, the target video resolution is determined to be 720p; when the network bandwidth is greater than 4000kbps, the target video resolution is determined to be 1080p.

[0091] Exemplarily, the client analyzes its current network parameters, for example, the current network parameters can be determined by the situation of receiving data packets at the client. If the amount of data packets received by the client within a certain period of time is small, it means that the current network condition is poor. If the amount of data packets received by the client within a certain period of time is large, it means that the current network condition is good. After that, the client needs to send the current network parameters to the server so that the server can obtain the current network condition of the client, so as to facilitate the subsequent sending of data packets matching the network condition to the client. Optionally, the client can send a setup request carrying the current network parameters to the server. The setup request is, for example, a SETUP request in the RTSP transmission protocol. After that, the server obtains the current network parameters and determines the target video resolution matching the current network parameters from multiple video resolutions. In order to be able to transmit the data packet to the client, the server needs to establish a connection with the client. The connection established between the server and the client is based on the connection parameter information corresponding to the target video resolution matching the current network parameters, so that video data at the target video resolution can be transmitted through the connection.

[0092] Step S208: receiving a data packet sent by the server through the established connection.

[0093] Step S210, parsing the video data in the data packet and playing the video corresponding to the video data.

[0094] The resolution of the video data in the data packet is the same as the target video resolution. After the server and the client establish a connection, the server can transmit the video data corresponding to the target video resolution to the client through the connection. The client can also receive the data packet corresponding to the target video resolution sent by the server through the established connection. The resolution of the video corresponding to the video data in the data packet is the target video resolution.

[0095] Optionally, for a video, the server stores video data corresponding to each video resolution of the video. When the network parameters change, causing the resolution of the video played on the client to change, the server sends all the video data of the video at the target video resolution to the client. The client determines the time to continue playing by recording the length of time the video has been played or the time point when the video is being played when the network parameters change. Optionally, when the network parameters change, the client can also carry the length of time the video has been played or the time point when the video is being played in the request sent to the server, so that the server starts transmitting the video data corresponding to the changed target video resolution after the length of time the video has been played.

[0096] In the above-mentioned video data playback method, the client receives the media stream information sent by the server. If the client identifies the connection parameter information corresponding to multiple video resolutions from the media stream, it means that the server supports the transmission of multiple video data with different resolutions. In this way, the client can play videos with adapted resolutions based on the network conditions to make full use of the network bandwidth. In order to obtain the network conditions in which the client is located, the client can obtain the current network parameters and send a setup request carrying the current network parameters to the server, so that the server selects the target video resolution based on the current network parameters and establishes a connection with the client based on the connection parameter information corresponding to the target video resolution. The established connection is used to transmit the video with the target video resolution. The client receives the data packet sent by the server through the established connection, and then parses the data packet to obtain the video data and plays the video corresponding to the video data. Since the data packet encapsulates the video data of the target video resolution, the resolution of the played video is the target video resolution. In this way, the video with the video resolution adapted to the current network conditions can be broadcast, and the video resolution can be automatically increased when the network conditions are good to provide high-definition picture quality, and the resolution can be automatically reduced when the network conditions are poor, so as to ensure the smoothness of real-time video transmission and the continuity and smoothness of video playback, thereby improving the robustness of the playback system.

[0097] In an exemplary embodiment, obtaining the current network parameters can be achieved through the following steps: obtaining data packet information of a target data packet within a preset time period before the current moment; obtaining the data transmission volume within the preset time period based on the data packet information, and obtaining the data transmission time of the target data packet within the preset time period based on the data packet information; and obtaining the current network parameters corresponding to the current moment based on the ratio of the data transmission volume to the data transmission time.

[0098] The target data packet is a data packet sent from the server and received by the client within a period of time before the current moment. The number of target data packets within the preset time period may be more than one. Data packet information refers to the size of the data packet and the time when the client receives the data packet. Data transmission volume refers to the total amount of data transmitted through the communication connection between the client and the server within the preset time period. Data transmission time refers to the time taken to actually transmit all target data packets within the preset time period.

[0099] Optionally, the data transmission time can be obtained by the following steps: obtaining a first receiving time when the first target data packet is received within a preset time period; obtaining a second receiving time when the last target data packet is received within a preset time period; and obtaining the data transmission time based on the difference between the first receiving time and the second receiving time. , the second receiving time is , the data transmission time is .

[0100] For example, when the current network parameter is the network bandwidth, the network bandwidth is obtained based on the obtained data packet information through the following steps.

[0101] (1) Record in time The received The data size of an RTP packet is (Unit: Byte). Then in the time window The total amount of data received for: .in, t i ∈[t-T,t] For the time window The number of RTP packets received within .

[0102] (2) Calculate the total transmission time within the time window:

[0103] Assume the total transmission time in the time window is , .in and They are the timestamps of the first and last RTP packets received in the time window, respectively.

[0104] (3) Estimated bandwidth:

[0105] The bandwidth B is estimated by: (Unit: bps). You can also convert the bandwidth unit to kbps.

[0106] In this embodiment, the current network parameters of the client are obtained by analyzing the specific conditions of the data packets received by the client within a certain period of time before the current moment, so that the current network status can be accurately obtained.

[0107] In addition to the above-mentioned network bandwidth, the current network parameters can also be the quality score of the network. In this case, obtaining the current network parameters can be achieved by the following steps: obtaining the data packet information of the target data packet within a preset time period before the current moment; obtaining the data packet round-trip delay and packet loss rate in the preset time period based on the data packet information; obtaining the current network parameters at the current moment based on the data packet round-trip delay and packet loss rate.

[0108] Through the above steps, the client can evaluate the current network by analyzing the round-trip delay and packet loss rate of data packets over a period of time, thereby obtaining the quality score of the current network. The server can then select the corresponding target video resolution for networks with different quality scores, so that a comprehensive analysis of the client's network can be performed to obtain a video resolution and bit rate that is more suitable for the current network.

[0109] In order to achieve real-time automatic adaptation of the resolution of the video being played to the current network status, the client can monitor the network environment in which it is located to understand the current network status of the client in real time. Therefore, the client can monitor the network parameters; if it is detected that the current network parameters have changed and the change meets the target conditions, the played timestamp of the currently played audio is obtained, and the establishment request carrying the changed network parameters is sent to the server, so that the server selects the target video resolution based on the changed network parameters and establishes a connection with the client based on the connection parameter information corresponding to the target video resolution; receives the data packet sent by the server through the established connection; parses the video data in the data packet and plays the video corresponding to the video data from the played timestamp; if it is detected that the change of the current network parameters does not meet the target conditions, the data packet generated by the server continues to be received based on the current target video stream session.

[0110] Optionally, a resolution matching the changed network parameters is obtained based on the connection parameter information corresponding to a plurality of video resolutions, and the connection parameter information corresponding to each video resolution includes the correspondence between the resolution supported by the video and the network parameters; if the resolution corresponding to the changed network parameters is inconsistent with the resolution corresponding to the current network parameters, it is determined that the change meets the target conditions. Since the bit rate corresponding to each video resolution is stored in the media stream information, the supported network bandwidth corresponding to each video resolution can be obtained. Therefore, when the client detects that the network parameters have changed, it can analyze whether the resolution corresponding to the changed network parameters is different from the resolution corresponding to the current network parameters. If different, the client requests the video data corresponding to the changed video resolution from the server. If the same, the video continues to be played at the video resolution. This can reduce the frequent switching of video clarity due to slight changes in the network, improve the quality of the played video, and enhance the user's experience of watching videos.

[0111] In this embodiment, the client monitors the network parameters in which it is located. If the network parameters change and meet the target conditions, that is, the resolution switching conditions, the client can resend an establishment request to the server to establish a connection corresponding to the target video resolution adapted to the changed network parameters. In this way, the video played on the client can be automatically optimized to improve the clarity of the video while ensuring fluency. In addition, when the network parameters change, in order to achieve audio and video synchronization, the client can record the played timestamp of the current audio, that is, the played duration or the current playing time point, so that when the video data corresponding to the new video resolution is received and the video corresponding to the video data is played, it can be played from the played timestamp, so that after switching the video resolution, the audio and video screen of the video are synchronized, which improves the robustness of the video playback system and can further enhance the user's video viewing experience.

[0112] In some exemplary embodiments, in conjunction with FIG. 3 , in order to implement dynamic adaptive resolution adjustment of RTSP under different network conditions, the server is configured with video data corresponding to different resolutions for each video.

[0113] Exemplarily, the client includes a user interface, an RTP receiving module, an RTSP control module, a bandwidth detection module, a track selection module, and an RTCP sending module. The server includes an RTCP receiving module, an RTSP parsing module, an RTP sending module, and an SDP generating module. After the user selects a video in the user interface of the client, the RTSP control module of the client sends a DESCRIBE request to the RTSP parsing module of the server. After receiving the DESCRIBE request, the RTSP parsing module sends the generated SDP information to the SDP generating module of the server. Then, the SDP generating module of the server sends the SDP information to the RTSP control module of the client. After receiving the SDP information, the client sends a SETUP request to the server through the RTSP control module. After the server determines the video to be sent and the corresponding video track, it sends the video data to the RTP receiving module of the client through the RTP sending module. The RTP receiving module records the RTP packet information, and uses the bandwidth detection module to estimate the bandwidth and select the video track. The track selecting module sends an RTCP APP message to select the corresponding track to the RTCP sending module. The RTCP sending module sends a track selection message to the RTCP receiving module of the server. The RTCP receiving module of the server sends information for adjusting the video track to the RTP, so that the server switches the video track to send video data of different resolutions to the client.

[0114] Optionally, when the client is ready to play the video, it receives the media stream information sent by the server. For example, during the `DESCRIBE` interaction of RTSP, the SDP description file returned by the server needs to clearly list all available video tracks and their related information, such as resolution, bit rate, etc. In this way, the client can understand all available video tracks and select the appropriate track for transmission according to the network conditions.

[0115] Optionally, the DESCRIBE request information sent by the client to the server to obtain the media stream information may refer to the following content:

[0116] C->S: DESCRIBE rtsp: / / example.com / media.mp4 RTSP / 1.0

[0117] CSeq: 2

[0118] Optionally, the media stream information sent by the server to the client in response to the DESCRIBE request information may refer to the following content:

[0119] S->C: RTSP / 1.0 200 OK

[0120] CSeq: 2

[0121] Content-Base: rtsp: / / example.com / media.mp4

[0122] Content-Type: application / sdp

[0123] Content-Length: 460

[0124] v=0

[0125] o=- 2890844526 2890842807 IN IP4 192.168.1.1

[0126] s=RTSP Session

[0127] t=0 0

[0128] a=control:*

[0129] m=audio 0 RTP / AVP 97

[0130] c=IN IP4 192.168.1.1

[0131] b=AS:128

[0132] a=rtpmap:97 MPEG4-GENERIC / 44100 / 2

[0133] a=control:trackID=1

[0134] m=video 0 RTP / AVP 96

[0135] c=IN IP4 192.168.1.1

[0136] b=AS:500

[0137] a=rtpmap:96 H264 / 90000

[0138] a=framerate:25

[0139] a=control:trackID=2

[0140] a=resolution:480p

[0141] m=video 0 RTP / AVP 97

[0142] c=IN IP4 192.168.1.1

[0143] b=AS:1500

[0144] a=rtpmap:97 H264 / 90000

[0145] a=framerate:25

[0146] a=control:trackID=3

[0147] a=resolution:720p

[0148] m=video 0 RTP / AVP 98

[0149] c=IN IP4 192.168.1.1

[0150] b=AS:4500

[0151] a=rtpmap:98 H264 / 90000

[0152] a=framerate:25

[0153] a=control:trackID=4

[0154] a=resolution:1080p

[0155] In this SDP response, the audio track and three video tracks of different resolutions (480p, 720p, 1080p) are listed. Each video track has a unique `trackID` and bandwidth information (refer to the above "b=AS:4500").

[0156] After receiving the above media stream information, the client can identify the connection parameter information corresponding to multiple video resolutions from the media stream information. To determine the current network status, the client obtains the data packet information of the target data packet within a preset time period before the current moment. Based on the data packet information, the data transmission volume within the preset time period is obtained, and the first receiving time for receiving the first target data packet within the preset time period is obtained. The second receiving time for receiving the last target data packet within the preset time period is obtained. The data transmission time is obtained based on the difference between the first receiving time and the second receiving time. The current network parameters corresponding to the current moment are obtained based on the ratio of the data transmission volume to the data transmission time.

[0157] For example, in order to determine the current network status, the current network bandwidth can be calculated. The client receives the RTP packet and monitors the bandwidth in real time, and estimates the current network bandwidth by calculating the RTT (round trip time) and packet loss rate. Select the appropriate video track according to the bandwidth and send a SETUP request to the server to request a video track of the corresponding resolution. The main purpose of bandwidth monitoring is to estimate the current network bandwidth by calculating the total size and transmission time of the RTP packets received within a certain time window. The main formula can be found in the previous content and will not be repeated here. According to the estimated bandwidth, select the appropriate track (resolution and bit rate). Assume that there are three tracks corresponding to different resolutions and bit rates: 480p video track bit rate: = 1500kbps; bitrate of 720p video track: = 3000 kbps; bitrate for a 1080p video track: = 4500kbps.

[0158] The conditions for selecting a video track are as follows: Less than or equal to 2000 kbps: Select track = 480p; when bandwidth Greater than 2000 kbps and less than or equal to 4000 kbps: Select Track = 720p; when bandwidth Greater than 4000 kbps: Select track = 1080p. It is understood that the corresponding relationship between bandwidth and video resolution may be pre-stored in the server.

[0159] Through the above formulas and steps, the client can dynamically adjust the video track according to the real-time network conditions to ensure the best viewing experience.

[0160] After the video starts to play successfully, the client monitors the network parameters; if the change of the current network parameters is not satisfied, the client continues to receive the data packets generated by the server based on the current target video streaming session. If the current network parameters are changed and the change meets the target conditions, the played timestamp of the currently played audio is obtained, and a setup request carrying the changed network parameters is sent to the server, so that the server selects the target video resolution based on the changed network parameters and establishes a connection with the client based on the connection parameter information corresponding to the target video resolution; receives the data packet sent by the server through the established connection; parses the video data in the data packet and plays the video corresponding to the video data from the played timestamp. In other words, when switching video tracks, the client must keep the audio and video synchronized. There is only one audio track. After the video track is switched, the video playback needs to be aligned with the audio timestamp. In the RTP packet, both the audio and video packets carry timestamp information (RTP timestamp). When switching the video track, the client needs to ensure that the video playback timestamp is aligned with the current audio playback timestamp. In order to achieve synchronization, the timestamp of the currently playing audio is recorded before switching the video track. When setting a new video track, adjust the start timestamp of the video playback to align it with the current audio timestamp. This allows the client to dynamically adjust the video resolution under different network conditions to ensure synchronous playback of audio and video, thus providing the best viewing experience.

[0161] Through the above steps of real-time monitoring and adjusting video resolution, a smooth video viewing experience can be provided even when the network condition is poor, significantly improving the user experience. When the network condition is good, the video quality is automatically optimized without manual operation by the user, making the operation more intelligent and automated.

[0162] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0163] Based on the same inventive concept, an embodiment of the present application also provides a method for playing video data, which is applied to a server, and the method includes: sending media stream information to a client, wherein the media stream information includes connection parameter information corresponding to multiple video resolutions; receiving an establishment request sent by the client and carrying the current network parameters; selecting a target video resolution based on the current network parameters and establishing a connection with the client based on the connection parameter information corresponding to the target video resolution; sending a data packet to the client through the established connection, wherein the resolution of the video data in the data packet is the same as the target video resolution, so that the client parses the video data in the data packet and plays the video corresponding to the video data.

[0164] For specific limitations on the method for playing video data of this embodiment, reference may be made to the description of the method for playing video data applied on the client, which will not be described in detail here.

[0165] Based on the same inventive concept, the embodiment of the present application also provides a video data playback device for implementing the video data playback method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations of one or more video data playback device embodiments provided below can refer to the limitations of the video data playback method above, and will not be repeated here.

[0166] In an exemplary embodiment, as shown in FIG. 4 , a video data playback device 400 is provided, comprising: a pre-configuration module 401, a network module 402, a connection module 403, an interaction module 404 and a playback module 405, wherein:

[0167] The pre-configuration module 401 is used to receive media stream information sent by the server.

[0168] The network module 402 is used to obtain current network parameters if connection parameter information corresponding to multiple video resolutions is identified from the media stream information.

[0169] The connection module 403 is used to send a connection request carrying current network parameters to the server, so that the server selects a target video resolution based on the current network parameters and establishes a connection with the client based on the connection parameter information corresponding to the target video resolution.

[0170] The interaction module 404 is used to receive a data packet sent by the server through the established connection, where the resolution of the video data in the data packet is the same as the target video resolution.

[0171] The playing module 405 is used to parse the video data in the data packet and play the video corresponding to the video data.

[0172] In some embodiments, in terms of obtaining current network parameters, the network module 402 is also used to: obtain data packet information of a target data packet within a preset time period before the current moment; obtain the data transmission volume within the preset time period based on the data packet information, and obtain the data transmission time of the target data packet within the preset time period based on the data packet information; and obtain the current network parameters corresponding to the current moment based on the ratio of the data transmission volume to the data transmission time.

[0173] In some embodiments, in terms of obtaining the data transmission time of a target data packet within a preset time period based on data packet information, the network module 402 is also used to: obtain a first receiving time for receiving the first target data packet within the preset time period; obtain a second receiving time for receiving the last target data packet within the preset time period; and obtain the data transmission time based on the difference between the first receiving time and the second receiving time.

[0174] In some embodiments, in terms of obtaining current network parameters, the network module 402 is also used to: obtain data packet information of a target data packet within a preset time period before the current moment; obtain the round-trip delay and packet loss rate of the data packet in the preset time period based on the data packet information; and obtain the current network parameters at the current moment based on the round-trip delay and packet loss rate of the data packet.

[0175] In some embodiments, the network module 402 is also used to monitor network parameters; if it is monitored that the current network parameters have changed and the change meets the target conditions, the played timestamp of the currently played audio is obtained. The connection module 403 is used to send a setup request carrying the changed network parameters to the server, so that the server selects the target video resolution based on the changed network parameters and establishes a connection with the client based on the connection parameter information corresponding to the target video resolution. The interaction module 404 is used to receive a data packet sent by the server through the established connection. The playback module 405 is used to parse the video data in the data packet and play the video corresponding to the video data from the played timestamp.

[0176] In some embodiments, in terms of monitoring that the current network parameters have changed and that the changes meet the target conditions, the network module 402 is also used to: obtain a resolution that matches the changed network parameters based on connection parameter information corresponding to multiple video resolutions, the connection parameter information including the correspondence between the resolution and the network parameters; if the resolution corresponding to the changed network parameters is inconsistent with the resolution corresponding to the current network parameters, it is determined that the change meets the target conditions.

[0177] Each module in the above video data playback device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.

[0178] In an exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in FIG5. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface is connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store the corresponding relationship between the video resolution and the network parameters and the video data of each video at each video resolution. The input / output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a method for playing video data is implemented.

[0179] In an exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be shown in FIG6. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, the memory, and the input / output interface are connected via a system bus, and the communication interface, the display unit, and the input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner may be implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a method for playing video data is implemented. The display unit of the computer device is used to form a visually visible picture, which may be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.

[0180] Those skilled in the art will appreciate that the structure shown in FIG. 5 or FIG. 6 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.

[0181] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.

[0182] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0183] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0184] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0185] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.

[0186] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0187] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A method for playing video data, characterized in that: The method comprises: Receive media stream information sent by the server; If connection parameter information corresponding to a plurality of video resolutions is identified from the media stream information, the current network parameters are obtained; Sending a connection request carrying the current network parameters to the server, so that the server selects a target video resolution based on the current network parameters and establishes a connection with the client based on the connection parameter information corresponding to the target video resolution; Receiving a data packet sent by the server through the established connection, wherein the resolution of the video data in the data packet is the same as the target video resolution; Parse the video data in the data packet and play the video corresponding to the video data.

2. The method according to claim 1, characterized in that The obtaining of current network parameters includes: Obtaining data packet information of a target data packet within a preset time period before the current moment; Obtaining the data transmission amount within the preset time period based on the data packet information, and obtaining the data transmission time of the target data packet within the preset time period based on the data packet information; A current network parameter corresponding to the current moment is obtained based on a ratio of the data transmission amount to the data transmission time.

3. The method according to claim 2, characterized in that The obtaining the data transmission time of the target data packet within the preset time period based on the data packet information includes: Acquire a first receiving time of receiving a first target data packet within the preset time period; Acquire a second receiving time of receiving the last target data packet within the preset time period; The data transmission time is obtained based on a difference between the first receiving time and the second receiving time.

4. The method according to claim 2, characterized in that: The obtaining of current network parameters includes: Obtaining data packet information of a target data packet within a preset time period before the current moment; Based on the data packet information, obtain the round-trip delay and packet loss rate of the data packet in a preset time period; The current network parameters at the current moment are obtained based on the round-trip delay of the data packet and the packet loss rate.

5. The method according to claim 1, characterized in that The method further comprises: Monitor network parameters; If it is monitored that the current network parameters have changed and the change meets the target condition, the played timestamp of the currently played audio is obtained, and a setup request carrying the changed network parameters is sent to the server, so that the server selects a target video resolution based on the changed network parameters and establishes a connection with the client based on the connection parameter information corresponding to the target video resolution; receives a data packet sent by the server through the established connection; parses the video data in the data packet and plays the video corresponding to the video data starting from the played timestamp; If it is monitored that the change of the current network parameter does not meet the target condition, the data packets generated by the server continue to be received based on the current target video stream session.

6. The method according to claim 5, characterized in that The monitoring that the current network parameter changes and the change meets the target condition includes: Obtaining a resolution matching the changed network parameter based on connection parameter information corresponding to the multiple video resolutions, wherein the connection parameter information includes a correspondence between the resolution and the network parameter; If the resolution corresponding to the changed network parameter is inconsistent with the resolution corresponding to the current network parameter, it is determined that the change satisfies the target condition.

7. A video data playback device, characterized in that: The device comprises: A pre-configuration module, used for receiving media stream information sent by a server; A network module, configured to obtain current network parameters if connection parameter information corresponding to a plurality of video resolutions is identified from the media stream information; A connection module, configured to send a connection request carrying the current network parameters to a server, so that the server selects a target video resolution based on the current network parameters and establishes a connection with the client based on the connection parameter information corresponding to the target video resolution; An interaction module, configured to receive a data packet sent by the server through the established connection, wherein the resolution of the video data in the data packet is the same as the target video resolution; The playing module is used to parse the video data in the data packet and play the video corresponding to the video data.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

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

Citation Information

Cited By

  • Audio and video data transmission method and system, electronic equipment and storage medium

    CN120812209A

  • Video resolution prediction method and device, electronic equipment and storage medium

    CN121056688A