Video source switching method and device, electronic equipment and storage medium

By obtaining and analyzing the head data of the backup video source, evaluating its playability and fluency, and automatically switching to the optimal video source, it solves the problem of insufficient video playback reliability and fluency in the existing technology, and achieves efficient video source switching and user experience improvement.

CN120301993APending Publication Date: 2025-07-11BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510466404.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-14
Publication Date
2025-07-11

AI Technical Summary

Technical Problem

The existing web video playback technology has shortcomings in terms of reliability and fluency. The lack of active detection mechanism and static allocation of video sources have resulted in network conditions and playback quality not being dynamically related, which increases bandwidth cost and the probability of playback lag.

Method used

By obtaining the header data of the backup video source, analyzing its playability and fluency, automatically assessing and switching to the optimal video source, and achieving intelligent switching of the video source.

Benefits of technology

It improves the reliability and fluency of video playback, reduces lag caused by network fluctuations or excessive load on the source station, and improves the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120301993A_ABST
    Figure CN120301993A_ABST
Patent Text Reader

Abstract

The invention provides a video source switching method and device, electronic equipment and a storage medium, and relates to the technical field of computer networks, in particular to the technical field of multimedia processing. The method comprises the following steps: acquiring at least one standby video source; analyzing the head data of the at least one standby video source, and evaluating the playability of the standby video source according to an analysis result to obtain an effective video source; and evaluating the fluency of the effective video sources, selecting one video source from the effective video sources as a target video source according to an evaluation result, and switching the current video source to the target video source. According to the video playing method and device, the video playing reliability is improved, it is ensured that a user can rapidly switch to an available standby source when encountering an unplayable video source, the playing fluency is remarkably improved, and the phenomenon of jamming caused by network fluctuation or too high load of a source station is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer network technologies, specifically to the field of multimedia processing technologies, and particularly to a video source switching method, apparatus, electronic device, and storage medium. Background Art

[0002] With the rapid development of mobile Internet technologies, mobile devices have become important tools for people to obtain information and entertainment. Among them, watching web drama videos on mobile devices has gradually become one of the main ways of users' daily entertainment due to its convenience and rich content selection. However, with the increasing requirements of users for video viewing experiences, the existing web video playback technologies have problems of insufficient reliability and insufficient smoothness that need to be solved urgently. Summary of the Invention

[0003] The present disclosure provides a video source switching method, apparatus, electronic device, and storage medium.

[0004] According to one aspect of the present disclosure, a video source switching method is provided. The method includes:

[0005] Obtaining at least one backup video source;

[0006] Parsing the header data of the at least one backup video source, and evaluating the playability of the backup video source according to the parsing result to obtain valid video sources;

[0007] Evaluating the smoothness of the valid video sources, selecting one of the valid video sources as the target video source according to the evaluation result, and switching the current video source to the target video source.

[0008] According to another aspect of the present disclosure, a video source switching apparatus is provided. The apparatus includes:

[0009] An obtaining module, configured to obtain at least one backup video source;

[0010] A parsing module, configured to parse the header data of the at least one backup video source, and evaluate the playability of the backup video source according to the parsing result to obtain valid video sources;

[0011] A switching module, configured to evaluate the smoothness of the valid video sources, select one of the valid video sources as the target video source according to the evaluation result, and switch the current video source to the target video source.

[0012] According to a third aspect of the present disclosure, an electronic device is provided, including:

[0013] At least one processor; and

[0014] a memory communicatively connected to the at least one processor; wherein,

[0015] the memory stores instructions executable by the at least one processor, and when executed by the at least one processor, the instructions enable the at least one processor to execute the method described in any one of the above technical solutions.

[0016] According to a fourth aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause the computer to execute the method described in any one of the above technical solutions.

[0017] According to a fifth aspect of the present disclosure, there is provided a computer program product including a computer program, where the computer program, when executed by a processor, implements the method described in any one of the above technical solutions.

[0018] The present disclosure provides a video source switching method, apparatus, electronic device and storage medium. The present disclosure can quickly evaluate the playability of backup video sources by obtaining at least one backup video source and parsing the header data of these backup video sources, and then screen out valid video sources. Then, further evaluate the smoothness of these valid video sources and select the optimal video source as the target video source from them, realizing the intelligent switching of video sources. This process not only improves the reliability of video playback, ensuring that users can quickly switch to available backup sources when encountering unplayable video sources, but also significantly improves the smoothness of playback, reducing stuttering caused by network fluctuations or high source station loads. In addition, the automated switching mechanism also greatly improves the user experience, and users can enjoy a continuous and high-quality video viewing experience without manual operation.

[0019] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it used to limit the scope of the present disclosure. Other features of the present disclosure will become easily understandable through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The drawings are used to better understand the solution and do not constitute a limitation to the present disclosure. Among them:

[0021] Figure 1 is a schematic diagram of the steps of the video source switching method in an embodiment of the present disclosure;

[0022] Figure 2 is in an embodiment of the present disclosure Figure 1 a schematic flowchart corresponding to step S102;

[0023] Figure 3 is a schematic diagram of the steps of determining valid video sources in an embodiment of the present disclosure;

[0024] Figure 4 is the schematic flow chart corresponding to step S103 in the embodiments of the present disclosure; Figure 1

[0025] Figure 5 is the schematic diagram of the step of determining the target video source in the embodiments of the present disclosure;

[0026] Figure 6 is the schematic diagram of the working process of the video playback optimization system in the embodiments of the present disclosure;

[0027] Figure 7 The principle block diagram of the video source switching device in the embodiments of the present disclosure;

