Video caching method, device, equipment and storage medium
By obtaining the actual cache amount and setting the cache threshold during the video playback process, the target download volume is determined, and the cache of video data is controlled, which solves the problems of data waste and high transmission cost in the existing technology, and achieves more efficient data usage and save.
Patent Information
- Application Number
- CN202210564572.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-23
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2042-05-23
AI Technical Summary
In the prior art, during online video playback, when the video file is not downloaded, the difference between the playback completion rate and the download completion rate is too large, resulting in data waste and increased data transmission costs.
During the video playback process, the actual cache amount of video data is obtained and the cache threshold is set, the target download amount is determined based on the actual cache amount and the set cache threshold, and the video data of the target download amount is requested from the server for caching to control data downloading. quantity.
It reduces data waste rate, saves data transmission costs, and improves data usage efficiency during playback.
Smart Images

Figure CN114979768B
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to the field of communication technology, and in particular to a video caching method, apparatus, device, and storage medium. Background Art
[0002] During the online video playback, the client will continuously request video data from the server and store the downloaded data in the video buffer. The buffer is used to solve the problem of playback jams caused by bandwidth jitter, and some data will be downloaded ahead of the playback progress.
[0003] In the prior art, as long as the video is still playing and the video file has not been downloaded, the download process will continue. The above method will result in a lot of data being downloaded to the client. If the user does not watch this part of the data, there will be a huge difference between the playback completion rate and the download completion rate, which not only causes data waste, but also increases the data transmission cost. Summary of the invention
[0004] The embodiments of the present disclosure provide a video caching method, apparatus, device and storage medium to achieve control over video data caching, thereby reducing data waste and saving transmission costs.
[0005] In a first aspect, an embodiment of the present disclosure provides a video caching method, including:
[0006] During video playback, obtain the actual cache amount of video data and set the cache threshold;
[0007] Determine a target download amount based on the actual cache amount and the set cache threshold;
[0008] Request the server to cache the target download amount of video data.
[0009] In a second aspect, the embodiment of the present disclosure further provides a video caching device, including:
[0010] The acquisition module is used to obtain the actual cache amount of video data and set the cache threshold during video playback;
[0011] A target download amount determination module, used to determine a target download amount based on the actual cache amount and the set cache threshold;
[0012] The cache module is used to request the server to cache the video data of the target download amount.
[0013] In a third aspect, an embodiment of the present disclosure further provides an electronic device, the electronic device comprising:
[0014] one or more processors;
[0015] a storage device for storing one or more programs,
[0016] When the one or more programs are executed by the one or more processors, the one or more processors implement the video caching method as described in the embodiment of the present disclosure.
[0017] In a fourth aspect, the embodiments of the present disclosure further provide a storage medium comprising computer executable instructions, which, when executed by a computer processor, are used to execute the video caching method as described in the embodiments of the present disclosure.
[0018] The disclosed embodiments disclose a video caching method, apparatus, device and storage medium. During video playback, the actual cache amount of video data is obtained and a cache threshold is set; a target download amount is determined based on the actual cache amount and the set cache threshold; and the target download amount of video data is requested from a server for caching. The video caching method provided by the disclosed embodiments requests a server to cache the determined target download amount of video data, so as to achieve control over the video data cache, reduce data waste rate, and save transmission costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
[0020] Figure 1 is a flow chart of a video caching method provided by an embodiment of the present disclosure;
[0021] Figure 2 is a structural diagram of a video caching device provided by an embodiment of the present disclosure;
[0022] Figure 3 It is a structural schematic diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0023] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0024] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0025] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0026] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0027] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0028] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0029] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0030] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.
[0031] As an optional but non-limiting implementation, in response to receiving an active request from the user, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0032] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet the relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0033] It is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and relevant provisions.
[0034] Figure 1 A flow chart of a video caching method provided in an embodiment of the present disclosure is applicable to a situation where the caching of video data is controlled. The method can be executed by a video caching device, which can be implemented in the form of software and / or hardware, and optionally, by an electronic device, which can be a mobile terminal, a PC or a server, etc.
[0035] Video playback requires the cooperation of two modules: the first part is the player, and the second part is the data download module. The data download module is responsible for downloading video data from the server, and the player reads data from the data download module and displays the video to the user after decoding and rendering the data. The data download module stores the data downloaded from the server in the cache area of the data download module. The player continuously reads from the data download module and then stores the read data in the player buffer. The data cached by the player is the data that the player has read from the data download module but has not yet been played. The data download module cache data is the data that the data module has downloaded but the player has not yet read.
[0036] The current playback request process is: the user starts watching the video -> the player initiates a data download request to the data download module -> the data download module continuously requests data from the server. As long as the user continues to watch the video and the video file has not been downloaded, the download process will continue. The above download mode will cause a lot of data to be downloaded to the client, but if the cached data is not viewed by the user, there will be a huge difference between the playback completion rate and the download completion rate, so that this part of the data is wasted. In order to reduce the waste rate and save transmission costs, this embodiment controls the amount of data downloaded during playback.
[0037] like Figure 1 As shown, the method includes:
[0038] S110, during video playback, obtaining an actual buffer size of video data and setting a buffer threshold.
[0039] The actual cache amount can be the amount of video data that has not been played and is currently cached by the client, which is obtained by adding the cache amount in the player to the cache amount in the data download module. The cache threshold can be set by the user and can be a hyperparameter.
[0040] In this embodiment, the actual cache amount and the set cache threshold can be represented by data volume (such as Kb, Mb or Gb, etc.) or video duration. Assuming that it is represented by video duration, the actual cache amount is the actual cache video duration, and the set cache threshold is the set cache duration threshold.
[0041] S120: Determine a target download amount based on the actual cache amount and the set cache threshold.
[0042] The target download amount can be understood as the amount of video data requested from the server.
[0043] Optionally, the method for determining the target download amount based on the actual cache amount and the set cache threshold can be: if the actual cache amount is greater than or equal to the set cache threshold, the target download amount is the set value; if the actual cache amount is less than the set cache threshold, the set optimization algorithm is used to process the actual cache amount and the set cache threshold to obtain the target download amount.
[0044] The set value may be 0, that is, when the actual buffer amount is greater than or equal to the set buffer threshold, requesting video data from the server is suspended.
[0045] The set optimization algorithm may be a Lyapunov optimization algorithm. Specifically, if the actual cache amount is less than the set cache threshold, the process of using the set optimization algorithm to process the actual cache amount and the set cache threshold may be: constructing an optimization function based on the set optimization algorithm consisting of the actual cache amount and the set cache threshold, and setting constraints on the independent variables in the optimization function, optimizing the optimization function based on the constraints until the optimal target corresponding to the independent variable is determined, and the independent variable value corresponding to the optimal target is the target download amount.
[0046] Optionally, a set optimization algorithm is used to process the actual cache amount and the set cache threshold, and the process of obtaining the target download amount may be: obtaining multiple candidate download amounts; for each candidate download amount, using a set optimization algorithm to process the actual cache amount, the set cache threshold and the candidate download amount to obtain a processing result; and determining the candidate download amount corresponding to the maximum processing result as the target download amount.
[0047] Among them, the candidate download amount can be represented by the data amount (such as Kb, Mb or Gb, etc.) or the video duration. If it is represented by the video duration, the candidate download amount is the candidate download video duration. In this embodiment, multiple candidate download amounts can be randomly selected from the above-mentioned constraints. For example, assuming that the constraint is any value between 1-10 seconds, multiple values are randomly selected from 1-10 as candidate download amounts. Alternatively, multiple candidate download amounts can be pre-set by the user, that is, download amounts of different gears that can be selected. For example, the candidate download amount set by the user can be: [2,4,6,8]. If 6 is selected, it means that 6 seconds of video data are to be downloaded.
[0048] In this embodiment, the process of using the set optimization algorithm to process the actual cache amount, the set cache threshold and the candidate download amount can be: constructing an optimization function based on the set optimization algorithm composed of the actual cache amount, the set cache threshold and the candidate download amount, inputting multiple candidate download amounts into the optimization function in turn, obtaining the target values corresponding to each candidate download amount, and determining the target download amount based on the target values.
[0049] Among them, the optimization function composed of the actual cache amount, the set cache threshold and the candidate download amount constructed based on the set optimization algorithm can be expressed as: target = -abs(buffer-B+P) / P, where buffer is the actual cache amount, B is the set cache threshold, and P is the candidate download amount. Specifically, each candidate download amount is substituted into the above optimization function to obtain the target value (i.e., the processing result) corresponding to each candidate download amount, and finally the candidate download amount corresponding to the maximum target value is determined as the target download amount.
[0050] Optionally, after determining the target download amount based on the actual cache amount and the set cache threshold, the following steps are also included: obtaining network speed and / or video freeze information; the video freeze information includes whether freeze occurs or does not occur; and adjusting the target download amount according to the network speed and / or video freeze information.
[0051] The network speed may be understood as the speed of downloading video data, and the video freeze information may include whether freeze occurs or not.
[0052] Specifically, the network speed may be obtained by determining the network speed according to the download amount of the previous video data and its request duration.
[0053] The download amount of the last video data can be understood as the data amount of the video data requested from the server last time, and the request duration can be understood as the request time, that is, the time required to completely download the video data to the client. The way to determine the network speed based on the download amount of the last video data and its request duration can be: divide the data amount of the video data requested from the server last time by the request duration.
[0054] Accordingly, the target download amount is adjusted according to the network speed and / or video freeze information in the following manner: if the network speed is less than a first threshold, the target download amount is increased; if the network speed is greater than a second threshold, the target download amount is decreased.
[0055] Wherein, the first threshold is less than the second threshold. Increasing the target download amount can be understood as increasing the target download amount by a set value. For example, assuming that the target download amount is 4 seconds, the target download amount is increased by 1 second to 5 seconds. Decreasing the target download amount can be understood as reducing the target download amount by a set value. For example, assuming that the target download amount is 4 seconds, the target download amount is reduced by 1 second to 3 seconds.
[0056] In this embodiment, if the network speed is less than the first threshold, it indicates that the network speed is low, and the target download amount is increased to ensure the playback quality. If the network speed is greater than the second threshold, it indicates that the network speed is high, and the target download amount is reduced to reduce data download and thus reduce transmission costs.
[0057] In this embodiment, the method of obtaining the video freeze information may be: obtaining the video freeze information during the current video playback process; or obtaining the video freeze information in a historical period.
[0058] The historical time period may be a time period within 10-15 minutes from the current time. If the user is watching a short video, it can be determined whether the user has a freeze in the process of watching the current short video. If the user is watching a long video (such as a movie, documentary, TV series, etc.), it can be determined whether the user has a freeze in the video of the historical time period.
[0059] Correspondingly, the target download amount may be adjusted according to the network speed and / or video freeze information by increasing the target download amount if freeze occurs.
[0060] In order to avoid lag again, increase the target download amount to ensure playback quality.
[0061] S130, requesting a target download amount of video data to be cached from the server.
[0062] Specifically, after determining the target download volume, the client requests the server to cache the video data of the target download volume, which can reduce the lag and ensure the stability of the cache volume.
[0063] The technical solution of the disclosed embodiment is to obtain the actual cache amount of video data and set the cache threshold during video playback; determine the target download amount based on the actual cache amount and the set cache threshold; and request the server to cache the video data of the target download amount. The video caching method provided by the disclosed embodiment requests the server to cache the determined target download amount of video data to achieve control of video data caching, which can reduce data waste rate and save transmission costs.
[0064] Figure 2 A schematic diagram of the structure of a video caching device provided by an embodiment of the present disclosure is shown in FIG. Figure 2 As shown, the device comprises:
[0065] The acquisition module 210 is used to acquire the actual cache amount of the video data and set the cache threshold during the video playback process;
[0066] The target download amount determination module 220 is used to determine the target download amount based on the actual cache amount and the set cache threshold;
[0067] The cache module 230 is used to request the server to cache the target download amount of video data.
[0068] Optionally, the target download amount determination module 220 is further configured to:
[0069] If the actual cache amount is greater than or equal to the set cache threshold, the target download amount is the set value;
[0070] If the actual cache amount is less than the set cache threshold, the set optimization algorithm is used to process the actual cache amount and the set cache threshold to obtain the target download amount.
[0071] Optionally, the target download amount determination module 220 is further configured to:
[0072] Get multiple candidate downloads;
[0073] For each candidate download amount, a set optimization algorithm is used to process the actual cache amount, the set cache threshold and the candidate download amount to obtain a processing result;
[0074] The candidate download amount corresponding to the maximum processing result is determined as the target download amount.
[0075] Optionally, it also includes: a target download amount adjustment module, which is used to:
[0076] Obtaining network speed and / or video freeze information; the video freeze information includes whether freeze occurs or not;
[0077] Adjust the target download size based on network speed and / or video stall information.
[0078] Optionally, the target download amount adjustment module is further used to:
[0079] Determine the network speed based on the amount of the previous video data downloaded and its request duration;
[0080] If the network speed is less than the first threshold, the target download amount is increased;
[0081] If the network speed is greater than the second threshold, the target download amount is reduced; wherein the first threshold is less than the second threshold.
[0082] Optionally, the target download amount adjustment module is further used to:
[0083] Get the video freeze information during the current video playback; or,
[0084] Get video freeze information in a historical period.
[0085] Optionally, a target download amount adjustment module is used to:
[0086] If lag occurs, increase the target download amount.
[0087] The video caching device provided in the embodiments of the present disclosure can execute the video caching method provided in any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method.
[0088] It is worth noting that the various units and modules included in the above-mentioned device are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the embodiments of the present disclosure.
[0089] Figure 3 This is a schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure. Figure 3 , which shows an electronic device (eg, Figure 3 The terminal device in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 3 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0090] like Figure 3 As shown, the electronic device 500 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic device 500 are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An edit / output (I / O) interface 505 is also connected to the bus 504.
[0091] Typically, the following devices may be connected to the I / O interface 505: an input device 506 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 507 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 508 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 509. The communication device 509 may allow the electronic device 500 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 3 The electronic device 500 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0092] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 509, or installed from a storage device 508, or installed from a ROM 502. When the computer program is executed by the processing device 501, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0093] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0094] The electronic device provided in the embodiment of the present disclosure and the video caching method provided in the above embodiment belong to the same inventive concept. The technical details not fully described in this embodiment can be referred to the above embodiment, and this embodiment has the same beneficial effects as the above embodiment.
[0095] The embodiment of the present disclosure provides a computer storage medium on which a computer program is stored. When the program is executed by a processor, the video caching method provided by the above embodiment is implemented.
[0096] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0097] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0098] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0099] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device:
[0100] The above-mentioned computer-readable medium carries one or more programs. When the above-mentioned one or more programs are executed by the electronic device, the electronic device: obtains the actual cache amount of video data and sets the cache threshold during video playback; determines the target download amount based on the actual cache amount and the set cache threshold; and requests the server to cache the video data of the target download amount.
[0101] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0102] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0103] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware. The name of a unit does not limit the unit itself in some cases. For example, the first acquisition unit may also be described as a "unit for acquiring at least two Internet Protocol addresses".
[0104] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0105] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0106] According to one or more embodiments of the present disclosure, a video caching method is provided, including:
[0107] During video playback, obtain the actual cache amount of video data and set the cache threshold;
[0108] Determine a target download amount based on the actual cache amount and the set cache threshold;
[0109] Request the server to cache the target download amount of video data.
[0110] Further, determining a target download amount based on the actual cache amount and the set cache threshold includes:
[0111] If the actual cache amount is greater than or equal to the set cache threshold, the target download amount is the set value;
[0112] If the actual cache amount is less than the set cache threshold, a set optimization algorithm is used to process the actual cache amount and the set cache threshold to obtain a target download amount.
[0113] Further, the actual cache amount and the set cache threshold are processed by using a set optimization algorithm to obtain a target download amount, including:
[0114] Get multiple candidate downloads;
[0115] For each candidate download amount, the set optimization algorithm is used to process the actual cache amount, the set cache threshold and the candidate download amount to obtain a processing result;
[0116] The candidate download amount corresponding to the maximum processing result is determined as the target download amount.
[0117] Further, after determining the target download amount based on the actual cache amount and the set cache threshold, the method further includes:
[0118] Obtaining network speed and / or video freeze information; the video freeze information includes whether freeze occurs or not;
[0119] The target download amount is adjusted according to the network speed and / or video freeze information.
[0120] Furthermore, the network speed is obtained, including:
[0121] Determine the network speed based on the amount of the previous video data downloaded and its request duration;
[0122] Adjusting the target download amount according to the network speed and / or video freeze information includes:
[0123] If the network speed is less than a first threshold, increasing the target download amount;
[0124] If the network speed is greater than a second threshold, the target download amount is reduced; wherein the first threshold is less than the second threshold.
[0125] Furthermore, the video freeze information is obtained, including:
[0126] Get the video freeze information during the current video playback; or,
[0127] Get video freeze information in a historical period.
[0128] Further, adjusting the target download amount according to the network speed and / or video freeze information includes:
[0129] If lag occurs, increase the target download amount.
[0130] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0131] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0132] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. A video caching method, characterized in that: include: During video playback, obtain the actual cache amount of video data and set the cache threshold; Determining a target download amount based on the actual cache amount and the set cache threshold amount; wherein the target download amount is an amount of video data requested from the server; Requesting the server to cache the target download amount of video data; The step of determining the target download amount based on the actual cache amount and the set cache threshold includes: If the actual cache amount is greater than or equal to the set cache threshold, the target download amount is the set value; If the actual cache amount is less than the set cache threshold, a set optimization algorithm is used to process the actual cache amount and the set cache threshold to obtain a target download amount.
2. The method according to claim 1, characterized in that The actual cache amount and the set cache threshold are processed using a set optimization algorithm to obtain a target download amount, including: Get multiple candidate downloads; For each candidate download amount, the set optimization algorithm is used to process the actual cache amount, the set cache threshold and the candidate download amount to obtain a processing result; The candidate download amount corresponding to the maximum processing result is determined as the target download amount.
3. The method according to claim 1, characterized in that After determining the target download amount based on the actual cache amount and the set cache threshold, the method further includes: Obtaining network speed and / or video freeze information; the video freeze information includes whether freeze occurs or not; The target download amount is adjusted according to the network speed and / or video freeze information.
4. The method according to claim 3, characterized in that: Get network speed, including: Determine the network speed based on the amount of the previous video data downloaded and its request duration; Adjusting the target download amount according to the network speed and / or video freeze information includes: If the network speed is less than a first threshold, increasing the target download amount; If the network speed is greater than a second threshold, the target download amount is reduced; wherein the first threshold is less than the second threshold.
5. The method according to claim 3, characterized in that: Get video freeze information, including: Get the video freeze information during the current video playback; or, Get video freeze information in a historical period.
6. The method according to claim 5, characterized in that Adjusting the target download amount according to the network speed and / or video freeze information includes: If lag occurs, increase the target download amount.
7. A video caching device, characterized in that: include: The acquisition module is used to obtain the actual cache amount of video data and set the cache threshold during video playback; A target download amount determination module, used to determine a target download amount based on the actual cache amount and the set cache threshold; wherein the target download amount is the amount of video data requested from the server; A cache module, used for requesting the target download amount of video data from the server for caching; The target download amount determination module is further used for: If the actual cache amount is greater than or equal to the set cache threshold, the target download amount is the set value; If the actual cache amount is less than the set cache threshold, the set optimization algorithm is used to process the actual cache amount and the set cache threshold to obtain the target download amount.
8. An electronic device, characterized in that: The electronic device comprises: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the video caching method according to any one of claims 1 to 6.
9. A storage medium comprising computer executable instructions, wherein the computer executable instructions are used to perform the video caching method according to any one of claims 1 to 6 when executed by a computer processor.
