Video data buffering method, apparatus, device and readable storage medium

By detecting the start position and hotspot data of video-on-demand requests and adopting a three-level caching strategy, the problem of long video playback waiting time on user terminals in CDN systems is solved, and the effect of quickly obtaining video data is achieved.

CN116347117BActive Publication Date: 2026-01-13WUHAN FONSVIEW TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310232549.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-06
Publication Date
2026-01-13
Estimated Expiration
2043-03-06

AI Technical Summary

Technical Problem

The long video playback time on user terminals in CDN systems is mainly due to the large data files of video-on-demand content, which leads to a long time for CDN edge nodes and user terminals to obtain video data.

Method used

By detecting the start position of the video-on-demand request and whether the video data is hot data, a three-level caching strategy is adopted: the header data and the first frame group of the video data are cached in memory, the header data and the first K frame groups are cached in high-speed hard disk, and all frame groups are cached in low-speed hard disk.

Benefits of technology

It effectively reduces the time it takes for user terminals to acquire video data, reduces backhaul traffic, and improves the response speed of video playback.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116347117B_ABST
    Figure CN116347117B_ABST
Patent Text Reader

Abstract

The application provides a video data caching method, device and equipment and a readable storage medium. The method comprises the following steps: when it is detected that a starting position of a video on demand request is a video starting position, calculating a number K of cached picture groups; when it is detected that target video data of the video on demand request is hot spot video data, detecting whether a first video size corresponding to the target video data is greater than or equal to a second video size corresponding to the first K picture groups of complete video data corresponding to the video on demand request; if the first video size is greater than or equal to the second video size, caching head data and a first picture group of the target video data to an internal memory cache, caching the head data and the first K picture groups of the target video data to a high-speed hard disk, and caching the head data and all picture groups of the target video data to a low-speed hard disk. Through the application, the problem that a user terminal takes a long time to obtain video on demand content and causes a long waiting time for video playing of the user terminal is solved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of communication technology, and in particular to a video data caching method, device, equipment and readable storage medium. BACKGROUND

[0002] In a CDN (Content Delivery Network) system, video contents are generally stored in CDN center nodes and video source stations with sufficient storage space, and CDN edge nodes are used to respond to video on-demand requests of users. When the video on-demand content requested by a user does not exist in the cache of a CDN edge node, the CDN edge node will obtain the video on-demand content from a CDN center node or a video source station. However, the video data file corresponding to the video on-demand content is large, so that the CDN edge node and the user terminal take a long time to obtain the video on-demand content, resulting in a long waiting time for video playing of the user terminal. SUMMARY

[0003] The main purpose of the present application is to provide a video data caching method, device, equipment and readable storage medium, aiming at solving the problem of long waiting time for video playing of a user terminal.

[0004] In a first aspect, the present application provides a video data caching method, which comprises:

[0005] detecting whether a starting position of a video on-demand request is a video starting position;

[0006] when the starting position of the video on-demand request is the video starting position, calculating a number K of cached picture groups, wherein K is a positive integer;

[0007] detecting whether target video data of the video on-demand request is hot video data;

[0008] when the target video data of the video on-demand request is hot video data, detecting whether a first video size corresponding to the target video data is greater than or equal to a second video size corresponding to the first K picture groups of complete video data corresponding to the video on-demand request;

[0009] if the first video size is greater than or equal to the second video size, caching head data and a first picture group of the target video data to an internal memory cache, caching the head data and the first K picture groups of the target video data to a high-speed hard disk, and caching the head data and all picture groups of the target video data to a low-speed hard disk.

[0010] Optionally, before the step of detecting whether the starting position of the video on-demand request is the video starting position, the method comprises:

[0011] receiving a video on demand request from a user terminal;

[0012] obtaining a start position and a video size of target video data of the video on demand request;

[0013] reading the target video data in the order of memory cache, high-speed hard disk and low-speed hard disk based on the start position and the video size;

[0014] when the target video data is not read completely, obtaining the target video data and performing the step of detecting whether the start position of the video on demand request is a video start position.

[0015] Optionally, after the step of reading the target video data in the order of memory cache, high-speed hard disk and low-speed hard disk based on the start position and the video size, comprising:

[0016] when the target video data is read partially, obtaining new target video data, wherein the new target video data is the target video data not read;

[0017] detecting whether the start position of the video on demand request is a video start position;

[0018] when the start position of the video on demand request is a video start position, calculating a number K of buffered picture groups, wherein K is a positive integer;

[0019] detecting whether the target video data of the video on demand request is hot video data;

[0020] if the target video data of the video on demand request is hot video data, detecting whether a first video size of the target video data is greater than or equal to a second video size corresponding to the first K picture groups of complete video data corresponding to the video on demand request;

[0021] if the first video size is greater than or equal to the second video size, detecting whether the video data corresponding to the first K picture groups of the complete video data completely contains the new target video data;

[0022] if yes, buffering the head data and the first picture group of the target video data to the memory cache, and buffering the head data of the target video data and the first K picture groups of the complete video data to the high-speed hard disk and the low-speed hard disk;

[0023] if no, buffering the new target video data to the low-speed hard disk;

[0024] If the target video data contains a part of new target video data, the header data and the first group of pictures of the target video data are cached to the memory cache, the header data and the first K groups of pictures of the complete video data are cached to the high-speed hard disk, and the header data, the first K groups of pictures of the complete video data and another part of the new target video data are cached to the low-speed hard disk.