[0028] Figure 8 is the block diagram of the electronic device for implementing the video source switching method in the embodiments of the present disclosure. Detailed implementation manners

[0029] The following makes an explanation of the exemplary embodiments of the present disclosure with reference to the accompanying drawings. Various details of the embodiments of the present disclosure are included to facilitate understanding, and they should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted below.

[0030] The prior art mainly adopts the following processing methods in the video playback of web dramas:

[0031] When switching web dramas, the following two methods are adopted. The first method is to implement the switching between dramas by parsing the DOM (Document Object Model) structure of the web page. This method relies on the structured information of the web page and enables users to select between different dramas. The second method is to provide a button for manually switching the video source on the player interface, and users can select different video sources according to the playback effect to obtain a better viewing experience.

[0032] When allocating the video source corresponding to the web aggregation, the default video source is roughly allocated according to the user's IP (Internet Protocol) address. This method routes the user request to a CDN (Content Delivery Network) node closer to the geographical location to reduce latency and improve the loading speed.

[0033] However, the above video playback methods for web dramas have the following problems:

[0034] ​First, there is a lack of an active detection mechanism. The existing technology does not establish an active detection mechanism for the availability of video sources. Only when users encounter playback failures or make active complaints will manual troubleshooting be triggered, which cannot avoid risks in advance and results in delayed problem response.

[0035] Second, since the existing technology solutions use static allocation of video sources, this method does not establish a dynamic association model between playback quality and network environment. It only allocates video sources based on static CDN nodes, without real-time monitoring of network conditions and the availability of video sources, which may lead to users being assigned to video sources with poor quality.

[0036] Third, due to the lack of an effective video source detection and switching mechanism in the existing technology solutions, users may repeatedly attempt to play unplayable video sources, resulting in the consumption of invalid traffic and increasing bandwidth costs.

[0037] In addition, the existing technology lacks a preloading strategy, which increases the probability of stuttering during playback. Especially in the case of poor network conditions, users may frequently encounter buffering problems.

[0038] In summary, the existing technology has obvious deficiencies in the availability detection, dynamic allocation, resource optimization, and playback smoothness of video sources, and these problems need to be solved urgently.

[0039] To solve the above technical problems, the present disclosure provides a video source switching method. See Figure 1 as shown. Figure 1 It is a schematic diagram of the steps of the video source switching method in an embodiment of the present disclosure. This method is applied to a client and includes:

[0040] Step S101, obtain at least one alternative video source.

[0041] Specifically, "obtain at least one alternative video source" means that when it is detected that there are playback problems (such as unplayable or stuttering) with the current main video source, at least one alternative video source is automatically selected from a pre-set list of alternative video sources. An alternative video source refers to other selectable video sources in addition to the current main video source being played. These video sources are usually stored on different servers or CDN nodes to ensure that when the main video source has problems, users can quickly switch to other available video sources and continue watching the video.

[0042] The specific implementation process of this solution includes: First, according to the distribution of video content, a list of backup video sources is pre-generated. This list may contain multiple backup video sources, and each backup video source contains key information such as the URL (Uniform Resource Locator) of the video, the server address, and the encoding format. When it is detected that the current main video source has an unplayable or lagging problem, the backup video source acquisition mechanism will be triggered. At this time, at least one backup video source is selected from the list of backup video sources for subsequent detection and evaluation. When acquiring the backup video source, some preset conditions (such as network status, geographical location, server load, etc.) can be used to initially screen the backup video source to ensure that the selected backup video source has high availability and performance.

[0043] In this way, it is possible to quickly respond to the playback problems of the main video source and provide users with a more reliable video playback experience. The acquisition of backup video sources is the basic step of the entire solution and provides the necessary data support for the subsequent evaluation of the playability and smoothness of the video source.

[0044] Step S102, parse the header data of at least one backup video source, and evaluate the playability of the backup video source according to the parsing result to obtain valid video sources.

[0045] Specifically, after obtaining the backup video source, the header data of the backup video source is parsed to determine whether each backup video source can be played normally. Here, the "header data" refers to the starting part of the video file or stream, which contains key information of the video, such as the encoding format, the number of streams, the duration, the frame rate, etc. These information are crucial for determining whether the video source can be correctly decoded and played by the current player.

[0046] The specific implementation process of this solution includes: First, use a video processing tool (such as FFmpeg) to open the backup video source and read its header data. Then, according to the parsed header data, evaluate the playability of the backup video source. For example, check whether the encoding format of the video is supported by the current player, whether the number of streams is complete, and whether valid duration and frame rate information can be obtained. If these key information can be successfully obtained and meet the playback requirements, it is determined that the backup video source is playable. Through the above evaluation, playable video sources can be screened out from all backup video sources. These playable video sources are called "valid video sources". These valid video sources will enter the next step of smoothness evaluation to determine the final target video source.

[0047] Through this process, it is possible to quickly exclude video sources that cannot be played due to unsupported encoding formats, data corruption, or other problems, thereby ensuring that the subsequent switched video sources are available and improving the reliability and user experience of video playback.

[0048] Step S103, evaluating the fluency of the valid video sources, selecting one of the valid video sources as the target video source according to the evaluation result, and switching the current video source to the target video source.

