Video frame caching method and device and electronic equipment

By segmenting the video frames and adopting the priority cache strategy, the problem of users being unable to quickly play video frames at a new specified time point when they quickly drag and drop the playback progress, achieving fast playback and efficient caching, improving the user experience.

CN120201234APending Publication Date: 2025-06-24ZHEJIANG UNIVIEW TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311794145.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-22
Publication Date
2025-06-24

AI Technical Summary

Technical Problem

During the video playback process, when the user quickly drags the playback progress, it is difficult for the existing technology to quickly play video frames at a newly designated time point, resulting in poor user video viewing experience.

Method used

By segmenting the video frame cache into the first period and the second period, the video frames within the first period are cached in sequence in time, and based on the preset cache strategy, the intra-coded frames and intra-predicted encoded frames within the second period are preferred, and the cache priority of the intra-coded frames is higher than the intra-predicted encoded frames.

Benefits of technology

It realizes the rapid playback of video frames at specified time points, avoids playback lag and improves the user's video viewing experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120201234A_ABST
    Figure CN120201234A_ABST
Patent Text Reader

Abstract

The invention provides a video frame caching method and device and electronic equipment, and relates to the technical field of video caching. The method comprises the steps of segmenting a time period between a playing time point of a target video and a target time point of the target video in response to a playback operation on the target video; sequentially caching the plurality of first video frames in the first time period according to a time sequence; and caching the plurality of intra-frame coding frames and the plurality of intra-frame prediction coding frames in the second time period based on a preset caching strategy, the preset caching strategy comprising that the caching priority of the plurality of intra-frame coding frames is higher than the caching priority of the plurality of intra-frame prediction coding frames. In this way, different caching mechanisms are adopted, so that the video frames at the playing time point can be prevented from being paused in playing, and smooth playing of the video frames at the playing time point is ensured; and when the user drags the playing progress to the second time period quickly, the video frame within the time period after the specified time point can be quickly played, so that the video watching experience of the user is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of video caching, and particularly to a method, apparatus, and electronic device for caching video frames. Background Art

[0002] Video playback refers to the process of re-playing a previously played video file through a video playback software to reproduce the scene at that time, and can be applied to various different scenarios, such as video teaching, video training, video conference recording, etc.

[0003] During video playback, when the user drags the playback progress, it is necessary to reload the video frames at the specified time point to play the video frames at that specified time point. In the prior art, in order to quickly play the video frames at the specified time point and thus improve the user's video viewing experience, the complete video frames near the specified time point are usually cached in chronological order. However, if the user quickly drags the playback progress beyond the cached time period within a short time, the video frames at the newly specified time point cannot be played quickly.

[0004] Therefore, how to cache video frames better so that the video frames at the specified time point can be played quickly, thereby improving the user's video viewing experience to a certain extent, is a technical problem that needs to be solved by those skilled in the art. Summary of the Invention

[0005] This application provides a method, apparatus, and electronic device for caching video frames, which can cache video frames better so that the video frames at the specified time point can be played quickly, thereby improving the user's video viewing experience to a certain extent.

[0006] In a first aspect, this application provides a method for caching video frames, which may include:

[0007] In response to a playback operation on a target video, segment the time period between the playback time point of the target video and the target time point of the target video to obtain a first time period and a second time period;

[0008] Cache multiple first video frames in the first time period in chronological order;

[0009] Based on a preset caching policy, cache multiple second video frames in the second time period; wherein, the multiple second video frames include multiple intra-coded frames and multiple intra-predicted coded frames, and the preset caching policy includes: the caching priority of the multiple intra-coded frames is higher than the caching priority of the multiple intra-predicted coded frames.

[0010] According to the method for caching video frames provided by this application, the caching of the multiple second video frames in the second time period includes:

[0011] Determine the priority corresponding to each intra-coded frame among the multiple intra-coded frames;

[0012] Cache the multiple intra-coded frames in sequence based on the priority corresponding to each intra-coded frame;

[0013] When the caching of the multiple intra-coded frames is completed, cache the multiple intra-frame prediction coded frames.

[0014] According to a method for caching video frames provided by the present application, the determining the priority corresponding to each intra-coded frame among the multiple intra-coded frames includes:

[0015] Determine the priority corresponding to each intra-coded frame among the multiple intra-coded frames based on a preset interval algorithm;

[0016] Correspondingly, the caching the multiple intra-coded frames in sequence based on the priority corresponding to each intra-coded frame includes:

[0017] Determine the caching order of the multiple intra-coded frames based on the priority corresponding to each intra-coded frame; the priority of the intra-coded frame is positively correlated with the caching order of the intra-coded frame;

[0018] Cache the multiple intra-coded frames in sequence based on the caching order of the multiple intra-coded frames.

[0019] According to a method for caching video frames provided by the present application, the caching the multiple intra-frame prediction coded frames includes:

[0020] Cache multiple first intra-frame prediction coded frames among the multiple intra-frame prediction coded frames. For the first caching operation, the first intra-frame prediction coded frame is an intra-frame prediction coded frame adjacent to each of the intra-coded frames;

[0021] Determine multiple second intra-frame prediction coded frames adjacent to the multiple first intra-frame prediction coded frames from the multiple intra-frame prediction coded frames;

[0022] Determine the multiple second intra-frame prediction coded frames as the new multiple first intra-frame prediction coded frames, and repeat the above operations until the caching of the multiple intra-frame prediction coded frames is completed.

[0023] According to a method for caching video frames provided by the present application, the caching the multiple first intra-frame prediction coded frames among the multiple intra-frame prediction coded frames includes:

[0024] Determine the caching order of the multiple intra-prediction coded frames based on the priorities of the intra-coded frames corresponding to the respective intra-prediction coded frames; the priority of the intra-coded frame is positively correlated with the caching order of the corresponding intra-prediction coded frame.