[0025] Optionally, after the step of detecting whether the first video size is greater than or equal to the second video size, the method further comprises:

[0026] If the first video size is smaller than the second video size, the header data and the first group of pictures of the complete video data corresponding to the video on demand request are cached to the memory cache, and the header data and the first K groups of pictures of the complete video data are cached to the high-speed hard disk and the low-speed hard disk.

[0027] Optionally, after the step of detecting whether the start position of the video on demand request is the video start position, the method further comprises:

[0028] When the start position of the video on demand request is not the video start position, detecting whether the target video data of the video on demand request is hot video data;

[0029] When the target video data is hot video data, caching the target video data to the low-speed hard disk.

[0030] Optionally, the step of calculating the number K of cached groups of pictures comprises:

[0031] obtaining a video code rate B of the complete video data corresponding to the video on demand request, a read speed DL of the low-speed hard disk, a read speed DH of the high-speed hard disk, a maximum playing time m of the video data cached in the high-speed hard disk and a playing time t of one group of pictures, wherein the read speed DL of the low-speed hard disk is greater than the video code rate B;

[0032] calculating the number K of cached groups of pictures by a preset formula wherein L' = L*e, and e represents an elasticity coefficient, e = 1 when e < 1, e = 2 when e > 2, L' = 1 when L' < 1, and L' = m when L' > m.

[0033] Optionally, after the step of detecting whether the target video data of the video on demand request is hot video data, the method further comprises:

[0034] ​If the target video data is not hot video data, then the header data and the first frame group of the complete video data corresponding to the video-on-demand request are cached in the memory cache, and the header data and the first K frame groups of the complete video data corresponding to the video-on-demand request are cached in the high-speed hard disk and the low-speed hard disk.

[0035] Secondly, the present invention also provides a video data caching device, the video data caching device comprising:

[0036] The first detection module is used to detect whether the start position of the video-on-demand request is the start position of the video.

[0037] The calculation module is used to calculate the number of cached frame groups K when the start position of the video-on-demand request is the start position of the video, where K is a positive integer;

[0038] The second detection module is used to detect whether the target video data of the video-on-demand request is hot video data.

[0039] The third detection module is used to detect whether the first video size of the target video data is greater than or equal to the second video size corresponding to the first K frame groups of the complete video data corresponding to the video-on-demand request when the target video data of the video-on-demand request is hot video data.

[0040] The caching module is used to cache the header data and the first frame group of the target video data to the memory cache if the size of the first video is greater than or equal to the size of the second video, cache the header data and the first K frame groups of the target video data to the high-speed hard disk, and cache the header data and all frame groups of the target video data to the low-speed hard disk.

[0041] Thirdly, the present invention also provides a video data caching device, the video data caching device including a processor, a memory, and a video data caching program stored in the memory and executable by the processor, wherein when the video data caching program is executed by the processor, it implements the steps of the video data caching method described above.

[0042] Fourthly, the present invention also provides a readable storage medium storing a video data caching program, wherein when the video data caching program is executed by a processor, it implements the steps of the video data caching method described above.

[0043] In this invention, it is detected whether the start position of the video-on-demand request is the start position of the video; when the start position of the video-on-demand request is the start position of the video, the number of cached frame groups K is calculated, where K is a positive integer; it is detected whether the target video data of the video-on-demand request is hot video data; when the target video data of the video-on-demand request is hot video data, it is detected whether the size of the first video corresponding to the target video data is greater than or equal to the size of the second video corresponding to the first K frame groups of the complete video data corresponding to the video-on-demand request; if the size of the first video is greater than or equal to the size of the second video, the header data and the first frame group of the target video data are cached in memory, the header data and the first K frame groups of the target video data are cached in high-speed hard disk, and the header data and all frame groups of the target video data are cached in low-speed hard disk. This invention employs a three-level caching system for target video data that starts playing from the beginning of the video and is considered a hot topic. Specifically, the header data and the first frame group of the target video data are cached in memory; the header data and the first K frame groups are cached on a high-speed hard drive; and the header data and all frame groups are cached on a low-speed hard drive. This allows user terminals to quickly retrieve the header data and the first K frame groups from the memory cache and the high-speed hard drive, solving the problem of long waiting times for video playback caused by the long time it takes for user terminals to obtain video-on-demand content. Attached Figure Description

[0044] Figure 1 This is a flowchart illustrating the first embodiment of the video data caching method of the present invention;

[0045] Figure 2 This is a schematic diagram of the caching module of the video data caching method of the present invention;

[0046] Figure 3 This is a flowchart illustrating the second embodiment of the video data caching method of the present invention;

[0047] Figure 4 This is a flowchart illustrating the third embodiment of the video data caching method of the present invention;

[0048] Figure 5 This is a flowchart illustrating the fourth embodiment of the video data caching method of the present invention;

[0049] Figure 6 This is a flowchart illustrating the fifth embodiment of the video data caching method of the present invention;

[0050] Figure 7 This is a functional module diagram of the first embodiment of the video data caching device of the present invention;

[0051] Figure 8This is a schematic diagram of the hardware structure of the video data caching device involved in the embodiment of the present invention.

[0052] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0053] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

[0054] In a first aspect, embodiments of the present invention provide a video data caching method.

[0055] In one embodiment, reference is made to Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the video data caching method of the present invention. Figure 1 As shown, the video data caching method includes:

[0056] Step S10: Detect whether the start position of the video-on-demand request is the start position of the video;

[0057] In this embodiment, after obtaining the video-on-demand request, it is checked whether the start position of the video-on-demand request is the start position of the video. Specifically, if playing an MP4 video, it is checked whether the start byte position indicated by the RANGE field in the HTTP request header of the video-on-demand request is 0. If it is 0, the detection result is that the start position of the video-on-demand request is the start position of the video. If it is not 0 (greater than 0), the detection result is that the start position of the video-on-demand request is not the start position of the video.

[0058] Step S20: When the start position of the video-on-demand request is the start position of the video, calculate the number of cached frame groups K, where K is a positive integer;

[0059] In this embodiment, when the detection result indicates that the start position of the on-demand request is the video start position, the number K of the frame groups that need to be cached to the high-speed hard disk is calculated, where K is a positive integer.

[0060] Further, in one embodiment, the step of calculating the number K of cached screen groups includes:

[0061] The video bitrate B corresponding to the video-on-demand request is obtained, along with the low-speed hard drive read speed DL, the high-speed hard drive read speed DH, the maximum playback duration m of the video data cached in the high-speed hard drive, and the playback duration t of a group of frames. The low-speed hard drive read speed DL is greater than the video bitrate B.

[0062] By preset formula The number of buffered frame groups K is calculated, where L′=L*e, When K is not a positive integer, round up. Let e represent the elastic coefficient. When e < 1, take e = 1; when e > 2, take e = 2. When L′ < 1, take L′ = 1; when L′ > m, take L′ = m.

[0063] In this embodiment, obtain the video bit rate B of the complete video data corresponding to the video-on-demand request. Here, the bit rate is the number of data bits transmitted per unit time during data transmission, and the general unit is kbps, that is, thousands of bits per second. The read speed DL of the low-speed hard disk, the read speed DH of the high-speed hard disk, the maximum playback duration m of the video data cached in the high-speed hard disk, and the playback duration t of a group of pictures. Among them, the read speed DL of the low-speed hard disk is greater than the video bit rate B. That is, the read speed of the low-speed hard disk must be greater than the video bit rate. If this requirement is not met, a low-speed hard disk that meets the requirements needs to be replaced.

[0064] Taking B = 300 Mbps, m = 5 s, DL = 800 Mbps, DH = 24000 Mbps, t = 0.5 s as an example,

[0065] Since 1 < e = 1.2 < 2, the elastic coefficient e remains unchanged. And when e < 1, take e = 1; when e > 2, take e = 2. L′ = L * e = 1.875 * 1.2 = 2.25 (seconds). Since when L′ < 1, take L′ = 1; when L′ > m, take L′ = m, and m = 5 s, and 1 s < L′ = 2.25 s < 5 s, the playback duration L′ of K groups of pictures remains unchanged. Through the preset formula Calculate the number K of cached picture groups, that is When K = 4.5 is not a positive integer, round up to get K = 5 (groups).

[0066] Step S30, detect whether the target video data of the video-on-demand request is hot video data;

[0067] In this embodiment, taking the target video data belonging to Video 1 as an example, according to the number of on-demand requests for Video 1 received within the preset duration, detect whether the target video data of the video-on-demand request is hot video data. Specifically, obtain the number of on-demand requests for Video 1 within the preset duration. If the number of on-demand requests for Video 1 is greater than or equal to the threshold, determine that the target video data is hot video data. If the number of on-demand requests for Video 1 is less than the threshold, determine that the target video data is not hot video data. It is easy to understand that the target video data can be the video data corresponding to the complete Video 1, or part of the video data corresponding to Video 1.

[0068] Furthermore, when the start position of the video-on-demand request is the beginning position of the video and it is detected that the target video data of the video-on-demand request is not hot video data, the header data of the complete video data corresponding to the video-on-demand request and the first frame group are cached in the memory cache, and the header data of the complete video data corresponding to the video-on-demand request and the first K frame groups are cached in the high-speed hard disk and the low-speed hard disk.

[0069] Step S40: When the target video data of the video-on-demand request is hot video data, detect whether the size of the first video corresponding to the target video data is greater than or equal to the size of the second video corresponding to the first K frame groups of the complete video data corresponding to the video-on-demand request.

[0070] In this embodiment, when the target video data of the video-on-demand request is detected to be hot video data, it is checked whether the first video size of the target video data is greater than or equal to the second video size corresponding to the first K frame groups of the complete video data corresponding to the video-on-demand request. Specifically, taking a complete video size corresponding to the video-on-demand request as 120M and a second video size corresponding to the first K frame groups as 50M as an example, if the first video size corresponding to the target video data is 80M, then the first video size corresponding to the target video data is greater than the second video size corresponding to the first K frame groups of the complete video data corresponding to the video-on-demand request. If the first video size corresponding to the target video data is 30M, then the first video size corresponding to the target video data (30M) is less than the second video size corresponding to the first K frame groups of the complete video data corresponding to the video-on-demand request (50M).

[0071] Step S50: If the size of the first video is greater than or equal to the size of the second video, then cache the header data and the first frame group of the target video data in the memory cache, cache the header data and the first K frame groups of the target video data in the high-speed hard disk, and cache the header data and all frame groups of the target video data in the low-speed hard disk.