[0049] Specifically, after confirming that the backup video source is playable, the playback smoothness of these valid video sources is further quantitatively evaluated to ensure that users get the best viewing experience. The "smoothness" here is measured by key indicators such as the download speed, packet loss rate, and buffering time of the video source, which can reflect the transmission efficiency and stability of the video in the current network environment. In specific implementation, a small segment of data from each valid video source can be pre-fetched, and the time spent downloading this segment of data can be recorded to calculate the download speed; at the same time, the packet loss during data transmission and the buffering frequency during playback are monitored. Based on these data, the smoothness of each valid video source is comprehensively evaluated, and the video source with the best smoothness is selected as the "target video source". Finally, the currently playing video source is automatically switched to the target video source, thereby achieving seamless switching, so that users can hardly notice the switching action during the viewing process, effectively avoiding viewing interruptions caused by video freezes or loading failures, significantly improving the continuity and smoothness of video playback, and enhancing user viewing satisfaction.

[0050] The present disclosure provides a video source switching method, device, electronic device and storage medium. The present disclosure obtains at least one backup video source and parses the header data of these backup video sources, so as to quickly evaluate the playability of the backup video sources and then screen out the valid video sources. Then, the smoothness of these valid video sources is further evaluated, and the optimal video source is selected as the target video source, thereby realizing the intelligent switching of video sources. This process not only improves the reliability of video playback, ensuring that users can quickly switch to available backup sources when encountering unplayable video sources, but also significantly improves the smoothness of playback and reduces the jamming caused by network fluctuations or excessive source station load. In addition, the automated switching mechanism also greatly improves the user experience, and users can enjoy a continuous, high-quality video viewing experience without manual operation.

[0051] In some optional embodiments, see Figure 2 , Figure 2 In the present disclosure embodiment Figure 1 Flow chart corresponding to step S102. Step S102, parsing header data of at least one backup video source, and evaluating the playability of the backup video source according to the parsing result to obtain a valid video source, including:

[0052] Step S201: using a video source parsing tool to read header data of at least one backup video source.

[0053] Specifically, a "video source parsing tool" refers to a software tool that can analyze and extract the basic information of a video file or stream, such as FFmpeg. This tool can quickly read the header data of the video source, and the "header data" refers to the starting part of the video file or stream, which contains key information about the video, such as the encoding format, number of streams, duration, frame rate, etc.

[0054] The specific implementation process of this solution includes: when it is detected that there are playback problems (such as unplayable or stuck) with the current main video source, at least one alternative video source is selected from a pre-set list of alternative video sources. Then, the video source parsing tool (such as FFmpeg) is called and pointed to the selected alternative video source. The video source parsing tool opens the alternative video source and reads its header data, and then the parsing tool extracts key information from the header data, such as the encoding format, number of streams, duration, frame rate, etc., and this information will be used for subsequent playability evaluation.

[0055] Through this process, the basic information of the alternative video source can be quickly obtained, providing data support for subsequent playability evaluation. This method ensures that when there are problems with the main video source, available alternative video sources can be quickly found, thereby enhancing the user's viewing experience.

[0056] Step S202: Parse the header data of at least one alternative video source, and determine the playability of at least one alternative video source according to the parsing result.

[0057] Specifically, after obtaining the header data of at least one alternative video source, these header data are parsed. The specific implementation process of this solution includes: after using the video source parsing tool (such as FFmpeg) to open the alternative video source and read its header data, the read header data is parsed to extract key information such as the encoding format, number of streams, duration, frame rate, etc., and this information will be used to evaluate the playability of the video source. Then, according to the parsing result, the playability of the alternative video source is evaluated. For example, it can be checked whether the encoding format of the video is supported by the current player, whether the number of streams is complete, and whether valid duration and frame rate information can be obtained. If these key information can be successfully obtained and meet the playback requirements, it is determined that the alternative video source is playable. If the alternative video source is evaluated as playable, it is marked as an "effective video source". These effective video sources will enter the next step of smoothness evaluation to determine the final target video source.

[0058] Through this process, available alternative video sources can be quickly screened out, ensuring that the subsequent switched video sources can not only play, but also have high availability and stability. This method not only improves the reliability of video playback, but also reduces playback interruptions and traffic waste caused by attempting to play unplayable video sources, thereby significantly enhancing the user's viewing experience.

[0059] Step S203, if the backup video source is in a playable state, then determine the backup video source in the playable state as the valid video source.

[0060] Specifically, the "playable state" means that after the header data of the backup video source is parsed, it is judged to be in a state where it can be played normally, that is, its encoding format is supported, the number of streams is complete, and key metadata such as valid duration and frame rate information can be obtained. And the "valid video source" refers to those backup video sources that have been evaluated and confirmed to be playable normally, and these video sources will be further used for smoothness evaluation and the final video source switch.

[0061] The specific implementation process of this solution includes: once the backup video source is evaluated as being in a playable state, it is marked as a "valid video source". These valid video sources will be incorporated into the subsequent smoothness evaluation process to determine the final target video source. Then, the valid video sources will be further evaluated for their smoothness, such as download speed, packet loss rate, etc., to ensure the best viewing experience for users. Finally, the optimal video source is selected for switching according to the smoothness evaluation results.

[0062] Through this process, available backup video sources can be quickly screened out, ensuring that when the main video source has problems, it can be quickly switched to an available backup video source, thereby improving the reliability and smoothness of video playback, reducing the waiting time of users and the possibility of playback interruption.

[0063] In this way, by using a video source parsing tool to read and parse the header data of the backup video source, the playability of the backup video source can be quickly and accurately evaluated, and valid video sources can be screened out. This process not only improves the reliability of video playback, ensuring that users can quickly switch to an available backup source when encountering an unplayable video source, but also reduces playback interruptions and traffic waste caused by attempting to play unplayable video sources. In addition, by pre-screening valid video sources, higher-quality candidate sources can be provided for subsequent smoothness evaluation, further enhancing the smoothness of video playback and the user experience.