[0025] Cache the multiple intra-prediction coded frames in sequence based on the caching order of the multiple intra-prediction coded frames.

[0026] According to a video frame caching method provided by the present application, the caching of the multiple second video frames in the second period based on a preset caching policy includes:

[0027] When it is detected that the caching of the first video frame in the third period is completed, cache the multiple second video frames based on a preset caching policy;

[0028] Wherein, the start time point of the third period is the playback time point, the end time point of the third period is earlier than the end time point of the first period, or the end time point of the third period is the end time point of the first period.

[0029] According to a video frame caching method provided by the present application, the video frame caching method further includes:

[0030] When the playback time point of the detected progress touch operation is in the second period, play the video frames after the playback time point based on the cached video frames in the second period.

[0031] In a second aspect, the present application further provides a video frame caching device, which may include:

[0032] A segmentation unit, configured to segment the period between the playback time point of the target video and the target time point of the target video in response to a playback operation on the target video, to obtain a first period and a second period;

[0033] A first caching unit, configured to cache the multiple first video frames in the first period in chronological order;

[0034] A second caching unit, configured to cache the multiple second video frames in the second period based on a preset caching policy; wherein, the multiple second video frames include multiple intra-coded frames and multiple intra-prediction coded frames, and the preset caching policy includes: the caching priority of the multiple intra-coded frames is higher than the caching priority of the multiple intra-prediction coded frames.

[0035] According to a video frame caching device provided by the present application, the second caching unit, configured to cache the multiple second video frames in the second period, includes:

[0036] Determine the priorities corresponding to each intra-coded frame among the multiple intra-coded frames;

[0037] Cache the multiple intra-coded frames in sequence based on the priorities corresponding to each intra-coded frame;

[0038] When the caching of the multiple intra-coded frames is completed, cache the multiple intra-frame predicted-coded frames.

[0039] According to a video frame caching device provided by the present application, the second caching unit, which is used to determine the priorities corresponding to each intra-coded frame among the multiple intra-coded frames, includes:

[0040] Determine the priorities corresponding to each intra-coded frame among the multiple intra-coded frames based on a preset interval algorithm;

[0041] Correspondingly, caching the multiple intra-coded frames in sequence based on the priorities corresponding to each intra-coded frame includes:

[0042] Determine the caching order of the multiple intra-coded frames based on the priorities corresponding to each intra-coded frame; the priority of the intra-coded frame is positively correlated with the caching order of the intra-coded frame;

[0043] Cache the multiple intra-coded frames in sequence based on the caching order of the multiple intra-coded frames.

[0044] According to a video frame caching device provided by the present application, the second caching unit, which is used to cache the multiple intra-frame predicted-coded frames, includes:

[0045] Cache multiple first intra-frame predicted-coded frames among the multiple intra-frame predicted-coded frames. For the first caching operation, the first intra-frame predicted-coded frame is an intra-frame predicted-coded frame adjacent to each of the intra-coded frames;

[0046] Determine multiple second intra-frame predicted-coded frames adjacent to the multiple first intra-frame predicted-coded frames from the multiple intra-frame predicted-coded frames;

[0047] Determine the multiple second intra-frame predicted-coded frames as the new multiple first intra-frame predicted-coded frames, and repeat the above operations until the caching of the multiple intra-frame predicted-coded frames is completed.

[0048] According to a video frame caching device provided by the present application, the second caching unit, which is used to cache multiple first intra-frame predicted-coded frames among the multiple intra-frame predicted-coded frames, includes:

[0049] Determine the caching order of the multiple intra-prediction encoded frames based on the priorities of the intra-coded frames corresponding to the respective intra-prediction encoded frames; the priority of the intra-coded frame is positively correlated with the caching order of the corresponding intra-prediction encoded frame;

[0050] Cache the multiple intra-prediction encoded frames in sequence based on the caching order of the multiple intra-prediction encoded frames.

[0051] According to a video frame caching device provided by the present application, the second caching unit is configured to cache multiple second video frames within the second time period based on a preset caching policy, including:

[0052] When it is detected that the caching of the first video frame within the third time period is completed, cache the multiple second video frames based on the preset caching policy;

[0053] Wherein, the start time point of the third time period is the playback time point, the end time point of the third time period is earlier than the end time point of the first time period, or the end time point of the third time period is the end time point of the first time period.

[0054] According to a video frame caching device provided by the present application, the video frame caching device further includes a playback unit;

[0055] The playback unit is configured to, when the playback time point of the detected progress touch operation is within the second time period, play the video frames after the playback time point based on the cached video frames within the second time period.

[0056] The present application further provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the program, it implements the video frame caching method as described in any one of the above.

[0057] The present application further provides a non-transitory computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the video frame caching method as described in any one of the above.

[0058] The present application further provides a computer program product, including a computer program, and when the computer program is executed by a processor, it implements the video frame caching method as described in any one of the above.

[0059] The video frame caching method, device, and electronic device provided by the embodiments of the present application segment the period between the playback time point of the target video and the target time point of the target video in response to a playback operation on the target video; sequentially cache multiple first video frames within the first period in chronological order; and cache multiple intra-coded frames and multiple intra-predicted coded frames within the second period based on a preset caching policy, where the preset caching policy includes: the caching priority of multiple intra-coded frames is higher than the caching priority of multiple intra-predicted coded frames. In this way, by adopting different caching mechanisms, it is not only possible to avoid stuttering in the playback of video frames at the playback time point and ensure the smooth playback of video frames at the playback time point; but also when the user quickly drags the playback progress to the second period, it is possible to quickly play the video frames within the period after the specified time point, thereby improving the user's video viewing experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0060] To more clearly illustrate the technical solutions in the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0061] Figure 1 A schematic diagram of an existing method for caching video frames after a specified time point provided by the embodiments of the present application;