[0072] In this embodiment, when the size of the first video corresponding to the target video data is greater than or equal to the size of the second video corresponding to the first K frame groups of the complete video data corresponding to the video-on-demand request, it is easy to understand that the number N of the frame groups corresponding to the target video data is greater than or equal to K. In this case, the header data and the first frame group of the target video data are cached in memory, the header data and the first K frame groups of the target video data are cached in a high-speed hard disk, and the header data and all frame groups (N frame groups) of the target video data are cached in a low-speed hard disk. This allows the edge CDN node to read the video data from the cache and return it to the user terminal when the target video data is read subsequently, without needing to fetch video data from the CDN central node or video origin server each time, effectively reducing the back-to-origin traffic. Here, the header data refers to the video data before the first frame group in the ultra-high-definition video file. It is easy to understand that when the start position of the video-on-demand request is the beginning position of the video and the size of the first video corresponding to the target video data is greater than or equal to the size of the second video corresponding to the first K frame groups of the complete video data corresponding to the video-on-demand request, the first K frame groups of the target video data are the same as the first K frame groups of the complete video data.

[0073] Specifically, refer to Figure 2 , Figure 2 This is a schematic diagram of the caching module in the video data caching method of the present invention. Figure 2 As shown, the memory cache is used to cache the video header data and the data corresponding to the first group of frames (GOP1). The high-speed hard disk is used to cache the video header data and the first K groups of frames (GOP1...GOP). k The corresponding data. Low-speed hard drives are used to cache the video header data and the complete video data (GOP1...GOP). Last For ultra-high-definition video files in MP4 and FLV formats, the header data refers to Moov; for ultra-high-definition video files in HLS format, the header data refers to the index data; for ultra-high-definition video files in other formats, the header data is specific to the format and will not be explained here.

[0074] Low-speed hard drives need to store complete video files of ultra-high-definition video files, so the hard drive capacity needs to be large, generally greater than or equal to 4TB; the read speed is usually around 200MBps, specifically 200±100MBps. In particular, low-speed hard drives of 4TB to 14TB can be used, with read speeds of around 200MBps, which can meet the usage requirements. Of course, this is just an example, and other suitable large-capacity hard drives can also be used, without making specific limitations here.

[0075] High-speed hard drives are used to store the header data and the first K frames of ultra-high-definition video. This video data needs to be read very quickly, so the read speed of the high-speed hard drive needs to be high, generally greater than 2000 MBps. The capacity is not limited, but it is usually less than 4TB. For example, a high-speed hard drive with a capacity of 500GB and an average read speed of greater than 2000 MBps can meet the requirements. Of course, this is just an example, and other suitable high-speed hard drives can be used. No specific limitation is made here.

[0076] The memory cache is used to store the header data and first frame group of ultra-high-definition video. This part of the video data is cached in memory and can be read quickly. There is no limit to the capacity, but usually 128MB or larger can be selected.

[0077] In this embodiment, it is detected whether the start position of the video-on-demand request is the start position of the video; when the start position of the video-on-demand request is the start position of the video, the number of cached frame groups K is calculated, where K is a positive integer; it is detected whether the target video data of the video-on-demand request is hot video data; when the target video data of the video-on-demand request is hot video data, it is detected whether the size of the first video corresponding to the target video data is greater than or equal to the size of the second video corresponding to the first K frame groups of the complete video data corresponding to the video-on-demand request; if the size of the first video is greater than or equal to the size of the second video, the header data and the first frame group of the target video data are cached in memory, the header data and the first K frame groups of the target video data are cached in high-speed hard disk, and the header data and all frame groups of the target video data are cached in low-speed hard disk. This embodiment implements a three-level cache for target video data that starts playing from the beginning of the video and is considered a hot topic. Specifically, the header data and the first frame group of the target video data are cached in memory, the header data and the first K frame groups are cached in a high-speed hard drive, and the header data and all frame groups are cached in a low-speed hard drive. This allows the user terminal to quickly read the header data and the first K frame groups of the target video data from the memory cache and the high-speed hard drive, solving the problem of long waiting times for video playback caused by long acquisition times of video-on-demand content on the user terminal.

[0078] Furthermore, in one embodiment, reference is made to Figure 3 , Figure 3 This is a flowchart illustrating a second embodiment of the video data caching method of the present invention. Figure 3 As shown, before step S10, the following steps are included:

[0079] Step S001: Receive a video-on-demand request from the user terminal;

[0080] Step S002: Obtain the start position and video size of the target video data in the video-on-demand request;

[0081] Step S003: Based on the starting position and video size, read the video in the following order: first memory cache, then high-speed hard disk, and finally low-speed hard disk.

[0082] Step S004: When no target video data is read, acquire the target video data and perform the step of detecting whether the start position of the video-on-demand request is the video start position.

[0083] In this embodiment, a video-on-demand request sent by a user terminal is received, the start position of the target video data of the video-on-demand request is determined according to the start byte position indicated by the RANGE field in the HTTP request header of the video-on-demand request, and the video size of the target video data of the video-on-demand request is obtained.

[0084] The starting position for reading target video data from memory cache, high-speed hard drive, and low-speed hard drive is determined based on the starting position of the target video data. The ending position for reading from memory cache, high-speed hard drive, and low-speed hard drive is determined based on the video size of the target video data.

[0085] After reading the target video data sequentially from the memory cache, high-speed hard drive, and low-speed hard drive, it is checked whether the target video data has been completely read. If the target video data has not been read at all, that is, if the target video data of the video-on-demand request does not exist in the memory cache, high-speed hard drive, and low-speed hard drive, the target video data of the video-on-demand request is obtained from the CDN central node or the video origin station, and steps S10 to S50 are executed.