[0064] In some alternative embodiments, parsing the header data of at least one backup video source and determining the playability of at least one backup video source according to the parsing result includes:

[0065] Parse the header data of at least one backup video source to obtain metadata corresponding to the backup video source;

[0066] If the encoding format in the metadata is supported and the data stream is complete, then determine the playability of the corresponding backup video source as the playable state.

[0067] Specifically, "header data" refers to the starting part of a video file or stream, which contains key information of the video, such as encoding format, number of streams, duration, etc. These information are collectively referred to as "metadata". "Encoding format" refers to the compression method of video data, and different encoding formats may require different decoders to play. "Data stream" refers to the continuous sequence of video data. If the data stream is incomplete, the video may not play properly.

[0068] The specific implementation process of this solution includes: using a video processing tool (such as FFmpeg) to read the header data of the backup video source and extract the metadata from it. Check the encoding format information in the parsed metadata to determine whether the current player supports this encoding format. If it is supported, it means that the video source is playable at the encoding level. Then, further check the information about the data stream in the metadata to confirm whether the video stream is complete and there is no data loss or damage due to transmission errors or other reasons. If the encoding format in the metadata is supported and the data stream is complete, then determine that the corresponding backup video source is in the "playable state", that is, the state available for playback. Through this process, the availability of the backup video source can be automatically evaluated, providing a decision basis for subsequent video source switching, thereby improving the reliability of video playback and the user experience.

[0069] In this way, by parsing the header data of at least one backup video source to obtain the corresponding metadata, and further verifying whether the encoding format in these metadata is supported and whether the data stream is complete, the technically playable backup video sources can be effectively identified. This greatly improves the accuracy of video source selection and the reliability of playback, ensuring that when the main video source cannot be played, users can quickly switch to a definitely playable backup video source. This not only reduces the risk of playback failure, avoids the inconvenience of users manually searching for available video sources, but also improves the user experience, ensuring the continuity and smoothness of video playback. In addition, this method also optimizes the use of network resources by ensuring that the switch is only made when the video source is truly playable, avoiding the consumption of invalid traffic caused by attempting to play unavailable video sources.

[0070] In some alternative embodiments, using a video source parsing tool to read the header data of at least one backup video source includes:

[0071] Using a fast multimedia processing tool to read the header data of at least one backup video source.

[0072] Specifically, the fast multimedia processing tool (i.e., FFmpeg) is an open-source multimedia processing tool library that is widely used in tasks such as video and audio encoding, decoding, transcoding, recording, streaming transmission, and playback. It can quickly read the header data of the video source, which contains basic information about the video, such as the encoding format, number of streams, duration, frame rate, etc.

[0073] The specific implementation process of this solution includes: when it is detected that there is a playback problem (such as unplayable or stuck) with the current main video source, at least one alternative video source is selected from a pre-set list of alternative video sources. Then, the FFmpeg tool is called and pointed to the selected alternative video source. FFmpeg opens the video source through its built-in functions (such as avformat_open_input). FFmpeg reads the header data of the video source, which is usually located at the beginning of the video file or stream. The header data contains key information about the video, such as the encoding format, number of streams, duration, frame rate, etc. FFmpeg parses the header data and extracts the key metadata information. This information will be used for subsequent playability evaluation. For example, checking whether the encoding format of the video is supported by the current player, whether the number of streams is complete, and whether valid duration and frame rate information can be obtained.

[0074] In this way, by using FFmpeg to read the header data of at least one alternative video source, key information about the video source, such as the encoding format, number of streams, duration, etc., can be quickly obtained. This process significantly improves the efficiency of evaluating the playability of alternative video sources, ensuring that when the main video source has problems, available alternative video sources can be quickly screened out, reducing playback interruptions and waiting times. At the same time, by leveraging the efficient parsing ability of FFmpeg, unplayable video sources can be quickly excluded, avoiding ineffective switching attempts, thereby enhancing the user experience.

[0075] To facilitate understanding of the overall process of determining the effective video source in this application, refer to Figure 3 , Figure 3 is a schematic diagram of the steps for determining the effective video source in the embodiments of the present disclosure. The method includes: if the current video source fails to play, then check for alternative video sources. If there are alternative video sources, take out one alternative video source, use a video source parsing tool to read the header data of the alternative video source, parse the header data of the alternative video source to obtain the metadata corresponding to the alternative video source; if the encoding format in the metadata is supported and the data stream is complete, then determine that the playability of the corresponding alternative video source is in a playable state, that is, it can be determined that the alternative video source is an effective video source. When the current video source fails to play, select one of the effective video sources as the target video source and switch to it, so that normal playback of the video can be achieved.

[0076] In some alternative embodiments, refer toFigure 4 , Figure 4 In the present disclosure embodiment Figure 1 Flow chart corresponding to step S103. Step S103, evaluating the fluency of the valid video sources, and selecting one of the valid video sources as the target video source according to the evaluation result, includes:

[0077] Step S401, obtaining a test data segment in a valid video source, and recording the download time consumed for downloading the test data segment.

[0078] Specifically, the "test data segment" refers to a small portion of data pre-fetched from the video source, usually only a few megabytes (MB), which is large enough to evaluate the download speed and network stability of the video source, but does not take up too much bandwidth or time. The "download time" refers to the time consumed from the start of downloading the test data segment to the completion of the download. This indicator can reflect the actual transmission efficiency of the video source under the current network environment.