[0062] Figure 2 A schematic diagram of the relationship between I frames and P frames provided by the embodiments of the present application;

[0063] Figure 3 A schematic diagram of a method for caching video frames after a specified time point provided by the embodiments of the present application;

[0064] Figure 4 A schematic flowchart of a video frame caching method provided by the embodiments of the present application;

[0065] Figure 5 A schematic flowchart of a method for caching multiple second video frames within the second period provided by the embodiments of the present application;

[0066] Figure 6 A schematic diagram of sequentially caching multiple intra-coded frames based on a hierarchical caching policy provided by the embodiments of the present application;

[0067] Figure 7 A schematic diagram of multiple cached intra-coded frames provided by the embodiments of the present application;

[0068] Figure 8 A schematic diagram of the structure of a video frame caching device provided by the embodiments of the present application;

[0069] Figure 9 This is a schematic diagram of the physical structure of an electronic device provided by an embodiment of the present application. Specific embodiments

[0070] To make the objectives, technical solutions, and advantages of the present application clearer, the technical solutions in the present application will be clearly and completely described below with reference to the accompanying drawings in the present application. Apparently, the described embodiments are some, but not all, of the embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without creative efforts shall fall within the protection scope of the present application.

[0071] In the embodiments of the present application, "at least one" means one or more, and "a plurality" means two or more. "And / or" describes the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. Among them, A and B can be singular or plural. In the text description of the present application, the character " / " generally represents an "or" relationship between the associated objects before and after.

[0072] The technical solution provided by the embodiment of the present application can be applied to the video frame buffer scenario. Taking the video frame buffer scenario of video playback as an example, video playback can be applied to a variety of different scenarios, such as video teaching, video training, video conference recording, etc.

[0073] During video playback, when the user drags the playback progress, it is necessary to reload the video frames at the specified time point to play the video frames at the specified time point. In the prior art, in order to quickly play the video frames at the specified time point and thus improve the user's video viewing experience, the complete video frames near the specified time point are usually cached in chronological order.

[0074] Exemplarily, reference can be made to Figure 1 as shown in Figure 1 This is a schematic diagram of caching video frames after a specified time point provided by an embodiment of the present application. Assume that the user performs a playback operation on a certain video, and the specified time point of the playback operation is 15:12:21. Then, starting from the specified time point 15:12:21, the complete video frames near the specified time point are cached in chronological order, that is, the intra-coded frames (i.e., I-frames) and intra-predicted coded frames (i.e., P-frames) near the specified time point are cached in chronological order.

[0075] Exemplarily, reference can be made to Figure 2 as shown in Figure 2A schematic diagram of the relationship between I-frames and P-frames provided by an embodiment of the present application. Among them, multiple P-frames are adjacent to each I-frame. Among them, an I-frame, also known as an intra-coded frame, is a frame with independent and complete information and can be decoded independently without referring to other image frames, which can be understood as a static picture.

[0076] In a video frame sequence, the first frame of each new Group of Pictures (GOP) is an I-frame, which is provided to the decoder as a key frame for reference and can be used as a reference for other frames, playing an important role in the data transmission of the entire GOP.

[0077] A P-frame, also known as an inter-predicted coded frame, needs to refer to the previous I-frame or P-frame for encoding, indicating the difference between the current image frame and the previous image frame. When decoding a P-frame, it is necessary to superimpose the difference defined by the current P-frame on the basis of the previously cached image frames to generate the final image.

[0078] However, with this method of caching complete video frames, if the user quickly drags the playback progress beyond the cached time period within a short time. For example, starting from the video frame at the specified time point 15:12:21 for caching, a 5-minute caching operation has been performed. Assuming that only the video frames up to the time point 16:10:20 have been cached, but the user has quickly dragged the playback progress to the time point 16:50:31, and the video frame corresponding to this time point has not been cached yet. It is necessary to re-cache the video frames within the new specified time point 16:50:31 and subsequent time periods, resulting in the inability to quickly play the video frames at the new specified time point.

[0079] Therefore, in order to better cache video frames and enable quick playback of video frames at a specified time point, an embodiment of the present application provides a method for caching video frames, which can divide the time period after the specified time point into two time periods, which can be denoted as the first time period and the second time period. For example, see Figure 3 as shown Figure 3 A schematic diagram of caching video frames after a specified time point provided by an embodiment of the present application. Still assuming that the user performs a playback operation on a certain video, and the specified time point of the playback operation is 15:12:21. In order to avoid video frame playback jitter, multiple video frames within the first time period can be preferentially cached in chronological order. For example, the first time period can be 20 seconds.

[0080] For multiple second video frames within the second time period, multiple intra-coded frames can be preferentially cached, and then multiple intra-predicted coded frames can be cached. In this way, even if the user has quickly dragged the playback progress to the time point 16:50:31, due to the 5-minute caching operation that has been performed, compared with the prior art, it is sufficient to cache more intra-coded frames within the second time period. Therefore, the video frames within the time period after the newly specified time point 16:50:31 can still be quickly played based on the preferentially cached intra-coded frames within the second time period, thereby improving the user's video viewing experience to a certain extent.

[0081] Next, the video frame caching method provided by the present application will be described in detail through the following specific embodiments. It can be understood that these specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments.

[0082] Figure 4 The flowchart of a video frame caching method provided by an embodiment of the present application. This video frame caching method can be executed by software and / or hardware devices. For example, please refer to Figure 4 As shown, this video frame caching method may include:

[0083] S401. In response to a playback operation on a target video, segment the time period between the playback time point of the target video and the target time point of the target video to obtain a first time period and a second time period.

[0084] Among them, the target time point may be a certain time point after the playback time of the target video. For example, 10 minutes after the playback time point, 20 minutes after the playback time point, the end time point of some videos in the current playback operation interface, or the end time point of the entire target video, etc. Specifically, it can be set according to actual needs. Here, for the specific value of the target time point, the embodiments of the present application do not make further limitations.