[0086] Furthermore, in one embodiment, reference is made to Figure 4 , Figure 4 This is a flowchart illustrating the third embodiment of the video data caching method of the present invention. Figure 4 As shown, after step S003, the following steps are included:

[0087] Step S030: When a portion of the target video data is read, new target video data is obtained, wherein the new target video data is the unread target video data;

[0088] Step S031: Detect whether the start position of the video-on-demand request is the start position of the video;

[0089] Step S032: When the start position of the video-on-demand request is the start position of the video, calculate the number of cached frame groups K, where K is a positive integer;

[0090] Step S033: Detect whether the target video data of the video-on-demand request is hot video data;

[0091] Step S034: If the target video data of the video-on-demand request is hot video data, then detect whether the first video size of the target video data is greater than or equal to the second video size corresponding to the first K frame groups of the complete video data corresponding to the video-on-demand request.

[0092] Step S035: If the size of the first video is greater than or equal to the size of the second video, then detect whether the video data corresponding to the first K frame groups of the complete video data completely contains the new target video data.

[0093] Step S036: If the target video data is completely contained, the header data and the first frame group of the target video data are cached in the memory cache, and the header data of the target video data and the first K frame groups of the complete video data are cached in the high-speed hard disk and the low-speed hard disk.

[0094] Step S037: If the target video data is not included at all, then cache the new target video data to a low-speed hard drive.

[0095] Step S038: If it contains some new target video data, then cache the header data and the first frame group of the target video data to the memory cache, cache the header data and the first K frame groups of the complete video data to the high-speed hard disk, and cache the header data, the first K frame groups of the complete video data, and another part of the new target video data to the low-speed hard disk.

[0096] In this embodiment, when only a portion of the target video data is read from the memory cache, high-speed hard drive, and low-speed hard drive—that is, when only a portion of the target video data for the video-on-demand request exists in these three locations—new target video data, i.e., the unread portion of the target video data, is retrieved from the CDN central node or the video origin server. Then, it is checked whether the start position of the video-on-demand request is the video's starting position.

[0097] When the start position of the video-on-demand request is the beginning position of the video, after calculating the number of cached frame groups K, it is checked whether the target video data of the video-on-demand request is hot video data, where K is a positive integer.

[0098] If the target video data requested in the video-on-demand request is not a popular video, then after obtaining all the new target video data, the process continues to obtain video data until the video data corresponding to the first K frame groups of the complete video data is obtained. Then, the header data and the first frame group of the complete video data corresponding to the video-on-demand request are cached in memory, and the header data and the first K frame groups of the complete video data corresponding to the video-on-demand request are cached on both high-speed and low-speed hard drives. It's easy to understand that obtaining all the target video data includes obtaining it sequentially from the memory cache, high-speed hard drive, and low-speed hard drive, or from the memory cache, high-speed hard drive, low-speed hard drive, and CDN central node or video origin server, or from the CDN central node or video origin server.

[0099] If the target video data of the video-on-demand request is detected as hot video data, then it is checked whether the size of the first video corresponding to the target video data is greater than or equal to the size of the second video corresponding to the first K frame groups of the complete video data corresponding to the video-on-demand request. Specifically, if the size of the first video of the target video data of the video-on-demand request is 60M, and the size of the video corresponding to the partially read target video data is 20M, then the size of the new target video data is 40M. Taking the size of the second video corresponding to the first K frame groups of the complete video data corresponding to the video-on-demand request as an example, in this case, the size of the first video of the target video data is 60M, which is greater than the size of the second video, which is 50M. Then it is checked whether the video data corresponding to the first K frame groups of the complete video data completely contains the new target video data.

[0100] If the video data corresponding to the first K frames of the complete video data completely contains the new 40M part of the target video data, then the header data of the target video data and the first frame group are cached in the memory cache, and the header data of the target video data and the first K frames of the complete video data are cached in the high-speed hard drive and the low-speed hard drive.

[0101] If the video data corresponding to the first K frames of the complete video data does not contain any of the new 40M portion of the target video data, then the new target video data will be cached to a low-speed hard drive.

[0102] If the video data corresponding to the first K frames of the complete video data contains 30M of new target video data, but not the other 10M of new target video data, then the header data of the target video data and the first frame group are cached in memory, the header data of the target video data and the first K frames of the complete video data are cached in high-speed hard disk, and the header data of the target video data, the first K frames of the complete video data, and a portion of the target video data corresponding to the video data that does not belong to the first K frames of the complete video data are cached in low-speed hard disk.

[0103] Furthermore, when the start position of the video-on-demand request is not the start position of the video, it checks whether the target video data of the video-on-demand request is hot video data. If the target video data of the video-on-demand request is hot video data, the new target video data of the video-on-demand request is cached to a low-speed hard drive. If the target video data of the video-on-demand request is not hot video data, the new target video data and the read partial target video data are sent to the user terminal.

[0104] Further, in one embodiment, after the step of detecting whether the first video size of the target video data is greater than or equal to the second video size corresponding to the first K frame groups of the complete video data corresponding to the video-on-demand request, the method includes:

[0105] If the size of the first video is smaller than the size of the second video, then the header data of the complete video data corresponding to the video-on-demand request and the first frame group are cached in the memory cache, and the header data of the complete video data and the first K frame groups are cached in the high-speed hard disk and the low-speed hard disk.