[0079] The specific implementation process of the scheme includes: after parsing the header data, at least one valid video source that can be played has been screened out. Then a small segment of data is pre-fetched from each valid video source as a test data segment. It should be noted that this process is usually performed in the background of video playback and will not affect the user's viewing experience. When pre-fetching a small segment of data from each valid video source, the time consumed to download each test data segment, that is, the download time, is recorded at the same time. This time includes the entire process from sending a request to receiving the data. After obtaining the size and download time of the test data segment, the actual download speed of each valid video source is calculated by the size and download time of the test data segment. Download speed is one of the important indicators for evaluating the fluency of a video source. A higher download speed usually means a smoother playback experience. Finally, based on the calculated download speed, the fluency of each valid video source is further evaluated, and the optimal video source is selected as the target video source for switching.

[0080] Through this process, the network transmission performance of each valid video source can be quickly evaluated to ensure that when a problem occurs with the main video source, it can be switched to the backup video source with the best network conditions, thereby significantly improving the smoothness of video playback and user experience.

[0081] Step S402: determining the fluency of the effective video source according to the data size and download time of the test data segment.

[0082] Specifically, "smoothness" refers to the coherence of video playback, that is, whether there will be stuttering or buffering interruptions during video playback. After obtaining the data size and download time of the test data segment, the actual download speed of each valid video source is calculated based on the size and download time of the test data segment. Finally, according to the calculated download speed, the smoothness of each valid video source is evaluated. It should be noted that in addition to the download speed, other metrics (such as packet loss rate, buffering frequency, etc.) can of course be combined to comprehensively evaluate the smoothness of the video source.

[0083] Step S403, select one of the valid video sources as the target video source according to the smoothness of the valid video sources.

[0084] Specifically, "smoothness" refers to the coherence of video playback, that is, whether there will be stuttering or buffering interruptions during video playback, which is usually measured by metrics such as download speed, packet loss rate, buffering frequency, etc. And the "target video source" refers to the video source that is considered to have the best smoothness after evaluation among multiple valid video sources, and will be switched by the system to the currently playing video source.

[0085] After obtaining the smoothness of the valid video sources, select the valid video source with the highest smoothness as the target video source. This selection process ensures that users can obtain the best viewing experience. Finally, switch the currently playing video source to the selected target video source. This switching process is usually completed in the background, and users can hardly notice the switching action. Through this process, it can be ensured that when the main video source has problems, it can quickly switch to the backup video source with the best network conditions, thus significantly improving the smoothness of video playback and the user experience.

[0086] In this way, by obtaining the test data segments in the valid video sources and recording their download times, the smoothness of each valid video source can be accurately evaluated. The smoothness of the video source is evaluated based on the download speed calculated from the size and download time of the test data segment, and the video source with the highest smoothness is selected as the target video source. This process not only ensures that when the main video source has problems, it can quickly switch to the optimal backup video source, but also significantly improves the smoothness and stability of video playback, reduces stuttering and buffering time, thus providing users with a better viewing experience.

[0087] In some alternative embodiments, determining the smoothness of the valid video source according to the data size and download time of the test data segment includes:

[0088] Calculate the ratio between the data size and the download time of the test data segment to obtain the download speed, and use the download speed as the smoothness of the valid video source.

[0089] Specifically, a "test data segment" refers to a small portion of data pre-fetched from a video source, usually only a few megabytes (MB), which is large enough to evaluate the download speed and network stability of the video source, but does not occupy too much bandwidth or time. The "download time" refers to the time consumed from the start of downloading the test data segment to the completion of the download. This metric can reflect the actual transmission efficiency of the video source under the current network environment. The "download speed" is calculated by dividing the data size of the test data segment by the download time. It directly reflects the speed of video data transmission and is an important indicator for evaluating the smoothness of the video source.

[0090] The specific implementation process of this solution includes: calculating the actual download speed of each valid video source based on the data size and download time of the test data segment. The calculation formula for the download speed is:

[0091] Download speed = Data size of the test data segment / Download time. For example, if the size of the test data segment is 1MB and the download time is 2 seconds, the download speed is 0.5MB / s. The calculated download speed is used as the smoothness level of the valid video source. A higher download speed usually means a smoother playback experience because the video data can be transmitted to the player faster, reducing the buffering time and the possibility of stuttering. Finally, based on the download speed, the valid video source with the highest smoothness level is selected as the target video source, and the current video source is switched to this target video source.

[0092] In this way, by calculating the ratio between the data size and the download time of the test data segment to obtain the download speed, and using this as the evaluation criterion for the smoothness level of the valid video source, it is possible to quickly and accurately quantify the network transmission performance of each valid video source. This quantitative evaluation method makes the selection of the target video source more scientific and objective, ensuring that the switched video source can provide the best playback smoothness under the current network environment. This not only reduces the stuttering and buffering time during video playback, improving the user's viewing experience, but also enhances the overall performance and reliability of the system, making video playback more stable and efficient.

[0093] In some optional embodiments, selecting one of the valid video sources as the target video source according to the smoothness level of the valid video source includes:

[0094] Obtaining the video source with the fastest download speed from the valid video sources, and using the video source with the fastest download speed as the target video source.

[0095] Specifically, the feature of "obtaining the video source with the fastest download speed from the valid video sources and using the video source with the fastest download speed as the target video source" describes how to select the optimal video source for playback among multiple valid video sources. Here, the "valid video source" refers to the backup video source that can be played normally after header data parsing and playability evaluation. The "download speed" refers to the speed calculated by prefetching test data segments and recording their download times, which directly reflects the transmission efficiency of the video source in the current network environment. The "target video source" refers to the video source with the highest download speed selected after evaluation among multiple valid video sources, and it is switched to the currently playing video source.