[0085] For example, in the embodiments of the present application, the first time period and the second time period do not overlap. The duration of the first time period can be set according to actual needs. For example, the first time period can be set to 20 seconds, or 25 seconds or 30 seconds, etc. Specifically, it can be set according to actual needs.

[0086] When the user plays back the target video, the user can query the video server to check whether there is a video within the corresponding time. The server returns the video time period that exists within this time period. For example, the video server can be a cloud storage server or a local video server, specifically set according to actual needs.

[0087] In the case where there is a video time period within this time period, the user can perform a playback operation on the target video. In response to the playback operation on the target video, the playback time point of the target video can be determined, and the video frames after the playback time point can be cached to perform the target video playback based on the cached video frames.

[0088] In the embodiments of the present application, when caching the video frames after the playback time point, different from the prior art, instead of caching the complete video frames near the specified time point in chronological order, the time period between the playback time point of the target video and the target time point of the target video is segmented to obtain a first time period and a second time period, and different caching mechanisms are used to cache the video frames within the first time period and the second time period. For details, refer to S402 and S403 below.

[0089] S402: Cache multiple first video frames within the first time period in chronological order.

[0090] Among them, the multiple first video frames may include multiple intra-coded frames (I-frames) and multiple intra-predicted coded frames (P-frames).

[0091] In the embodiments of the present application, when using different caching mechanisms to cache the video frames within the first time period and the second time period, two threads can be started. Among them, thread 1 is used to cache multiple first video frames within the first time period in chronological order; thread 2 is used to cache multiple second video frames within the second time period based on a preset caching strategy.

[0092] In the embodiments of the present application, when caching the video frames after the playback time point, multiple first video frames within the first time period can be preferentially cached in chronological order, which can avoid stuttering in the playback of the video frames at the playback time point and ensure the smooth playback of the video frames at the playback time point.

[0093] Exemplarily, in the embodiments of the present application, when preferentially caching multiple first video frames within the first time period in chronological order, it may include at least two possible implementation manners as follows:

[0094] In a possible implementation manner, after caching multiple first video frames within the first time period in chronological order, multiple second video frames within the second time period can be cached based on a preset caching strategy. In this way, preferentially caching multiple first video frames within the first time period can effectively avoid stuttering in the playback of the video frames at the playback time point and ensure the smooth playback of the video frames at the playback time point.

[0095] For example, if the duration of the first time period is 20 seconds, thread 1 can be started first. After caching multiple first video frames within 20 seconds in chronological order, thread 2 can be started, and based on a preset caching policy, multiple second video frames within the second time period can be cached.

[0096] In another possible implementation, multiple first video frames within a partial time period of the first time period can be cached in chronological order. Synchronously, based on a preset caching policy, multiple second video frames within the second time period can be cached. Caching multiple first video frames within the first time period first can not only effectively avoid stuttering in the playback of video frames at the playback time point and ensure the smooth playback of video frames at the playback time point, but also start caching the second video frames within the second time period in advance, which provides convenience for better caching of the second video frames within the second time period.

[0097] For example, if the duration of the first time period is 20 seconds, thread 1 can be started first. After caching multiple first video frames within 10 seconds in chronological order, thread 2 can be started synchronously, so that thread 2 and thread 1 run in parallel, and based on a preset caching policy, multiple second video frames within the second time period can be cached.

[0098] S403. Based on a preset caching policy, cache multiple second video frames within the second time period; wherein, the multiple second video frames include multiple intra-coded frames and multiple intra-predicted coded frames, and the preset caching policy includes: the caching priority of multiple intra-coded frames is higher than the caching priority of multiple intra-predicted coded frames.

[0099] Wherein, the caching priority of multiple intra-coded frames is higher than the caching priority of multiple intra-predicted coded frames can be understood as: cache multiple intra-coded frames first, and then cache multiple intra-predicted coded frames after the multiple intra-coded frames.

[0100] Considering that an intra-coded frame is a frame with independent and complete information and can be decoded independently without referring to other image frames, therefore, in order to be able to quickly play video frames within the time period after a specified time point when the user quickly drags the playback progress to the second time period, in the embodiments of the present application, for multiple second video frames within the second time period, multiple intra-coded frames can be cached first to improve the hit rate when the user drags the time point within the second time period; then cache multiple intra-predicted coded frames, which can improve the user's video viewing experience to a certain extent.

[0101] Exemplarily, in the embodiments of the present application, when caching multiple second video frames within the second time period based on a preset caching policy, it can be detected whether the first video frames within the third time period are cached. If the first video frames within the third time period are cached, then based on the preset caching policy, cache multiple second video frames.

[0102] Among them, the start time point of the third period is the playback time point, and the end time point of the third period is earlier than the end time point of the first period, or the end time point of the third period is the end time point of the first period.

[0103] It can be understood that when the end time point of the third period is the end time point of the first period, that is, after caching multiple first video frames in the first period in chronological order, then based on the preset caching policy, cache multiple second video frames in the second period. Refer to the first possible implementation method in S402 above; when the end time point of the third period is earlier than the end time point of the first period, that is, after caching multiple first video frames in some periods of the first period in chronological order, synchronously based on the preset caching policy, cache multiple second video frames in the second period. Refer to the second possible implementation method in S402 above. The third period is the partial period in S402 above and can be specifically set according to actual needs.