[0106] In this embodiment, if the first video size of the target video data in the video-on-demand request is 30M, and this size is less than the second video size of 50M, then after acquiring all the target video data, the acquisition of video data continues until the video data corresponding to the first K frame groups of the complete video data is acquired. Then, the header data and the first frame group of the complete video data corresponding to the video-on-demand request are cached in memory, and the header data and the first K frame groups of the complete video data are cached on both high-speed and low-speed hard drives. Acquiring the video data corresponding to the first K frame groups of the complete video data includes acquiring the video data corresponding to the first K frame groups of the complete video data from the CDN central node or the video origin server, or acquiring the video data corresponding to the first K frame groups of the complete video data from memory cache, high-speed hard drive, low-speed hard drive, and both the CDN central node and the video origin server.

[0107] Furthermore, in one embodiment, reference is made to Figure 5 , Figure 5 This is a flowchart illustrating the fourth embodiment of the video data caching method of the present invention. Figure 5 As shown, after step S10, the following steps are included:

[0108] Step S60: When the start position of the video-on-demand request is not the start position of the video, detect whether the target video data of the video-on-demand request is hot video data.

[0109] Step S70: When the target video data is hot video data, cache the target video data to a low-speed hard disk.

[0110] In this embodiment, when the start position of the video-on-demand request is not the start position of the video, it is detected whether the target video data of the video-on-demand request is hot video data. If the target video data is hot video data, the target video data is cached to a low-speed hard disk.

[0111] Furthermore, when the start position of the video-on-demand request is not the start position of the video, if it is detected that the target video data of the video-on-demand request is not hot video data, the target video data of the video-on-demand request will not be cached, and after obtaining the target video data of the video-on-demand request, the target video data of the video-on-demand request will be sent to the user terminal.

[0112] Furthermore, in one embodiment, reference is made to Figure 6 , Figure 6 This is a flowchart illustrating the fifth embodiment of the video data caching method of the present invention. Figure 6 As shown, after step S30, the following steps are included:

[0113] Step S80: If the target video data is not hot video data, then the header data and the first frame group of the complete video data corresponding to the video-on-demand request are cached in the memory cache, and the header data and the first K frame groups of the complete video data corresponding to the video-on-demand request are cached in the high-speed hard disk and the low-speed hard disk.

[0114] In this embodiment, when the start position of the video-on-demand request is the beginning position of the video, if it is detected that the target video data is not hot video data, then after acquiring all the target video data, the acquisition of video data continues until the video data corresponding to the first K frame groups of the complete video data is acquired. Then, the header data and the first frame group of the complete video data corresponding to the video-on-demand request are cached in memory, and the header data and the first K frame groups of the complete video data corresponding to the video-on-demand request are cached in high-speed hard disk and low-speed hard disk. It is easy to understand that acquiring all the target video data includes acquiring it sequentially from memory cache, high-speed hard disk, and low-speed hard disk, or from memory cache, high-speed hard disk, low-speed hard disk, and CDN central node or video origin server, or from CDN central node or video origin server.

[0115] Secondly, embodiments of the present invention also provide a video data caching device.

[0116] In one embodiment, reference is made to Figure 7 , Figure 7 This is a functional module diagram of the first embodiment of the video data caching device of the present invention. Figure 7 As shown, the video data buffer device includes:

[0117] The first detection module 10 is used to detect whether the start position of the video-on-demand request is the start position of the video.

[0118] Calculation module 20 is used to calculate the number of cached frame groups K when the start position of the video-on-demand request is the start position of the video, where K is a positive integer;

[0119] The second detection module 30 is used to detect whether the target video data of the video-on-demand request is hot video data.

[0120] The third detection module 40 is used to detect whether the size of the first video corresponding to the target video data is greater than or equal to the size of the second video corresponding to the first K frame groups of the complete video data corresponding to the video on demand request when the target video data of the video on demand request is hot video data.

[0121] The caching module 50 is used to cache the header data and the first frame group of the target video data to the memory cache if the size of the first video is greater than or equal to the size of the second video, cache the header data and the first K frame groups of the target video data to the high-speed hard disk, and cache the header data and all frame groups of the target video data to the low-speed hard disk.

[0122] Furthermore, in one embodiment, the video data caching device further includes a reading module, used for:

[0123] Receive video-on-demand requests from user terminals;

[0124] Obtain the start position and video size of the target video data in the video-on-demand request;

[0125] Based on the starting position and video size, the data is read in the following order: first from the memory cache, then from the high-speed hard drive, and finally from the low-speed hard drive.

[0126] When no target video data is read, the target video data is acquired, and it is detected whether the start position of the video-on-demand request is the video start position.

[0127] Furthermore, in one embodiment, the video data caching device further includes an acquisition module, used for:

[0128] When a portion of the target video data is read, new target video data is obtained, wherein the new target video data is the target video data that was not read.

[0129] The first detection module 10 is used to: detect whether the start position of the video-on-demand request is the start position of the video;

[0130] Calculation module 20 is used to: calculate the number of cached frame groups K when the start position of the video-on-demand request is the start position of the video, where K is a positive integer;

[0131] The second detection module 30 is used to: detect whether the target video data of the video-on-demand request is hot video data;

[0132] The third detection module 40 is used to: if the target video data of the video-on-demand request is hot video data, detect whether the first video size of the target video data is greater than or equal to the second video size corresponding to the first K frame groups of the complete video data corresponding to the video-on-demand request.