[0096] After calculating the actual download speed of each valid video source based on the data size and download time of the test data segments, compare the download speeds of all valid video sources and select the video source with the fastest download speed as the target video source. This selection process ensures that users can obtain the best viewing experience.

[0097] In this way, by selecting the video source with the fastest download speed from the valid video sources as the target video source, it can be ensured that when the main video source has problems, it can quickly switch to the backup video source with the best network conditions. This process not only significantly improves the fluency and stability of video playback, reduces stuttering and buffering time, but also optimizes the user's viewing experience, enabling users to enjoy high-quality video content in different network environments. At the same time, this optimization selection mechanism based on download speed improves the overall performance and reliability of the system, ensuring the coherence and efficiency of video playback.

[0098] For the convenience of understanding the overall process of determining the target video source in this application as a whole, see Figure 5 , Figure 5 is a schematic diagram of the steps for determining the target video source in the embodiments of the present disclosure. The method includes: if it is detected that the current video source is stuck, trigger the prefetch mechanism, that is, prefetch the test data segments in the valid video sources and record the download time consumed for downloading the test data segments. Calculate the ratio between the data size of the test data segments and the download time to obtain the download speed, and use the download speed as the smoothness degree of the valid video source. Obtain the video source with the fastest download speed from the valid video sources, use the video source with the fastest download speed as the target video source, and switch the current video source to the target video source.

[0099] In some optional embodiments, before obtaining at least one backup video source, the method further includes:

[0100] Obtain the playback state of the current video source;

[0101] If the playback status of the current video source is in an unplayable state, at least one alternative video source is obtained.

[0102] Specifically, the "playback status" refers to the playback situation of the video source in the current network environment, including whether it can be loaded normally, whether the playback is smooth, etc. The "unplayable state" refers to the situation where the video source cannot be played normally due to network problems, server failures or other reasons. The alternative video source refers to other video sources that are preset and can replace the current video source, usually stored on different servers or CDN nodes to ensure quick switching when the main video source has problems.

[0103] The specific implementation process of this solution includes: real-time monitoring of the playback status of the current video source, and judging whether the video can be played normally by detecting indicators such as video loading time, buffering time, and packet loss rate. If it is detected that the playback status of the current video source is in an unplayable state, for example, the video cannot be loaded or there are frequent freezes during playback, the alternative video source acquisition mechanism will be triggered. Select at least one alternative video source from the preset list of alternative video sources. The list of alternative video sources is usually generated during system initialization and contains detailed information of multiple alternative video sources, such as URLs, server addresses, encoding formats, etc. When obtaining alternative video sources, the alternative video sources can be initially screened according to factors such as the current network condition, user geographical location, and server load to ensure that the selected alternative video sources have high availability and performance. Through this process, the playback problems of the current video source can be quickly responded to, and a switch can be made to an available alternative video source in a timely manner, thereby reducing the playback interruption time and enhancing the user experience. This mechanism not only improves the reliability and stability of video playback but also enhances the fault tolerance of the system, ensuring that users can obtain a smooth viewing experience in different network environments.

[0104] In this way, by real-time monitoring the playback status of the current video source and quickly obtaining at least one alternative video source when an unplayable state is detected, the time of video playback interruption can be effectively reduced, ensuring that users can quickly switch to an available video source when encountering playback problems, thereby significantly enhancing the reliability and stability of video playback. This mechanism not only improves the fault tolerance of the system but also enhances the user experience, enabling users to enjoy a continuous and smooth viewing experience in different network environments.

[0105] In some alternative embodiments, the method further includes:

[0106] Uploading the log file generated on the client to the server, and analyzing the log file by the server to sort the priorities of the video sources.

[0107] Specifically, the feature of "uploading the log files generated on the client to the server and analyzing the log files by the server to sort the priorities of video sources" describes how to utilize the log data generated on the client to optimize the selection of video sources. Here, the "log files" refer to the record files generated by the client during video playback, which contain key information such as user behavior data, network status, playback smoothness, buffering time, packet loss rate, etc. These log files can reflect the viewing experience of users in different network environments and the actual performance of video sources. And the "priority sorting" means that the server dynamically evaluates and sorts the video sources according to the data in the log files, so as to preferentially select the video sources with better performance in subsequent playback.

[0108] The specific implementation process of this solution includes: The client records various key information in real time during video playback to generate log files. This information includes but is not limited to user playback behaviors (such as pausing, fast-forwarding, switching video sources, etc.), network status (such as bandwidth, latency, packet loss rate, etc.), and playback smoothness (such as the number of freezes, buffering time, etc.). The client regularly uploads the generated log files to the server. This process usually occurs in the background and does not affect the user's viewing experience. The server receives and stores the log files from the client, and then conducts multi-dimensional analysis on these log data. The analysis content includes but is not limited to indicators such as the freeze rate, loading time, and packet loss rate of video sources to evaluate the performance and user experience of each video source. The server dynamically sorts the priorities of video sources according to the analysis results. Video sources with good performance (such as low freeze rate, high download speed, low packet loss rate, etc.) will be given higher priorities, while those with poor performance will have their priorities reduced. In subsequent video playback, according to the priority sorting results, video sources with better performance are preferentially selected for playback. This not only improves the overall quality of video playback but also optimizes the user's viewing experience.

