Video playing control method and device, electronic device and storage medium
By using a local video proxy entity between the player and the network server to preload video data segments using index information, the problems of slow startup and frequent stuttering in online TV video playback are solved, thereby accelerating video playback and improving the user experience.
Patent Information
- Application Number
- CN202211046180.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-30
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2042-08-30
AI Technical Summary
Online video playback on TV suffers from slow startup and frequent buffering issues, which are difficult to resolve effectively with existing technologies. This is especially problematic in complex and unstable home network environments, resulting in a poor user experience.
By setting up a local video proxy entity between the player and the network server, and using index information to preload video data segments into the data cache unit, the system ensures smooth playback of the current video while caching the next video data in advance. By using segmentation information and caching mechanism, the system can preload video data, adapt to different player control methods, devices, and storage media, and effectively isolate the player from the data acquisition device and storage media, thereby enabling video playback control.
Accelerate online video playback, save network traffic, improve playback speed and user experience, adapt to different player kernel architectures and online video content resource service methods, and achieve seamless switching and perfect compatibility.
Smart Images

Figure CN115811631B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of digital television, and in particular to a video playing control method and device, an electronic device and a storage medium. BACKGROUND
[0002] With the development of Internet technology and the popularity of network television, online video playing on television has become one of the main uses of television. However, in the related art, online network video playing often has problems such as slow video playing starting and frequent freezing due to unstable network and poor performance of television equipment, which affects the user experience.
[0003] In the related art, network servers are often optimized in order to solve the problems of slow video playing starting and frequent freezing in online video playing on television. For example, online video network distribution and video private line network are used. This method can alleviate the problem of video freezing to a certain extent, but due to the complexity of home network and the large number of network devices, network fluctuations and network occupation by other devices and televisions still occur, which results in poor user experience. The above problems are not well solved. In the related art, network environment is also optimized, for example, network devices are replaced and network speed-up services are opened. However, this method increases the cost of user watching and has poor applicability.
[0004] There is no effective solution to the problems of slow video playing starting and frequent freezing in online video playing on television in the related art. SUMMARY
[0005] The present application provides a video playing control method and device, an electronic device and a storage medium to at least solve the problems of slow video playing starting and frequent freezing in online video playing on television in the related art.
[0006] In a first aspect, the present application provides a video playing control method, comprising: obtaining a first request of a request party for obtaining a current video, and obtaining the current video from a preset data cache unit according to index information carried in the first request, wherein the index information records the shard information of at least one data shard corresponding to the current video, and the shard information is used to represent the playing time and request address of the corresponding data shard; when the request party plays the received current video, determining target shard information according to reference shard information detected from the index information, wherein the reference shard information is the shard information corresponding to the last data shard of the at least one data shard corresponding to the current video; based on the target shard information, downloading a target shard corresponding to the target shard information from a preset network server, and preloading the target shard to the data cache unit.
[0007] In a second aspect, the present application provides a control device for video playing, comprising:
[0008] an obtaining module, configured to obtain a first request for requesting a current video from a requestor, and obtain the current video from a preset data cache unit according to index information carried in the first request, wherein the index information records piece information of at least one data piece corresponding to the current video, and the piece information is used to represent a playing time and a request address of the corresponding data piece;
[0009] a determining module, configured to determine target piece information according to reference piece information detected from the index information when the requestor plays the received current video, wherein the reference piece information is the piece information corresponding to a last data piece of the at least one data piece corresponding to the current video;
[0010] a processing module, configured to download a target piece corresponding to the target piece information from a preset network server based on the target piece information, and preload the target piece into the data cache unit.
[0011] In a third aspect, an electronic device is provided, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus;
[0012] the memory, configured to store a computer program;
[0013] the processor, configured to execute the program stored on the memory, and realize the steps of the control method for video playing according to any one of the embodiments of the first aspect.
[0014] In a fourth aspect, a computer readable storage medium is provided, which stores a computer program, and the computer program is executed by a processor to realize the steps of the control method for video playing according to any one of the embodiments of the first aspect.
[0015] Compared with the related art, the embodiment provides a video playing control method, device, electronic device and storage medium, a first request of a request party requesting to acquire a current video is acquired, and the current video is acquired from a preset data cache unit according to index information carried in the first request, wherein the index information records shard information of at least one data shard corresponding to the current video, and the shard information is used to represent a playing time and a request address of the corresponding data shard; when the request party plays the received current video, target shard information is determined according to reference shard information detected from the index information, wherein the reference shard information is the shard information corresponding to the last data shard in the at least one data shard corresponding to the current video; and based on the target shard information, a target shard corresponding to the target shard information is downloaded from a preset network server, and the target shard is preloaded to the data cache unit, thereby solving the problems of slow start of online video playing on a television device and frequent freezing in a playing process in the related art, achieving the beneficial effects of saving network flow resources, accelerating online video playing, improving the playing speed of online video and user experience.
[0016] The details of one or more embodiments of the present application are presented in the following drawings and description to make other features, objects and advantages of the present application more clear and easy to understand. BRIEF DESCRIPTION OF DRAWINGS
[0017] The accompanying drawings incorporated in and forming a part of the specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the application.
[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or prior art description will be briefly introduced as follows, and obviously, other drawings can also be obtained by those skilled in the art without any creative labor.
[0019] Figure 1 is a flowchart of a video playing control method provided by the embodiment of the present application;
[0020] Figure 2 is a frame diagram of a player, a local video proxy entity and a network server of the video playing control method according to the preferred embodiment of the present application;
[0021] Figure 3 is a flowchart of a video playing control method according to the preferred embodiment of the present application;
[0022] Figure 4 is a timing diagram when the video playing and preloading according to the preferred embodiment of the present application are executed Figure 1 ;
[0023] Figure 5 This is a timing diagram illustrating the video playback and preloading process in a preferred embodiment of this application. Figure 2 ;
[0024] Figure 6 This is a schematic diagram illustrating the effect of preloading during the execution of a preferred embodiment of this application;
[0025] Figure 7 This is a structural block diagram of the video playback control device provided in the embodiments of this application;
[0026] Figure 8 This is a schematic diagram of the structure of an electronic device according to an embodiment of this application. Detailed Implementation
[0027] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0028] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.
[0029] Figure 1 This is a flowchart illustrating the video playback control method provided in an embodiment of this application. Figure 1 As shown in the figure, this application provides a video playback control method, which includes the following steps:
[0030] Step S101: Obtain the first request from the requester to obtain the current video, and obtain the current video from the preset data cache unit according to the index information carried in the first request. The index information records the segment information of at least one data segment corresponding to the current video, and the segment information is used to represent the playback time and request address of the corresponding data segment.
[0031] In this embodiment, the execution entity that implements the video playback control method is a local video proxy entity set up between the player and the online video network server. At the same time, in this embodiment, the execution entity analyzes and caches the online video data requested by the requester (player), ensuring smooth playback of the current video while also silently preloading and caching the video data to be played next in the background using the current video playback time.
[0032] In the embodiment, after the execution subject obtains the first request of the requestor to obtain the current video, the video data cached in the preset data cache unit is obtained according to the index information (including the request address information and the playing time of the corresponding data segment) carried in the first request, and after being returned to the requestor, the requested video data is loaded and processed by the requestor to complete the closed-loop playing, and after the playing is started, the video data to be played next is preloaded in the background in silence; in the embodiment, the video data requested by the requestor is cached in the preset data cache unit in the form of corresponding data segments, for example, the video data with a playing time of 0-10 seconds is data segment a, the video data with a playing time of 11-20 seconds is data segment b, and when the index information corresponding to the first request indicates that the video data requested by the requestor is the video data with a playing time of 5-9 seconds, it indicates that the current video requested is data segment a; in some embodiments, when the playing time requested by the requestor is a playing time point across data segments, for example, the video data with a playing time of 8-15 seconds is requested to be played, the local video agent will process the corresponding request as two requests, that is, the requestor makes two different requests, and data segment a and data segment b are requested to be obtained, respectively; of course, for different video formats of video data, there are corresponding video formats of video data supporting the acquisition of video data across data segments, for example, MP4 (MPEG-4 Part 14), but when the data segments are cached and preloaded, the embodiment still adopts the mode of caching and preloading according to data segments, at this time, the acquisition of the video data of the corresponding format is performed in the mode supported by the video data, and the embodiment is not limited.
[0033] In the embodiment, each request for playing a video (for example, the first request) corresponds to a unique piece of memory cache data or disk cache data in the form of data segments, and different requests can be uniquely identified and determined through the request address in the corresponding request; considering that the same video playing data under the same device may exist in different online video content resource service modes, for example, traditional video service, content delivery network (Content Delivery Network, CDN for short) video content resource service, P2P content delivery network (P2P Content Delivery Network, PCDN for short) video content resource service, in different content resource service environments, the request address in the request corresponding to the same video is often different, and the corresponding prefix information is added to distinguish and identify.
[0034] Step S102, when the requester plays the received current video, target segment information is determined according to reference segment information detected from the index information, wherein the reference segment information is segment information corresponding to the last data segment in at least one data segment corresponding to the current video.
[0035] In the embodiment, after the current video requested by the requester is acquired, the current video is returned to the requester, and after the requester starts playing the current video, the process of preloading video data to be played next is performed. For example, the current video is played for 0-10 seconds of data segment, and after the requester plays the current video, 1-20 seconds of data segment to be played next is preloaded. Since the video is played according to time points or segment sequences, in order to determine the position of the preloaded video data, the position of the current video is determined first, which is determined by the time point or segment index position information of the current video played carried by the index information corresponding to the first request. After the time point or segment index position information of the current video played is determined, the next time point or the next segment (corresponding to the data segment) is the video data to be sequentially played by the player next, which is also the video data to be preloaded and cached. In some optional embodiments, a plurality of video data in the same sequential case can be considered simultaneously. In the embodiment, in the process of determining the position of the preloaded video data according to the playing position of the current video, the segment information of the last data segment in at least one data segment corresponding to the current video is determined, and the segment information is used as reference segment information to determine corresponding target segment information, so that the last data segment is determined first, then the next data segment corresponding to the last data segment is determined, and then the video data to be preloaded and cached is determined.
[0036] Step S103, based on the target segment information, a target segment corresponding to the target segment information is downloaded from a preset network server, and the target segment is preloaded to the data cache unit.
[0037] In the embodiment, after the video data to be preloaded and cached is determined, the corresponding target segment can be downloaded from the preset network server during the playing time of the current video, and the target segment is preloaded to the data cache unit.
[0038] Through the steps S101 to S103, the first request of the acquisition request party is used to request to acquire the current video, and the index information carried in the first request is used to acquire the current video from the preset data cache unit, wherein the index information records the segment information of at least one data segment corresponding to the current video, and the segment information is used to represent the playing time and the request address of the corresponding data segment; when the request party plays the received current video, the target segment information is determined according to the reference segment information detected from the index information, wherein the reference segment information is the segment information corresponding to the last data segment in the at least one data segment corresponding to the current video; based on the target segment information, the target segment corresponding to the target segment information is downloaded from the preset network server, and the target segment is preloaded to the data cache unit, thereby solving the problem of slow start of online video playing on the television device and frequent freezing in the related art, achieving the beneficial effects of saving network flow resources, accelerating online video playing, and improving the playing speed of online video and user experience.
[0039] It should be noted that the control method of the video playing of the embodiment of the application is optimized in the video playing software layer, the preloading processing of the player video data is performed through the local video proxy, and the purpose of video accelerated playing is achieved; in the embodiment, a local video proxy intermediate interception layer is established between the player and the preset network video server, the requested video data is analyzed and cached, the next video data to be played is preloaded, downloaded and cached in the idle time while ensuring the smooth playing of the current video stream, so that the next video data to be played can be directly read and returned from the cached video data in the preset data cache unit, the time consumption caused by the network resource downloading process is saved, and the start speed of the player is improved; at the same time, the data is preloaded in the idle time, which can keep downloading in the background under the condition of unstable network, fill more downloading data time, and reduce the number of freezing in the playing process; in addition, the local video proxy entity is used to perform the interception processing in the middle, which can effectively isolate the interference between the player data acquisition and the data playing, effectively decouple the playing data, and reduce the complexity of the software; the seamless switching and perfect compatibility of different player kernel architectures (system kernel, self-developed kernel, third-party kernel, etc.) and different online video content resource service modes (such as traditional video service, CDN video content resource service, PCDN video content resource service, etc.) can be realized without changing the player end and the online video server, and the compatibility and adaptability of the software are improved.
[0040] It needs to be further explained that in the embodiments of the present application, by designing the corresponding preloading download cache mechanism, the use rate of the download cache video resources can be effectively improved, and at the same time of ensuring the smooth playing of the video, the latest requested video data can be downloaded and cached in the first time.
[0041] In some embodiments, the piece information at least records the playing time period of the corresponding data piece, the target piece information is determined according to the reference piece information detected from the index information, and the determination is realized by the following steps:
[0042] Step 21, the playing time period corresponding to the reference piece information is determined.
[0043] In the embodiments, when the current video only includes one data piece, the data piece corresponding to the reference piece information is the current video itself; when the current video includes multiple data pieces, that is, the local video proxy entity processes the requests of the requestor in the form of multiple requests and returns multiple data pieces to the requestor, the last data piece is taken as the data piece corresponding to the reference piece information; at the same time, the time point at which the current video ends is determined by determining the playing time period corresponding to the reference piece information, and the playing time period corresponding to the next data piece is determined based on the time point at which the current video ends.
[0044] Step 21, the next playing time period of the playing time period corresponding to the reference piece information is selected to obtain the target playing time period, wherein the playing time period corresponding to the target piece information includes the next playing time period.
[0045] By determining the playing time period corresponding to the reference piece information in the above steps; selecting the next playing time period of the playing time period corresponding to the reference piece information to obtain the target playing time period, wherein the playing time period corresponding to the target piece information includes the next playing time period, the last data piece is determined first, then the next data piece corresponding to the last data piece is determined, and then the video data that needs to be preloaded and cached is determined, and then the next video data that needs to be played by the player is quickly determined, so that the video data acquisition is accelerated and the user's playing experience effect is improved.
[0046] In some embodiments, based on the target piece information, the target piece corresponding to the target piece information is downloaded from the preset network server, and the downloading is realized by the following steps:
[0047] Step 31, the start time and the end time of the playing time period corresponding to the target piece information are determined.
[0048] In the embodiment, the start time is a next time point of a current video playback end time point, and the end time is a time point with a preset time length from the start time, for example, the time point corresponding to the start time is the 11th second, and the time point corresponding to the end time is the 20th second. The time difference between the start time and the end time is set based on a preset rule, that is, the time length of the playback time period corresponding to each data chunk is preset and uniform.
[0049] In step 32, the video frames corresponding to the start frame corresponding to the start time to the end frame corresponding to the end time are downloaded from the preset network server, and the target chunk is determined to include the video frames corresponding to the start frame to the end frame.
[0050] In the embodiment, since the video is played in the order of time points or segments, after the position of the current video is determined, the time point or segment index position information corresponding to the next data chunk can be determined according to the position of the current video, and then the next data chunk can be downloaded from the preset network server, so as to realize the acquisition of the target chunk and accelerate the acquisition of the video data.
[0051] In some embodiments, the target chunk is preloaded into the data cache unit, including the following steps:
[0052] In step 41, after the target chunk is cached into the disk cache unit in the data cache unit, it is determined whether to perform memory caching.
[0053] In step 42, in the case that it is determined that memory caching is needed, the target chunk cached into the disk cache unit is cached into the memory cache unit in the data cache unit.
[0054] In the embodiment, the preloading of the target chunk into the data cache unit means that the target chunk is cached into the disk cache unit, and whether memory caching is needed is also determined according to the need. Specifically, when the disk cache data needs to be preloaded, after the target chunk is acquired from the network server, the target chunk is cached into the disk cache unit, and it is determined whether memory caching is needed. If needed, the memory cache data is preloaded, and the cached target chunk is acquired from the disk cache unit for memory caching processing.
[0055] In the above steps, after the target chunk is cached into the disk cache unit in the data cache unit, it is determined whether to perform memory caching, and in the case that it is determined that memory caching is needed, the target chunk cached into the disk cache unit is cached into the memory cache unit in the data cache unit, so as to realize the preloading of the target chunk into the data cache unit, so that the video data needed to be requested by the requester can be directly acquired from the data cache unit, the video playback processing is accelerated, and the user's playback experience effect is improved.
[0056] In the embodiment, the set cache mode is also classified, and the cache is processed through different cache algorithms. In the embodiment, all the preloaded video data is downloaded and cached to the disk, and the corresponding cache categories include disk-level cache and memory-level cache. The disk-level cache is general cache, and in the embodiment, the cached video data or data segment is caused to avoid single excessively long video data and excessively large file size video data as much as possible based on the data information of the video data, so as to improve the effective utilization rate of the disk cache. In the embodiment, the corresponding cache algorithms include LRU algorithm and priority algorithm. The LRU algorithm, also called least recently used algorithm, causes the latest requested video data to be preferentially saved and the least used or longest unused video data to be preferentially deleted in the disk cache by using the LRU algorithm. The priority algorithm further divides the video data into priority levels on the basis of the LRU algorithm. For example, the first frame data of video playback needs to be preferentially saved to avoid black screen during starting playback and improve the starting playback experience. For example, for m3u8 encapsulation format video, the m3u8 file needs to be parsed every time the video is played, and therefore, the data priority of the m3u8 file is higher than that of ordinary video data. For example, for encrypted video, the encryption key needs to be loaded every time the video is played, and therefore, the data priority of the encrypted video is higher than that of ordinary video data. At the same time, important data is marked with a higher priority and occupies a larger cache weight through priority marking of the video data, which greatly improves the cache utilization rate of the data.
[0057] In some embodiments, the current video is obtained from the preset data cache unit according to the index information carried in the first request, including the following steps:
[0058] Step 51, according to the segment information of the data segment recorded by the index information, the corresponding data segment is searched in the data cache unit, and the search result is determined, wherein the data cache unit includes a memory cache unit and a disk cache unit.
[0059] Step 52, when the search result is that the corresponding data segment is cached in one of the memory cache unit and the disk cache unit, it is determined that the current video is obtained from the preset data cache unit.
[0060] According to the segment information of the data segment recorded by the index information, the corresponding data segment is searched in the data cache unit, and the search result is determined, wherein the data cache unit includes a memory cache unit and a disk cache unit, when the search result is that the corresponding data segment is cached in one of the memory cache unit and the disk cache unit, it is determined that the current video is obtained from the preset data cache unit, the current video requested by the requester is obtained from the data cache unit, the acquisition of the video data is accelerated, and the data loading rate is improved.
[0061] It should be noted that in the present embodiment, after receiving the first request of the requestor requesting to obtain the current video, it is found in the memory cache unit whether there is corresponding memory cache data, that is, whether there is corresponding data segment in the memory cache unit, if there is, the data segment is directly returned to the requestor, the requestor loads and processes the corresponding data segment, and the play loop is completed; if there is no memory cache data, it is found in the disk cache unit whether there is corresponding disk cache data, that is, whether there is corresponding data segment in the disk cache unit, if there is, the data segment is also directly returned to the requestor, so that the requestor loads and processes the corresponding data segment or video data, and the play loop is completed; in the present embodiment, as long as one of the memory cache unit and the disk cache unit caches the corresponding data segment, it indicates that the current video can be obtained from the preset data cache unit. Of course, because the read-write speed of the memory is faster than that of the disk, but the space of the memory is smaller, therefore, in the present embodiment, the memory cache unit is used to cache the most important video data when the memory space allows, and the video data that will be requested to play first in time is given priority, and by starting the cache of the memory cache unit to cache the corresponding video data, zero-delay data loading can be realized; at the same time, in the present embodiment, when multiple video data are downloaded and cached asynchronously, the number of data cached at a time can be further increased, so that the cache hit rate is improved while the cache amount is increased.
[0062] In some embodiments, the current video is obtained from the preset data cache unit according to the index information carried in the first request, including the following steps:
[0063] Step 61, according to the segment information of the data segment recorded by the index information, finding the corresponding data segment in the data cache unit and determining the finding result, wherein the data cache unit includes a memory cache unit and a disk cache unit.
[0064] Step 62, when the finding result is that neither the memory cache unit nor the disk cache unit caches the corresponding data segment, obtaining the corresponding data segment from the preset network server to obtain the current video;
[0065] Step 63, caching the obtained current video to the preset data cache unit according to a preset rule.
[0066] In the embodiment, after receiving the first request of the requester for obtaining the current video, it is checked in the memory cache unit and the disk cache unit in sequence whether there is corresponding cache data, that is, whether there is corresponding data segment in the memory cache unit or the disk cache unit. When the corresponding data segment of the current video is not cached in the memory cache unit and the disk cache unit, the network data is obtained from the preset network server (online network video server), that is, the corresponding data segment is obtained, and after the corresponding data segment is obtained, the disk cache unit caches the data segment obtained from the network server and returns to the requester, so that the requester loads and processes the corresponding data segment or video data, and the playback loop is completed. At the same time, it is further judged whether the memory cache data needs to be processed by the memory cache unit. If so, the corresponding data segment is obtained from the disk cache unit which has completed the disk cache, and the memory cache data processing is performed.
[0067] According to the segment information of the data segment recorded in the index information in the above steps, the corresponding data segment is searched in the data cache unit, and the search result is determined. The data cache unit includes a memory cache unit and a disk cache unit. When the search result is that the memory cache unit and the disk cache unit do not cache the corresponding data segment, the corresponding data segment is obtained from the preset network server, and the current video is obtained. The obtained current video is cached to the preset data cache unit according to the preset rule, so as to obtain the current video requested by the requester from the network server, accelerate the acquisition of video data, and improve the data loading rate.
[0068] In order to ensure that the currently requested video data is played preferentially, in some embodiments, the following steps are implemented:
[0069] Before the requester plays the current video, the step of determining the target segment information according to the reference segment information detected from the index information, downloading the target segment corresponding to the target segment information from the preset network server based on the target segment information, and preloading the target segment to the data cache unit is prohibited.
[0070] In the embodiment, if the currently played video data is still in the loading process, that is, the requester has not completed the complete reception of the current video, the preloading task will be delayed for a certain time before being executed.
[0071] In order to ensure that the preloading mechanism is effectively executed, in some embodiments, the following steps are implemented:
[0072] Step 71, within a preset time after the requester starts playing the current video, a plurality of second requests of the requester for re-requesting the video data are received, wherein the second request carries the index information corresponding to the video data re-requested by the requester.
[0073] Step 72, judging whether the plurality of second requests and the first request are the same request according to the index information carried by the plurality of second requests and the index information carried by the first request.
[0074] Step 73, in the case of judging that the plurality of second requests and the first request are the same request, determining that the plurality of second requests are invalid requests.
[0075] In the embodiment, the same request ignoring principle is executed, that is, for the same request, the subsequent request is filtered and ignored. For example, in the scene of frequently fast forwarding and fast rewinding to the same play time point, there may be multiple same requests for playing the same data segment or video data in a short time and multiple same preload tasks are triggered. By filtering and ignoring these subsequent same requests, unnecessary repeated request processing can be avoided, and the utilization rate of resources and the stability of playing can be effectively improved.
[0076] Step 74, in the case of judging that the plurality of second requests and the first request are different requests, selecting one request with the smallest time difference between the request time and the current time from the plurality of second requests to obtain a target request; and obtaining the corresponding video data from the preset data cache unit based on the index information carried by the target request.
[0077] In the embodiment, the latest request processing principle is executed, that is, for different requests, the latest request is processed preferentially and the old request is ignored. In the scene of quickly starting and exiting playing and frequently fast forwarding and fast rewinding, multiple requests and multiple preload tasks are triggered. By setting a certain delay for the preload task to avoid immediate execution and buffer processing, the situation of multiple preload tasks in a short time can be effectively reduced, and the latest request can be ensured to be executed preferentially.
[0078] Within a preset time after the requester starts playing the current video, the above steps involve receiving multiple second requests from the requester to re-request video data. Each second request carries index information corresponding to the video data being re-requested. Based on the index information carried by the multiple second requests and the index information carried by the first request, it is determined whether the multiple second requests are the same as the first request. If multiple second requests are the same as the first request, they are determined to be invalid requests. If multiple second requests are different from the first request, the request with the smallest time difference between its corresponding request time and the current time is selected as the target request. Based on the index information carried by the target request, the corresponding video data is retrieved from a preset data cache unit. This achieves an efficient pre-loading cache mechanism, effectively improving the utilization rate of downloaded cached video resources. Simultaneously, while ensuring smooth video playback, the latest requested video data can be downloaded and cached immediately, thereby improving video playback speed, reducing playback stuttering, and enhancing the user's playback experience.
[0079] In some embodiments, the segmentation information includes the request address information and playback time period of the corresponding data segment. Based on the index information carried by multiple second requests and the index information carried by the first request, it is determined whether the multiple second requests and the first request are the same request. This is achieved through the following steps:
[0080] Step 81: Detect the fragment information of the data fragment requested by the corresponding request from the index information carried by the multiple second requests and the first request, and determine the request address information and playback time period corresponding to each fragment information. The request address information is determined according to the resource service method and data cache unit associated with the corresponding data fragment.
[0081] Step 82: Determine whether the request address information corresponding to multiple second requests and the first request is the same;
[0082] Step 83: If it is determined that the request address information is different, determine that the multiple second requests are different from the first request;
[0083] Step 84: If the requested address information is the same, determine whether the playback time period corresponding to the corresponding request is the same, and determine whether multiple second requests are the same as the second request based on the determination result.
[0084] By analyzing the index information carried by multiple second requests and first requests in the above steps, the fragment information of the data fragments requested by the corresponding requests is detected, and the request address information and playback time period corresponding to each fragment information are determined. The request address information is determined based on the resource service method and data caching unit associated with the corresponding data fragment. It is then determined whether the request address information corresponding to multiple second requests and first requests is the same. If the request address information is different, it is determined that multiple second requests and first requests are different requests. If the request address information is the same, it is determined whether the playback time period corresponding to the corresponding requests is the same, and based on the determination result, it is determined whether multiple second requests and second requests are the same requests. This process verifies the requests, enabling the latest requests to be executed preferentially and the same requests to be ignored, avoiding multiple executions of preloading tasks in a short period of time, and effectively improving resource utilization and playback stability.
[0085] In this embodiment, each request from the requesting party is verified based on the request verification principle. That is, the request is distinguished as a single request by at least checking the request address information in the corresponding request. This is because, for the same video data, there may be multiple different addresses in different online video content resource service environments, such as traditional video services, CDN video content resource services, and PCDN video content resource services. By adding auxiliary identification information of the online video content service method to the request address information, the uniqueness of each request can be effectively determined in different environments.
[0086] Figure 2 This is a schematic diagram of the framework of a player, a local video proxy entity, and a network server implementing the video playback control method of the preferred embodiment of this application; Figure 3 This is a flowchart illustrating a preferred embodiment of the video playback control method of this application; Figure 4 This is a timing diagram illustrating the video playback and preloading process in a preferred embodiment of this application. Figure 1 ; Figure 5 This is a timing diagram illustrating the video playback and preloading process in a preferred embodiment of this application. Figure 2 ; Figure 6 This is a schematic diagram illustrating the effect of preloading during a preferred embodiment of this application. The following references... Figures 2 to 6 The video playback control method of the preferred embodiment of this application is described in detail below:
[0087] Combination Figure 2In the preferred embodiment of the present application, the corresponding interaction is performed through the player, the local video proxy entity and the network server to complete the playing of the current video requested and the preloading of the video data to be played next. The local video proxy entity includes a preloading manager, a memory cache manager and a disk cache manager. The three managers cooperate with each other to complete the request and playing of the current video and the preloading of the video data to be played next.
[0088] Reference Figure 3 In the preferred embodiment of the present application, the playing of the current video requested and the preloading of the video data to be played next are achieved through the following steps.
[0089] Step 1: receiving the request of the player to play the current video, checking whether the current video requested has corresponding memory cache data, if yes, returning the corresponding current video to the player, the player loading and processing the corresponding current video to complete the playing loop.
[0090] Step 2: if there is no memory cache data in step 1, checking whether the current video requested has corresponding disk cache data, if yes, returning the corresponding current video to the player, the player loading and processing the corresponding current video to complete the playing loop.
[0091] Step 3: if there is no disk cache data in step 2, the network data corresponding to the current video is needed to be obtained from the network server, after obtaining the network data, the network data is cached on the disk and returned to the player, the player loading and processing the corresponding network data to complete the playing loop, and whether the memory cache is needed is determined, if yes, the memory cache processing is performed asynchronously.
[0092] Step 4: while completing the playing loop, whether the video data needs to be preloaded is determined, if yes, the preloading processing is performed.
[0093] In the embodiment, the preloading processing is performed to ensure that the video data to be played next can be obtained directly from the corresponding data cache unit to complete the data acquisition acceleration process.
[0094] Step 5: if it is determined that the video data needs to be preloaded, the network data is obtained from the network video server, after obtaining the network data, the disk cache is performed, and whether the memory cache is needed is determined, if yes, the memory cache processing is performed asynchronously.
[0095] Step 6: if the memory cache data needs to be preloaded, the cached video is obtained from the disk cache to perform the memory cache processing.
[0096] In this embodiment, during the process of playing the currently requested video and preloading the video data to be played next, when both memory caching and disk caching are used simultaneously, reference can be made to... Figure 4 The sequence diagram shown illustrates three processes in this scenario: Process ①: If memory cache data exists, return directly; Process ②: If there is no memory cache data but disk cache data exists, load the disk data into the memory cache and return; Process ③: If there is neither memory nor disk cache data, load video data from the network server, write it to the disk cache, and finally put it into the memory cache and return. When using disk caching, refer to... Figure 5 The timing diagram shown illustrates two processes in this scenario: Process ①: If disk cache data exists, return directly; Process ②: If no disk cache data exists, load video data from the network server, write it to the disk cache, and return.
[0097] The local video proxy entity, cache preloading mechanism, and adaptive memory cache used in the embodiments of this application are described below:
[0098] Local video proxy entity
[0099] In this embodiment, an intermediate interception layer consisting of a local video proxy entity is established between the player and the network server. This layer analyzes and caches the requested online video data, ensuring smooth playback of the current video while silently downloading and caching the video data to be played next in the background during idle time. This allows the video data to be played next to be read directly from the cached video data, saving the time spent downloading network resources and improving the player's startup speed. Furthermore, by preloading data during idle time, the background can continue to download video data even when the network is unstable, filling in the download time and reducing the number of stutters during playback.
[0100] In this embodiment, by setting up an intermediate interception layer for interception processing, the two operations of player data acquisition and data playback can be effectively isolated, decoupling the playback data and reducing the complexity of the software. At the same time, it can also achieve seamless switching and compatibility with different player kernel architectures (system kernel, self-developed kernel, third-party kernel) and different online video content resource service methods (e.g., traditional video service, CDN video content resource service, PCDN video content resource service) without making changes to the player and network server, thus improving the software's compatibility and adaptability.
[0101] Cache preloading mechanism
[0102] In the embodiments of the present application, the video data is downloaded and cached in the background in advance by using the local video proxy. However, in order to further solve the problem that in the corresponding scenarios such as fast start and exit of playing or frequent fast forward and fast backward, the preloaded video data is too much and changes too fast, the most needed video data cannot be downloaded and cached in the first time, and the use rate of the downloaded video data is not high, resulting in waste of video resources, the cache preloading mechanism is adopted to improve the use rate of the downloaded and cached video resources, and the video data newly requested to be played can be downloaded and cached in the first time while ensuring smooth playing of the video. In the embodiments of the present application, the trigger time, execution principle, preloading process and performance maximization of the cache preloading are optimized.
[0103] Specifically, for the trigger time, the cache preloading task is automatically triggered after each request of the player to play data, so that the preloading mechanism can be fully executed.
[0104] For the execution principle, the following principles are executed:
[0105] 1. Current playing priority principle: The video data currently being played is preferentially guaranteed. If the video data currently being played is still in the loading process, the preloading task is delayed for a certain time and then executed.
[0106] 2. Request verification principle: Each request is verified, and whether it is the same request is determined through the request address information of the request. In the case that there are multiple different addresses of the same video data in different online video content resource service environments, the auxiliary identification information of the online video content service mode is added in the request address information, so that the uniqueness of each request can be effectively determined in different environments.
[0107] 3. Latest request principle: The latest request is preferentially executed, and the old request is ignored. In the scenarios such as fast start and exit of playing, frequent fast forward and fast backward, multiple requests are triggered, and multiple preloading tasks are triggered. By setting a certain delay for the execution of the preloading task, the immediate execution is avoided, and the buffering process is performed, so that the multiple preloading tasks in a short time can be effectively reduced, and the latest request can be preferentially executed.
[0108] 4. Same request ignoring principle: The same request is filtered and ignored. In the scenario of frequent fast forward and fast backward to the same playing time point, multiple same requests exist in a short time, and multiple same preloading tasks are triggered. By filtering and ignoring the same request, unnecessary repeated request processing can be avoided, and the resource utilization and the stability of playing are improved.
[0109] In combination withFigure 6 The preloading process of the embodiment of the application is described as follows: for the video data 1 which is the currently played video data, under the preloading mechanism, the video data 2 to be played next has been in the memory cache and can be directly used; at the same time, the video data 3 and the video data 4 have been in the disk cache and can also be directly used, the video data loaded in the local cache saves the time of network downloading; at the same time, the video data 5, the video data 6 and the like which are not needed temporarily are not in the local cache and can be downloaded and put into the local cache when needed, so that the cache space is saved and the video playing loading speed is greatly improved.
[0110] Memory adaptive management
[0111] In the embodiment of the application, based on the size of the memory of the television device and the size of the disk space, the data storage management based on high adaptability and high cache hit rate is adopted to ensure the acceleration effect of video playing and improve the friendliness and compatibility to different performance devices.
[0112] The embodiment also provides a control device for video playing, which is used for implementing the above-mentioned embodiments and preferred embodiments and has been described above. The terms "module", "unit", "sub-unit" and the like used below can be a combination of software and / or hardware which can realize the predetermined function. Although the device described in the following embodiments is preferably realized in software, the realization of hardware or the combination of software and hardware is also possible and conceived.
[0113] Figure 7 is a structural block diagram of the control device for video playing provided by the embodiment of the application, as shown in Figure 7 The device comprises:
[0114] The acquisition module 71 is configured to acquire a first request of a requestor for acquiring a current video, and acquire the current video from a preset data cache unit according to index information carried in the first request, wherein the index information records the segment information of at least one data segment corresponding to the current video, and the segment information is used to represent the playing time and the request address of the corresponding data segment.
[0115] The determination module 72 is coupled with the acquisition module 71 and is configured to determine target segment information according to reference segment information detected from the index information when the requestor plays the received current video, wherein the reference segment information is the segment information corresponding to the last data segment in the at least one data segment corresponding to the current video.
[0116] The processing module 73 is coupled with the determination module 72 and is configured to download a target segment corresponding to the target segment information from a preset network server based on the target segment information, and pre-load the target segment into the data cache unit.
[0117] The control device for video playing of the embodiment of the application adopts a first request for requesting a current video by a requestor, and acquires the current video from a preset data cache unit according to index information carried in the first request, wherein the index information records slice information of at least one data slice corresponding to the current video, and the slice information is used to represent a playing time and a request address of the corresponding data slice; when the requestor plays the received current video, target slice information is determined according to reference slice information detected from the index information, wherein the reference slice information is slice information corresponding to a last data slice in the at least one data slice corresponding to the current video; and based on the target slice information, a target slice corresponding to the target slice information is downloaded from a preset network server and preloaded to the data cache unit, thereby solving the problem of slow starting of online video playing on a television device and frequent freezing in a playing process in related technologies, achieving the beneficial effects of saving network flow resources, accelerating online video playing, improving the playing speed of online video and user experience.
[0118] In some embodiments, the slice information at least records a playing time period of the corresponding data slice, and the determining module 72 further includes:
[0119] a first determining unit, configured to determine a playing time period corresponding to the reference slice information;
[0120] a first selecting unit, coupled with the first determining unit, configured to select a next playing time period of the playing time period corresponding to the reference slice information to obtain a target playing time period, wherein the playing time period corresponding to the target slice information includes the next playing time period.
[0121] In some embodiments, the processing module 73 further includes:
[0122] a second determining unit, configured to determine a start time and an end time of the playing time period corresponding to the target slice information;
[0123] a first downloading unit, coupled with the second determining unit, configured to download, from a preset network server, video frames corresponding to a start frame corresponding to the start time to an end frame corresponding to the end time, and determine that the target slice includes the video frames corresponding to the start frame to the end frame.
[0124] In some embodiments, the processing module 72 is further configured to, after caching the target slice to a disk cache unit in the data cache unit, judge whether to perform memory caching; and in a case where it is judged that memory caching is needed, cache the target slice cached to the disk cache unit to a memory cache unit in the data cache unit.
[0125] In some embodiments, the obtaining module 71 further comprises:
[0126] a first searching unit, configured to search for the corresponding data segment in the data cache unit according to the segment information of the data segment recorded in the index information, and determine a searching result, wherein the data cache unit comprises a memory cache unit and a disk cache unit;
[0127] a third determining unit, coupled to the first searching unit, configured to determine to obtain the current video from the preset data cache unit when the searching result is that the corresponding data segment is cached in one of the memory cache unit and the disk cache unit.
[0128] In some embodiments, the obtaining module 71 further comprises:
[0129] a first searching unit, configured to search for the corresponding data segment in the data cache unit according to the segment information of the data segment recorded in the index information, and determine a searching result, wherein the data cache unit comprises a memory cache unit and a disk cache unit;
[0130] a fourth determining unit, coupled to the first searching unit, configured to obtain the corresponding data segment from a preset network server when the searching result is that the corresponding data segment is not cached in the memory cache unit and the disk cache unit, to obtain the current video, and cache the obtained current video to the preset data cache unit according to a preset rule.
[0131] In some embodiments, the apparatus is further configured to, before the requester plays the current video, prohibit the step of determining the target segment information according to the reference segment information detected from the index information, downloading the target segment corresponding to the target segment information from the preset network server based on the target segment information, and preloading the target segment to the data cache unit.
[0132] In some embodiments, the apparatus is further configured to, within a preset time after the requester starts playing the current video, receive a plurality of second requests in which the requester requests to obtain the video data, wherein the second request carries the index information corresponding to the video data requested by the requester; determine whether the plurality of second requests and the first request are the same request according to the index information carried by the plurality of second requests and the index information carried by the first request; and determine that the plurality of second requests are invalid requests when it is determined that the plurality of second requests and the first request are the same request.
[0133] In some embodiments, the device is further configured to, in a case where it is determined that the plurality of second requests are different from the first request, select one of the plurality of second requests with a smallest time difference between a corresponding request time and a current time as a target request; and obtain corresponding video data from a preset data cache unit based on index information carried by the target request.
[0134] In some embodiments, the piece of information includes request address information and a playing time period of the corresponding data piece, and the device is further configured to detect the piece of information of the data piece requested by the corresponding request from the index information carried by the plurality of second requests and the first request respectively, and determine the request address information and the playing time period corresponding to each piece of information, wherein the request address information is determined according to a resource service mode associated with the corresponding data piece and the data cache unit; determine whether the request address information corresponding to the plurality of second requests and the first request is the same; in a case where it is determined that the request address information is different, determine that the plurality of second requests are different from the first request; and in a case where it is determined that the request address information is the same, determine whether the playing time periods corresponding to the corresponding requests are the same, and determine whether the plurality of second requests are the same as the first request according to the determination result.
[0135] Figure 8 is a structural schematic diagram of an electronic device of an embodiment of the present application, as Figure 8 shown, the present application provides an electronic device, which includes a processor 81, a communication interface 82, a memory 83 and a communication bus 84, wherein the processor 81, the communication interface 82 and the memory 83 complete communication with each other through the communication bus 84,
[0136] The memory 83 is configured to store a computer program.
[0137] The processor 81 is configured to execute the program stored in the memory 83, so as to realize the method steps in Figure 8 .
[0138] The processor in the electronic device realizes the method steps in Figure 1 , and the technical effects brought by the method steps are the same as the technical effects of the method of controlling video playing in the above-mentioned embodiments, which will not be described here again. Figure 1
[0139] The communication bus mentioned in the above-mentioned electronic device can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For the convenience of representation,Figure 8 Only one bus or type of bus might exist however.
[0140] The communication interface is configured to communicate between the terminal and other devices.
[0141] The memory can include a random access memory (RAM) and can also include a non-volatile memory, such as at least one disk memory. Optionally, the memory can also be at least one storage device located away from the aforementioned processor.
[0142] The aforementioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component.
[0143] The embodiments of the present application further provide a computer readable storage medium, which has a computer program stored thereon, and the computer program is executed by a processor to implement the steps of the video playing control method provided by any one of the preceding method embodiments.
[0144] In yet another embodiment provided by the present application, a computer program product containing instructions, which, when executed on a computer, causes the computer to perform the steps of the video playing control method of any one of the preceding embodiments.
[0145] It has to be noted that, in the present document, relational terms are intended only to convey a possible relationship between elements or
[0146] The above description is merely that of the specific embodiments of the application and as such is not to be taken in a limiting sense, as the specific embodiments merely exemplify the general principles of the application. Certain modifications to the specific embodiments disclosed above can be apparent to one skilled in the art with the benefit of the present disclosure, and as such, should be within the purview of the application defined by the following claims, and their equivalents.
Claims
1. A control method of video play, characterized by, The method comprises the following steps: acquiring a first request for acquiring a current video from a request party, and acquiring the current video from a preset data cache unit according to index information carried in the first request, wherein the index information records segment information of at least one data segment corresponding to the current video, and the segment information is used to represent the playing time and the request address of the corresponding data segment; when the request party plays the received current video, determining target segment information according to reference segment information detected from the index information, wherein the reference segment information is the segment information corresponding to the last data segment of the at least one data segment corresponding to the current video; based on the target segment information, downloading a target segment corresponding to the target segment information from a preset network server, and preloading the target segment into the data cache unit; wherein the segment information at least records the playing time period of the corresponding data segment, and the determining of the target segment information according to the reference segment information detected from the index information comprises: determining the playing time period corresponding to the reference segment information; selecting the next playing time period of the playing time period corresponding to the reference segment information to obtain a target playing time period, wherein the playing time period corresponding to the target segment information includes the next playing time period; the downloading of the target segment corresponding to the target segment information from the preset network server comprises: determining the start time and the end time of the playing time period corresponding to the target segment information; downloading, from the preset network server, video frames corresponding to the start frame corresponding to the start time to the end frame corresponding to the end time to determine that the target segment includes the video frames corresponding to the start frame to the end frame; the preloading of the target segment into the data cache unit comprises: after caching the target segment into a disk cache unit in the data cache unit, judging whether to perform memory caching; in the case of judging that memory caching is needed, caching the target segment cached into the disk cache unit into a memory cache unit in the data cache unit; the acquiring of the current video from the preset data cache unit according to the index information carried in the first request comprises: according to the segment information of the data segment recorded in the index information, searching for the corresponding data segment in the data cache unit and determining a search result, wherein the data cache unit includes a memory cache unit and a disk cache unit; when the search result is that one of the memory cache unit and the disk cache unit caches the corresponding data segment, it is determined to acquire the current video from the preset data cache unit.
2. The method of claim 1, wherein, when the search result is that neither the memory cache unit nor the disk cache unit caches the corresponding data segment, the method further comprises: acquiring the corresponding data segment from the preset network server to obtain the current video; The obtained current video is cached to the preset data cache unit according to a preset rule.
3. The method of claim 1, wherein, The method further comprises: Before the requestor plays the current video, the step of determining target segment information according to reference segment information detected from the index information, downloading a target segment corresponding to the target segment information from a preset network server based on the target segment information, and preloading the target segment to the data cache unit is prohibited.
4. The method of claim 1, wherein, The method further comprises: Within a preset time after the requestor starts playing the current video, a plurality of second requests for reacquiring video data are received, wherein the second requests carry index information corresponding to the video data reacquired by the requestor; According to the index information carried by the plurality of second requests and the index information carried by the first request, it is determined whether the plurality of second requests and the first request are the same request; In the case where it is determined that the plurality of second requests and the first request are the same request, it is determined that the plurality of second requests are invalid requests.
5. The method of claim 4, wherein, In the case where it is determined that the plurality of second requests and the first request are different requests, the method further comprises: Among the plurality of second requests, a target request with the smallest time difference between the corresponding request time and the current time is selected to obtain a target request; According to the index information carried by the target request, corresponding video data is obtained from the preset data cache unit.
6. The method of claim 4, wherein, The segment information includes request address information and a playing time period of corresponding data segments, according to the index information carried by the plurality of second requests and the index information carried by the first request, it is determined whether the plurality of second requests and the first request are the same request, comprising: The segment information of the data segments requested by the corresponding requests is detected from the index information carried by the plurality of second requests and the first request, respectively, and the request address information and the playing time period corresponding to each segment information are determined, wherein the request address information is determined according to the resource service mode and the data cache unit associated with the corresponding data segment; It is determined whether the request address information corresponding to the plurality of second requests and the first request is the same; In the case where it is determined that the request address information is different, it is determined that the plurality of second requests and the first request are different requests; In the case where it is determined that the request address information is the same, it is determined whether the playing time periods corresponding to the corresponding requests are the same, and according to the determination result, it is determined whether the plurality of second requests and the second request are the same request.
7. A control apparatus for video playback, characterized by comprising: Comprise: An acquisition module is configured to acquire a first request for a requestor to acquire a current video, and to acquire the current video from a preset data cache unit according to index information carried in the first request, wherein the index information records segment information of at least one data segment corresponding to the current video, and the segment information is used to represent the playing time and the request address of the corresponding data segment. determining module, configured to determine target segment information according to reference segment information detected from the index information when the requester plays the received current video, wherein the reference segment information is the segment information corresponding to a last data segment of at least one data segment corresponding to the current video; processing module, configured to download a target segment corresponding to the target segment information from a preset network server based on the target segment information, and preload the target segment to the data cache unit; wherein the segment information at least records a playing time period of a corresponding data segment, and the determining of the target segment information according to the reference segment information detected from the index information comprises: determining a playing time period corresponding to the reference segment information; selecting a next playing time period of the playing time period corresponding to the reference segment information to obtain a target playing time period, wherein the playing time period corresponding to the target segment information comprises the next playing time period; the downloading of the target segment corresponding to the target segment information from the preset network server comprises: determining a start time and an end time of the playing time period corresponding to the target segment information; downloading, from the preset network server, video frames corresponding to a start frame corresponding to the start time to an end frame corresponding to the end time to determine that the target segment comprises the video frames corresponding to the start frame to the end frame; the preloading of the target segment to the data cache unit comprises: after the target segment is cached to a disk cache unit in the data cache unit, judging whether to perform memory caching; in a case that it is judged that memory caching is needed, caching the target segment cached to the disk cache unit to a memory cache unit in the data cache unit; the obtaining of the current video from the preset data cache unit according to the index information carried in the first request comprises: according to the segment information of the data segment recorded in the index information, searching for the corresponding data segment in the data cache unit and determining a search result, wherein the data cache unit comprises a memory cache unit and a disk cache unit; in a case that the search result is that one of the memory cache unit and the disk cache unit caches the corresponding data segment, determining that the current video is obtained from the preset data cache unit.
8. An electronic device, comprising: a device comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus; the memory is used to store a computer program; the processor is used to execute the program stored on the memory to implement the steps of the video playing control method in any one of claims 1-6.
9. A computer readable storage medium having stored thereon a computer program, characterized in that, the computer program is executed by the processor to implement the steps of the video playing control method in any one of claims 1-6.
Citation Information
Patent Citations
Video playing method, terminal, server and storage medium
CN109996110A
Video caching method and related equipment
CN110545459A