Video preloading method, device, equipment and storage medium
By monitoring and controlling the video buffering amount and setting a duration threshold to start or stop subsequent video preloading, the problem of low video preloading hit rate is solved, and the user experience and system efficiency are improved.
Patent Information
- Application Number
- CN202110996519.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-27
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2041-08-27
AI Technical Summary
In the prior art, the video preloading strategy results in a low video preloading hit rate, and the first frame length is prolonged when the user switches videos, affecting the viewing experience, especially in the case of longer videos.
By monitoring the playback time supported by the buffered amount of the current video, setting the preset first and second time thresholds, and controlling the start or stop of the preloading of subsequent videos, the smoothness of the current video is ensured and the preloading hit rate is improved.
It improves the hit rate of video preloading, shortens the first frame length when users switch videos, enhances the user viewing experience, and reduces system resource consumption.
Smart Images

Figure CN115734020B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data processing, and in particular to a video preloading method, apparatus, device, and storage medium. Background Art
[0002] With the continuous development of Internet short video technology, more and more short video apps (Applications) are affecting people's lives and providing people with richer leisure and entertainment experiences.
[0003] Currently, when users watch videos based on short video apps, subsequent videos are preloaded after the currently playing video is loaded. This way, when users switch to subsequent videos after the currently playing video is finished, the first frame length of the subsequent videos can be shortened to ensure the user's viewing experience.
[0004] However, if the user switches to a subsequent video before the currently playing video has finished loading, the preloading strategy described above will prevent the subsequent video from being preloaded when the user switches to the subsequent video. This is particularly true for videos with a long total duration. Therefore, the preloading strategy described above can result in a low video preloading hit rate, meaning that in many cases, the subsequent video cannot be preloaded.
[0005] Therefore, how to improve the hit rate of video preloading, thereby increasing the probability of shortening the first frame length when the user switches to the subsequent video for playback and ensuring the user's viewing experience, is a technical problem that urgently needs to be solved. Summary of the Invention
[0006] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides a video preloading method to improve the hit rate of video preloading, thereby increasing the probability of shortening the first frame length when the user switches to a subsequent video for playback, thereby ensuring the user's viewing experience.
[0007] In a first aspect, the present disclosure provides a video preloading method, the method comprising:
[0008] Monitoring, within a preset first time period, whether a playback duration supported by a buffered amount of a current video is greater than a preset first duration threshold; wherein the current video belongs to a video stream, the video stream includes a plurality of videos having a playback order, and the preset first duration threshold is determined based on the total duration of the current video;
[0009] If it is determined that the playback duration supported by the buffered amount of the current video is greater than the preset first duration threshold, control is performed to start preloading of the next N videos adjacent to the current video in the video stream; wherein N is a preset natural number.
[0010] In an optional implementation manner, after the control starts preloading N adjacent videos following the current video, the method further includes:
[0011] monitoring, within a preset second time period, whether a playback duration supported by a buffered amount of the current video is less than a preset second duration threshold; wherein the preset second duration threshold is determined based on the total duration of the current video, and the preset second duration threshold is less than the first duration threshold;
[0012] If it is determined that the playback time supported by the buffered amount of the current video is less than the preset second time threshold, the control stops preloading the last M videos of the last N videos, where M is a preset natural number and M is less than or equal to N.
[0013] In an optional implementation manner, before the control stops preloading the last M videos among the last N videos, the method further includes:
[0014] Determine whether the current video has finished loading;
[0015] Correspondingly, if it is determined that the playback duration supported by the buffered amount of the current video is less than the preset second duration threshold, controlling to stop preloading the next M videos of the next N videos includes:
[0016] If it is determined that the playback time supported by the buffered amount of the current video is less than the preset second time threshold, and the current video has not been loaded, the control stops preloading the last M videos of the last N videos.
[0017] In an optional implementation, the preset first duration threshold or the second duration threshold is determined based on the current network speed and / or the picture clarity of the current video and the total duration of the current video.
[0018] In an optional implementation, the method further includes:
[0019] Determine the duration threshold deviation based on the current network speed fluctuation;
[0020] Determining whether the playback duration supported by the buffered amount of the current video is less than the difference between the preset first duration threshold and the duration threshold deviation;
[0021] If it is determined that the playback duration supported by the buffered amount of the current video is not less than the difference between the preset first duration threshold and the duration threshold deviation, the preset first duration threshold is updated based on the duration threshold deviation.
[0022] In an optional implementation, if it is determined that the playback duration supported by the buffered amount of the current video is not less than the difference between the preset first duration threshold and the duration threshold deviation, then determining whether the playback duration supported by the buffered amount of the current video is greater than the sum of the preset first duration threshold and the duration threshold deviation;
[0023] If it is determined that the playback duration supported by the buffered amount of the current video is greater than the sum of the preset first duration threshold and the duration threshold deviation, the preset first duration threshold is updated using the sum of the duration threshold deviation and the preset first duration threshold.
[0024] In an optional embodiment, if it is determined that the playback time supported by the buffered amount of the current video is not greater than the sum of the preset first time threshold and the time threshold deviation, the preset first time threshold is updated using the sum of the time threshold deviation and the playback time supported by the buffered amount of the current video.
[0025] In a second aspect, the present disclosure provides a video preloading device, the device comprising:
[0026] a first monitoring module, configured to monitor, within a preset first time period, whether a playback duration supported by a buffered amount of a current video is greater than a preset first duration threshold; wherein the current video belongs to a video stream, the video stream includes a plurality of videos in a playback order, and the preset first duration threshold is determined based on the total duration of the current video;
[0027] The first control module is used to control the preloading of the next N videos adjacent to the current video in the video stream when it determines that the playback duration supported by the buffered amount of the current video is greater than the preset first duration threshold; wherein N is a preset natural number.
[0028] In a third aspect, the present disclosure provides a computer-readable storage medium, wherein instructions are stored in the computer-readable storage medium. When the instructions are executed on a terminal device, the terminal device implements the above method.
[0029] In a fourth aspect, the present disclosure provides a device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned method when executing the computer program.
[0030] In a fifth aspect, the present disclosure provides a computer program product, which includes a computer program / instructions, and the computer program / instructions implement the above method when executed by a processor.
[0031] The technical solution provided by the embodiments of the present disclosure has at least the following advantages compared with the prior art:
[0032] An embodiment of the present disclosure provides a video preloading method. First, a preset first time period is used to monitor whether the playback duration supported by the buffered amount of the current video is greater than a preset first duration threshold. The current video belongs to a video stream, which includes multiple videos with a playback order relationship. The preset first duration threshold is determined based on the total duration of the current video. If it is determined that the playback duration supported by the buffered amount of the current video is greater than the preset first duration threshold, the preloading of the next N videos adjacent to the current video in the video stream is controlled to be started.
[0033] The embodiment of the present disclosure controls the start of preloading of subsequent videos by monitoring whether the playback time supported by the buffered amount of the currently playing video is greater than a preset first time threshold. Compared with the strategy in the prior art that triggers the preloading of subsequent videos only after the loading of the currently playing video is completed, the embodiment of the present disclosure can improve the hit rate of video preloading. That is to say, compared with the prior art, it can achieve preloading of subsequent videos in more cases, thereby increasing the probability of shortening the first frame time when the user switches to the subsequent video for playback, thereby ensuring the user's viewing experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0035] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0036] Figure 1 A flowchart of a video preloading method provided in an embodiment of the present disclosure;
[0037] Figure 2 A flowchart of another video preloading method provided by an embodiment of the present disclosure;
[0038] Figure 3 A schematic diagram of an implementation process of a video preloading method provided in an embodiment of the present disclosure;
[0039] Figure 4A flowchart of a method for updating a preset first duration threshold provided in an embodiment of the present disclosure;
[0040] Figure 5 A schematic structural diagram of a video preloading device provided in an embodiment of the present disclosure;
[0041] Figure 6 A schematic diagram of the structure of a video preloading device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0042] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features therein can be combined with each other in the absence of conflict.
[0043] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.
[0044] Currently, when users watch videos on short video apps, subsequent videos are preloaded after the currently playing video is loaded. However, if the user switches from the currently playing video to the subsequent video before the current video is loaded, the above-mentioned preloading strategy will result in the subsequent video not being preloaded when the user switches to the subsequent video. This situation is particularly evident when the currently playing video is a long video. It can be seen that the above-mentioned preloading strategy may result in a low hit rate for video preloading. In other words, the existing preloading strategy cannot preload subsequent videos in many cases.
[0045] Therefore, how to improve the hit rate of video preloading, thereby increasing the probability of shortening the first frame length when the user switches to the subsequent video for playback and ensuring the user's viewing experience, is a technical problem that urgently needs to be solved.
[0046] To this end, an embodiment of the present disclosure provides a video preloading method, which monitors whether the playback time supported by the buffered amount of the current video is greater than a preset first time threshold in a preset first time period; wherein, the current video belongs to a video stream, the video stream includes multiple videos with a playback order relationship, and the preset first time threshold is determined based on the total time of the current video; if it is determined that the playback time supported by the buffered amount of the current video is greater than the preset first time threshold, then control is started to preload the next N videos adjacent to the current video in the video stream.
[0047] Compared with the strategy in the prior art that triggers the preloading of subsequent videos only after the currently playing video is loaded, the embodiment of the present disclosure can improve the hit rate of video preloading. That is, compared with the prior art, it can realize the preloading of subsequent videos in more cases, thereby increasing the probability of shortening the first frame length when the user switches to the subsequent video for playback, thereby ensuring the user's viewing experience.
[0048] Based on this, the embodiment of the present disclosure provides a video preloading method, referring to Figure 1 , is a flowchart of a video preloading method provided by an embodiment of the present disclosure, the method comprising:
[0049] S101: Monitor, within a preset first time period, whether a playback duration supported by a buffered amount of a current video is greater than a preset first duration threshold.
[0050] The current video belongs to a video stream, and the video stream includes multiple videos having a playback order relationship. The preset first duration threshold is determined based on the total duration of the current video.
[0051] In the disclosed embodiment, the video stream may be a recommended video stream, a video collection, or a TV series. The current video may be any video in the recommended video stream, any video in the video collection, or any TV series in the TV series.
[0052] In the embodiment of the present disclosure, the playback duration supported by the buffered amount of the current video refers to the duration that the current video can still be played when the network is disconnected.
[0053] In an optional implementation, the playback duration supported by the buffered amount of the current video is related to the total duration of the current video, the buffered amount of the current video, the total size of the current video, etc. Specifically, the playback duration supported by the buffered amount of the current video can be calculated based on the following formula (1):
[0054] buffer Time=duration*preload size / video size (1)
[0055] Among them, buffer time is used to indicate the playback time supported by the buffered amount of the current video, duration is used to indicate the total duration of the current video, preload size is used to indicate the buffered amount of the current video, and video size is used to indicate the total size of the current video.
[0056] For example, when the total size of the current video (video size) is 100M, the preloaded size of the video (preload size) is 10M, and the total duration of the current video (duration) is 10s, then based on the above formula (1), it can be calculated that the playback duration supported by the buffered amount of the current video is buffer time = 10s*10M / 100M = 1s.
[0057] In order to improve the user's viewing experience when switching from the current video to the subsequent video, the embodiment of the present disclosure can control the preloading of the subsequent video during the playback of the current video if it is determined that the playback time supported by the buffered amount of the current video is greater than the first time threshold.
[0058] If the playback duration supported by the buffered amount of the current video is greater than a preset first duration threshold, the playback duration supported by the buffered amount of the current video can ensure smooth playback of the current video and does not affect the viewing experience of the current video. Therefore, in the embodiment of the present disclosure, preloading of subsequent videos can only be performed while ensuring smooth playback of the current video.
[0059] In an optional embodiment, the preset first duration threshold can be determined based on the total duration of the current video. For example, if the total duration of the current video is between 30 seconds and 60 seconds, the preset first duration threshold can be set to 15 seconds. If the total duration of the current video is 60 seconds or longer, the preset first duration threshold can be set to 20 seconds.
[0060] In actual applications, the playback time supported by the buffered amount of the current video can be periodically monitored, so that when it is determined that the playback time supported by the buffered amount of the current video is greater than the preset first time threshold, the preloading of the next N videos adjacent to the current video in the video stream can be controlled in a timely manner to improve the preloading hit rate.
[0061] Specifically, in the embodiment of the present disclosure, the monitoring period of the playback time supported by the buffered amount of the current video can be set based on demand. In an optional implementation, the monitoring period is proportional to the total length of the current video. The longer the total length, the longer the corresponding monitoring period. Conversely, the shorter the total length, the shorter the corresponding monitoring period. For example, for a short video of 1 minute, the monitoring period can be set to 4 seconds, and for a short video of 10 minutes, the monitoring period can be set to 1 minute.
[0062] S102. If it is determined that the playback duration supported by the buffered amount of the current video is greater than the preset first duration threshold, control to start preloading of the next N videos adjacent to the current video in the video stream; wherein N is a preset natural number.
[0063] In the disclosed embodiment, if it is determined that the playback duration supported by the buffered amount of the current video is greater than a preset first duration threshold, it indicates that the playback duration supported by the buffered amount of the current video can ensure smooth playback of the current video and does not affect the viewing experience of the current video. Therefore, preloading of the next N videos adjacent to the current video can be controlled and enabled.
[0064] For example, the total playback time of the video currently played by the user is 1 minute, and the preset first time threshold can be set to 20 seconds. During the loading process of the current video, when it is monitored that the playback time supported by the buffered amount of the current video is greater than 20 seconds, the control starts to preload the next N videos adjacent to the current video in the video stream.
[0065] Among them, N is a preset natural number, which can be 1 or multiple. Specifically, N can be set based on demand or determined based on the current network speed, etc., and the embodiments of the present disclosure do not limit it.
[0066] In an optional implementation, assuming that N is a natural number greater than 1, for example 3, when it is determined that the playback time supported by the buffered amount of the current video is greater than the preset first time threshold, the control is turned on to preload the next three videos adjacent to the current video in the video stream.
[0067] The implementation method for controlling the preloading of the next three videos adjacent to the current video may include controlling the preloading of the preset buffer amount of the next three videos in sequence. For example, the next three videos adjacent to the current video may be named video A (i.e., the first video after the current video and adjacent to the current video), video B (i.e., the next video adjacent to the aforementioned video A), and the third video (i.e., the next video adjacent to the aforementioned video B) in sequence. Specifically, first control the preloading of video A, and when it is determined that the preloaded buffer amount of video A reaches the preset buffer amount, continue to enable the preloading of video B. When it is determined that the preloaded buffer amount of video B reaches the preset buffer amount, then enable the preloading of video C.
[0068] In the video preloading method provided by the embodiment of the present disclosure, whether to start preloading of the next N videos adjacent to the current video is determined based on whether the playback time supported by the buffered amount of the current video is greater than a preset first time threshold. This method can achieve preloading of subsequent videos in more cases, improve the probability of preloading the next N videos adjacent to the current video, and thus increase the probability of shortening the first frame time when the user switches to the subsequent video for playback, thereby ensuring the user's viewing experience.
[0069] Based on the above embodiment, in order to further improve the user's viewing experience of the currently playing video and avoid the situation where the playback duration supported by the buffered amount of the current video is insufficient to ensure the smoothness of the current video, the embodiment of the present disclosure can control the cessation of preloading of the last M videos of the next N videos based on a preset second duration threshold. Specifically, by determining that the playback duration supported by the buffered amount of the current video is less than the preset second duration threshold, the preloading of multiple videos after the current video is controlled to be stopped, thereby maximally ensuring the smoothness of the current video and avoiding affecting the user's viewing experience of the current video.
[0070] Based on this, the embodiment of the present disclosure provides another video preloading method, referring to Figure 2 , is a flowchart of another video preloading method provided by an embodiment of the present disclosure, the method comprising:
[0071] S201: Monitor in a preset first time period whether the playback duration supported by the buffered amount of the current video is greater than a preset first duration threshold.
[0072] The current video belongs to a video stream, and the video stream includes multiple videos having a playback order relationship. The preset first duration threshold is determined based on the total duration of the current video.
[0073] S202. If it is determined that the playback duration supported by the buffered amount of the current video is greater than the preset first duration threshold, control to start preloading of the next N videos adjacent to the current video in the video stream; wherein N is a preset natural number.
[0074] S201 and S202 in the embodiments of the present disclosure can be understood with reference to the description of S101 and S102 in the above embodiments, and will not be repeated here.
[0075] S203: Monitor in a preset second time period whether the playback duration supported by the buffered amount of the current video is less than a preset second duration threshold.
[0076] The preset second duration threshold is determined based on the total duration of the current video, and the preset second duration threshold is smaller than the first duration threshold.
[0077] The preset second duration threshold is used to indicate the minimum playback duration supported by the buffered amount to ensure smooth playback of the current video. For example, if the total playback duration of the video currently being played by the user is 1 minute, the preset second duration threshold is 15 seconds, and the preset first duration threshold is 25 seconds.
[0078] When the playback time supported by the buffered amount of the current video is lower than the preset second time threshold, it means that the playback time supported by the buffered amount of the current video is insufficient to ensure the smoothness of the current video playback. At this time, you can control to stop preloading multiple videos after the current video to avoid affecting the user's viewing experience of the current video.
[0079] In actual applications, the playback time supported by the buffered amount of the current video can be periodically monitored so that it can be timely detected that the playback time supported by the buffered amount of the current video is insufficient to ensure the smoothness of the current video playback, thereby controlling the stop of preloading of multiple videos after the current video.
[0080] Specifically, the monitoring process of monitoring the playback time supported by the buffered amount of the current video in the preset second time period can refer to the process of monitoring the playback time supported by the buffered amount of the current video in the preset first time period in the above S101, which will not be repeated here.
[0081] S204: If it is determined that the playback duration supported by the buffered amount of the current video is less than the preset second duration threshold, control to stop preloading the next M videos among the next N videos.
[0082] Wherein, M is a preset natural number, and M is less than or equal to N.
[0083] In the disclosed embodiment, if the playback duration supported by the buffered amount of the current video is determined to be less than a preset second duration threshold, this indicates that the playback duration supported by the buffered amount of the current video cannot guarantee smooth playback of the current video, affecting the viewing experience of the current video. Therefore, it is necessary to control the suspension of preloading of the next M videos among the next N videos adjacent to the current video.
[0084] For example, assuming that the value of N is 5 and the value of M is 3, controlling to stop preloading the last M videos among the last N videos means controlling to stop preloading the last 3 videos among the last 5 videos adjacent to the current video.
[0085] In an optional implementation, the value of M can be determined based on the current network speed. Specifically, the faster the current network speed, the smaller the value of M. Conversely, the slower the current network speed, the larger the value of M. That is to say, when the current network speed is relatively fast, the preloading of a smaller number of videos can be controlled to stop, that is, the loading speed of the current video can be guaranteed. However, when the current network speed is relatively slow, it is necessary to control the preloading of a larger number of videos to stop in order to ensure the loading speed of the current video. For example, when the current network speed is 600k / s, the preloading of the last two videos of the last five videos being preloaded can be controlled to stop, so as to ensure the loading speed of the current video. When the current network speed is 100k / s, due to the slow current network speed, it is necessary to control the preloading of the last five videos of the last five videos being preloaded (that is, stop all videos being preloaded) to ensure the loading speed of the current video.
[0086] In an optional implementation, if the buffered amount of the current video is detected to support a playback duration of less than 10 seconds (assuming the preset second duration threshold is 10 seconds) due to factors such as network speed degradation, the preloading of the next five videos adjacent to the current video in the video stream can be stopped, and the remaining 100 k / s after the network speed degradation is used only for loading the current video, thereby ensuring smooth playback of the current video. In this way, the user's viewing experience of the current video can be improved.
[0087] In an embodiment of the present disclosure, if it is determined that the playback duration supported by the buffered amount of the current video is less than a preset second duration threshold, control is performed to stop preloading the next M videos among the next N videos adjacent to the current video. In this way, the preloading of multiple videos after the current video is stopped when the playback duration supported by the buffered amount of the current video is insufficient to ensure the smoothness of the current video, thereby improving the user's viewing experience of the current video.
[0088] In another embodiment of the present disclosure, before the control stops preloading the next M videos among the next N videos, it further includes: determining whether the current video has completed loading;
[0089] Correspondingly, if it is determined that the playback duration supported by the buffered amount of the current video is less than the preset second duration threshold, controlling to stop preloading the next M videos of the next N videos includes:
[0090] If it is determined that the playback time supported by the buffered amount of the current video is less than the preset second time threshold, and the current video has not been loaded, the control stops preloading the last M videos of the last N videos.
[0091] In an embodiment of the present disclosure, when it is determined that the playback duration supported by the buffered amount of the current video is less than the preset second duration threshold, if the current video has not been loaded, the preloading of the last M videos of the last N videos is stopped to ensure the loading speed of the current video. If the current video has been loaded, there is no need to stop the preloading of the last M videos of the last N videos. This allows the preloading of subsequent videos to be achieved in more cases, thereby increasing the probability of shortening the first frame duration when the user switches to the subsequent video for playback, thereby ensuring the user's viewing experience.
[0092] In an embodiment of the present disclosure, since the current network speed, the picture clarity of the current video, and the total length of the current video may affect the loading speed of the current video, the embodiment of the present disclosure can determine the preset first length threshold or the second length threshold based on the current network speed and / or the picture clarity of the current video and the total length of the current video.
[0093] In an optional implementation, the preset first duration threshold can be determined based on the current network speed and the total duration of the current video, or it can be determined based on the picture clarity of the current video and the total duration of the current video, or it can be determined based on the current network speed, the picture clarity of the current video and the total duration of the current video.
[0094] Correspondingly, the preset second duration threshold can be determined based on the current network speed and the total duration of the current video, or based on the picture clarity of the current video and the total duration of the current video, or based on the current network speed, the picture clarity of the current video and the total duration of the current video.
[0095] The total duration of the current video and the preset first duration threshold and second duration threshold may be in direct proportion. The longer the total duration of the current video, the larger the preset first duration threshold and second duration threshold are. Conversely, the shorter the total duration of the current video, the smaller the preset first duration threshold and second duration threshold are. For example, when the current short video is 30 to 60 seconds long, the second duration threshold may be set to 15 seconds, and the first duration threshold may be set to 25 seconds. When the short video is 60 seconds or longer, the second duration threshold may be set to 20 seconds, and the first duration threshold may be set to 30 seconds.
[0096] The current network speed and the preset first duration threshold and the second duration threshold may be inversely proportional. The faster the current network speed, the smaller the preset first duration threshold and the second duration threshold. On the contrary, the slower the current network speed, the larger the preset first duration threshold and the second duration threshold are in order to ensure the smoothness of the current video playback.
[0097] Since the loading speed of the current video is related to the picture clarity of the current video, under the same network conditions, the higher the picture clarity of the current video, the slower the loading speed of the current video. Therefore, in order to ensure the smoothness of the current video playback, the larger the preset first duration threshold and the second duration threshold are determined; on the contrary, the lower the picture clarity of the current video, the faster the loading speed of the current video, and accordingly, the smaller the preset first duration threshold and the second duration threshold are determined.
[0098] The embodiments of the present disclosure do not limit other factors that affect the determination of the above-mentioned preset first duration threshold and second duration threshold.
[0099] In order to more vividly describe the implementation process of the video preloading method provided by the embodiment of the present disclosure, the process from video data loading to video data reading of the current video can be compared to the process of filling a bucket with water. Figure 3 The figure shows a schematic diagram of the implementation process of a video preloading method provided by an embodiment of the present disclosure. The video data loading process is similar to the process of water flowing into a bucket, and the video data reading process is similar to the process of water flowing out of the bucket. The playback duration (buffer time) supported by the buffered amount of the current video is similar to the current water storage capacity in the bucket; the total duration of the current video is similar to the maximum water storage capacity of the entire bucket.
[0100] For ease of understanding, the preset first duration threshold can be named a safety water level. When the playback duration supported by the buffered amount of the current video is higher than the safety water level, the playback duration supported by the buffered amount of the current video can ensure the smoothness of the current video playback, and the next N videos adjacent to the current video can be preloaded.
[0101] Similarly, the preset second duration threshold can be named the dangerous water level. When the playback duration supported by the buffered amount of the current video is lower than the dangerous water level, it means that the smoothness of the current video playback is threatened. Then, the preloading of M videos among the next N videos adjacent to the current video can be controlled to stop, so as to ensure the loading speed of the current video.
[0102] In the video preloading method provided by the embodiment of the present disclosure, when it is monitored that the playback time supported by the buffered amount of the current video is greater than the preset first time threshold, the preloading of the next N videos adjacent to the current video is controlled to be started, and when it is monitored that the playback time supported by the buffered amount of the previous video is less than the preset second time threshold, the above-mentioned preloading is controlled to be stopped. It can be seen that when the playback time supported by the buffered amount of the current video is between the preset first time threshold and the preset second time threshold, the embodiment of the present disclosure keeps the preloading strategy for the next N videos adjacent to the current video unchanged, that is, it will not control the start of preloading, nor will it control the stop of the current existing preloading.
[0103] If the playback duration supported by the buffered amount of the current video is greater than the safe level, the preloading status of the next N videos adjacent to the current video remains unchanged. If the playback duration supported by the buffered amount of the current video is less than the dangerous level, preloading of M videos among the next N videos adjacent to the current video is disabled.
[0104] The embodiment of the present disclosure avoids frequent control of preloading start and stop, thereby reducing the consumption of system CPU resources.
[0105] In the embodiment of the present disclosure, if the playback duration supported by the buffered amount of the current video is between the dangerous level and the safe level, the strategy of preloading the next N videos adjacent to the current video remains unchanged.
[0106] In actual applications, due to the influence of network speed fluctuations, frequent control of preloading start and stop may occur, which is undoubtedly a consumption of system CPU resources. For example, suppose Figure 3 When the buffer time in the video is near the safe level, the buffer time may fluctuate around the safe level due to fluctuations in network speed. Based on the strategy of controlling the preloading of the next N videos adjacent to the current video when the buffer time is determined to be higher than the safe level, the CPU may need to control the preloading of the next N videos every time the buffer time is detected to be higher than the safe level. Obviously, due to fluctuations in network speed, the CPU may need to frequently control the preloading of the next N videos, thereby wasting system CPU resources.
[0107] In order to reduce the probability of frequently controlling and starting the preloading of subsequent videos due to the current network speed fluctuation, thereby reducing the consumption of CPU resources, the embodiment of the present disclosure can update the preset first duration threshold (safety level) taking into account the impact of the current network speed fluctuation. Figure 4 FIG. 1 is a flowchart of updating a preset first duration threshold provided by an embodiment of the present disclosure, which includes:
[0108] S401, determining a duration threshold deviation based on current network speed fluctuations;
[0109] During actual video playback, the network speed may fluctuate greatly. For example, the current network speed may fluctuate between 100k / s and 600k / s. In order to reduce the impact of the current network speed fluctuation on the preloading strategy of video pre-addition, the duration threshold deviation can be determined based on the current network speed fluctuation. For example, for a video of 30s to 60s, the first duration threshold is preset to 20s, and the preset duration threshold deviation can be 5s.
[0110] S402: Determine whether the playback duration supported by the buffered amount of the current video is less than the difference between the preset first duration threshold and the duration threshold deviation.
[0111] If it is determined that the playback time supported by the buffered amount of the current video is less than the difference between the current preset first time threshold and the time threshold deviation, it means that considering the impact of the current network speed fluctuation, the playback time supported by the buffered amount of the current video is less than the preset first time threshold, and the smoothness of the current video cannot be guaranteed. At this time, there is no need to control the preloading of subsequent videos. Therefore, frequent preloading will not occur due to the current network speed fluctuation. Therefore, the preset first time threshold can be kept unchanged at this time.
[0112] S403. If it is determined that the playback duration supported by the buffered amount of the current video is not less than the difference between the preset first duration threshold and the duration threshold deviation, determine whether the playback duration supported by the buffered amount of the current video is greater than the sum of the preset first duration threshold and the duration threshold deviation.
[0113] If it is determined that the playback duration supported by the buffered amount of the current video is greater than or equal to the difference between the current preset first duration threshold (safety water level) and the duration threshold deviation, it means that considering the impact of current network speed fluctuations, the playback duration supported by the buffered amount of the current video may frequently trigger the preloading of N videos after the start. Therefore, in order to avoid the occurrence of the above situation, the preset first duration threshold can be updated based on the duration threshold deviation to reduce the impact of current network speed fluctuations.
[0114] In an optional implementation, the first duration threshold (safety level) can be increased, thereby enlarging the area between the first duration threshold (safety level) and the second duration threshold (danger level). Furthermore, the probability that the playback duration supported by the buffered amount of the current video will be between the first duration threshold (safety level) and the second duration threshold (danger level) is increased, which helps maintain the current preloading strategy unchanged and reduces the probability of frequently controlling the start of preloading of subsequent videos.
[0115] Since the safety water level is increased in the embodiments of the present disclosure, the area between the safety water level and the danger water level becomes larger. As a result, the probability that the playback duration supported by the buffered amount of the current video falls within the first duration threshold (safety water level) and the second duration threshold (danger water level) increases, which is beneficial to increasing the probability of maintaining the preloading strategy unchanged. For example, assume that the current network speed is 500 k / s and the next 5 videos adjacent to the current video are in the preloading state. If the current network speed changes to 400 k / s due to network speed fluctuations, the embodiments of the present disclosure can increase the probability of keeping the next 5 videos adjacent to the current video still in the preloading state, thereby reducing the probability that the control stops preloading the next 5 videos adjacent to the current video due to the current network speed fluctuation (assuming it changes from 500 k / s to 400 k / s), and thus reducing the occurrence probability of frequently starting or stopping the preloading of subsequent videos due to the current network speed fluctuation.
[0116] S404. If it is determined that the playback duration supported by the buffered amount of the current video is greater than the sum of the preset first duration threshold and the duration threshold deviation, then update the preset first duration threshold by using the sum of the duration threshold deviation and the preset first duration threshold.
[0117] If it is determined that the playback duration supported by the buffered amount of the current video is greater than the sum of the current preset first duration threshold and the duration threshold deviation, in order to avoid the influence of the actual current network speed fluctuation on the preloading method, increase the current preset first duration threshold by the duration threshold deviation to implement the update of the preset first duration threshold. The specific reason for the update of the first duration threshold is the same as the above analysis and will not be elaborated here.
[0118] S405. If it is determined that the playback duration supported by the buffered amount of the current video is not greater than the sum of the preset first duration threshold and the duration threshold deviation, then update the preset first duration threshold by using the sum of the duration threshold deviation and the playback duration supported by the buffered amount of the current video.
[0119] The specific reason for the update of the first duration threshold is the same as the above analysis and will not be elaborated here.
[0120] Exemplarily, the playback duration supported by the buffered amount of the current video is buffer Time. It can be assumed that the initial value of the safety water level is safe Pos, the danger water level is danger Pos, and the duration threshold deviation is preload Offset. [[ID=十六]] [[ID=十七]]
[0121] [[ID=十八]]If buffer Time < safe Pos - preload Offset, then buffer Time is within the interval between the safety water level and the danger water level, and the safety water level will not be updated, that is, the safety water level is still safe Pos and the danger water level is danger Pos.
[0122] If buffer time >= safe position – preload offset, the safe water level is updated to prevent the impact of current network speed fluctuations on preload. That is, the safe water level is increased, thereby increasing the area between the safe water level and the dangerous water level. Specifically, the safe water level can be updated based on the relationship between buffer time and safe position + offset.
[0123] When safe Pos–preload Offset <= buffer Time <= safe Pos+Offset, the updated safe water level is buffer Time+preload Offset, and the dangerous water level is danger Pos.
[0124] When bufferTime>safePos+preloadOffset, the updated safe water level is safePos+preloadOffset, and the dangerous water level is dangerPos.
[0125] The embodiment of the present disclosure takes into account the impact of the current network speed fluctuation on the control of starting preloading. By updating the preset first duration threshold based on the relationship between the duration threshold deviation, the playback duration supported by the buffered amount of the current video, and the preset first duration threshold, the probability of frequent control to start preloading of subsequent videos due to the current network speed fluctuation can be reduced, thereby reducing the consumption of CPU resources.
[0126] Based on the same inventive concept as the above method embodiment, the present disclosure also provides a video preloading device, referring to Figure 5 , is a structural diagram of a video preloading device provided by an embodiment of the present disclosure, the device comprising:
[0127] A first monitoring module 501 is configured to monitor, within a preset first time period, whether the playback duration supported by the buffered amount of the current video is greater than a preset first duration threshold; wherein the current video belongs to a video stream including multiple videos in a playback order, and the preset first duration threshold is determined based on the total duration of the current video;
[0128] The first control module 502 is used to control the preloading of the next N videos adjacent to the current video in the video stream when it is determined that the playback duration supported by the buffered amount of the current video is greater than the preset first duration threshold; wherein N is a preset natural number.
[0129] In an optional embodiment, the device further includes:
[0130] a second monitoring module, configured to monitor, within a preset second time period, whether the playback duration supported by the buffered amount of the current video is less than a preset second duration threshold; wherein the preset second duration threshold is determined based on the total duration of the current video, and the preset second duration threshold is less than the first duration threshold;
[0131] The second control module is used to determine that the playback time supported by the buffered amount of the current video is less than the preset second time threshold, and then control to stop preloading the last M videos of the last N videos, where M is a preset natural number and M is less than or equal to N.
[0132] In an optional embodiment, the device further includes:
[0133] A first determining module, configured to determine whether the current video has been loaded;
[0134] Accordingly, the second control module is specifically configured to:
[0135] If it is determined that the playback time supported by the buffered amount of the current video is less than the preset second time threshold, and the current video has not been loaded, the control stops preloading the last M videos of the last N videos.
[0136] In an optional implementation, the preset first duration threshold or the second duration threshold is determined based on the current network speed and / or the picture clarity of the current video and the total duration of the current video.
[0137] In an optional embodiment, the device further includes:
[0138] The second determination module is used to determine the duration threshold deviation based on the current network speed fluctuation;
[0139] A third determining module is configured to determine whether the playback duration supported by the buffered amount of the current video is less than the difference between the preset first duration threshold and the duration threshold deviation;
[0140] The updating module is used to update the preset first duration threshold based on the duration threshold deviation when it is determined that the playback duration supported by the buffered amount of the current video is not less than the difference between the preset first duration threshold and the duration threshold deviation.
[0141] In an optional implementation, the update module includes:
[0142] a first determining submodule configured to, upon determining that the playback duration supported by the buffered amount of the current video is not less than the difference between the preset first duration threshold and the duration threshold deviation, determine whether the playback duration supported by the buffered amount of the current video is greater than the sum of the preset first duration threshold and the duration threshold deviation;
[0143] The first update submodule is used to update the preset first duration threshold using the sum of the duration threshold deviation and the preset first duration threshold when it is determined that the playback duration supported by the buffered amount of the current video is greater than the sum of the preset first duration threshold and the duration threshold deviation.
[0144] In an optional embodiment, the device further includes:
[0145] The second update submodule is used to update the preset first duration threshold using the sum of the duration threshold deviation and the playback time supported by the buffered amount of the current video when it is determined that the playback time supported by the buffered amount of the current video is not greater than the sum of the preset first duration threshold and the duration threshold deviation.
[0146] The video preloading device provided by the embodiment of the present disclosure controls the start of preloading of subsequent videos by monitoring whether the playback time supported by the buffered amount of the currently playing video is greater than a preset first time threshold. Compared with the strategy of the prior art that triggers the preloading of subsequent videos only after the loading of the currently playing video is completed, the embodiment of the present disclosure can improve the hit rate of video preloading. That is, compared with the prior art, it can achieve preloading of subsequent videos in more cases, thereby increasing the probability of shortening the first frame time when the user switches to the subsequent video for playback, thereby ensuring the user's viewing experience.
[0147] In addition to the above-mentioned method and apparatus, the embodiments of the present disclosure further provide a computer-readable storage medium, which stores instructions. When the instructions are executed on a terminal device, the terminal device implements the video preloading method described in the embodiments of the present disclosure.
[0148] The embodiments of the present disclosure further provide a computer program product, which includes a computer program / instructions. When the computer program / instructions are executed by a processor, the video preloading method described in the embodiments of the present disclosure is implemented.
[0149] In addition, the present disclosure also provides a video preloading device, see Figure 6 As shown, this may include:
[0150] Processor 601, memory 602, input device 603 and output device 604. The number of processor 601 of the video preloading method device can be one or more. Figure 6 In some embodiments of the present disclosure, the processor 601, the memory 602, the input device 603 and the output device 604 may be connected via a bus or other means, wherein: Figure 6 The bus connection is taken as an example.
[0151] The memory 602 can be used to store software programs and modules. The processor 601 executes various functional applications and data processing of the video preloading device by running the software programs and modules stored in the memory 602. The memory 602 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, at least one application required for a function, etc. In addition, the memory 602 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage device. The input device 603 may be used to receive input digital or character information and generate signal input related to user settings and function control of the video preloading device.
[0152] Specifically in this embodiment, the processor 601 will load the executable files corresponding to the processes of one or more applications into the memory 602 according to the following instructions, and the processor 601 will run the applications stored in the memory 602, thereby realizing the various functions of the above-mentioned video preloading device.
[0153] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.
[0154] The foregoing description is intended only to provide specific embodiments of the present disclosure, intended to enable those skilled in the art to understand and implement the present disclosure. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure is not intended to be limited to the embodiments described herein, but rather to be construed in the broadest manner consistent with the principles and novel features disclosed herein.
Claims
1. A video preloading method, characterized in that: The method comprises: Monitoring, in a preset first time period, whether the playback duration supported by the buffered amount of the current video is greater than a preset first duration threshold; wherein the current video belongs to a video stream, the video stream includes multiple videos having a playback order relationship, the preset first duration threshold is determined based on the total duration of the current video, and when the playback duration supported by the buffered amount of the current video is not less than the difference between the preset first duration threshold and the duration threshold deviation, the preset first duration threshold is updated based on the duration threshold deviation, and the duration threshold deviation is determined based on current network speed fluctuations; If it is determined that the playback duration supported by the buffered amount of the current video is greater than the preset first duration threshold, control is performed to start preloading of the next N videos adjacent to the current video in the video stream; wherein N is a preset natural number.
2. The method according to claim 1, characterized in that After the control starts preloading the next N videos adjacent to the current video in the video stream, the method further includes: monitoring, within a preset second time period, whether a playback duration supported by a buffered amount of the current video is less than a preset second duration threshold; wherein the preset second duration threshold is determined based on the total duration of the current video, and the preset second duration threshold is less than the first duration threshold; If it is determined that the playback time supported by the buffered amount of the current video is less than the preset second time threshold, the control stops preloading the last M videos of the last N videos, where M is a preset natural number and M is less than or equal to N.
3. The method according to claim 2, characterized in that Before the control stops preloading the last M videos of the last N videos, the method further includes: Determine whether the current video has finished loading; Correspondingly, if it is determined that the playback duration supported by the buffered amount of the current video is less than the preset second duration threshold, controlling to stop preloading the next M videos of the next N videos includes: If it is determined that the playback time supported by the buffered amount of the current video is less than the preset second time threshold, and the current video has not been loaded, the control stops preloading the last M videos of the last N videos.
4. The method according to claim 1 or 2, characterized in that The preset first duration threshold or the second duration threshold is determined based on the current network speed and / or the picture clarity of the current video and the total duration of the current video.
5. The method according to claim 1, wherein The method further comprises: Determine the duration threshold deviation based on the current network speed fluctuation; Determining whether the playback duration supported by the buffered amount of the current video is less than the difference between the preset first duration threshold and the duration threshold deviation; If it is determined that the playback duration supported by the buffered amount of the current video is not less than the difference between the preset first duration threshold and the duration threshold deviation, the preset first duration threshold is updated based on the duration threshold deviation.
6. The method according to claim 5, characterized in that If it is determined that the playback duration supported by the buffered amount of the current video is not less than the difference between the preset first duration threshold and the duration threshold deviation, updating the preset first duration threshold based on the duration threshold deviation includes: If it is determined that the playback duration supported by the buffered amount of the current video is not less than the difference between the preset first duration threshold and the duration threshold deviation, then determining whether the playback duration supported by the buffered amount of the current video is greater than the sum of the preset first duration threshold and the duration threshold deviation; If it is determined that the playback duration supported by the buffered amount of the current video is greater than the sum of the preset first duration threshold and the duration threshold deviation, the preset first duration threshold is updated using the sum of the duration threshold deviation and the preset first duration threshold.
7. The method according to claim 6, characterized in that The method further comprises: If it is determined that the playback time supported by the buffered amount of the current video is not greater than the sum of the preset first time threshold and the time threshold deviation, the preset first time threshold is updated using the sum of the time threshold deviation and the playback time supported by the buffered amount of the current video.
8. A video preloading device, characterized in that: The device comprises: A first monitoring module is configured to monitor, within a preset first time period, whether the playback duration supported by the buffered amount of the current video is greater than a preset first duration threshold; wherein the current video belongs to a video stream, the video stream includes multiple videos having a playback order relationship, the preset first duration threshold is determined based on the total duration of the current video, and when the playback duration supported by the buffered amount of the current video is not less than the difference between the preset first duration threshold and the duration threshold deviation, the preset first duration threshold is updated based on the duration threshold deviation, and the duration threshold deviation is determined based on current network speed fluctuations; The first control module is used to control the preloading of the next N videos adjacent to the current video in the video stream when it is determined that the playback duration supported by the buffered amount of the current video is greater than the preset first duration threshold; wherein N is a preset natural number.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores instructions, and when the instructions are executed on a terminal device, the terminal device implements the method according to any one of claims 1 to 7.
10. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.
11. A computer program product, characterized in that The computer program product comprises a computer program / instruction, and when the computer program / instruction is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Video buffer adjustment method and device, storage medium and electronic device
CN112333526A
Video preloading method and device
CN112672186A