[0109] Through this process, it is possible to dynamically adjust the priorities of video sources based on actual user behavior and network environment data, thereby implementing a more intelligent and efficient video source selection mechanism. This method not only improves the stability and smoothness of video playback but also enhances the system's adaptability, ensuring that users can obtain the best viewing experience under different network conditions.

[0110] In this way, by uploading the log files generated by the client to the server, and the server analyzing these log files to sort the priorities of the video sources, this solution can achieve dynamic optimization based on the user's actual viewing experience and network environment. This mechanism enables the system to intelligently adjust the priority of the video source based on key indicators such as the freeze rate, loading time, and packet loss rate recorded in the log, and give priority to recommending video sources with better performance. This not only improves the stability and smoothness of video playback, reduces the user's waiting time and the possibility of playback interruption, but also enhances the system's adaptive ability, ensuring that users can provide a high-quality viewing experience under different network conditions.

[0111] In some optional embodiments, see Figure 6 , Figure 6 It is a schematic diagram of the workflow of the video playback optimization system in the embodiment of the present disclosure. The process includes: first, the system collects log data including fluency, region, network and time, and uploads it to the log server. Subsequently, the data is cleaned and aggregated through the real-time stream processing engine, and multi-dimensional analysis is performed, including regional network matching, historical fluency score and user intent recognition. The analysis results are used to generate a dynamic weight table to optimize the search result sorting. When a user initiates a search request, the system assigns the user to different sites (site A, site B, etc.) according to the dynamic weight table and load balancing algorithm (such as consistent hashing) to ensure that the user obtains the best video source, thereby improving the playback experience. In addition, the system is also provided with a feedback loop to continue to collect logs according to the client playback behavior to achieve continuous system optimization.

[0112] The following describes an apparatus embodiment of the present application, which can be used to execute the video source switching method in the above-mentioned embodiment of the present application. For details not disclosed in the apparatus embodiment of the present application, please refer to the above-mentioned embodiment of the video source switching method of the present application.

[0113] The present disclosure also provides a video source switching device 700, such as Figure 7 As shown, including:

[0114] An acquisition module 701 is used to acquire at least one backup video source;

[0115] The parsing module 702 is used to parse the header data of at least one backup video source, and evaluate the playability of the backup video source according to the parsing result to obtain a valid video source;

[0116] The switching module 703 is used to evaluate the fluency of the valid video sources, select one of the video sources from the valid video sources as the target video source according to the evaluation result, and switch the current video source to the target video source.

[0117] In some alternative embodiments, the parsing module 702 parses the header data of at least one backup video source, and evaluates the playability of the backup video source according to the parsing result to obtain a valid video source, including:

[0118] Read the header data of at least one backup video source by using a video source parsing tool;

[0119] Parse the header data of at least one backup video source, and determine the playability of at least one backup video source according to the parsing result;

[0120] If the backup video source is in a playable state, determine the backup video source in the playable state as a valid video source.

[0121] In some alternative embodiments, the parsing module 702 parses the header data of at least one backup video source, and determines the playability of at least one backup video source according to the parsing result, including:

[0122] Parse the header data of at least one backup video source to obtain metadata corresponding to the backup video source;

[0123] If the encoding format in the metadata is supported and the data stream is complete, determine that the playability of the corresponding backup video source is in a playable state.

[0124] In some alternative embodiments, the parsing module 702 reads the header data of at least one backup video source by using a video source parsing tool, including:

[0125] Read the header data of at least one backup video source by using a fast multimedia processing tool.

[0126] In some alternative embodiments, the switching module 703 evaluates the smoothness of the valid video source, and selects one of the valid video sources as the target video source according to the evaluation result, including:

[0127] Obtain a test data segment in the valid video source, and record the download time consumed for downloading the test data segment;

[0128] Determine the smoothness of the valid video source according to the data size and download time of the test data segment;

[0129] Select one of the valid video sources as the target video source according to the smoothness of the valid video source.

[0130] In some alternative embodiments, the switching module 703 determines the smoothness of the valid video source according to the data size and download time of the test data segment, including:

[0131] Calculate the ratio between the data size and the download time of the test data segment to obtain the download speed, and use the download speed as the smoothness of the valid video source.

[0132] In some alternative embodiments, the switching module 703 selects one of the valid video sources as the target video source according to the smoothness of the valid video source, including:

[0133] Obtain the video source with the fastest download speed from the valid video sources, and use the video source with the fastest download speed as the target video source.

[0134] In some alternative embodiments, before obtaining at least one backup video source, the obtaining module 701 is further configured to:

[0135] Obtain the playing state of the current video source;

[0136] If the playing state of the current video source is an unplayable state, obtain at least one backup video source.

[0137] In some alternative embodiments, the device further includes an uploading module, configured to:

[0138] Upload the log file generated at the client to the server, and analyze the log file through the server to sort the priorities of the video sources.

[0139] In the technical solution of the present disclosure, the acquisition, storage, and application of the user's personal information involved all comply with the provisions of relevant laws and regulations and do not violate public order and good customs.

[0140] According to the embodiments of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0141] Figure 8 FIG. shows a schematic block diagram of an exemplary electronic device 800 that can be used to implement the embodiments of the present disclosure. The electronic device is intended to represent various forms of digital computers, such as, a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as, a personal digital processing, a cellular phone, a smart phone, a wearable device, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0142] As Figure 8As shown, the electronic device 800 includes a computing unit 801, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the device 800 can also be stored. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0143] Multiple components in the device 800 are connected to the I / O interface 805, including: an input unit 806, such as a keyboard, a mouse, etc.; an output unit 808, such as various types of displays, speakers, etc.; a storage unit 808, such as a magnetic disk, an optical disc, etc.; and a communication unit 809, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 809 allows the device 800 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.