[0104] It can be seen that in the embodiment of the present application, when caching video frames, in response to the playback operation of the target video, the period between the playback time point of the target video and the target time point of the target video is segmented to obtain a first period and a second period; cache multiple first video frames in the first period in chronological order; and based on the preset caching policy, cache multiple second video frames in the second period; among them, the multiple second video frames include multiple intra-coded frames and multiple intra-prediction coded frames, and the preset caching policy includes: the caching priority of the multiple intra-coded frames is higher than the caching priority of the multiple intra-prediction coded frames. In this way, different caching mechanisms are used to cache the video frames in the first period and the second period, which can not only avoid stuttering in the playback of the video frame at the playback time point and ensure the smooth playback of the video frame at the playback time point; but also by preferentially caching the multiple intra-coded frames in the second period, even if the user quickly drags the playback progress to the second period, it is also possible to quickly play the video frames in the period after the specified time point based on the multiple intra-coded frames preferentially cached in the second period, which can improve the user's video viewing experience to a certain extent.

[0105] Based on the above Figure 4 In the embodiment shown, in the embodiment of the present application, as the playback time point is updated, the corresponding first period and second period will also be continuously updated.

[0106] Exemplarily, the first time period can update the time period range every 1 second. For the second time period, since the caching is performed according to the determined priority of the video frames, in order to avoid a greater impact on the caching process, in the embodiments of the present application, the update duration of the second time period is greater than that of the first time period. For example, the update duration of the second time period can be set to 10 seconds, that is, the time period range is updated every 10 seconds, which can avoid the frequent update of the time period range of the second time period from affecting the video caching, and can be specifically set according to actual needs.

[0107] It can be understood that in the embodiments of the present application, thread 1 for caching multiple first video frames within the first time period and thread 2 for caching multiple second video frames within the second time period can reuse the same caching space. In this way, when thread 1 and thread 2 request the video frames to be cached, they can first check whether the corresponding video frames have been cached in the local caching space. If the corresponding video frames have been cached in the local caching space, there is no need to request the video frames from the video server.

[0108] Based on the above Figure 4 shown embodiments, in order to facilitate understanding of how to cache multiple second video frames within the second time period in S403 above, below, the following Figure 5 shown embodiments will be described in detail.

[0109] Figure 5 FIG. is a schematic flowchart of a method for caching multiple second video frames within the second time period provided by the embodiments of the present application, and this method can also be executed by software and / or hardware devices. Exemplarily, please refer to Figure 5 shown, the method for caching multiple second video frames within the second time period may include:

[0110] S501. Determine the priority corresponding to each intra-coded frame among multiple intra-coded frames.

[0111] Exemplarily, in the embodiments of the present application, when determining the priority corresponding to each intra-coded frame among multiple intra-coded frames, the priority corresponding to each intra-coded frame among multiple intra-coded frames can be determined based on a preset interval algorithm, or other similar algorithms can also be used to determine the priority corresponding to each intra-coded frame among multiple intra-coded frames, and can be specifically set according to actual needs.

[0112] Exemplarily, the preset interval algorithm can be a binary interval algorithm, or a ternary interval algorithm, etc., and can be specifically set according to actual needs.

[0113] In the subsequent description, taking the determination of the priority corresponding to each intra-coded frame among multiple intra-coded frames based on the binary interval algorithm as an example for description, but it does not mean that the embodiments of the present application are only limited to this.

[0114] For example, if there are a total of 100 intra-coded frames in the second time period, the priority corresponding to each of the 100 intra-coded frames can be determined based on the binary interval algorithm. Assuming that the priorities from high to low are: the 50th frame, the 25th frame, the 75th frame, the 13th frame, the 37th frame, the 63rd frame, the 88th frame, …, then the 100 intra-coded frames can be cached in sequence based on the priorities corresponding to each of the 100 intra-coded frames.

[0115] S502. Cache multiple intra-coded frames in sequence based on the priorities corresponding to each intra-coded frame.

[0116] For example, in the embodiments of the present application, when caching multiple intra-coded frames in sequence based on the priorities corresponding to each intra-coded frame, the caching order of the multiple intra-coded frames can be determined based on the priorities corresponding to each intra-coded frame; the priority of the intra-coded frame is positively correlated with the caching order of the intra-coded frame; and the multiple intra-coded frames are cached in sequence based on the caching order of the multiple intra-coded frames.

[0117] Among them, the higher the priority of the intra-coded frame, the more preferentially the caching order of the intra-coded frame is cached.

[0118] In this way, by preferentially caching multiple intra-coded frames in the second time period, even if the user quickly drags the playback progress to the second time period, the video frames in the time period after the specified time point can be quickly played based on the multiple intra-coded frames preferentially cached in the second time period, which can improve the user's video viewing experience to a certain extent.

[0119] For example, as can be seen Figure 6 shown Figure 6 is a schematic diagram of caching multiple intra-coded frames in sequence based on a hierarchical caching strategy provided by the embodiments of the present application. Still assuming that there are a total of 100 intra-coded frames in the second time period, based on the binary interval algorithm, the priorities corresponding to the 100 intra-coded frames from high to low are: the 50th frame, the 25th frame, the 75th frame, the 13th frame, the 37th frame, the 63rd frame, the 88th frame, …, then according to the priorities corresponding to each of the 100 intra-coded frames, the 50th frame can be cached first, and then the 25th frame and the 75th frame; then the 13th frame, the 37th frame, the 63rd frame and the 88th frame, …, which is similar to hierarchical caching of 100 intra-coded frames. Among them, the number of intra-coded frames cached in the first layer is 1, and the corresponding intra-coded frame is the 50th frame with the highest priority; the number of intra-coded frames cached in the second layer is 2, and the corresponding intra-coded frames are the 25th frame and the 75th frame; the number of intra-coded frames cached in the third layer is 4, and the corresponding intra-coded frames are the 13th frame, the 37th frame, the 63rd frame and the 88th frame, …, and the caching of 100 intra-coded frames is completed in sequence.

[0120] It can be understood that in the embodiments of the present application, by preferentially caching multiple intra-coded frames within the second time period and caching the multiple intra-coded frames in sequence according to the priorities corresponding to the respective intra-coded frames, within the limited caching time, the multiple cached intra-coded frames can be more evenly distributed, so as to improve the hit rate when the user drags the time point within the second time period.

