A video stream playing method, system, terminal and storage medium
By combining two-way data interaction between the video server and the user terminal, the video stream playback bitrate is dynamically adjusted, solving the problem of playback instability caused by network fluctuations and device differences, and achieving continuity and smoothness in video playback.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING HUIZHONG ZHILIAN TECH CO LTD
- Filing Date
- 2025-11-06
- Publication Date
- 2026-05-22
AI Technical Summary
Existing video streaming technologies cannot effectively solve problems such as frequent bitrate switching, video segment loading delays, or sudden drops in picture quality when there are network fluctuations and differences in device performance, resulting in an unstable playback experience.
The system obtains the identification information of the target video and the device parameters of the user terminal from the video server. Combined with the network bandwidth and device performance level, it selects the playback bitrate and preloads the video stream data into local buffers in segments. It monitors the network transmission rate and the amount of data in the buffer in real time and dynamically adjusts the bitrate level to achieve seamless switching.
Under complex network and heterogeneous device conditions, it achieves continuous and smooth video playback, avoids screen flickering, stuttering and delay, and improves playback stability and user experience.
Smart Images

Figure CN121486615B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of mobile Internet, and in particular to a video streaming playback method, system, terminal and storage medium. Background Technology
[0002] With the widespread adoption of mobile internet and smart devices, video streaming has become one of the main forms of network content transmission. Users can access video platforms anytime to watch various high-definition video content through smartphones, tablets, smart TVs, and other terminal devices. However, as the resolution and frame rate of high-definition video continue to improve, achieving continuous and stable playback under conditions of network fluctuations and device performance limitations remains a significant technical challenge for video transmission systems.
[0003] In existing video streaming technologies, the download speed is often detected in real time based on changes in network conditions during playback. The system then switches between video streams of different bitrates to reduce playback stuttering and ensure smooth playback. At the same time, the video resolution can be automatically reduced when network bandwidth is limited, thus achieving a degree of adaptive playback.
[0004] While network rate detection can achieve adaptive adjustment of video bitrate to some extent, thus avoiding playback interruptions due to insufficient bandwidth, existing solutions rely solely on a single network rate metric for adjustment when network fluctuations are frequent and device performance varies greatly. This ignores the dynamic impact of multiple factors such as terminal device performance and buffer data volume, which can easily lead to frequent bitrate switching, video segment loading delays, or sudden drops in picture quality, resulting in an unstable playback experience. Summary of the Invention
[0005] To overcome the problem of insufficient stability in video playback under complex network and heterogeneous device conditions, this application provides a video streaming playback method, system, terminal and storage medium that can comprehensively consider network bandwidth and device performance status to achieve dynamic optimization and seamless switching of playback bitrate, thereby ensuring the continuity of video playback and the balance of viewing experience.
[0006] On one hand, the present invention provides a video stream playback method, comprising: obtaining the identification information of a target video and the device parameters of a user terminal through a video server; determining the network bandwidth and device performance level of the user terminal according to the device parameters, so as to select a playback bitrate from a plurality of preset bitrate levels; retrieving the corresponding video stream data based on the identification information of the target video and the playback bitrate, segmenting the video stream data to obtain a plurality of video segment data, and preloading a plurality of video segment data of preset duration into the local buffer of the user terminal; monitoring the current network transmission rate and the amount of data in the local buffer in real time, so as to adjust the bitrate level of the playback bitrate and obtain a bitrate adjustment result; when reading video segment data from the local buffer for decoding and playback, dynamically switching video streams of different bitrates for seamless playback according to the bitrate adjustment result.
[0007] As a preferred embodiment, the step of obtaining the identification information of the target video and the device parameters of the user terminal through the video server includes: obtaining the unique identifier of the target video as identification information based on the video playback application deployed on the video server; and obtaining the current network connection type, network signal strength, processor model, memory capacity, and screen resolution of the user terminal as device parameters through the system interface of the user terminal.
[0008] As a preferred embodiment, the step of determining the network bandwidth and device performance level of the user terminal based on the device parameters, and selecting the playback bitrate from a preset multiple bitrate levels, includes: querying a preset network bandwidth mapping table based on the network connection type and network signal strength in the device parameters to determine the theoretical network bandwidth value of the user terminal; sending a test data packet to the user terminal and receiving the response time returned by the user terminal to calculate the actual network bandwidth value, and taking the smaller value between the theoretical network bandwidth value and the actual network bandwidth value as the network bandwidth; querying a preset performance scoring rule library based on the processor model, memory capacity, and screen resolution in the device parameters to calculate the device performance score of the user terminal, and mapping the device performance score to a device performance level of high performance, medium performance, or low performance through a preset performance level classification standard; and searching for the corresponding bitrate level in a preset bitrate level decision matrix based on the network bandwidth and the device performance level as the playback bitrate.
[0009] As a preferred embodiment, the steps of retrieving the corresponding video stream data based on the identification information of the target video and the playback bitrate, segmenting the video stream data to obtain several video segment data, and preloading several video segment data of preset duration into the local buffer of the user terminal include: retrieving the corresponding video stream data from a preset video storage system according to the identification information of the target video and the playback bitrate; segmenting the video stream data according to a preset segment duration to obtain several video segment data including segment index information; generating a video segment data list according to the segment index information of each video segment data; sending the video segment data list to the user terminal; and when receiving a download request of preset duration initiated by the user terminal based on the video segment data list, transmitting the corresponding video segment data in the video segment data list in sequence and writing it into the local buffer of the user terminal for storage.
[0010] As a preferred embodiment, the step of real-time monitoring of the current network transmission rate and the data volume of the local buffer to adjust the bitrate level of the playback bitrate and obtain the bitrate adjustment result includes: taking the ratio of the number of bytes of video segment data downloaded by the user terminal to the duration of the monitoring period as the current network transmission rate within a preset monitoring period; reading the total number of bytes of video segment data that has been downloaded but not played in the local buffer of the user terminal as the data volume of the local buffer; comparing the current network transmission rate and the data volume of the local buffer with a preset threshold, and adjusting the bitrate level of the playback bitrate based on the comparison result to obtain the bitrate adjustment result.
[0011] As a preferred embodiment, the step of comparing the current network transmission rate and the amount of data in the local buffer with preset thresholds, and adjusting the bitrate level of the playback bitrate based on the comparison result to obtain a bitrate adjustment result includes: generating a bitrate reduction adjustment instruction when the current network transmission rate is lower than a preset rate threshold range or the amount of data in the local buffer is lower than a preset buffer amount threshold range; generating a bitrate increase adjustment instruction when the current network transmission rate is higher than a preset rate threshold range and the amount of data in the local buffer is higher than a preset buffer amount threshold range; generating a bitrate maintenance adjustment instruction when both the current network transmission rate and the amount of data in the local buffer are within preset threshold ranges; and using the adjustment instruction as the bitrate adjustment result.
[0012] As a preferred embodiment, the step of dynamically switching video streams with different bitrates for seamless playback based on the bitrate adjustment result when reading video segment data from the local buffer for decoding and playback includes: when the user terminal starts the video decoding and playback thread, reading video segment data from the local buffer based on the video segment data list, and decoding the video segment data through a video decoder to obtain original video frame data; rendering the original video frame data onto the display screen of the user terminal for playback according to the frame rate of the target video; during playback, the video decoding and playback thread receives the bitrate adjustment result in real time, and when the bitrate adjustment result is received as a decrease in bitrate or an increase in bitrate, requesting the video server to obtain the video stream data of the adjusted bitrate level corresponding to the next video segment data, so as to achieve seamless playback of video streams with different bitrates.
[0013] On the other hand, this application also provides a video streaming playback system, including: an acquisition module, used to acquire the identification information of a target video and the device parameters of a user terminal through a video server; a selection module, used to determine the network bandwidth and device performance level of the user terminal according to the device parameters, so as to select a playback bitrate from a preset multiple bitrate levels; a segmentation module, used to retrieve the corresponding video stream data based on the identification information of the target video and the playback bitrate, segment the video stream data to obtain several video segment data, and preload several video segment data of preset duration into the local buffer of the user terminal; an adjustment module, used to monitor the current network transmission rate and the amount of data in the local buffer in real time, so as to adjust the bitrate level of the playback bitrate and obtain a bitrate adjustment result; and a playback module, used to dynamically switch between different bitrate video streams for seamless playback according to the bitrate adjustment result when reading video segment data from the local buffer for decoding and playback.
[0014] On the other hand, this application also provides a terminal, the terminal including a processor and a memory, the memory storing at least one instruction or at least one program, the at least one instruction or the at least one program being loaded and executed by the processor to implement the video streaming playback method as described in any one of the above.
[0015] On the other hand, this application also provides a computer-readable storage medium storing at least one instruction or at least one program, which is loaded and executed by a processor to implement the video streaming playback method as described in any one of the above.
[0016] The video streaming playback method, system, terminal, and storage medium provided in this application have the following technical effects: By combining bidirectional data interaction between the video server and the user terminal during video streaming playback, dynamic bitrate decision-making and playback control based on the identification information of the target video and the parameters of the user terminal device are realized. By determining the playback bitrate using the identification information and device parameters in the pre-playback stage, the playback quality that matches the device capabilities and network conditions can be selected at the startup stage, thereby shortening the startup buffer time and reducing the initial loading delay. By monitoring the current network transmission rate and the amount of local buffer data in real time, a dynamic feedback mechanism is formed, which can generate bitrate adjustment results and perform switching in a timely manner when there are network fluctuations or insufficient buffer, ensuring the continuity and smoothness of the playback process. Furthermore, by introducing a segmented data structure and a gradual transition algorithm, seamless switching between video streams with different bitrates is achieved, effectively eliminating the problems of screen flickering, stuttering, and latency in traditional switching mechanisms, and overcoming the problem of insufficient video playback stability under complex network and heterogeneous device conditions. Attached Figure Description
[0017] To more clearly illustrate the technical solutions and advantages in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 This is a flowchart illustrating a video stream playback method provided in an embodiment of the present invention;
[0019] Figure 2 This is a schematic block diagram of a video streaming playback system provided in an embodiment of the present invention;
[0020] Figure 3 This is a schematic block diagram of the terminal structure provided in an embodiment of the present invention. Detailed Implementation
[0021] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0022] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or server that includes a series of steps or sub-modules is not necessarily limited to those steps or sub-modules explicitly listed, but may include other steps or sub-modules not explicitly listed or inherent to such processes, methods, products, or terminals.
[0023] The technical solution of the present invention will be further described below with reference to the accompanying drawings and specific embodiments.
[0024] Example 1:
[0025] like Figure 1 As shown, this application provides a video streaming playback method that can be used to achieve dynamic bitrate adjustment and seamless playback during video playback under conditions of network fluctuations and differences in device performance. The video streaming playback method specifically includes the following steps S1 to S5:
[0026] Step S1: Obtain the identification information of the target video and the device parameters of the user terminal through the video server.
[0027] The video server provides a basic access interface for user terminals to access target videos. The video server receives video playback requests from user terminals and extracts the target video's identification information from the request data packet. This identification information is a data string that uniquely identifies the target video content and can be a unique identifier assigned by the video management system during video upload. Simultaneously, the video server retrieves device parameters related to the current device's operating status by calling the user terminal's system information interface. These device parameters include network connection type, network signal strength, processor model, memory capacity, and screen resolution, characterizing the user terminal's performance features and network conditions.
[0028] When the user terminal is a smartphone, the video server receives the playback request via the HTTPS protocol, which includes the target video's identification information "VID20251023_001". The server also calls the terminal system interface (such as the / proc / cpu info and Display Metrics interface of the Android system) to obtain device parameters including: network connection type "4G", network signal strength "-75dBm", processor model "Snapdragon870", memory capacity "6GB", and screen resolution "2400×1080".
[0029] Step S2: Determine the network bandwidth and device performance level of the user terminal based on the device parameters, so as to select the playback bitrate from multiple preset bitrate levels.
[0030] The video server uses the network connection type and network signal strength from the device parameters to determine the theoretical network bandwidth through a table lookup. Then, it sends test data packets to the user terminal and calculates the round-trip time (RTT) to obtain the actual network bandwidth value. The video server uses the smaller of the theoretical and actual bandwidth values as the effective network bandwidth for the user terminal.
[0031] Next, the server calculates a device performance score based on the processor model, memory capacity, and screen resolution in the device parameters. The performance score is determined based on a pre-defined performance scoring rule base, and the score corresponds to a high-performance, medium-performance, or low-performance level. Finally, the server determines the corresponding playback bitrate based on a combination of network bandwidth and performance level within a pre-defined bitrate tier decision matrix.
[0032] When the theoretical network bandwidth is "12Mbps" and the actual test result is "9.5Mbps", the system takes "9.5Mbps" as the effective bandwidth. The device performance score is calculated as "82 points" based on processor performance, memory capacity, and resolution, corresponding to the "high-performance" level. The system queries the bitrate decision matrix and determines that with a bandwidth of 9~10Mbps and a high-performance device combination, the playback bitrate should be "720p@6Mbps", and uses this playback bitrate as the parameter for subsequent video data requests.
[0033] Step S3: Based on the identification information and playback bitrate of the target video, retrieve the corresponding video stream data, segment the video stream data to obtain several video segment data, and preload several video segment data of preset duration into the local buffer of the user terminal.
[0034] The video server uses identification information to locate the target video file in the video storage system and calls the transcoding module to retrieve video stream data that matches the playback bitrate. The system segments the video stream data according to a preset segment duration (e.g., 2 seconds per segment), generating several video segment data and assigning a unique segment index number to each segment. The server generates a list of video segment data based on the index numbers and returns it to the user terminal.
[0035] The user terminal initiates a preloading request based on the video segment data list. The video server transmits several video segment data in sequence and stores them in the terminal's local buffer for the preloading stage before playback.
[0036] If the target video has a total duration of 600 seconds and a playback bitrate of "720p@6Mbps", the system will divide the video stream into 300 video segments, each segment lasting 2 seconds. The video server generates a list of segment data and returns index information. The user terminal requests the first 10 segments (a total of 20 seconds of video) for preloading based on this list. The server sequentially transmits the video segment data numbered 1 to 10 to the local buffer to prepare for playback.
[0037] Step S4: Monitor the current network transmission rate and the amount of data in the local buffer in real time to adjust the bitrate level of the playback bitrate and obtain the bitrate adjustment result.
[0038] The video server periodically records the total number of bytes of video segment data downloaded by the user terminal within a preset monitoring period (e.g., every 3 seconds), and divides the number of bytes by the monitoring period duration to calculate the current network transmission rate. Simultaneously, the system reads the total number of bytes of downloaded but unplayed video segment data from the user terminal's local buffer, which is used as the data volume of the local buffer.
[0039] Subsequently, the server compares the current network transmission rate and the amount of data in the local buffer with preset rate threshold ranges and buffer size threshold ranges, respectively. When the detection result exceeds the threshold range, a corresponding adjustment instruction is generated, including "reduce bitrate", "increase bitrate", or "maintain bitrate", and the adjustment instruction is used as the bitrate adjustment result.
[0040] If the monitoring period is 3 seconds and the total number of bytes of video segment data downloaded by the terminal is 2.1MB, then the current network transmission rate is 0.7MB / s (i.e., 5.6Mbps). If the buffer data size is 10MB at this time, and the rate threshold is 4~8Mbps and the buffer size threshold is 6~12MB, then the system determines that both the rate and the buffer size are within the threshold range and generates an adjustment instruction to maintain the bitrate. If the network rate drops to 3Mbps or the buffer size is less than 6MB, then an adjustment instruction to reduce the bitrate is generated.
[0041] Step S5: When reading video segment data from the local buffer for decoding and playback, dynamically switch between video streams with different bitrates for seamless playback based on the bitrate adjustment result.
[0042] The user terminal starts a video decoding and playback thread, reads video segment data from the local buffer according to the order of the video segment data list, decodes it using a video decoder to obtain the original video frame data. The terminal then renders the video frames onto the display screen for playback based on the frame rate of the target video.
[0043] When the decoding and playback thread receives a new bitrate adjustment result, if the result is "decrease bitrate" or "increase bitrate," it requests the adjusted bitrate video stream data for the next video segment from the video server after the current segment has finished playing. The terminal allocates an independent storage area in its local buffer for the video stream data at the new bitrate level and retains the data for the unplayed old bitrate segments. During switching, the playback thread uses a gradual transition algorithm to smoothly handle the boundaries between segments, achieving seamless switching of video frames.
[0044] If the current playback bitrate is "720p@6Mbps", and the network speed drops to 3.5Mbps, the system generates an adjustment command to reduce the bitrate. After the terminal finishes playing the current 15th segment, it requests the "480p@3Mbps" video stream of the 16th segment and allocates a new buffer area to store this video segment. During switching, the playback thread uses a frame brightness linear interpolation gradual transition algorithm to smoothly blend the last 5 frames of the previous segment with the first 5 frames of the next segment to eliminate visual jumps and achieve seamless playback.
[0045] In this embodiment, the identification information of the target video and the device parameters of the user terminal are obtained through a video server. Then, the network bandwidth and device performance level of the user terminal are determined based on the device parameters to select the playback bitrate from multiple preset bitrate levels. After determining the playback bitrate, the corresponding video stream data is retrieved based on the identification information of the target video and the playback bitrate. The video stream data is segmented to obtain several video segment data, and several video segment data of preset duration are preloaded into the local buffer of the user terminal. During playback, the current network transmission rate and the amount of data in the local buffer are monitored in real time to adjust the bitrate level of the playback bitrate and obtain the bitrate adjustment result. When reading video segment data from the local buffer for decoding and playback, the video streams of different bitrates are dynamically switched for seamless playback based on the bitrate adjustment result, thereby realizing adaptive adjustment and continuous smooth playback of the video playback process.
[0046] By comprehensively utilizing the target video's identification information obtained from the video server and the user terminal's device parameters, the system can jointly evaluate network bandwidth and device performance before playback, and rationally select the initial playback bitrate. Simultaneously, by monitoring the current network transmission rate and the data volume in the local buffer in real time, the system dynamically adjusts the playback bitrate level, enabling rapid response to network fluctuations or changes in device performance. When switching between video streams with different bitrates based on the bitrate adjustment results, a seamless segment-level switching mechanism effectively avoids playback interruptions and stuttering. Therefore, this method achieves a balance between video playback quality and stability in complex network environments and with diverse terminal devices, overcoming the problem of insufficient video playback stability under complex network and heterogeneous device conditions, and improving the continuity of video playback and user experience.
[0047] Specifically, step S1 can preferably be implemented as follows:
[0048] The video playback application deployed on the video server obtains the unique identifier of the target video as identification information.
[0049] When a video playback application running on the video server receives a playback request from a user's terminal, it first retrieves the video file information corresponding to the playback request from the video resource database. The video file information includes metadata such as the video's unique identifier, video name, storage path, and available bitrate. The server then extracts the unique identifier from the video resource database by parsing the video name or URL parameters in the user's request and stores it as identification information in the playback session cache for subsequent retrieval and allocation of video stream data.
[0050] When a user terminal requests to play a target video named "demo_video.mp4", the video server can retrieve the corresponding video resource entry from the database through the video playback application and extract its unique identifier "VID_20251023001". This identifier serves as the identification information of the target video and is used for subsequent streaming data location and loading.
[0051] The system interface of the user terminal obtains the current network connection type, network signal strength, processor model, memory capacity and screen resolution of the user terminal as device parameters.
[0052] The video server receives device information proactively reported by user terminals through standardized interfaces (such as HTTP request headers, WebSocket status packets, or SDK acquisition interfaces). During the playback request initiation phase, the user terminal calls underlying system APIs (such as the Connectivity Manager interface in Android and the Network Info interface in iOS) to detect network connection type (such as 4G, 5G, Wi-Fi) and signal strength (in dBm), and simultaneously calls system information interfaces (such as CPU Info, Memory Info, and Display Metrics) to obtain processor model, available memory capacity, and screen resolution. The video server combines this data to form a device parameter structure for subsequent bandwidth and performance evaluation.
[0053] When the user terminal is an Android device, it detects via the system API that the current network type is Wi-Fi, the signal strength is -55dBm, the processor model is Snapdragon 8Gen2, the memory capacity is 8GB, and the screen resolution is 2400×1080. These device parameters are sent to the video server via an HTTP request and serve as input conditions for subsequent playback bitrate decisions.
[0054] Specifically, step S2 can preferably be implemented as follows:
[0055] The theoretical network bandwidth value of the user terminal is determined by querying the preset network bandwidth mapping table based on the network connection type and network signal strength in the device parameters.
[0056] After receiving the device parameters from the user terminal, the video server calls its internally stored network bandwidth mapping table (generated from historical speed test data and network type statistics) to look up the corresponding theoretical bandwidth value based on different network connection types and signal strength ranges. For example, the theoretical bandwidth value for a Wi-Fi connection at a signal strength of -60dBm is 100Mbps, while the theoretical bandwidth value for a 4G network at a signal strength of -85dBm is 10Mbps. This theoretical bandwidth value will serve as the initial reference value for subsequent actual bandwidth measurements.
[0057] When the user terminal's network type is Wi-Fi and the signal strength is -55dBm, the video server looks up the corresponding entry in the mapping table and obtains a theoretical bandwidth value of 120Mbps.
[0058] The actual network bandwidth value is calculated by sending test data packets to the user terminal and receiving the response time returned by the user terminal. The smaller value between the theoretical network bandwidth value and the actual network bandwidth value is taken as the network bandwidth.
[0059] The video server generates a test data packet of fixed byte length (e.g., 1MB), sends it to the user terminal via the HTTP / 2 channel, and records the sending time. Upon receiving the data packet, the user terminal immediately returns an acknowledgment response. The server calculates the total delay Δt from sending to receiving the acknowledgment and uses this delay to calculate the actual bandwidth value B. a =(Number of data packets in bytes × 8) / Δt (unit: bps). Subsequently, the server selects the smaller of the theoretical bandwidth and the actual bandwidth as the final network bandwidth to ensure that the bitrate selection better reflects the real-time network conditions.
[0060] When the theoretical bandwidth is 120Mbps, and the actual bandwidth calculated from the test is 95Mbps, then the final determined network bandwidth is 95Mbps.
[0061] The system queries a pre-defined performance scoring rule base based on the processor model, memory capacity, and screen resolution in the device parameters to calculate the device performance score of the user terminal. The device performance score is then mapped to one of the following device performance levels: high performance, medium performance, or low performance, using a pre-defined performance level classification standard.
[0062] The video server uses a performance scoring rule base to quantitatively score the hardware configuration of user terminals. The performance scoring rule base calculates a performance score P based on a weighted average of processor clock speed, number of cores, memory size, and resolution. s The specific scoring formula can be set as follows:
[0063] P s =α×C f +β×C n +γ×M c δ×R r ;
[0064] Among them, C f For processor clock speed (GHz), C n For the number of cores, M c For memory capacity (GB), R r The resolution is measured in pixels (megapixels), and α, β, γ, and δ are preset weighting coefficients. The calculation results are matched against a performance level standard table to determine whether the device's performance level is high-performance, medium-performance, or low-performance.
[0065] For example, if P is calculated s =82, and the performance grade standard table specifies: P s ≥80 indicates high performance, 50≤P s <80 indicates medium performance, P s If the value is less than 50, the terminal's performance level is high.
[0066] Based on network bandwidth and device performance level, the corresponding bitrate level is found in the preset bitrate level decision matrix as the playback bitrate. The bitrate level decision matrix includes multiple bitrate levels corresponding to different combinations of network bandwidth ranges and different device performance levels.
[0067] The video server stores a two-dimensional bitrate decision matrix. Rows represent different network bandwidth ranges (e.g., 0–5Mbps, 5–20Mbps, 20–100Mbps), and columns represent device performance levels (high performance, medium performance, low performance). Each matrix cell stores the corresponding recommended playback bitrate value. The system looks up the corresponding cell based on the determined network bandwidth and performance level, and outputs the corresponding playback bitrate. For example, if the bandwidth is 95Mbps and the performance level is high performance, the corresponding playback bitrate is "high bitrate (1080p@8Mbps)".
[0068] When the user terminal network bandwidth is 95Mbps and the device performance level is high performance, the corresponding playback bitrate is found to be 8Mbps in the bitrate decision matrix, thus determining the playback bitrate to be 1080p.
[0069] Specifically, the following scheme can be preferred in step S3:
[0070] Based on the target video's identification information and playback bitrate, the corresponding video stream data is retrieved from the preset video storage system. The video stream data is then segmented according to the preset segment duration to obtain several video segment data including segment index information.
[0071] The video server calls the video storage system interface to retrieve the corresponding stream file path for the video at different bitrate levels based on the target video's identifier information. Subsequently, the server calls the video segmentation module to logically divide the stream file according to the preset segment duration (e.g., 4 seconds), generating multiple video segment data. Each segment contains video content for a continuous time period and segment index information (such as segment number, start timestamp, and end timestamp).
[0072] When the target video length is 120 seconds and the segment duration is set to 4 seconds, the system will generate 30 video segment data, each segment with independent segment index information for subsequent download management.
[0073] A video segment data list is generated based on the segment index information of each video segment data, and the video segment data list is sent to the user terminal.
[0074] The video server aggregates the index information of each video segment data to form a video segment data list (including segment number, segment URL path, segment duration, etc.), and returns it to the user terminal in JSON format. The user terminal can then initiate segment download requests one by one based on this list, achieving segmented preloading.
[0075] The video segment data list may include: [{Number:1, Path:“ / v / VID_20251023001 / seg1_8M.ts”, Duration:4},{Number:2, Path:“ / v / VID_20251023001 / seg2_8M.ts”, Duration:4},…].
[0076] When a user terminal initiates a download request for a preset duration based on a video segment data list, the corresponding video segment data in the video segment data list is transmitted sequentially and written to the user terminal's local buffer for storage.
[0077] The video server sends the corresponding video segment data via HTTP transmission channel according to the order of download requests initiated by the user terminal. After receiving the segment data, the user terminal stores it in its local buffer. The system preferably adopts a ring buffer structure to improve access efficiency and ensures that the buffer capacity can hold at least three video segments to prevent playback interruptions caused by network fluctuations.
[0078] When the preset duration is 4 seconds and the buffer capacity is set to 12 seconds of video data, the user terminal can start decoding and playback after receiving the first 3 video segments, thus realizing a streaming playback mode in which playback and download are carried out in parallel.
[0079] Specifically, the following scheme can be preferred in step S4:
[0080] Within a preset monitoring period, the ratio of the number of bytes of video segment data downloaded by the user terminal to the duration of the monitoring period is used as the current network transmission rate.
[0081] Video servers or user terminals can count the total number of bytes of video segments successfully downloaded from the server within a fixed monitoring period (e.g., every 2 or 5 seconds) and record the duration of that period. By calculating the ratio of downloaded bytes to duration, the current network transmission rate can be obtained in real time. This method requires no additional test data transmission and directly reflects the actual media transmission capacity, helping to more accurately perceive the network status during playback.
[0082] If the user terminal downloaded 25MB of video segment data within the last 5-second monitoring period, the current network transmission rate is calculated as: (25×8) / 5=40Mbps. This rate will be used as an input parameter for real-time network status in subsequent bitrate adjustments.
[0083] The total number of bytes of downloaded but unplayed video segment data in the user terminal's local buffer is used as the data volume of the local buffer.
[0084] Video playback applications can obtain the total amount of undecoded video segment data in the current buffer through the local buffer management module, and count it in bytes. The amount of buffer data directly reflects the system's playback redundancy, that is, the length of the playback buffer, and is used to determine whether there is a risk of playback interruption.
[0085] If the maximum storage capacity of the local buffer is 60MB, and the total amount of unplayed video segment data in the current buffer is 40MB, then the data size of the local buffer can be considered to be 40MB. This value will be used as a real-time indicator of buffer safety in bitrate decisions.
[0086] The current network transmission rate and the amount of data in the local buffer are compared with a preset threshold, and the bitrate level of the playback bitrate is adjusted based on the comparison result to obtain the bitrate adjustment result.
[0087] The system compares the current network transmission rate with the rate threshold range, and simultaneously compares the local buffer data volume with the buffer size threshold range. This combined assessment accurately reflects the stability of the terminal's playback environment. When either parameter exceeds the threshold range, the system triggers a bitrate adjustment mechanism. If the network or buffering conditions are unsatisfactory, the bitrate is reduced to ensure continuous playback; if the conditions are good, the bitrate is increased to improve picture quality.
[0088] If the current network transmission rate is less than the lower limit of the rate threshold (e.g., 20Mbps), or the amount of buffered data is less than the lower limit of the buffer amount threshold (e.g., 10MB), the system will determine that the playback stability has decreased and trigger a reduction in bitrate adjustment.
[0089] The process involves comparing the current network transmission rate and the amount of data in the local buffer with a preset threshold, and adjusting the playback bitrate based on the comparison result. A preferred bitrate adjustment scheme is as follows:
[0090] When the current network transmission rate is lower than the preset rate threshold range or the amount of data in the local buffer is lower than the preset buffer amount threshold range, an adjustment instruction to reduce the bitrate is generated, and the bitrate level of the playback bitrate is reduced to the next lower bitrate level.
[0091] When the system detects insufficient download speed or low buffer volume, it immediately generates an adjustment command to reduce the bitrate to avoid playback stuttering. Upon receiving this command, the playback control module switches the current playback bitrate from the original level (e.g., 8Mbps) to the next lower level (e.g., 5Mbps) to reduce the amount of data transmitted per unit time and achieve playback continuity.
[0092] When the system detects that the network transmission rate has dropped from 40Mbps to 18Mbps and the buffer size has dropped from 40MB to 8MB, it generates an adjustment command to reduce the bitrate, lowering the playback bitrate from 8Mbps to 5Mbps to prevent the buffer from running out.
[0093] When the current network transmission rate is higher than the preset rate threshold range and the amount of data in the local buffer is higher than the preset buffer amount threshold range, an adjustment command to increase the bitrate is generated, and the bitrate level of the playback bitrate is increased to the next higher bitrate level.
[0094] If the network transmission rate is detected to be continuously higher than the rate threshold and the buffer data is sufficient, the system generates an adjustment instruction to increase the bitrate, raising the playback bitrate level from the current level to the next higher level, so as to make full use of bandwidth resources and improve video clarity and visual quality.
[0095] When the network transmission rate is stable at 80Mbps or higher and the buffer size exceeds 50MB, the system generates an adjustment command to increase the bitrate, raising the playback bitrate from 5Mbps to 8Mbps, thereby improving the playback quality.
[0096] When the current network transmission rate and the amount of data in the local buffer are both within the preset threshold range, an adjustment instruction to maintain the bitrate is generated, and the current bitrate level is kept unchanged.
[0097] When both the network and buffering status are within a stable range (e.g., transmission rate between 30–60 Mbps and buffer size between 20–40 MB), the system determines that the current playback status is balanced and no bitrate adjustment is needed. At this time, an adjustment instruction to maintain the bitrate is generated to avoid the additional resource consumption and image jitter caused by frequent bitrate switching.
[0098] If the network speed is detected to be 45Mbps and the buffer size is 25MB, the system generates an adjustment instruction to maintain the current playback bitrate level.
[0099] The adjustment command is used as the result of the bitrate adjustment.
[0100] The system takes the generated "reduce bitrate", "increase bitrate" or "maintain bitrate" instructions as the final bitrate adjustment result and transmits them to the playback control module of the user terminal through a message queue or playback control channel, so that the real-time playback thread can perform bitrate switching or maintenance operations.
[0101] If the current cycle judgment result is "increase bitrate", the system will send the adjustment instruction to the user terminal in JSON format, with the content being {"cmd":"increase_bitrate","target":"8Mbps"}, and the terminal will then perform subsequent bitrate switching operations accordingly.
[0102] Specifically, the following scheme can be preferred in step S5:
[0103] When the video decoding and playback thread is started on the user terminal, the video segment data is read from the local buffer based on the video segment data list, and the video segment data is decoded by the video decoder to obtain the original video frame data.
[0104] When the user terminal starts a playback task, it creates an independent decoding and playback thread. This thread extracts the corresponding video segment data from the local buffer according to the order of the video segment data list and passes the segment data to the video decoder. The video decoder selects the appropriate decoding parameter set (such as GOP length, quantization coefficient Qp, etc.) based on the playback bitrate, completing frame-level decoding of the video data to obtain uncompressed raw video frame data.
[0105] If the current playback bitrate is 8Mbps, the system selects a high-quality H.265 decoding parameter set to decode the video segment data and generate the corresponding 1080p original video frames.
[0106] The original video frame data is rendered onto the user terminal's display screen according to the frame rate of the target video for playback.
[0107] The video rendering module uses the target video frame rate (e.g., 30fps or 60fps) as the time base, reads the raw video frame data from the decoding buffer, and draws it into the display frame buffer. A frame synchronization clock control mechanism ensures smooth, jitter-free video playback and guarantees visual continuity.
[0108] For example, when the frame rate of the target video is 30fps, the system renders one frame of raw video data to the display screen every 33.3 milliseconds to achieve a smooth playback effect.
[0109] During playback, the video decoding and playback thread receives bitrate adjustment results in real time. When the received bitrate adjustment result is a decrease or increase in bitrate, after the currently playing video segment data has finished playing, it requests the video server to obtain the video stream data of the next video segment corresponding to the adjusted bitrate level. It allocates a new storage area in the local buffer for the video stream data of the adjusted bitrate level, while retaining the downloaded but unplayed video segment data of the current bitrate level. When switching to the adjusted bitrate level, it reads the corresponding video segment data from the new storage area for decoding and playback. It uses a gradual transition algorithm to process the boundary between the video segment data before and after adjustment to obtain the decoded video frame data, thereby achieving seamless playback of video streams with different bitrates. This eliminates the screen jump caused by bitrate switching and achieves seamless playback between video streams with different bitrates.
[0110] The system receives bitrate adjustment results in real time via an asynchronous event channel. When the adjustment result is "reduce bitrate" or "increase bitrate," the playback control module waits until the current video segment has finished playing before performing the switching operation to ensure frame sequence continuity. The system allocates a new area in the local buffer to store video segment data at the adjusted bitrate level; at the same time, it retains unplayed data at the current bitrate level to ensure a smooth transition during the switching process.
[0111] When achieving seamless switching, the system uses a gradual transition algorithm (such as brightness smoothing compensation or frame interpolation transition algorithm) to visually fuse the boundaries of video frames of the two bitrates, so that there is no obvious screen flickering or discontinuity during the switching process.
[0112] For example, when switching from a 5Mbps bitrate to an 8Mbps bitrate, the system will first decode and temporarily store the last few frames of the current segment, and then use a transition algorithm to stitch the two together after the first frame of the new bitrate video stream is decoded. The output composite frame is then rendered to achieve seamless playback.
[0113] Example 2:
[0114] like Figure 2 As shown, this application also provides a video streaming playback system 10, which specifically includes an acquisition module 11, a selection module 12, a segmentation module 13, an adjustment module 14, and a playback module 15, wherein:
[0115] The acquisition module 11 is mainly used to obtain the identification information of the target video and the device parameters of the user terminal 20 through the video server.
[0116] The acquisition module 11 obtains the unique identifier information of the target video and the device parameters of the user terminal 20 through the video server, including network connection type, network signal strength, processor 22 model, memory capacity and screen resolution, etc.
[0117] The selection module 12 is mainly used to determine the network bandwidth and device performance level of the user terminal 20 based on the device parameters, so as to select the playback bitrate from multiple preset bitrate levels.
[0118] Based on the acquired device parameters, the selection module 12 first determines the theoretical network bandwidth of the user terminal 20 by querying the network bandwidth mapping table, then calculates the actual network bandwidth by sending test data packets and receiving response times, and finally takes the smaller value of the two as the network bandwidth of the terminal 20; at the same time, it calculates the device performance score of the terminal 20 by querying the preset performance scoring rule library, and maps the score to high performance, medium performance or low performance level; based on the network bandwidth and device performance level, it selects the appropriate playback bitrate in the bitrate decision matrix.
[0119] The segmentation module 13 is mainly used to retrieve the corresponding video stream data based on the identification information and playback bitrate of the target video, segment the video stream data to obtain several video segment data, and preload several video segment data of preset duration into the local buffer of the user terminal 20.
[0120] The segmentation module 13 retrieves video stream data from the video storage system based on the target video's identification information and playback bitrate, and segments the video stream according to a preset segment duration, generating a list of several video segment data including segment index information. Subsequently, it preloads several preset duration segment data into the local buffer of the user terminal 20 to ensure playback continuity.
[0121] The adjustment module 14 is mainly used to monitor the current network transmission rate and the amount of data in the local buffer in real time, so as to adjust the bitrate level of the playback bitrate and obtain the bitrate adjustment result.
[0122] The adjustment module 14 monitors the current network transmission rate and the amount of data in the local buffer in real time. By comparing it with a preset threshold, it generates adjustment instructions to reduce the bit rate, increase the bit rate, or maintain the bit rate based on the monitoring results, thereby achieving dynamic bit rate adjustment.
[0123] The playback module 15 is mainly used to dynamically switch between different bitrate video streams for seamless playback when reading video segment data from the local buffer for decoding and playback, based on the bitrate adjustment result.
[0124] When the user terminal 20 starts the video decoding and playback thread, the playback module 15 reads the video segment data from the local buffer, decodes it, and renders it to the display screen according to the target video frame rate. During playback, the playback module 15 requests the adjusted bitrate data of the next segment after the current segment has finished playing, based on the bitrate adjustment result output by the adjustment module 14. It then uses buffer allocation and a gradual transition algorithm to achieve seamless switching between different bitrate video streams, thereby eliminating screen jumps and ensuring smooth video playback.
[0125] This embodiment enables adaptive bitrate selection that optimizes both network conditions and device performance, and dynamically adjusts the bitrate level during playback on the terminal 20 to achieve high-quality, continuous, and seamless video playback, while reducing the impact of network fluctuations and differences in terminal 20 performance on the user's viewing experience.
[0126] Example 3:
[0127] This application example also provides a terminal 20, which includes a processor 22 and a memory 24. The memory 24 stores at least one instruction or at least one program. The at least one instruction or at least one program is loaded and executed by the processor 22 to implement the video streaming playback method as described in Embodiment 1.
[0128] like Figure 3 As shown, in one alternative embodiment, a terminal 20 is provided. Figure 3 The terminal 20 shown includes a processor 22 and a memory 24. The processor 22 and the memory 24 are connected, for example, via a bus 21. Optionally, the terminal 20 may also include a transceiver 23, which can be used for data interaction between the terminal 20 and other terminals 20, such as sending and / or receiving data. It should be noted that in practical applications, the transceiver 23 is not limited to one, and the structure of the terminal 20 does not constitute a limitation on the embodiments of this application.
[0129] In this embodiment, the terminal 20 implements a complete video stream playback function. The processor 22 loads the program instructions stored in the memory 24 and executes the operations of the acquisition module 11, selection module 12, segmentation module 13, adjustment module 14, and playback module 15 according to the program logic: the acquisition module 11 obtains the identification information of the target video and the device parameters of the terminal 20 through the video server; the selection module 12 calculates the network bandwidth and device performance level, and selects the playback bitrate from the bitrate decision matrix; the segmentation module 13 retrieves video stream data and generates a video segment data list, and preloads the segment data of a preset duration into the local buffer; the adjustment module 14 monitors the network transmission rate and the amount of data in the local buffer in real time, and generates a bitrate adjustment instruction according to the threshold; the playback module 15 decodes the video segment data in the local buffer and renders it to the display screen, and dynamically switches between different bitrate video streams according to the bitrate adjustment result to achieve seamless playback.
[0130] Example 4:
[0131] This application also provides a computer-readable storage medium storing at least one instruction or at least one program, which is loaded and executed by a processor to implement the video streaming playback method as described in Embodiment 1.
[0132] In this embodiment, a complete video stream playback method is implemented through a program stored on a computer-readable storage medium. The processor loads and executes the program instructions stored in the storage medium. The program, following the method logic of Embodiment 1, sequentially executes the following steps: obtaining the identification information of the target video and the user terminal device parameters; determining the network bandwidth and device performance level and selecting the playback bitrate; retrieving video stream data and generating a video segment data list; preloading the segment data into the terminal's local buffer; real-time monitoring of network speed and buffer data volume to adjust the bitrate; and decoding and playing the video stream while dynamically switching bitrates. The program includes bitrate tier decision matrix query logic, network bandwidth measurement logic, performance scoring rule calculation logic, segment index generation and management logic, and gradual transition algorithm processing logic, realizing a complete process from obtaining data from the network to seamless playback on the terminal.
[0133] Through this computer-readable storage medium, this embodiment can transform the video streaming playback method of the present invention into an executable software product. By loading the program in different hardware environments, the functions of adaptive bitrate control and seamless video playback can be realized. It has the advantages of easy deployment, high portability and cross-terminal applicability, while ensuring smooth playback and stable user experience.
[0134] It should be noted that the order of the embodiments described above is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. Furthermore, the above description focuses on specific embodiments of this application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps described in the claims can be performed in a different order than that shown in the embodiments and still achieve the desired results. Additionally, the processes depicted in the drawings do not necessarily require a specific or sequential order to achieve the desired results. In some implementations, multitasking and parallel processing are also possible or may be advantageous.
[0135] The various embodiments in this application are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the device, terminal, and storage medium embodiments are basically similar to the method embodiments, so the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0136] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware, or by a program instructing the relevant hardware to implement them. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0137] The above are merely preferred embodiments of this application and are not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A method for playing a video stream, characterized in that, include: The identification information of the target video and the device parameters of the user terminal are obtained through the video server. The theoretical network bandwidth of the user terminal is determined by querying a preset network bandwidth mapping table based on the network connection type and network signal strength in the device parameters. A test data packet is sent to the user terminal, and the actual network bandwidth is calculated based on the response time returned by the user terminal. The smaller of the theoretical and actual network bandwidth values is taken as the network bandwidth. A preset performance scoring rule base is then queried based on the processor model, memory capacity, and screen resolution in the device parameters to calculate the user terminal's device performance score. This score is mapped to a performance level of high, medium, or low performance using a preset performance level classification standard. Finally, the corresponding bitrate is selected from a preset bitrate decision matrix based on the network bandwidth and the device performance level to determine the playback bitrate. Based on the identification information of the target video and the playback bitrate, the corresponding video stream data is retrieved, the video stream data is segmented to obtain several video segment data, and several video segment data of preset duration are preloaded into the local buffer of the user terminal. Within a preset monitoring period, the ratio of the number of bytes of video segment data downloaded by the user terminal to the duration of the monitoring period is taken as the current network transmission rate; the total number of bytes of video segment data downloaded but not played in the local buffer of the user terminal is read as the data volume of the local buffer; when the current network transmission rate is lower than a preset rate threshold range or the data volume of the local buffer is lower than a preset buffer size threshold range, an adjustment instruction to reduce the bitrate is generated; when the current network transmission rate is higher than a preset rate threshold range and the data volume of the local buffer is higher than a preset buffer size threshold range, an adjustment instruction to increase the bitrate is generated; when both the current network transmission rate and the data volume of the local buffer are within preset threshold ranges, an adjustment instruction to maintain the bitrate is generated; the adjustment instruction is taken as the bitrate adjustment result. When reading video segment data from the local buffer for decoding and playback, the video streams with different bitrates are dynamically switched for seamless playback based on the bitrate adjustment result.
2. The video stream playback method according to claim 1, characterized in that, The step of obtaining the identification information of the target video and the device parameters of the user terminal through the video server includes: The unique identifier of the target video is obtained as identification information based on the video playback application deployed on the video server; The system interface of the user terminal obtains the current network connection type, network signal strength, processor model, memory capacity and screen resolution of the user terminal as device parameters.
3. The video stream playback method according to claim 1, characterized in that, The steps of retrieving the corresponding video stream data based on the identifier information of the target video and the playback bitrate, segmenting the video stream data to obtain several video segment data, and preloading several video segment data of preset duration into the local buffer of the user terminal include: Based on the identification information of the target video and the playback bitrate, the corresponding video stream data is retrieved from the preset video storage system, and the video stream data is segmented according to the preset segment duration to obtain several video segment data including segment index information. A video segment data list is generated based on the segment index information of each video segment data, and the video segment data list is sent to the user terminal; When a user terminal initiates a download request for a preset duration based on the video segment data list, the corresponding video segment data in the video segment data list is transmitted sequentially and written to the user terminal's local buffer for storage.
4. The video stream playback method according to claim 3, characterized in that, The step of dynamically switching between different bitrate video streams for seamless playback based on the bitrate adjustment result when reading video segment data from the local buffer for decoding and playback includes: When the user terminal starts the video decoding and playback thread, it reads video segment data from the local buffer based on the video segment data list, and decodes the video segment data through the video decoder to obtain the original video frame data. The original video frame data is rendered onto the display screen of the user terminal according to the frame rate of the target video for playback; During playback, the video decoding and playback thread receives the bitrate adjustment result in real time. When the bitrate adjustment result is to reduce or increase the bitrate, it requests the video server to obtain the video stream data of the adjusted bitrate level corresponding to the next video segment data, so as to achieve seamless playback of video streams with different bitrates.
5. A video streaming playback system, characterized in that, include: The acquisition module is used to obtain the identification information of the target video and the device parameters of the user terminal through the video server; The selection module is used to query a preset network bandwidth mapping table based on the network connection type and network signal strength in the device parameters to determine the theoretical network bandwidth value of the user terminal; send test data packets to the user terminal and calculate the actual network bandwidth value based on the response time returned by the user terminal, taking the smaller value between the theoretical network bandwidth value and the actual network bandwidth value as the network bandwidth; query a preset performance scoring rule library based on the processor model, memory capacity, and screen resolution in the device parameters to calculate the device performance score of the user terminal, and map the device performance score to a device performance level of high performance, medium performance, or low performance through a preset performance level classification standard; and find the corresponding bitrate level in a preset bitrate level decision matrix based on the network bandwidth and the device performance level as the playback bitrate. The segmentation module is used to retrieve the corresponding video stream data based on the identification information of the target video and the playback bitrate, segment the video stream data to obtain several video segment data, and preload several video segment data of preset duration into the local buffer of the user terminal. An adjustment module is used to: use the ratio of the number of bytes of video segment data downloaded by the user terminal to the duration of the monitoring period as the current network transmission rate within a preset monitoring period; read the total number of bytes of video segment data downloaded but not played in the local buffer of the user terminal as the data volume of the local buffer; generate a bitrate reduction adjustment instruction when the current network transmission rate is lower than a preset rate threshold range or the data volume of the local buffer is lower than a preset buffer size threshold range; generate a bitrate increase adjustment instruction when the current network transmission rate is higher than a preset rate threshold range and the data volume of the local buffer is higher than a preset buffer size threshold range; generate a bitrate maintenance adjustment instruction when both the current network transmission rate and the data volume of the local buffer are within preset threshold ranges; and use the adjustment instruction as the bitrate adjustment result. The playback module is used to dynamically switch between video streams with different bitrates for seamless playback when reading video segment data from the local buffer for decoding and playback, based on the bitrate adjustment result.
6. A terminal, characterized in that, The terminal includes a processor and a memory, the memory storing at least one instruction or at least one program, the at least one instruction or the at least one program being loaded and executed by the processor to implement the video streaming playback method as described in any one of claims 1-4.
7. A computer-readable storage medium, characterized in that, The storage medium stores at least one instruction or at least one program, which is loaded and executed by a processor to implement the video streaming playback method as described in any one of claims 1-4.