[0144] The computing unit 801 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 801 include but are not limited to a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The computing unit 801 executes the various methods and processes described above, such as the video source switching method. For example, in some embodiments, the video source switching method can be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as the storage unit 808. In some embodiments, part or all of the computer program can be loaded and / or installed onto the device 800 via the ROM 802 and / or the communication unit 809. When the computer program is loaded into the RAM 803 and executed by the computing unit 801, one or more steps of the small program distribution described above can be executed. Alternatively, in other embodiments, the computing unit 801 can be configured to execute the video source switching method in any other appropriate way (e.g., by means of firmware).

[0145] The various embodiments of the systems and techniques described above in this specification can be implemented in digital electronic circuitry, integrated circuit systems, field programmable gate arrays (FPGA), application specific integrated circuits (ASIC), application specific standard products (ASSP), systems-on-chip (SOC), complex programmable logic devices (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include: being implemented in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be a special-purpose or general-purpose programmable processor that receives data and instructions from, and transmits data and instructions to, a storage system, at least one input device, and at least one output device.

[0146] The program code for implementing the methods of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable video source switching device, such that when the program codes are executed by the processor or controller, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The program code can be executed entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine, or entirely on the remote machine or server.

[0147] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0148] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, speech input, or tactile input).

[0149] The systems and techniques described herein can be implemented in a computing system including backend components (e.g., as a data server), or a computing system including middleware components (e.g., an application server), or a computing system including frontend components (e.g., a user computer having a graphical user interface or a web browser through which the user can interact with an implementation of the systems and techniques described herein), or a computing system including any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local area network (LAN), wide area network (WAN), and the Internet.

[0150] A computer system can include a client and a server. The client and the server are generally far from each other and typically interact through a communication network. The client - server relationship is created by computer programs running on respective computers and having a client - server relationship with each other. The server can be a cloud server, a server of a distributed system, or a server incorporating blockchain.

[0151] It should be understood that the various forms of processes shown above can be reordered, added to, or steps deleted. For example, the steps recited in this disclosure can be executed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of this disclosure can be achieved, and no limitation is imposed herein.

[0152] The above - described specific embodiments do not constitute a limitation on the protection scope of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub - combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure shall be included within the protection scope of this disclosure.

Claims

1. A video source switching method, wherein, The method includes: Obtain at least one backup video source; Parse the header data of the at least one backup video source, and evaluate the playability of the backup video source according to the parsing result to obtain a valid video source; Evaluate the smoothness of the valid video source, select one of the valid video sources as the target video source according to the evaluation result, and switch the current video source to the target video source.

2. The method according to claim 1, wherein, The step of parsing the header data of the at least one backup video source and evaluating the playability of the backup video source according to the parsing result to obtain a valid video source includes: Use a video source parsing tool to read the header data of the at least one backup video source; Parse the header data of the at least one backup video source, and determine the playability of the at least one backup video source according to the parsing result; If the backup video source is in a playable state, determine the backup video source in the playable state as a valid video source.

3. The method according to claim 2, wherein, The step of parsing the header data of the at least one backup video source and determining the playability of the at least one backup video source according to the parsing result includes: Parse the header data of the at least one backup video source to obtain metadata corresponding to the backup video source; If the encoding format in the metadata is supported and the data stream is complete, determine that the playability of the corresponding backup video source is in a playable state.

4. The method according to claim 2, wherein The step of using a video source parsing tool to read the header data of the at least one backup video source includes: Use a fast multimedia processing tool to read the header data of the at least one backup video source.

5. The method according to claim 1, wherein The step of evaluating the smoothness of the valid video source, selecting one of the valid video sources as the target video source according to the evaluation result includes: Obtain a test data segment in the valid video source, and record the download time consumed for downloading the test data segment; Determine the smoothness of the valid video source according to the data size of the test data segment and the download time; Select one of the valid video sources as the target video source according to the smoothness of the valid video source.

6. The method according to claim 5, wherein The step of determining the smoothness of the valid video source according to the data size of the test data segment and the download time includes: Calculate the ratio between the data size of the test data segment and the download time to obtain the download speed, and use the download speed as the smoothness of the valid video source.

7. The method according to claim 6, wherein, The step of selecting one of the valid video sources as the target video source according to the smoothness of the valid video source includes: Obtain the video source with the fastest download speed from the valid video sources, and use the video source with the fastest download speed as the target video source.

8. The method according to any one of claims 1 to 7, wherein, Before obtaining the at least one backup video source, the method further includes: Obtain the play state of the current video source; If the play state of the current video source is in an unplayable state, obtain at least one backup video source.

9. The method according to any one of claims 1 to 7, wherein, The method further includes: Upload the log file generated on the client to the server, and analyze the log file through the server to sort the priorities of the video sources.

10. A video source switching device, wherein, The device includes: An acquisition module, configured to acquire at least one backup video source; An analysis module, configured to analyze the header data of the at least one backup video source, and evaluate the playability of the backup video source according to the analysis result to obtain a valid video source; A switching module, configured to evaluate the smoothness of the valid video source, select one of the valid video sources as the target video source according to the evaluation result, and switch the current video source to the target video source.

11. An electronic device, comprising: At least one processor; And A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method according to any one of claims 1-9.

12. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to execute the method according to any one of claims 1-9.

13. A computer program product, comprising a computer program, where the computer program, when executed by a processor, implements the method according to any one of claims 1-9.