[0133] The third detection module 40 is further configured to: if the size of the first video is greater than or equal to the size of the second video, detect whether the video data corresponding to the first K frame groups of the complete video data completely contains the new target video data;

[0134] The caching module 50 is used to: cache the header data and the first frame group of the target video data to the memory cache if the target video data is completely contained, and cache the header data and the first K frame groups of the complete video data to the high-speed hard disk and the low-speed hard disk.

[0135] Cache module 50 is used to: cache new target video data to a low-speed hard drive if it is not contained at all;

[0136] The caching module 50 is used to: cache the header data and the first frame group of the target video data to the memory cache if it contains some new target video data; cache the header data and the first K frame groups of the complete video data to the high-speed hard disk; and cache the header data, the first K frame groups of the complete video data, and another part of the new target video data to the low-speed hard disk.

[0137] Furthermore, in one embodiment, the cache module 50 is also used for:

[0138] If the size of the first video is smaller than the size of the second video, then the header data of the complete video data corresponding to the video-on-demand request and the first frame group are cached in the memory cache, and the header data of the complete video data and the first K frame groups are cached in the high-speed hard disk and the low-speed hard disk.

[0139] Furthermore, in one embodiment, the second detection module 30 is also used for:

[0140] When the start position of a video-on-demand request is not the start position of the video, check whether the target video data of the video-on-demand request is hot video data.

[0141] The caching module 50 is also used to: cache the target video data to a low-speed hard disk when the target video data is hot video data.

[0142] Furthermore, in one embodiment, the calculation module 20 is used for:

[0143] The video bitrate B corresponding to the video-on-demand request is obtained, along with the low-speed hard drive read speed DL, the high-speed hard drive read speed DH, the maximum playback duration m of the video data cached in the high-speed hard drive, and the playback duration t of a group of frames. The low-speed hard drive read speed DL is greater than the video bitrate B.

[0144] By preset formula The number of buffered frame groups K is calculated, where L′=L*e, When K is not a positive integer, round up. e represents the elasticity coefficient. When e < 1, take e = 1. When e > 2, take e = 2. When L′ < 1, take L′ = 1. When L′ > m, take L′ = m.

[0145] Furthermore, in one embodiment, the cache module 50 is also used for:

[0146] If the target video data is not hot video data, then the header data and the first frame group of the complete video data corresponding to the video-on-demand request are cached in the memory cache, and the header data and the first K frame groups of the complete video data corresponding to the video-on-demand request are cached in the high-speed hard disk and the low-speed hard disk.

[0147] The functions of each module in the video data caching device correspond to the steps in the video data caching method embodiment, and their functions and implementation processes will not be described in detail here.

[0148] Thirdly, embodiments of the present invention provide a video data caching device, which can be a personal computer (PC), laptop computer, server or other device with data processing capabilities.

[0149] Reference Figure 8 , Figure 8This is a schematic diagram of the hardware structure of the video data caching device involved in an embodiment of the present invention. In this embodiment, the video data caching device may include a processor 1001 (e.g., a Central Processing Unit, CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. The communication bus 1002 is used to implement communication between these components; the user interface 1003 may include a display screen or an input unit such as a keyboard; the network interface 1004 may optionally include a standard wired interface or a wireless interface (e.g., Wireless Fidelity, Wi-Fi); the memory 1005 may be high-speed random access memory (RAM) or stable memory (non-volatile memory), such as a disk storage device. The memory 1005 may also optionally be a storage device independent of the aforementioned processor 1001. Those skilled in the art will understand that… Figure 8 The hardware structure shown does not constitute a limitation of the invention and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0150] Continue to refer to Figure 8 , Figure 8 The memory 1005, serving as a computer storage medium, may include an operating system, a network communication module, a user interface module, and a video data caching program. The processor 1001 can call the video data caching program stored in the memory 1005 and execute the video data caching method provided in this embodiment of the invention.

[0151] Fourthly, embodiments of the present invention also provide a readable storage medium.

[0152] The present invention provides a video data caching program stored on a readable storage medium, wherein when the video data caching program is executed by a processor, it implements the steps of the video data caching method described above.

[0153] The method implemented when the video data caching program is executed can be referred to in various embodiments of the video data caching method of the present invention, and will not be repeated here.

[0154] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.

[0155] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0156] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes several instructions to cause a terminal device to execute the methods described in the various embodiments of the present invention.

[0157] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.

Claims

1. A video data caching method, characterized in that, The video data caching method includes: Detect whether the start position of the video-on-demand request is the beginning position of the video; When the start position of the video-on-demand request is the start position of the video, calculate the number of cached frame groups K, where K is a positive integer; Detect whether the target video data in the video-on-demand request is a popular video data; When the target video data of the video-on-demand request is hot video data, check whether the size of the first video corresponding to the target video data is greater than or equal to the size of the second video corresponding to the first K frame groups of the complete video data corresponding to the video-on-demand request. If the size of the first video is greater than or equal to the size of the second video, then the header data and the first frame group of the target video data are cached in the memory cache, the header data and the first K frame groups of the target video data are cached in the high-speed hard disk, and the header data and all frame groups of the target video data are cached in the low-speed hard disk. Before the step of detecting whether the start position of the video-on-demand request is the start position of the video, the following steps are included: Receive video-on-demand requests from user terminals; Obtain the start position and video size of the target video data in the video-on-demand request; Based on the starting position and video size, the data is read in the following order: first from the memory cache, then from the high-speed hard drive, and finally from the low-speed hard drive. When no target video data is read, the target video data is acquired, and the step of detecting whether the start position of the video-on-demand request is the start position of the video is executed.