[0121] Exemplarily, reference can be made to Figure 7 as shown Figure 7 which is a schematic diagram of multiple cached intra-coded frames provided by the embodiments of the present application. Figure 7 It includes the case of "continuously caching I-frames" and the case of "hierarchically caching I-frames according to the priorities corresponding to the respective I-frames". Generally, the I-frame interval is 2 seconds. For the sake of easy understanding, assume Figure 7 as shown, the caching time is 40 seconds. Within 40 seconds, the number of cached I-frames in the two schemes is the same. Specifically: in the case of "continuously caching I-frames", the I-frames cached at 0, 2, 4, 6,..., 20 seconds are cached, a total of 11 I-frames; in the case of "hierarchically caching I-frames according to the priorities corresponding to the respective I-frames", the I-frames cached at 0, 4, 6, 8,..., 40 seconds are cached, a total of 11 I-frames.

[0122] Combined with Figure 7 it is not difficult to see that although the number of cached I-frames is the same in both cases, in the case of "hierarchically caching I-frames according to the priorities corresponding to the respective I-frames", the 11 cached frames are more evenly distributed within the 40-second caching time and can better cover the caching time. Therefore, when the user drags the progress to the second time period, only using the locally cached I-frames, the video frames in the time period after the specified time point can be played quickly, thereby improving the user's video viewing experience to a certain extent.

[0123] For example, when 50% (the percentage is A, and A is 50%) of the I-frames within the second time period are cached, as shown above Figure 7 when the current user drags the time progress to the range of the second time period, the accuracy of the time axis is adjusted, and the time accuracy T is adjusted to 2 / A seconds. When A is 50%, the time accuracy T is 4 seconds. During the process of the user dragging the time progress, the minimum unit of time display is 4 seconds, and any time point within the second time period can be played in a timely manner based on the cached video frames. In addition, in order to improve the hit rate when the user drags the time point within the second time period, it is also possible to consider that when the user drags to a time point with a cached I-frame under the condition that the time accuracy remains unchanged, the mobile phone increases damping and other effects to prompt the user that there is a picture at this time point that can be directly played.

[0124] S503. When multiple intra-coded frames are cached, cache multiple intra-frame prediction coded frames.

[0125] Exemplarily, in the embodiments of the present application, when multiple intra-predicted coded frames are cached after multiple intra-coded frame buffers are completed, multiple first intra-predicted coded frames among the multiple intra-predicted coded frames can be cached first. For the first caching operation, the first intra-predicted coded frames are the intra-predicted coded frames adjacent to each intra-coded frame; among the multiple intra-predicted coded frames, multiple second intra-predicted coded frames adjacent to the multiple first intra-predicted coded frames are determined; the multiple second intra-predicted coded frames are determined as the new multiple first intra-predicted coded frames, and the above operations are repeated until the caching of all the intra-predicted coded frames is completed.

[0126] Combined with the above description, it is not difficult to see that when caching multiple P frames in the second time period, a similar hierarchical prediction strategy can be continued to cache the multiple P frames in the second time period. Since within the interval of I-frame groups, P frames need to be cached continuously for normal playback, therefore, in the embodiments of the present application, when caching multiple P frames in the second time period, according to the hierarchical strategy, the first P frame after all I frames can be preferentially cached; after the first P frame after all I frames is cached, continue to cache the second P frame after all I frames according to the hierarchical strategy; after the second P frame after all I frames is cached, continue to cache the third P frame after all I frames according to the hierarchical strategy, and so on, until all P frames after all I frames are cached. In this way, the multiple P frames in the second time period can be cached by the hierarchical prediction strategy, which can effectively improve the time accuracy of the cached video and further enhance the user's video viewing experience.

[0127] Exemplarily, in the embodiments of the present application, when caching multiple first intra-predicted coded frames among the multiple intra-predicted coded frames, the caching order of the multiple first intra-predicted coded frames can be determined based on the priorities of the intra-coded frames corresponding to each of the multiple first intra-predicted coded frames; the priority of the intra-coded frame is positively correlated with the caching order of the corresponding first intra-predicted coded frame; based on the caching order of the multiple first intra-predicted coded frames, the multiple first intra-predicted coded frames are cached in sequence.

[0128] Taking the example of preferentially caching the first P frame after all I frames, when preferentially caching the first P frame after all I frames, based on the priorities of each of the I frames, the first P frame after the I frame with the highest priority can be cached first; secondly, the first P frame after the I frame with the second highest priority is cached; then the first P frame after the I frame with the third highest priority is cached, and so on, until the first P frame after all I frames is cached.

[0129] It can be seen that in the embodiments of the present application, when caching multiple second video frames within the second time period, the priorities corresponding to each intra-coded frame among the multiple intra-coded frames can be determined first, and based on the priorities corresponding to each intra-coded frame, the multiple intra-coded frames can be cached in sequence; when the caching of the multiple intra-coded frames is completed, multiple intra-predicted coded frames can be cached based on a similar hierarchical prediction strategy. In this way, by preferentially caching multiple intra-coded frames within the second time period, even if the user quickly drags the playback progress to the second time period, the video frames within the time period after the specified time point can be quickly played based on the multiple intra-coded frames preferentially cached within the second time period, which can improve the user's video viewing experience to a certain extent. In addition, caching multiple intra-predicted coded frames within the second time period based on a similar hierarchical prediction strategy can effectively improve the time accuracy of the cached video.

[0130] It can be understood that in the case of good network conditions, the layering of video frames at the playback time point can be further increased, and video frames can be obtained. In this way, even when the user drags the playback progress backward, the corresponding playback video frames can be quickly played. If the video frames in both the forward and backward directions are layered and obtained, they can be layered and obtained in the order of: I frames in the future time, I frames in the past time, P frames in the future time, and P frames in the past time. Specifically, it can be set according to actual needs. Here, the embodiments of the present application will not elaborate further.

[0131] Based on any of the above embodiments, during the process of caching video frames by using the video frame caching method provided by the embodiments of the present application, if it is detected that the user has a progress touch operation on the target video, then in response to the progress touch operation on the target video, when the playback time point after detecting the progress touch operation is within the second time period, based on the video frames cached within the second time period, the video frames after the playback time point can be played. Since multiple intra-coded frames within the second time period have been preferentially cached, even if the user quickly drags the playback progress to the second time period, the video frames within the time period after the specified time point can be quickly played based on the multiple intra-coded frames preferentially cached within the second time period, which can improve the user's video viewing experience to a certain extent.

[0132] Next, the video frame caching device provided by the present application will be described. The video frame caching device described below can be correspondingly referred to the video frame caching method described above.

[0133] Figure 8 The structure diagram of a video frame caching device provided by the embodiments of the present application, which is applied to a video frame caching device. By way of example, please refer to Figure 8 As shown, the video frame caching device 80 may include:

[0134] A segmentation unit 801, configured to segment a time period between a playback time point of the target video and a target time point of the target video in response to a playback operation on the target video, to obtain a first time period and a second time period;

[0135] A first buffer unit 802, configured to sequentially buffer multiple first video frames within the first time period in chronological order;

[0136] A second buffer unit 803, configured to buffer multiple second video frames within the second time period based on a preset buffering policy; wherein the multiple second video frames include multiple intra-coded frames and multiple intra-predicted coded frames, and the preset buffering policy includes: the buffering priority of the multiple intra-coded frames is higher than the buffering priority of the multiple intra-predicted coded frames.

[0137] Exemplarily, in an embodiment of the present application, the second buffer unit 803 is configured to buffer multiple second video frames within the second time period, including:

[0138] Determining the priority corresponding to each intra-coded frame among the multiple intra-coded frames;

[0139] Buffering the multiple intra-coded frames sequentially based on the priority corresponding to each intra-coded frame;

[0140] Buffering the multiple intra-predicted coded frames when the buffering of the multiple intra-coded frames is completed.

[0141] Exemplarily, in an embodiment of the present application, the second buffer unit 803 is configured to determine the priority corresponding to each intra-coded frame among the multiple intra-coded frames, including:

[0142] Determining the priority corresponding to each intra-coded frame among the multiple intra-coded frames based on a preset interval algorithm;

[0143] Correspondingly, the buffering the multiple intra-coded frames sequentially based on the priority corresponding to each intra-coded frame includes:

[0144] Determining the buffering order of the multiple intra-coded frames based on the priority corresponding to each intra-coded frame; the priority of the intra-coded frame is positively correlated with the buffering order of the intra-coded frame;

[0145] Buffering the multiple intra-coded frames sequentially based on the buffering order of the multiple intra-coded frames.

[0146] Exemplarily, in an embodiment of the present application, the second buffer unit 803 is configured to buffer the multiple intra-predicted coded frames, including:

[0147] Cache multiple first intra-prediction encoded frames among the multiple intra-prediction encoded frames. For the first caching operation, the first intra-prediction encoded frames are the intra-prediction encoded frames adjacent to each of the intra-encoded frames.

[0148] Determine multiple second intra-prediction encoded frames adjacent to the multiple first intra-prediction encoded frames from the multiple intra-prediction encoded frames.

[0149] Determine the multiple second intra-prediction encoded frames as the new multiple first intra-prediction encoded frames, and repeat the above operations until the caching of the multiple intra-prediction encoded frames is completed.

[0150] Exemplarily, in an embodiment of the present application, the second caching unit 803 is used to cache multiple first intra-prediction encoded frames among the multiple intra-prediction encoded frames, including:

[0151] Determine the caching order of the multiple first intra-prediction encoded frames based on the priorities of the intra-encoded frames corresponding to the multiple first intra-prediction encoded frames respectively; the priority of the intra-encoded frame is positively correlated with the caching order of the corresponding first intra-prediction encoded frame;

[0152] Cache the multiple first intra-prediction encoded frames in sequence based on the caching order of the multiple first intra-prediction encoded frames.

[0153] Exemplarily, in an embodiment of the present application, the second caching unit 803 is used to cache multiple second video frames in the second time period based on a preset caching policy, including:

[0154] When it is detected that the caching of the first video frame in the third time period is completed, cache the multiple second video frames based on the preset caching policy;

[0155] Wherein, the start time point of the third time period is the playing time point, the end time point of the third time period is earlier than the end time point of the first time period, or the end time point of the third time period is the end time point of the first time period.

[0156] Exemplarily, in an embodiment of the present application, the video frame caching device 80 further includes a playing unit.

[0157] The playing unit is used to play the video frames after the playing time point based on the cached video frames in the second time period when the playing time point of the detected progress touch operation is in the second time period.

[0158] The video frame caching device 80 provided in the embodiments of the present application can implement the technical solution of the video frame caching method in any of the above embodiments. Its implementation principle and beneficial effects are similar to those of the video frame caching method. For details, refer to the implementation principle and beneficial effects of the video frame caching method, which will not be elaborated here.

[0159] Figure 9 It is a schematic physical structure diagram of an electronic device provided in the embodiments of the present application. As Figure 9 shown, the electronic device may include: a processor 910, a communication interface 920, a memory 930, and a communication bus 940. Among them, the processor 910, the communication interface 920, and the memory 930 communicate with each other through the communication bus 940. The processor 910 can call the logical instructions in the memory 930 to execute the video frame caching method, which includes: in response to a playback operation on a target video, segmenting the period between the playback time point of the target video and the target time point of the target video to obtain a first period and a second period; caching multiple first video frames in the first period in chronological order; caching multiple second video frames in the second period based on a preset caching policy; where the multiple second video frames include multiple intra-coded frames and multiple intra-predicted coded frames, and the preset caching policy includes: the caching priority of the multiple intra-coded frames is higher than the caching priority of the multiple intra-predicted coded frames.