2. The video data caching method as described in claim 1, characterized in that, After the step of reading data based on the start position and video size in the order of first memory cache, then high-speed hard disk, and finally low-speed hard disk, the process includes: When a portion of the target video data is read, new target video data is obtained, wherein the new target video data is the target video data that was not read. Detect whether the start position of the video-on-demand request is the beginning position of the video; When the start position of the video-on-demand request is the start position of the video, calculate the number of cached frame groups K, where K is a positive integer; Detect whether the target video data in the video-on-demand request is a popular video data; If the target video data of the video-on-demand request is hot video data, then check whether the first video size of the target video data is greater than or equal to the second video size corresponding to the first K frame groups of the complete video data corresponding to the video-on-demand request. If the size of the first video is greater than or equal to the size of the second video, then check whether the video data corresponding to the first K frame groups of the complete video data completely contains the new target video data. If the target video data is fully contained, the header data and the first frame group of the target video data are cached in the memory cache, and the header data of the target video data and the first K frame groups of the complete video data are cached in the high-speed hard drive and the low-speed hard drive. If it is not included at all, the new target video data will be cached to a slow hard drive; If the target video data includes some new data, the header data and the first frame group of the target video data are cached in memory, the header data and the first K frames of the complete video data are cached in high-speed hard disk, and the header data, the first K frames of the complete video data, and another part of the new target video data are cached in low-speed hard disk.

3. The video data caching method as described in claim 1 or 2, characterized in that, After the step of detecting whether the first video size of the target video data is greater than or equal to the second video size corresponding to the first K frame groups of the complete video data corresponding to the video-on-demand request, the following is included: If the size of the first video is smaller than the size of the second video, then the header data of the complete video data corresponding to the video-on-demand request and the first frame group are cached in the memory cache, and the header data of the complete video data and the first K frame groups are cached in the high-speed hard disk and the low-speed hard disk.

4. The video data caching method as described in claim 1, characterized in that, After the step of detecting whether the start position of the video-on-demand request is the start position of the video, the following is included: When the start position of a video-on-demand request is not the start position of the video, check whether the target video data of the video-on-demand request is hot video data. When the target video data is hot video data, the target video data is cached to a low-speed hard drive.

5. The video data caching method as described in claim 1, characterized in that, The step of calculating the number K of cached screen groups includes: The video bitrate B corresponding to the video-on-demand request is obtained, along with the low-speed hard drive read speed DL, the high-speed hard drive read speed DH, the maximum playback duration m of the video data cached in the high-speed hard drive, and the playback duration t of a group of frames. The low-speed hard drive read speed DL is greater than the video bitrate B. By preset formula The number of cached frame groups K is calculated, where, , , , When K is not a positive integer, it is rounded up. e represents the elasticity coefficient; when e < 1, e = 1; when e > 2, e = 2. When <1, take =1, When >m, take =m.

6. The video data caching method as described in claim 1, characterized in that, After the step of detecting whether the target video data of the video-on-demand request is hot video data, the following is included: If the target video data is not hot video data, then the header data and the first frame group of the complete video data corresponding to the video-on-demand request are cached in the memory cache, and the header data and the first K frame groups of the complete video data corresponding to the video-on-demand request are cached in the high-speed hard disk and the low-speed hard disk.

7. A video data buffering device, characterized in that, The video data caching device includes: The first detection module is used to detect whether the start position of the video-on-demand request is the start position of the video. The calculation module is used to calculate the number of cached frame groups K when the start position of the video-on-demand request is the start position of the video, where K is a positive integer; The second detection module is used to detect whether the target video data of the video-on-demand request is hot video data. The third detection module is used to detect whether the first video size of the target video data is greater than or equal to the second video size corresponding to the first K frame groups of the complete video data corresponding to the video-on-demand request when the target video data of the video-on-demand request is hot video data. A caching module is configured to, if the size of the first video is greater than or equal to the size of the second video, cache the header data and the first frame group of the target video data in a memory cache, cache the header data and the first K frame groups of the target video data in a high-speed hard disk, and cache the header data and all frame groups of the target video data in a low-speed hard disk; before the step of detecting whether the start position of the video-on-demand request is the start position of the video, include: Receive video-on-demand requests from user terminals; Obtain the start position and video size of the target video data in the video-on-demand request; Based on the starting position and video size, the data is read in the following order: first from the memory cache, then from the high-speed hard drive, and finally from the low-speed hard drive. When no target video data is read, the target video data is acquired, and the step of detecting whether the start position of the video-on-demand request is the start position of the video is executed.

8. A video data caching device, characterized in that, The video data caching device includes a processor, a memory, and a video data caching program stored in the memory and executable by the processor, wherein when the video data caching program is executed by the processor, it implements the steps of the video data caching method as described in any one of claims 1 to 6.

9. A readable storage medium, characterized in that, The readable storage medium stores a video data caching program, wherein when the video data caching program is executed by a processor, it implements the steps of the video data caching method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Video-data-on-demand method and device and video-on-demand node

    CN112449248A

  • Method and device for quickly starting and playing ultra-high-definition on-demand video

    CN112533067A