[0160] In addition, when the logical instructions in the above-mentioned memory 930 are implemented in the form of software functional units and sold or used as an independent product, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The foregoing storage medium includes: various media such as a USB flash drive, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk, or an optical disc that can store program codes.

[0161] On the other hand, the present application also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the video frame caching method provided by each of the above methods. The method includes: in response to a playback operation on a target video, segmenting the period between the playback time point of the target video and the target time point of the target video to obtain a first period and a second period; sequentially caching a plurality of first video frames in the first period in chronological order; caching a plurality of second video frames in the second period based on a preset caching policy; wherein the plurality of second video frames include a plurality of intra-coded frames and a plurality of intra-predicted coded frames, and the preset caching policy includes: the caching priority of the plurality of intra-coded frames is higher than the caching priority of the plurality of intra-predicted coded frames.

[0162] In another aspect, the present application also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the video frame caching method provided by each of the above methods. The method includes: in response to a playback operation on a target video, segmenting the period between the playback time point of the target video and the target time point of the target video to obtain a first period and a second period; sequentially caching a plurality of first video frames in the first period in chronological order; caching a plurality of second video frames in the second period based on a preset caching policy; wherein the plurality of second video frames include a plurality of intra-coded frames and a plurality of intra-predicted coded frames, and the preset caching policy includes: the caching priority of the plurality of intra-coded frames is higher than the caching priority of the plurality of intra-predicted coded frames.

[0163] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art can understand and implement it without creative labor.

[0164] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on such an understanding, the above technical solutions, in essence, or the parts that contribute to the prior art can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0165] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, and are not intended to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A caching method for video frames, characterized in that, Including: In response to a playback operation on a target video, segment a period between a playback time point of the target video and a target time point of the target video to obtain a first period and a second period; Cache a plurality of first video frames within the first period in chronological order; Based on a preset caching policy, cache a plurality of second video frames within the second period; wherein, the plurality of second video frames include a plurality of intra-coded frames and a plurality of intra-prediction coded frames, and the preset caching policy includes: the caching priority of the plurality of intra-coded frames is higher than the caching priority of the plurality of intra-prediction coded frames.

2. The method according to claim 1, characterized in that, The caching of the plurality of second video frames within the second period includes: Determine the priority corresponding to each intra-coded frame among the plurality of intra-coded frames; Based on the priority corresponding to each intra-coded frame, cache the plurality of intra-coded frames in sequence; When the caching of the plurality of intra-coded frames is completed, cache the plurality of intra-prediction coded frames.

3. The method according to claim 2, wherein The determination of the priority corresponding to each intra-coded frame among the plurality of intra-coded frames includes: Based on a preset interval algorithm, determine the priority corresponding to each intra-coded frame among the plurality of intra-coded frames; Correspondingly, the caching of the plurality of intra-coded frames in sequence based on the priority corresponding to each intra-coded frame includes: Based on the priority corresponding to each intra-coded frame, determine the caching order of the plurality of intra-coded frames; the priority of the intra-coded frame is positively correlated with the caching order of the intra-coded frame; Based on the caching order of the plurality of intra-coded frames, cache the plurality of intra-coded frames in sequence.

4. The method according to claim 2 or 3, characterized in that, The caching of the plurality of intra-prediction coded frames includes: Cache a plurality of first intra-prediction coded frames among the plurality of intra-prediction coded frames. For the first caching operation, the first intra-prediction coded frame is an intra-prediction coded frame adjacent to each intra-coded frame; Determine a plurality of second intra-prediction coded frames adjacent to the plurality of first intra-prediction coded frames from the plurality of intra-prediction coded frames; Determine the plurality of second intra-prediction coded frames as the new plurality of first intra-prediction coded frames, and repeat the above operations until the caching of the plurality of intra-prediction coded frames is completed.

5. The method according to claim 4, wherein The caching of the plurality of first intra-prediction coded frames among the plurality of intra-prediction coded frames includes: Based on the priority of the intra-coded frame corresponding to each of the plurality of first intra-prediction coded frames, determine the caching order of the plurality of first intra-prediction coded frames; the priority of the intra-coded frame is positively correlated with the caching order of the corresponding first intra-prediction coded frame; Based on the caching order of the plurality of first intra-prediction coded frames, cache the plurality of first intra-prediction coded frames in sequence.

6. The method according to any one of claims 1-3, characterized in that, The caching of the plurality of second video frames within the second period based on the preset caching policy includes: When it is detected that the caching of the first video frame within the third period is completed, based on the preset caching policy, cache the plurality of second video frames; Among them, the start time point of the third time period is the playback time point, the end time point of the third time period is earlier than the end time point of the first time period, or the end time point of the third time period is the end time point of the first time period.

7. The method according to any one of claims 1 to 3, characterized in that, The method further includes: When the playback time point for detecting the progress touch operation is in the second time period, based on the video frames cached in the second time period, play the video frames after the playback time point.

8. A caching device for video frames, characterized in that, Including: A segmentation unit, configured to, in response to a playback operation on a target video, segment the time period between the playback time point of the target video and the target time point of the target video to obtain a first time period and a second time period; A first caching unit, configured to sequentially cache a plurality of first video frames in the first time period in chronological order; A second caching unit, configured to cache a plurality of second video frames in the second time period based on a preset caching policy; wherein the plurality of second video frames include a plurality of intra-coded frames and a plurality of intra-prediction coded frames, and the preset caching policy includes: the caching priority of the plurality of intra-coded frames is higher than the caching priority of the plurality of intra-prediction coded frames.

9. An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the video frame caching method according to any one of claims 1 to 7.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the video frame caching method according to any one of claims 1 to 7.