Video playing method, device, electronic equipment and system
By performing pre-decoding and state transition before video playback, the problems of long video playback waiting time and network failure impact are solved, achieving instant video opening and efficient playback, thus improving the user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN GREEN CONNECTION TECH CO LTD
- Filing Date
- 2026-01-21
- Publication Date
- 2026-05-01
AI Technical Summary
In existing video playback solutions, the waiting time from user operation to screen display is too long and is easily affected by network failures or timeouts, resulting in a poor user experience.
By predicting the target video and performing pre-decoding operations when the permission conditions are met, pre-decoding data is generated and stored in the memory buffer. The decoding state information is then transferred to the main player using a state transition algorithm, achieving parallel decoding and PTS alignment of the video. Finally, the first frame is rendered immediately when the playback command is given.
Significantly reduces the time users wait for video playback, improves video playback efficiency and user experience, and ensures that videos open instantly and display audio, video, and subtitles simultaneously.
Smart Images

Figure CN121967764A_ABST
Abstract
Description
A video playback method, apparatus, electronic device and system Technical Field
[0001] This invention relates to the field of video processing technology, and in particular to a video playback method, apparatus, electronic device, and system. Background Technology
[0002] Currently, most mainstream video playback solutions employ a sequential execution process. This means that after a user clicks the play button or triggers a playback operation, the system must complete several key steps sequentially before playback can begin: first, acquiring video information; then, parsing to obtain the specific playback address; next, initializing the player; and finally, loading the video data. This video playback process strictly relies on the order of these steps; each step must wait for the previous step to complete before it can begin, forming a linear, uninterrupted task chain.
[0003] However, although the above video playback process is logically clear, the cumulative delays in waiting and processing at each stage inevitably result in a total waiting time of 2 to 5 seconds or even longer from user operation to video display, which far exceeds the user's expectations. In addition, if a failure or network timeout occurs in any step during the video playback process, the playback process cannot proceed normally, affecting the user's video playback experience.
[0004] Therefore, it is particularly important to propose a technical solution that can improve video playback efficiency and thus enhance the user experience of video playback functions. Summary of the Invention
[0005] This invention provides a video playback method, apparatus, electronic device, and system that can improve video playback efficiency, thereby enhancing the user experience of video playback functions.
[0006] To address the aforementioned technical problems, the first aspect of this invention discloses a video playback method. The method is applied to an electronic device with an application installed, and the electronic device is communicatively connected to a network attached storage device (NETS). The electronic device can access the NETS via the application. The method includes: predicting a target video that needs to be preloaded; when the target video is detected to meet preset permission conditions, performing a pre-decoding operation on the target video based on a pre-decoder to obtain pre-decoded data corresponding to the target video; wherein the pre-decoding operation includes a parallel pre-decoding operation and a PTS alignment operation; the parallel pre-decoding operation includes at least a video decoding operation, or... The parallel pre-decoding operation includes at least the video decoding operation, and further includes audio decoding operation and / or subtitle decoding operation; wherein, the pre-decoding data includes video decoding data, and the video decoding data includes at least the first frame decoding data of the target video; the pre-decoding data is stored in a memory buffer; based on a state transition algorithm, the decoding state information corresponding to the pre-decoding data is transferred to the determined main player; after detecting a playback instruction for the target video, based on the main player and according to the decoding state information, the pre-decoding data is read from the memory buffer, and a playback operation is performed on the pre-decoding data; wherein, the playback operation includes at least a first frame rendering operation.
[0007] As an optional implementation, in the first aspect of the present invention, the step of performing a pre-decoding operation on the target video based on a pre-decoder to obtain pre-decoded data corresponding to the target video includes: determining a preloading strategy for the target video according to an acquired strategy adjustment reference parameter; wherein the strategy adjustment reference parameter includes at least one of network status information corresponding to the electronic device, device performance information corresponding to the electronic device, and battery status information corresponding to the electronic device; obtaining data to be decoded in the target video that matches the preloading strategy according to the preloading strategy; wherein the data to be decoded includes at least the first frame data corresponding to the target video; calling the pre-decoding interface corresponding to the pre-decoder to perform the parallel pre-decoding operation on the data to be decoded to obtain parallel decoded data corresponding to the target video; wherein the pre-decoder is a hardware decoder or a software decoder; and performing the PTS alignment operation on the parallel decoded data based on the PTS alignment algorithm to obtain the pre-decoded data corresponding to the target video.
[0008] As an optional implementation, in a first aspect of the present invention, performing the parallel pre-decoding operation on the data to be decoded to obtain parallel decoding data corresponding to the target video includes: determining the first keyframe of the data to be decoded based on the video metadata corresponding to the target video, and locating the first keyframe at the data reading position of the data to be decoded; wherein the first keyframe is the first frame to be rendered; determining the timestamp information corresponding to each frame data of the data to be decoded based on the video metadata; wherein the timestamp information corresponding to each frame data includes a decoding timestamp and a display timestamp; reading the frame data in the data to be decoded based on the data reading position; performing a video decoding operation on all the read frame data based on the decoding timestamp corresponding to each frame data to obtain a first video decoding buffer queue; wherein the first video decoding buffer queue includes frame decoding data; when the video data of the target video belongs to a complex encoding format, sorting the frame decoding data in the video decoding buffer queue based on the display timestamp corresponding to each frame data to obtain a second video decoding buffer queue; wherein the parallel decoding data includes parallel video decoding data, and the parallel video decoding data includes either the first video decoding buffer queue or the second video decoding buffer queue.
[0009] As an optional implementation, in the first aspect of the present invention, the decoding state information includes one or more combinations of the decoding position corresponding to the pre-decoding data, the timestamp information corresponding to the pre-decoding data, the cache position of the pre-decoding data in the memory cache, and the decoder configuration information corresponding to the decoder; wherein, migrating the decoding state information corresponding to the pre-decoding data to the determined main player based on the state transition algorithm includes: performing a state transition operation on the decoding state information corresponding to the pre-decoding data; wherein, the state transition operation includes multiple transition steps; the state transition operation is used to migrate the decoding state information to the determined main player; during the execution of the state transition operation on the decoding state information, when all the transition steps are executed successfully, the transition result corresponding to the state transition operation is determined to be a successful transition; when any of the transition steps fails, the transition result corresponding to the state transition operation is determined to be a failed transition, and a rollback operation for the state transition operation is triggered.
[0010] As an optional implementation, in a first aspect of the present invention, performing a playback operation on the pre-decoded data includes: rendering the first frame decoded data based on the main player; and, when the pre-decoded data further includes audio decoded data and / or subtitle decoded data, synchronously playing the audio decoded data and / or subtitle decoded data matching the first frame decoded data based on the main player; detecting whether there is a playback adjustment instruction for the target video; wherein the playback adjustment instruction includes at least one of a variable speed playback instruction, a skip playback instruction, a loop playback instruction, a pause / resume playback instruction, a reverse playback instruction, and a combined adjustment instruction; when a playback adjustment instruction for the target video is detected, performing an adjustment playback operation on the target video based on the main player and the PTS alignment algorithm, according to the playback adjustment instruction; when no playback adjustment instruction for the target video is detected, performing a playback operation on the target video based on the main player.
[0011] As an optional implementation, in the first aspect of the present invention, the prediction of the target video to be preloaded includes: collecting video prediction reference data of the user on the application; wherein the video prediction reference data includes the user's corresponding behavior data and / or the first video information corresponding to the currently playing video; calculating the playback probability of multiple candidate videos based on the behavior prediction algorithm and the video prediction reference data; and selecting candidate videos from all the candidate videos whose playback probability is higher than or equal to a preset playback probability as the target videos to be preloaded.
[0012] As an optional implementation, in the first aspect of the present invention, after predicting the target video that needs to be preloaded, the method further includes: obtaining user credential information, second video information of the target video, and device information of the electronic device; generating an authentication request corresponding to the target video based on the user credential information, the second video information, and the device information; sending the authentication request to a server corresponding to the application; upon receiving a request response information returned by the server corresponding to the authentication request, parsing the request response information to obtain an authentication request result; wherein the authentication request result includes the authentication result corresponding to the target video; when the authentication result indicates successful authentication, determining that the target video meets preset permission conditions; when the authentication result indicates failed authentication, determining that the target video does not meet preset permission conditions.
[0013] A second aspect of the present invention discloses a video playback device, which is applied to an electronic device with an application installed, and the electronic device is communicatively connected to a network attached storage device (NETS), through which the electronic device can access the NETS. via the application. The device includes: a prediction module for predicting a target video that needs to be preloaded; and a pre-decoding module for performing a pre-decoding operation on the target video based on a pre-decoder when the target video is detected to meet preset permission conditions, to obtain pre-decoded data corresponding to the target video. The pre-decoding operation includes a parallel pre-decoding operation and a PTS alignment operation; the parallel pre-decoding operation includes at least a video decoding operation, or the parallel pre-decoding operation... The system includes at least the video decoding operation, and further includes audio decoding operation and / or subtitle decoding operation; wherein the pre-decoding data includes video decoding data, and the video decoding data includes at least the first frame decoding data of the target video; a caching module is used to store the pre-decoding data in a memory cache; a migration module is used to migrate the decoding state information corresponding to the pre-decoding data to a determined main player based on a state migration algorithm; a playback module is used to, after detecting a playback instruction for the target video, read the pre-decoding data from the memory cache based on the main player and the decoding state information, and perform a playback operation on the pre-decoding data; wherein the playback operation includes at least a first frame rendering operation.
[0014] As an optional implementation, in a second aspect of the present invention, the specific method by which the pre-decoding module performs a pre-decoding operation on the target video based on a pre-decoder to obtain pre-decoded data corresponding to the target video includes: determining a preloading strategy for the target video based on acquired strategy adjustment reference parameters; wherein the strategy adjustment reference parameters include at least one of network status information corresponding to the electronic device, device performance information corresponding to the electronic device, and battery status information corresponding to the electronic device; obtaining, according to the preloading strategy, data to be decoded in the target video that matches the preloading strategy; wherein the data to be decoded includes at least the first frame data corresponding to the target video; calling the pre-decoding interface corresponding to the pre-decoder to perform the parallel pre-decoding operation on the data to be decoded to obtain parallel decoded data corresponding to the target video; wherein the pre-decoder is a hardware decoder or a software decoder; and performing the PTS alignment operation on the parallel decoded data based on the PTS alignment algorithm to obtain the pre-decoded data corresponding to the target video.
[0015] As an optional implementation, in a second aspect of the present invention, the specific method by which the pre-decoding module performs the parallel pre-decoding operation on the data to be decoded to obtain the parallel decoded data corresponding to the target video includes: determining the first keyframe of the data to be decoded based on the video metadata corresponding to the target video, and locating the first keyframe at the data reading position of the data to be decoded; wherein the first keyframe is the first frame to be rendered; determining the timestamp information corresponding to each frame of the data to be decoded based on the video metadata; wherein the timestamp information corresponding to each frame includes a decoding timestamp and a display timestamp; and based on the data reading position... The system reads frame data from the data to be decoded; based on the decoding timestamp corresponding to each frame data, it performs video decoding operations on all read frame data to obtain a first video decoding buffer queue; wherein, the first video decoding buffer queue includes frame decoding data; when the video data of the target video belongs to a complex encoding format, based on the display timestamp corresponding to each frame data, it sorts the frame decoding data in the video decoding buffer queue to obtain a second video decoding buffer queue; wherein, the parallel decoding data includes parallel video decoding data, and the parallel video decoding data includes either the first video decoding buffer queue or the second video decoding buffer queue.
[0016] As an optional implementation, in the second aspect of the present invention, the decoding state information includes one or more combinations of the decoding position corresponding to the pre-decoding data, the timestamp information corresponding to the pre-decoding data, the cache position of the pre-decoding data in the memory cache area, and the decoder configuration information corresponding to the decoder; wherein, the specific method by which the migration module migrates the decoding state information corresponding to the pre-decoding data to the determined main player based on the state migration algorithm includes: performing a state migration operation on the decoding state information corresponding to the pre-decoding data; wherein, the state migration operation includes multiple migration steps; the state migration operation is used to migrate the decoding state information to the determined main player; during the execution of the state migration operation on the decoding state information, when all the migration steps are executed successfully, the migration result corresponding to the state migration operation is determined to be a successful migration; when any of the migration steps fails, the migration result corresponding to the state migration operation is determined to be a failed migration, and a rollback operation for the state migration operation is triggered.
[0017] As an optional implementation, in a second aspect of the present invention, the playback module performs a playback operation on the pre-decoded data in the following manner: rendering the first frame decoded data based on the main player; and, when the pre-decoded data further includes audio decoded data and / or subtitle decoded data, synchronously playing the audio decoded data and / or subtitle decoded data matching the first frame decoded data based on the main player; detecting whether there is a playback adjustment instruction for the target video; wherein the playback adjustment instruction includes at least one of a variable speed playback instruction, a jump playback instruction, a loop playback instruction, a pause / resume playback instruction, a reverse playback instruction, and a combined adjustment instruction; when a playback adjustment instruction for the target video is detected, performing an adjustment playback operation on the target video based on the main player and the PTS alignment algorithm, according to the playback adjustment instruction; when no playback adjustment instruction for the target video is detected, performing a playback operation on the target video based on the main player.
[0018] As an optional implementation, in the second aspect of the present invention, the specific method by which the prediction module predicts the target video to be preloaded includes: collecting video prediction reference data of the user on the application; wherein the video prediction reference data includes the user's corresponding behavior data and / or the first video information corresponding to the currently playing video; calculating the playback probability of multiple candidate videos based on the behavior prediction algorithm and the video prediction reference data; and selecting candidate videos from all the candidate videos whose playback probability is higher than or equal to a preset playback probability as the target videos to be preloaded.
[0019] As an optional implementation, in a second aspect of the present invention, the apparatus further includes: an acquisition module, configured to acquire user credential information, second video information of the target video, and device information of the electronic device after the prediction module predicts the target video to be preloaded; a generation module, configured to generate an authentication request corresponding to the target video based on the user credential information, the second video information, and the device information; a sending module, configured to send the authentication request to a server corresponding to the application; a parsing module, configured to parse the request response information corresponding to the authentication request returned by the server to obtain an authentication request result; wherein the authentication request result includes the authentication result corresponding to the target video; and a determination module, configured to determine that the target video meets preset permission conditions when the authentication result indicates successful authentication, and determine that the target video does not meet preset permission conditions when the authentication result indicates failed authentication.
[0020] A third aspect of the present invention discloses an electronic device, the electronic device comprising: a memory storing executable program code; a processor coupled to the memory; the processor calling the executable program code stored in the memory to execute some or all of the steps of the video playback method disclosed in the first aspect of the present invention.
[0021] A fourth aspect of the present invention discloses a video playback system, the system comprising a video playback device as disclosed in the second aspect of the present invention, and a network-attached storage device communicatively connected to the video playback device; wherein the video playback device pre-decodes a target video before video playback according to the video playback method disclosed in the first aspect of the present invention to achieve low-latency playback of the target video; or, the system comprises an electronic device as disclosed in the third aspect of the present invention, and a network-attached storage device communicatively connected to the electronic device; wherein the electronic device pre-decodes a target video before video playback according to the video playback method disclosed in the first aspect of the present invention to achieve low-latency playback of the target video.
[0022] The fifth aspect of the present invention discloses a computer storage medium storing computer instructions, which, when invoked, are used to execute some or all of the steps of the video playback method disclosed in the first aspect of the present invention.
[0023] Compared with the prior art, the present invention has the following beneficial effects: After predicting the target video that needs to be preloaded, if the target video is detected to meet the preset permission conditions, the present invention performs a pre-decoding operation on the target video based on the pre-decoder to obtain pre-decoded data including at least the first frame decoding data, and stores the pre-decoded data in the memory cache. Then, the decoding status information corresponding to the pre-decoded data is migrated to the main player. After detecting the playback command, the main player reads the pre-decoded data from the memory cache according to the decoding status information and realizes the rendering of the first frame data. The present invention can pre-decode the video before video playback, so that the first frame can be rendered immediately when the video is played, realizing instant video playback. This improves video parsing efficiency and video playback efficiency, significantly reduces the user's waiting time for video playback, and thus improves the user's experience of video playback function. Attached Figure Description
[0024] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0025] Figure 1 is a flowchart illustrating a video playback method according to an embodiment of the present invention; Figure 2 is a flowchart illustrating another video playback method according to an embodiment of the present invention; Figure 3 is a flowchart illustrating yet another video playback method according to an embodiment of the present invention; Figure 4 is a structural schematic diagram illustrating a video playback device according to an embodiment of the present invention; Figure 5 is a structural schematic diagram illustrating another video playback device according to an embodiment of the present invention; Figure 6 is a structural schematic diagram illustrating an electronic device according to an embodiment of the present invention; Figure 7 is a structural schematic diagram illustrating a video playback system according to an embodiment of the present invention; Figure 8 is a structural schematic diagram illustrating another video playback system according to an embodiment of the present invention. Detailed Implementation
[0026] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0027] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, apparatus, product, or end that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or ends.
[0028] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0029] This invention discloses a video playback method, apparatus, electronic device, and system. After predicting the target video to be preloaded, if the target video meets preset permission conditions, a pre-decoding operation is performed on the target video based on a pre-decoder to obtain pre-decoded data including at least the first frame's decoded data. This pre-decoded data is stored in a memory buffer, and the decoding status information corresponding to the pre-decoded data is then transferred to the main player. Upon detecting a playback command, the main player, based on the decoding status information, reads the pre-decoded data from the memory buffer and renders the first frame. This pre-decoding of the video before playback allows for immediate rendering of the first frame during playback, achieving near-instantaneous video playback. This improves both video parsing and playback efficiency, significantly reducing user waiting time and enhancing the user experience. Detailed descriptions follow.
[0030] Please refer to Figure 1 for Embodiment 1. Figure 1 is a flowchart illustrating a video playback method disclosed in an embodiment of the present invention. The video playback method described in Figure 1 can be applied to a video playback device, which may include one of a smart device, a smart terminal, a smart system, and a server. The server may be a local server or a cloud server; this embodiment of the present invention does not limit the application. The method can also be applied to an electronic device with an application installed, and the electronic device is communicatively connected to a network attached storage device. The electronic device can access the network attached storage device through the application; this embodiment of the present invention does not limit the application. As shown in Figure 1, the video playback method may include the following operation: 101. Predicting the target video that needs to be preloaded.
[0031] In this embodiment of the invention, the target video that needs to be preloaded is the next video that the user may play in the application.
[0032] 102. When the target video is detected to meet the preset permission conditions, a pre-decoding operation is performed on the target video based on the pre-decoder to obtain the pre-decoded data corresponding to the target video.
[0033] In this embodiment of the invention, the pre-decoding operation may include a parallel pre-decoding operation and a PTS (Presentation Time Stamp) alignment operation; further, the parallel pre-decoding operation includes at least a video decoding operation; or, the parallel pre-decoding operation includes at least a video decoding operation, and may also include an audio decoding operation and / or a subtitle decoding operation, and all decoding operations included in the parallel pre-decoding operation can be executed asynchronously in parallel; further optionally, a multi-core CPU and multi-threading, and / or an asynchronous task queue can be used to manage decoding tasks to achieve parallel execution of the parallel pre-decoding operation.
[0034] Furthermore, the pre-decoding data includes video decoding data; optionally, when the parallel pre-decoding operation also includes audio decoding operation and / or subtitle decoding operation, the pre-decoding data may also include audio decoding data and / or subtitle decoding data.
[0035] Furthermore, the video decoding data includes at least the first frame decoding data of the target video; optionally, each frame decoding data in the video decoding data can be pixel data; further optionally, the data format of the pixel data can be YUV format or RGB format, or other pixel data formats, which are not limited in this embodiment of the invention.
[0036] 103. Store the pre-decoded data in the memory cache.
[0037] In this embodiment of the invention, the memory cache can be a memory cache pool; optionally, the memory cache supports cross-thread access, reference counting management, automatic eviction policies, and memory limit control; wherein, by using mutex locks / read-write locks for protection, concurrent access is supported, ensuring the safety of cross-thread access; reference counting management automatically manages the lifecycle, preventing memory leaks; the automatic eviction policy can be LRU (Least Recently Used), used to intelligently evict the least recently used cache when memory is insufficient; by using the memory cache, the same memory can be shared when rendering the same frame multiple times, achieving zero-copy reuse.
[0038] In this embodiment of the invention, optionally, the pre-decoding data cached in the memory cache can be cached for a preset duration (e.g., 5-10 minutes). After the preset duration is reached, the cached pre-decoding data is automatically cleared. This embodiment of the invention does not impose any limitations. For example, in scenarios that support quick playback, users may return to the same video multiple times while quickly scrolling up and down in the short video list. Through the memory cache, even if the user exits the playback interface and replays the video, the pre-decoding data (including the first frame data) remains in memory and does not need to be downloaded and decoded again. As another example, in scenarios such as picture-in-picture and split-screen, the same video may be displayed in multiple player instances, achieving multi-instance sharing optimization. The caching mechanism implemented through the above-mentioned memory cache allows multiple instances to share the same pixel data, significantly saving memory. This embodiment of the invention does not impose any limitations.
[0039] 104. Based on the state transition algorithm, the decoding state information corresponding to the pre-decoded data is transferred to the determined main player.
[0040] In this embodiment of the invention, steps 101-104 can optionally be executed asynchronously and in fragmented form by background tasks to alleviate the CPU and memory pressure on the device. This embodiment of the invention does not impose any limitations on this.
[0041] In this embodiment of the invention, optionally, multiple main players may exist; however, this embodiment of the invention does not impose any limitation.
[0042] 105. After detecting a playback command for the target video, based on the main player and the decoding status information, the pre-decoded data is read from the memory buffer and the playback operation is performed on the pre-decoded data.
[0043] In this embodiment of the invention, optionally, the playback command for the target video can be a playback command triggered by the user (e.g., the user clicks the play button, the user selects the target video to play), or it can be an automatic playback command for the target video (e.g., the next video in the video list is played automatically). This embodiment of the invention does not limit the scope of the command.
[0044] In this embodiment of the invention, the playback operation includes at least the first frame rendering operation; for example, when the user clicks play, the rendering thread can directly read the decoded pixel data from the memory cache for rendering, and when the cache is hit, there is no need to decode again.
[0045] In this embodiment of the invention, optionally, during the playback operation of the pre-decoded data, playback address resolution and CDN scheduling requests can be initiated simultaneously in parallel. This embodiment of the invention does not impose any limitations on this.
[0046] As can be seen, the method described in the embodiments of the present invention can, after predicting the target video that needs to be preloaded, if the target video is detected to meet the preset permission conditions, perform a pre-decoding operation on the target video based on the pre-decoder to obtain pre-decoded data including at least the first frame decoding data, and store the pre-decoded data in the memory buffer. Then, the decoding status information corresponding to the pre-decoded data is migrated to the main player. After detecting the playback command, based on the main player and according to the decoding status information, the pre-decoded data is read from the memory buffer and the first frame data is rendered. This method can pre-decode the video before playback, thereby enabling the first frame to be rendered immediately during video playback, achieving instant video playback. This improves video parsing efficiency and video playback efficiency, significantly reduces the user's waiting time for video playback, and thus improves the user's experience of using the video playback function.
[0047] In an optional embodiment, performing a pre-decoding operation on the target video based on the pre-decoder to obtain pre-decoded data corresponding to the target video may include the following operations: determining a preloading strategy for the target video based on the obtained strategy adjustment reference parameters; wherein, the strategy adjustment reference parameters include at least one of network status information corresponding to the electronic device, device performance information corresponding to the electronic device, and battery status information corresponding to the electronic device; obtaining the data to be decoded in the target video that matches the preloading strategy according to the preloading strategy; wherein, the data to be decoded includes at least the first frame data corresponding to the target video; calling the pre-decoding interface corresponding to the pre-decoder to perform a parallel pre-decoding operation on the data to be decoded to obtain parallel decoded data corresponding to the target video; wherein, the pre-decoder is a hardware decoder or a software decoder; and performing a PTS alignment operation on the parallel decoded data based on the PTS alignment algorithm to obtain the pre-decoded data corresponding to the target video.
[0048] Optionally, the network status information corresponding to the electronic device may include at least one of the following: the network type currently accessed by the electronic device (e.g., WiFi, 4G, 5G), network signal quality (e.g., strong signal, weak signal), bandwidth fluctuation data, latency data, and packet loss rate. This embodiment of the invention does not limit the information.
[0049] Optionally, determining the preloading strategy for the target video based on the obtained strategy adjustment reference parameters may include the following operations: estimating the required preloading duration and amount of preloaded data for video data corresponding to multiple preloading levels based on the obtained strategy adjustment reference parameters; wherein the preloading levels can be the first frame level, short segment level, and long segment level; selecting the preloading level that meets the preset data amount conditions and preset user experience conditions from all preloading levels based on the preloading duration and preloaded data amount as the target level; and determining the preloading strategy corresponding to the target level as the preloading strategy for the target video.
[0050] For example, loading the first frame requires 100KB, loading a short clip requires 2MB, and loading a long clip requires 5MB. Under a 4G network, downloading short or long video data takes 1-3 seconds, but this embodiment of the invention does not limit the time. This allows the selected preloading strategy to balance the cost of preloading and the user experience by setting preset data volume conditions and preset user experience conditions.
[0051] In another optional implementation, the preloading strategy for the target video may be determined by adjusting the reference parameters according to the obtained strategy, which may include the following operations: determining the network quality level based on bandwidth fluctuation data, latency data, and packet loss rate; wherein the network quality level is one of excellent, good, average, and poor; and determining the preloading strategy for the target video based on the network type and / or network quality level.
[0052] For example, WiFi preloads 10 seconds of content, 4G preloads 3 seconds, and weak network only preloads the first frame. This embodiment of the invention is not limited to these examples.
[0053] The pre-decoding interface corresponding to the pre-decoder can be a unified and abstract interface provided to the upper-layer services; for example, the pre-decoding interface corresponding to the pre-decoder may include the first frame pre-decoding interface, such as: preDecodeFirstFrame(video), but this embodiment of the invention does not limit it.
[0054] For example, the hardware decoder can be GPU VideoToolbox or MediaCodec, and the software decoder can be FFmpeg CPU decoder. This embodiment of the invention does not limit the scope of the invention. Optionally, the underlying layer can automatically select the hardware or software decoder to be used based on at least one of the following factors: device capabilities, video format, and system load. Furthermore, if either decoder fails, it can automatically switch to another decoder (e.g., if the hardware decoder fails, it can automatically switch to the software decoder). This achieves automatic decoder adaptation, so that the upper layer does not need to care about the decoding method selected by the lower layer.
[0055] Optionally, after step 104, the instance corresponding to the decoder or the instance corresponding to the decoder interface can be destroyed to release the occupied memory. This embodiment of the invention does not impose any limitations on this.
[0056] The PTS alignment operation is used to align the display timestamps between parallel video decoding data, parallel audio decoding data, and parallel subtitle decoding data to ensure synchronized display of audio, video, and subtitles.
[0057] As can be seen, this optional embodiment can adjust reference parameters according to the acquired strategy, intelligently adjust the preloading strategy for the target video, obtain the data to be decoded according to the preloading strategy, and then call the pre-decoding interface corresponding to the pre-decoder to perform parallel pre-decoding operations on the data to be decoded, obtaining the parallel decoded data corresponding to the target video. Then, based on the PTS alignment algorithm, PTS alignment operations are performed on the parallel decoded data to obtain the pre-decoded data corresponding to the target video. This can improve the efficiency and flexibility of obtaining the data to be loaded while realizing intelligent adjustment of the data loading strategy, thereby facilitating the adjustment of the amount of data that needs to be pre-decoded, so as to perform pre-decoding operations more efficiently, ensuring that at least the first frame of data can be decoded, and thus ensuring the rendering of at least the first frame of data during subsequent playback; and, through PTS alignment technology, the display timestamps of all pre-decoded data can be aligned, which is beneficial to ensure the synchronous playback of audio, video, and subtitles during subsequent playback, improving the accuracy of video playback.
[0058] In this optional embodiment, optionally, performing a parallel pre-decoding operation on the data to be decoded to obtain parallel decoded data corresponding to the target video may include the following operations: determining the first keyframe of the data to be decoded based on the video metadata corresponding to the target video, and locating the first keyframe at the data reading position of the data to be decoded; wherein, the first keyframe is the first frame to be rendered; determining the timestamp information corresponding to each frame data of the data to be decoded based on the video metadata; wherein, the timestamp information corresponding to each frame data includes a decoding timestamp and a display timestamp; reading the frame data in the data to be decoded based on the data reading position; performing a video decoding operation on all the read frame data based on the decoding timestamp corresponding to each frame data to obtain a first video decoding buffer queue; wherein, the first video decoding buffer queue includes frame decoding data; when the video data of the target video belongs to a complex encoding format, sorting the frame decoding data in the video decoding buffer queue based on the display timestamp corresponding to each frame data to obtain a second video decoding buffer queue; wherein, the parallel decoding data includes parallel video decoding data, and the parallel video decoding data includes either the first video decoding buffer queue or the second video decoding buffer queue.
[0059] For example, the video metadata mentioned above can be moov atom, but this embodiment of the invention does not limit it.
[0060] It is understandable that when the data to be decoded includes not only the video data to be decoded, but also the audio data and / or subtitle data to be decoded, it is necessary to locate the position of the first keyframe in order to read the video data to be decoded.
[0061] For example, the complex encoding format can be H.264 or H.265, and the embodiments of the present invention are not limited thereto.
[0062] It is understandable that when a video uses a complex encoding format (such as H.264 / H.265), B-frame technology is used. The display order of B-frames is different from the decoding order. Therefore, after decoding based on the decoding timestamp (DTS), the frames need to be reordered based on the display timestamp to realize the conversion from decoding order to display order, thereby ensuring that rendering is performed in the display order.
[0063] As can be seen, this optional embodiment can also determine the first keyframe, i.e. the first frame, of the data to be decoded based on the video metadata corresponding to the target video when decoding video data, and locate the data reading position corresponding to the first frame, so as to read the frame data in the data to be decoded based on the data reading position; and determine the timestamp information corresponding to each frame data based on the video metadata, so as to perform video decoding operation on all the read frame data based on the decoding timestamp to obtain a first video decoding buffer queue. Furthermore, when the video data of the target video belongs to a complex encoding format, the frame decoding data in the video decoding buffer queue is reordered based on the display timestamp to obtain a second video decoding buffer queue. It can decode and render video frame data according to different timestamp orders by processing the relationship between DTS and PTS, which can improve decoding efficiency and playback accuracy of decoded data.
[0064] In this optional embodiment, when the parallel pre-decoding operation also includes an audio decoding operation, performing the parallel pre-decoding operation on the data to be decoded to obtain the parallel decoded data corresponding to the target video may further include the following operations: extracting audio stream data from the video file or independent audio file in the data to be decoded; identifying the audio encoding format of the audio stream data; wherein, for example, the audio encoding format may be one of AAC, MP3, Opus, and AC-3, or other audio formats, which are not limited in this embodiment of the invention; creating a corresponding audio decoder instance according to the audio encoding format; decoding the audio stream data frame by frame based on the audio decoder instance to obtain the corresponding PCM data (Pulse-Code Modulation, i.e., uncompressed linear audio data); performing resampling and channel processing on the PCM data to obtain audio processing data; extracting and saving the audio metadata corresponding to the audio processing data; and storing the audio processing data as parallel audio decoding data in the audio buffer in the memory cache.
[0065] Among them, resampling processing is used to unify the sampling rate, such as 44.1kHz or 48kHz; channel processing is used to process channel mapping (such as stereo); optionally, audio metadata may include audio duration and / or bit rate, and may also include other metadata, which are not limited in this embodiment of the invention.
[0066] As can be seen, this optional embodiment can also realize audio decoding operation in parallel with frame decoding operation, which can improve the decoding efficiency and decoding accuracy of audio data while improving pre-decoding efficiency, which is beneficial to the efficiency and accuracy of subsequent PTS alignment of pre-decoded data.
[0067] In this optional embodiment, when the parallel pre-decoding operation also includes a subtitle decoding operation, performing the parallel pre-decoding operation on the data to be decoded to obtain the parallel decoding data corresponding to the target video may further include the following operations: obtaining the subtitle file corresponding to the target video from a CDN (Content Delivery Network) or local cache; identifying the encoding format of the subtitle file and parsing the subtitle file to obtain the subtitle parsing result; wherein, the subtitle parsing result may include one or more of timeline, text content, and style information; wherein, for example, the encoding format of the subtitle file may be one of SRT, ASS, and VTT, or other types of formats, which are not limited in this embodiment of the invention; wherein, the style information may include subtitle font information, subtitle color information, and subtitle position information; when the subtitle file meets the character encoding conversion conditions, converting the subtitle text to UTF-8; establishing a timeline index for the subtitle file; encapsulating the above subtitle parsing result into a renderable subtitle object as parallel subtitle decoding data; and caching the subtitle decoding data into the subtitle buffer in the memory cache.
[0068] As can be seen, this optional embodiment can also realize subtitle decoding operation in parallel with frame decoding operation, which can improve the decoding efficiency and accuracy of subtitle data while improving pre-decoding efficiency, which is beneficial to the efficiency and accuracy of subsequent PTS alignment of pre-decoded data.
[0069] In an optional embodiment, the decoding status information includes one or more of the following combinations: the decoding position corresponding to the pre-decoded data, the timestamp information corresponding to the pre-decoded data, the cache position of the pre-decoded data in the memory cache, and the decoder configuration information corresponding to the decoder.
[0070] Optionally, based on the state transition algorithm, the decoding state information corresponding to the pre-decoded data is transferred to the determined main player, which may include the following operations: performing a state transition operation on the decoding state information corresponding to the pre-decoded data; wherein, the state transition operation includes multiple transition steps; the state transition operation is used to transfer the decoding state information to the determined main player; during the process of performing the state transition operation on the decoding state information, when all transition steps are executed successfully, the transition result corresponding to the state transition operation is determined to be a successful transition; when any transition step fails, the transition result corresponding to the state transition operation is determined to be a failed transition, and a rollback operation for the state transition operation is triggered.
[0071] Among them, state transition can completely record the current state of the decoder and realize state snapshot; it can also pass the information of the pre-decoded data to the main player; and through atomic transition operation, the steps of the state transition operation can only have two states: all of them are executed successfully or rollback occurs, without intermediate states, so as to avoid users seeing part of the normally rendered part of the picture and avoid the program freezing or crashing.
[0072] As can be seen, this optional embodiment can perform a state transition operation on the decoding state information corresponding to the pre-decoded data to transfer the decoding state information to the determined main player. During the state transition operation, if all transition steps are executed successfully, the state transition can be determined to be successful; if any transition step fails, the transition fails, and a rollback operation for the state transition operation is triggered. This can improve the reliability of the state transition operation while achieving seamless transfer of the pre-decoded state to the main player, enabling the main player to fully and efficiently receive the pre-decoded results, avoiding waste of decoding results and anomalies during video playback, and improving the reliability and smoothness of subsequent video playback.
[0073] Please refer to Figure 2 for Embodiment 2. Figure 2 is a flowchart illustrating a video playback method disclosed in this embodiment of the invention. The video playback method described in Figure 2 can be applied to a video playback device, which may include one of a smart device, a smart terminal, a smart system, and a server. The server may be a local server or a cloud server; this embodiment of the invention does not limit the type of server. The method is applied to an electronic device with an application installed, and the electronic device is communicatively connected to a network attached storage device (LAN). The electronic device can access the LAN via the application; this embodiment of the invention does not limit the type of LAN. As shown in Figure 2, the video playback method may include the following operation: 201. Collecting video prediction reference data from the user's application.
[0074] In this embodiment of the invention, the video prediction reference data includes user-corresponding behavioral data and / or first video information corresponding to the currently playing video; wherein, optionally, the behavioral data may include one or more of sliding speed, viewport dwell time, and viewport position, and may also include user behavioral preference data, which is not limited in this embodiment of the invention; optionally, the first video information corresponding to the currently playing video may include one or more of the sorting position of the currently playing video in the playlist and / or video classification information, which is not limited in this embodiment of the invention.
[0075] 202. Based on the behavior prediction algorithm, calculate the playback probability of multiple candidate videos according to the video prediction reference data.
[0076] In this embodiment of the invention, for example, the behavior prediction algorithm can be a model constructed by a combination of LRU and machine learning, and this embodiment of the invention does not limit it; wherein, the behavior prediction algorithm can be constructed based on the user's historical behavior preference data combined with the user's historical viewing preference data, and this embodiment of the invention does not limit it.
[0077] In this embodiment of the invention, optionally, the candidate video can be any other video in the playlist of the currently playing video, or any other video on the current page of the application; this embodiment of the invention does not impose any limitations.
[0078] 203. Select candidate videos from all candidate videos whose playback probability is higher than or equal to the preset playback probability, and use them as target videos that need to be preloaded.
[0079] 204. When the target video is detected to meet the preset permission conditions, a pre-decoding operation is performed on the target video based on the pre-decoder to obtain the pre-decoded data corresponding to the target video.
[0080] In this embodiment of the invention, the pre-decoding operation includes a parallel pre-decoding operation and a PTS alignment operation; the parallel pre-decoding operation includes at least a video decoding operation, or the parallel pre-decoding operation includes at least a video decoding operation and also includes an audio decoding operation and / or a subtitle decoding operation; wherein, the pre-decoding data includes video decoding data, and the video decoding data includes at least the first frame decoding data of the target video.
[0081] 205. Store the pre-decoded data in the memory cache.
[0082] 206. Based on the state transition algorithm, the decoding state information corresponding to the pre-decoded data is transferred to the determined main player.
[0083] 207. After detecting a playback command for the target video, based on the main player and the decoding status information, the pre-decoded data is read from the memory buffer and the playback operation is performed on the pre-decoded data.
[0084] In this embodiment of the invention, the playback operation includes at least the first frame rendering operation.
[0085] In this embodiment of the invention, for other detailed descriptions of steps 204-207, please refer to the detailed description of steps 102-105 in Embodiment 1. These descriptions will not be repeated in this embodiment of the invention.
[0086] As can be seen, the method described in the embodiments of the present invention can, after predicting the target video that needs to be preloaded, if the target video is detected to meet the preset permission conditions, perform a pre-decoding operation on the target video based on the pre-decoder to obtain pre-decoded data including at least the first frame decoding data, and store the pre-decoded data in the memory buffer. Then, the decoding status information corresponding to the pre-decoded data is migrated to the main player. After detecting the playback command, based on the main player and according to the decoding status information, the pre-decoded data is read from the memory buffer and the first frame data is rendered. This method can pre-decode the video before playback, thereby enabling the first frame to be rendered immediately during video playback, achieving instant video playback. This improves video parsing efficiency and video playback efficiency, significantly reduces the user's waiting time for video playback, and thus improves the user's experience of using the video playback function. Furthermore, based on behavior prediction algorithms, it can calculate the playback probability of multiple candidate videos according to the collected user behavior data and / or video information. It can then select candidate videos with a playback probability higher than or equal to a preset playback probability from all candidate videos as target videos that need to be preloaded. This enables intelligent prediction of the videos that users may play, allowing for efficient pre-decoding of the videos. This improves the intelligence of video parsing and the accuracy of determining the target video playback, thereby enhancing the accuracy and effectiveness of pre-decoding operations and ultimately improving video playback efficiency.
[0087] In an optional embodiment, performing a playback operation on the pre-decoded data may include the following operations: rendering the first frame of decoded data based on the main player; and, when the pre-decoded data also includes audio decoded data and / or subtitle decoded data, synchronously playing the audio decoded data and / or subtitle decoded data matching the first frame of decoded data based on the main player; detecting whether there is a playback adjustment instruction for the target video; wherein the playback adjustment instruction includes at least one of a variable speed playback instruction, a skip playback instruction, a loop playback instruction, a pause / resume playback instruction, a reverse playback instruction, and a combined adjustment instruction; when a playback adjustment instruction for the target video is detected, performing an adjustment playback operation on the target video based on the main player and the PTS alignment algorithm, according to the playback adjustment instruction; when no playback adjustment instruction for the target video is detected, performing a playback operation on the target video based on the main player.
[0088] The variable speed playback command is used to adjust the video playback speed, such as 0.5x speed or 2x speed. This embodiment of the invention does not limit the speed.
[0089] The playback operation on the target video may include: playing the remaining pre-decoded data, and / or, performing real-time decoding on the target video and playing the real-time decoded data.
[0090] As can be seen, this optional embodiment can render the first frame of decoded data when the target video needs to be played, and then flexibly adjust the playback operation when a playback adjustment command is detected. Otherwise, the video is played normally. It can flexibly process the decoded data under different playback conditions, improve the flexibility and accuracy of video playback, and thus help to further improve the user's experience of video playback function.
[0091] In this optional embodiment, when the playback adjustment command is a variable speed playback command, based on the main player and the PTS alignment algorithm, the target video is adjusted according to the playback adjustment command, which may include the following operations: (1) Timestamp scaling calculation: Read the original PTS corresponding to the pre-decoded data and scale it according to the playback speed coefficient: adjusted_pts = original_pts / speed_rate; where adjusted_pts is the adjusted PTS, original_pts is the original PTS, and speed_rate is the playback speed; (e.g., 0.5x speed: PTS interval is magnified by 2 times; 2x speed: PTS interval is reduced to 1 / 2); Update the inter-frame time interval: frame_interval = base_interval / speed_rate; where frame_interval is the updated inter-frame time interval; base_interval is the original inter-frame time interval; speed_rate is the playback speed; (2) Audio PTS synchronization processing: resample the audio decoding data to adjust the sampling rate or use a time stretching algorithm (e.g., WSOLA) when changing speed; (e.g., 2x speed playback: the audio PTS interval is halved, and 2x speed resampling is performed at the same time; 0.5x speed playback: the audio PTS interval is doubled, and 0.5x speed resampling is performed); (3) Frame rate adaptation: calculate the target frame rate: target_fps = original_fps × speed_rate; where target_fps is the target frame rate; original_fps is the original frame rate; speed_rate is the playback speed; different frame processing strategies are adopted based on different playback speeds to process the frame decoding data; for example, when the playback speed is the acceleration speed (e.g., 2x speed), based on the key frame priority principle, I-frames and P-frames are retained first, and a frame discarding strategy is adopted to discard some B-frames at PTS intervals to maintain smoothness; when the playback speed is the deceleration speed (e.g., 0.5x speed), key frames are repeated to avoid stuttering; (4) Buffer queue management: dynamically adjust the buffer size (e.g., reduce the buffer when accelerating playback and increase the buffer when decelerating playback); where the buffer time window needs to be recalculated: buffer_window = base_window / speed_rate; where buffer_window is the buffer time window and base_window is the original buffer time window; and, expired frames are cleaned up in time to avoid memory accumulation; (5) B-frame processing optimization: the DTS / PTS relationship of B-frames remains unchanged when the speed changes, and B-frames are reordered according to the scaled PTS.
[0092] As can be seen, this optional embodiment can also achieve variable speed playback of video by combining operations such as timestamp scaling calculation, audio PTS synchronization processing, frame rate adaptation, buffer queue management, and B-frame processing optimization with the PTS alignment algorithm, thereby improving the accuracy of variable speed playback.
[0093] In this optional embodiment, when the playback adjustment instruction is a jump playback instruction, based on the main player and the PTS alignment algorithm, the target video is adjusted and played according to the playback adjustment instruction, which may include the following operations: (1) Jump (Seek) target time positioning: receive the target timestamp (target_pts) of the Seek request; find the nearest keyframe (I-frame) position; calculate the Seek offset: seek_offset = target_pts - nearest_keyframe_pts; jump to the nearest I-frame before the target time to locate the keyframe; (2) Decoder state reset: clear the current decoder buffer; reset the decoder state to avoid using old reference frames; clear the PTS alignment buffer queue; reset the audio decoder state; (3) Re-decode from the keyframe: start decoding from the located I-frame; decode the I-frame and subsequent P-frames and B-frames in DTS order; rebuild the reference frame chain to ensure that the P-frames and B-frames can correctly reference the I-frame; continue decoding until target_pts is reached or exceeded; (4) PTS alignment reconstruction: re-establish the PTS time axis reference: base_pts = keyframe_pts; Recalculate relative PTS: relative_pts = current_pts - base_pts; Rebuild display queue: Reorder decoded frames according to PTS order; Check for PTS jumps or repetitions to verify timestamp continuity; (5) Audio and video synchronization recovery: Audio Seek synchronization, so that the audio also jumps to the corresponding time point; Recalculate audio and video synchronization offset: sync_offset = video_pts - audio_pts; Audio buffer prefill: Preload audio data to avoid mute after Seek; Synchronization window adjustment: Relax synchronization tolerance after Seek, and gradually tighten it; (6) Special processing of B frames: Re-decode all B frames starting from I frame; Ensure that B frames are correctly sorted according to PTS; Discard or re-decode B frames near the Seek point; (7) Smooth transition processing: Display frames near the target time immediately after Seek; Quickly decode and render the first frame to avoid black screen; Prioritize displaying key frames, and then supplement intermediate frames to achieve progressive loading.
[0094] As can be seen, this optional embodiment can also achieve video jump playback by performing operations such as jump target time positioning, decoder state reset, re-decoding from keyframes, PTS alignment reconstruction, audio and video synchronization restoration, B-frame special processing, and smooth transition processing, combined with the PTS alignment algorithm, which can improve the accuracy and reliability of jump playback.
[0095] In this optional embodiment, optionally, when the playback adjustment instruction is a loop playback instruction, based on the main player and the PTS alignment algorithm, the target video is adjusted for playback according to the playback adjustment instruction, which may include the following operations: (1) Loop point detection: when the end of the video is detected: current_pts>= video_duration; trigger the loop, reset the playback position to the starting point; record the number of loops to count and limit infinite loops; (2) Time axis reset: reset the PTS baseline: base_pts = 0 or base_pts = start_pts; clear the display queue; reinitialize the decoder state; (3) Re-decode from the first frame: locate the first frame of the video (the first I-frame); restart the decoding process according to the DTS order; rebuild from the first I-frame and recalculate PTS from 0; (4) Seamless loop processing: pre-decode the first frame before looping to reduce black screen; smoothly switch between the last frame and the first frame to achieve a smooth transition; loop the audio at the same time to keep the audio and video synchronized; reset the timestamp to avoid PTS overflow; (5) B-frame loop processing: B-frames near the loop point need to be re-decoded; re-establish the display order of B-frames after looping; ensure that B-frames at the loop boundary are displayed correctly; (6) Partial loop support: support loop interval: loop_start_pts to loop_end_pts; when looping within the interval: jump to the starting point after reaching the end point; map the loop interval to the range from 0 to duration to achieve PTS mapping.
[0096] As can be seen, this optional embodiment can also achieve video loop playback by combining operations such as loop point detection, timeline reset, re-decoding from the first frame, seamless loop processing, B-frame loop processing, and partial loop support with the PTS alignment algorithm, thereby improving the accuracy of loop playback.
[0097] In this optional embodiment, when the playback adjustment command is a pause / resume playback command, based on the main player and the PTS alignment algorithm, the target video is adjusted according to the playback adjustment command, which may include the following operations: under the pause command, the increment of the PTS timestamp needs to be paused and the PTS position at the time of pause needs to be recorded; and the decoding buffer needs to be retained for continued use when resuming playback; under the resume playback command, the PTS increment needs to continue from the pause point and the time offset needs to be recalculated: resume_offset = current_time - pause_pts; and then the synchronized audio and video timestamps are restored.
[0098] As can be seen, this optional embodiment can also achieve precise control over pausing and resuming video playback by controlling the increment of the PTS timestamp.
[0099] In this optional embodiment, when the playback adjustment command is a reverse playback command, based on the main player and the PTS alignment algorithm, the target video is adjusted according to the playback adjustment command, which may include the following operations: first, the PTS is calculated in reverse, such as: reverse_pts = total_duration - current_pts; then, the frames are displayed in reverse PTS order, and the decoding order is adjusted, and the reference relationship of B frames needs to be specially handled; the audio also needs to be played in reverse or muted.
[0100] As can be seen, this optional embodiment can also reverse the PTS by calculating the PTS in reverse and displaying the frames in reverse order according to the PTS book order, adjust the decoding order, and perform reverse processing or mute processing on the audio data to achieve reverse playback of video, thereby improving the accuracy of video and audio processing during reverse playback.
[0101] In this optional embodiment, when the playback adjustment instruction is a combined adjustment instruction, based on the main player and the PTS alignment algorithm, the target video is adjusted and played according to the playback adjustment instruction. This may include the following operations: when the combined adjustment instruction is a speed-up playback instruction mixed with a jump playback instruction: Seek positioning is performed first, and then the speed-up coefficient is applied; that is, the jump playback operation is performed first, and then the speed-up playback operation is performed; when the combined adjustment instruction is a loop playback instruction mixed with a speed-up playback instruction, the playback speed of the speed-up playback operation is maintained during the loop playback operation.
[0102] Optionally, the execution priority of the instructions included in the combined adjustment instructions can be the priority of the jump playback instruction, which is higher than the priority of the loop playback instruction, which is higher than the speed change playback instruction, so that they are processed according to the execution priority.
[0103] As can be seen, this optional embodiment can also execute the processing operations corresponding to the combined adjustment instructions in sequence based on the priority of different instructions, thereby improving the accuracy of playback control in complex playback scenarios.
[0104] In an optional embodiment, after predicting the target video that needs to be preloaded, the method may further include the following operations: obtaining user credential information, second video information of the target video, and device information of the electronic device; generating an authentication request corresponding to the target video based on the user credential information, second video information, and device information; sending the authentication request to the server corresponding to the application; upon receiving the request response information corresponding to the authentication request returned by the server, parsing the request response information to obtain the authentication request result; wherein the authentication request result includes the authentication result corresponding to the target video; when the authentication result is used to indicate successful authentication, determining that the target video meets the preset permission conditions; when the authentication result is used to indicate authentication failure, determining that the target video does not meet the preset permission conditions.
[0105] Optionally, the user credential information may include a user ID and / or a token, which is not limited in this embodiment of the invention; optionally, the video information may include a video identifier (e.g., video ID).
[0106] This can be achieved by encapsulating video ID, user credentials, device information, etc., into an authentication request.
[0107] Optionally, the server can be an authentication server, and the authentication request can be an HTTP request. Further, the request method can be POST. This embodiment of the invention does not impose any limitations.
[0108] Optionally, the authentication request result may also include the permission level and / or permission expiration time, which is not limited in this embodiment of the invention.
[0109] Optionally, the authentication request result can be cached in memory to avoid duplicate requests.
[0110] Optionally, when the authentication result is used to indicate authentication failure, the error can be logged and subsequent preloading can be prevented.
[0111] As can be seen, this optional embodiment can generate an authentication request corresponding to the target video based on the obtained user credential information, the second video information of the target video, and the device information of the electronic device, and send the authentication request to the server. Then, by parsing the request response information returned by the server, the authentication request result is obtained. If the authentication result indicates successful authentication, it is determined that the target video meets the preset permission conditions; otherwise, it is determined that the target video does not meet the preset permission conditions. The authentication operation can be performed before the video is pre-decoded, thereby improving the reliability of the permission verification of the user, the target video, and the electronic device, while improving the accuracy of the pre-decoding operation, which is conducive to more efficient use of the resources required for video parsing.
[0112] In this optional embodiment, the server may optionally verify the authentication request in the following ways: verifying the user's viewing permissions to determine if the user has permission to watch the target video, and obtaining a viewing permission verification result; for example, verifying whether the user has VIP privileges, and / or whether the user has paid for the target video, and / or whether the target video can be played in the user's region; and / or verifying the content access permissions of the target video to determine if the video is visible to the user, and obtaining a content access permission verification result; for example, verifying whether the target video is currently unavailable or under review; and / or, when the target video is encrypted content, verifying whether the electronic device and / or the user have decryption and playback permissions for the target video, and obtaining a decryption and playback permission verification result; and / or verifying an access token (Access Token). The authentication request result is determined based on at least one of the following: whether the token is valid and has not expired; and / or, whether the device binding permission is verified to verify whether the device has been authorized under the multi-device restriction condition; and the authentication request result is determined based on at least one of the following: user viewing permission verification result, content access permission verification result, decryption playback permission verification result, token verification result, and device binding permission verification result.
[0113] When all of the above verification operations pass, the authentication result can be determined as successful authentication.
[0114] As can be seen, this optional embodiment can also authenticate user viewing permissions, content access permissions, decryption playback permissions, token permissions, device binding permissions, and other aspects, which helps to improve the comprehensiveness and reliability of permission verification, thereby further improving the accuracy of pre-decoding operations.
[0115] In an optional embodiment, after predicting the target video that needs to be preloaded, the method may further include loading the configuration information required for the target video.
[0116] Optionally, the configuration information may include at least one of the following: player configuration information, decoder configuration information, network configuration information, cache configuration information, subtitle configuration information, audio configuration information, and user preference configuration information.
[0117] Further optionally, the player configuration information may include at least one of the following: player type (e.g., native, Web), playback mode (autoplay, loop playback, mute, etc.), playback speed setting, and image quality selection strategy; the decoder configuration information may include at least one of the following: hardware / software decoder selection, decoder parameters (buffer size, number of threads, etc.), and a list of supported encoding formats; the network configuration information may include at least one of the following: network timeout, number of retries, and retry strategy; the cache configuration information may include at least one of the following: cache size limit, cache path setting, cache cleanup strategy, and preloaded cache size; the subtitle configuration information may include at least one of the following: default subtitle language, subtitle font, size, color, subtitle position and style, and subtitle on / off status; the audio configuration information may include at least one of the following: default audio track, volume setting, and audio enhancement options (equalizer, 3D sound effects, etc.); and the user preference configuration information may include at least one of the following: historical playback progress, user favorite / like status, playback history, and personalized recommendation parameters. This embodiment of the invention does not impose any limitations on these aspects.
[0118] As can be seen, this optional embodiment can realize intelligent loading of configuration information, which is beneficial to improve the execution reliability and execution efficiency of pre-decoding operation based on configuration information.
[0119] In this embodiment of the invention, the video playback method can be illustrated by referring to Figure 3, which is a schematic flowchart of another video playback method disclosed in this embodiment of the invention. As shown in Figure 3, the method can be as follows: after predicting the video that the user is about to play, a preloading operation is started: first, an authentication operation is performed; if the authentication is successful, configuration information is loaded; and then, frame decoding, subtitle decoding, and audio decoding operations are performed in parallel to complete the pre-decoding operation. After the user clicks play, the first frame data is rendered to achieve instant video playback.
[0120] Please refer to Figure 4 for Embodiment 3. Figure 4 is a schematic diagram of a video playback device disclosed in an embodiment of the present invention. The video playback device described in Figure 4 may include one of a smart device, a smart terminal, a smart system, and a server. The server may be a local server or a cloud server; this embodiment of the present invention does not limit the specific type of server. The device can be applied to an electronic device with an application installed, and the electronic device is communicatively connected to a network attached storage device. The electronic device can access the network attached storage device through the application; this embodiment of the present invention does not limit the specific type of device. As shown in Figure 4, the video playback device 30 may include: a prediction module 301, used to predict the target video that needs to be preloaded; a pre-decoding module 302, used to perform a pre-decoding operation on the target video based on the pre-decoder when the target video is detected to meet the preset permission conditions, to obtain the pre-decoding data corresponding to the target video; wherein, the pre-decoding operation includes parallel pre-decoding operation and PTS alignment operation; the parallel pre-decoding operation includes at least a video decoding operation, or the parallel pre-decoding operation includes at least a video decoding operation, and also includes an audio decoding operation and / or a subtitle decoding operation; wherein, the pre-decoding data includes video decoding data, and the video decoding data includes at least the first frame decoding data of the target video; a caching module 303, used to store the pre-decoding data in a memory cache; a migration module 304, used to migrate the decoding state information corresponding to the pre-decoding data to the determined main player based on a state migration algorithm; and a playback module 305, used to read the pre-decoding data from the memory cache based on the decoding state information and the main player after detecting a playback instruction for the target video, and to perform a playback operation on the pre-decoding data; wherein, the playback operation includes at least a first frame rendering operation.
[0121] As can be seen, the apparatus described in the embodiments of the present invention can, after predicting the target video that needs to be preloaded, if the target video is detected to meet the preset permission conditions, perform a pre-decoding operation on the target video based on the pre-decoder to obtain pre-decoded data including at least the first frame decoding data, store the pre-decoded data in the memory buffer, and then migrate the decoding status information corresponding to the pre-decoded data to the main player. After detecting the playback command, based on the main player and according to the decoding status information, the pre-decoded data is read from the memory buffer and the first frame data is rendered. It can pre-decode the video before video playback, so that the first frame can be rendered immediately when the video is played, achieving instant video playback. This improves video parsing efficiency and video playback efficiency, significantly reduces the user's waiting time for video playback, and thus improves the user's experience of video playback function.
[0122] In an optional embodiment, the pre-decoding module 302 performs a pre-decoding operation on the target video based on the pre-decoder to obtain the pre-decoded data corresponding to the target video. This process may include: determining a preloading strategy for the target video based on the obtained strategy adjustment reference parameters; wherein the strategy adjustment reference parameters include at least one of network status information, device performance information, and battery status information corresponding to the electronic device; obtaining the data to be decoded in the target video that matches the preloading strategy, wherein the data to be decoded includes at least the first frame data corresponding to the target video; calling the pre-decoding interface corresponding to the pre-decoder to perform a parallel pre-decoding operation on the data to be decoded, obtaining the parallel decoded data corresponding to the target video; wherein the pre-decoder is a hardware decoder or a software decoder; and performing a PTS alignment operation on the parallel decoded data based on the PTS alignment algorithm to obtain the pre-decoded data corresponding to the target video.
[0123] As can be seen, the apparatus described in this optional embodiment can adjust reference parameters according to the acquired strategy, intelligently adjust the preloading strategy for the target video, acquire the data to be decoded according to the preloading strategy, and then call the pre-decoding interface corresponding to the pre-decoder to perform parallel pre-decoding operations on the data to be decoded, thereby obtaining the parallel decoded data corresponding to the target video. Then, based on the PTS alignment algorithm, PTS alignment operations are performed on the parallel decoded data to obtain the pre-decoded data corresponding to the target video. This can improve the efficiency and flexibility of acquiring the data to be loaded while realizing intelligent adjustment of the data loading strategy, thereby facilitating the adjustment of the amount of data that needs to be pre-decoded, so as to perform the pre-decoding operation more efficiently, ensuring that at least the first frame of data can be decoded, and thus ensuring the rendering of at least the first frame of data during subsequent playback; and, through PTS alignment technology, the display timestamps of all pre-decoded data can be aligned, which is beneficial to ensuring the synchronous playback of audio, video, and subtitles during subsequent playback, thereby improving the accuracy of video playback.
[0124] In this optional embodiment, the specific method by which the pre-decoding module 302 performs parallel pre-decoding operations on the data to be decoded to obtain parallel decoded data corresponding to the target video may include: determining the first keyframe of the data to be decoded based on the video metadata corresponding to the target video, and locating the first keyframe at the data reading position of the data to be decoded; wherein the first keyframe is the first frame to be rendered; determining the timestamp information corresponding to each frame data of the data to be decoded based on the video metadata; wherein the timestamp information corresponding to each frame data includes a decoding timestamp and a display timestamp; reading the frame data in the data to be decoded based on the data reading position; performing video decoding operations on all the read frame data based on the decoding timestamp corresponding to each frame data to obtain a first video decoding buffer queue; wherein the first video decoding buffer queue includes frame decoding data; when the video data of the target video belongs to a complex encoding format, sorting the frame decoding data in the video decoding buffer queue based on the display timestamp corresponding to each frame data to obtain a second video decoding buffer queue; wherein the parallel decoding data includes parallel video decoding data, and the parallel video decoding data includes either the first video decoding buffer queue or the second video decoding buffer queue.
[0125] As can be seen, the apparatus described in this optional embodiment can also, when decoding video data, determine the first keyframe, i.e., the first frame, of the data to be decoded based on the video metadata corresponding to the target video, and locate the data reading position corresponding to the first frame, so as to read the frame data in the data to be decoded based on the data reading position; and, based on the video metadata, determine the timestamp information corresponding to each frame data, so as to perform video decoding operation on all the read frame data based on the decoding timestamp to obtain a first video decoding buffer queue. Furthermore, when the video data of the target video belongs to a complex encoding format, the frame decoding data in the video decoding buffer queue is reordered based on the display timestamp to obtain a second video decoding buffer queue. It can decode and render video frame data according to different timestamp orders by processing the relationship between DTS and PTS, which can improve decoding efficiency and playback accuracy of decoded data.
[0126] In an optional embodiment, the decoding state information includes one or more combinations of the following: the decoding position corresponding to the pre-decoded data, the timestamp information corresponding to the pre-decoded data, the cache position of the pre-decoded data in the memory cache, and the decoder configuration information corresponding to the decoder. The migration module 304, based on a state migration algorithm, migrates the decoding state information corresponding to the pre-decoded data to the determined main player in the following specific ways: performing a state migration operation on the decoding state information corresponding to the pre-decoded data; wherein the state migration operation includes multiple migration steps; the state migration operation is used to migrate the decoding state information to the determined main player; during the state migration operation on the decoding state information, when all migration steps are executed successfully, the migration result corresponding to the state migration operation is determined to be a successful migration; when any migration step fails, the migration result corresponding to the state migration operation is determined to be a failed migration, and a rollback operation for the state migration operation is triggered.
[0127] As can be seen, the apparatus described in this optional embodiment can perform a state transition operation on the decoding state information corresponding to the pre-decoded data to transition the decoding state information to the determined main player. During the state transition operation, if all transition steps are executed successfully, the state transition can be determined to be successful; if any transition step fails, the transition fails, and a rollback operation for the state transition operation is triggered. This can improve the reliability of the state transition operation while achieving seamless transition of the pre-decoded state to the main player, enabling the main player to fully and efficiently receive the pre-decoded results, avoiding waste of decoding results and anomalies during video playback, and improving the reliability and smoothness of subsequent video playback.
[0128] In an optional embodiment, the playback module 305 may perform playback operations on the pre-decoded data in the following manner: rendering the first frame of decoded data based on the main player; and, when the pre-decoded data also includes audio decoded data and / or subtitle decoded data, synchronously playing the audio decoded data and / or subtitle decoded data matching the first frame of decoded data based on the main player; detecting whether there is a playback adjustment instruction for the target video; wherein the playback adjustment instruction includes at least one of variable speed playback instruction, jump playback instruction, loop playback instruction, pause / resume playback instruction, reverse playback instruction, and combined adjustment instruction; when a playback adjustment instruction for the target video is detected, performing an adjustment playback operation on the target video based on the main player and the PTS alignment algorithm, according to the playback adjustment instruction; when no playback adjustment instruction for the target video is detected, performing a playback operation on the target video based on the main player.
[0129] As can be seen, the apparatus described in this optional embodiment can render the first frame of decoded data when the target video needs to be played, and then flexibly adjust the playback operation when a playback adjustment command is detected. Otherwise, the video is played normally. It can flexibly process the decoded data under different playback conditions, improve the flexibility and accuracy of video playback, and thus help to further improve the user's experience of video playback function.
[0130] In an optional embodiment, the prediction module 301 may predict the specific method of the target video to be preloaded, including: collecting video prediction reference data of the user on the application; wherein the video prediction reference data includes the user's corresponding behavior data and / or the first video information corresponding to the currently playing video; calculating the playback probability of multiple candidate videos based on the behavior prediction algorithm and the video prediction reference data; and selecting candidate videos with a playback probability higher than or equal to a preset playback probability from all candidate videos as the target videos to be preloaded.
[0131] As can be seen, the apparatus described in this optional embodiment can calculate the playback probability of multiple candidate videos based on a behavior prediction algorithm and the collected user behavior data and / or video information. It can then select candidate videos with a playback probability higher than or equal to a preset playback probability from all candidate videos as target videos that need to be preloaded. This enables intelligent prediction of the videos that the user may play, allowing for efficient pre-decoding of the video. This improves the intelligence of video parsing and the accuracy of determining the playback of the target video, thereby improving the accuracy and effectiveness of the pre-decoding operation and further enhancing video playback efficiency.
[0132] In an optional embodiment, as shown in FIG5, the device may further include: an acquisition module 306, configured to acquire user credential information, second video information of the target video, and device information of the electronic device after the prediction module 301 predicts the target video that needs to be preloaded; a generation module 307, configured to generate an authentication request corresponding to the target video based on the user credential information, second video information, and device information; a sending module 308, configured to send the authentication request to the server corresponding to the application; a parsing module 309, configured to parse the request response information corresponding to the authentication request returned by the server to obtain the authentication request result; wherein the authentication request result includes the authentication result corresponding to the target video; and a determination module 310, configured to determine that the target video meets the preset permission conditions when the authentication result indicates successful authentication, and determine that the target video does not meet the preset permission conditions when the authentication result indicates failed authentication.
[0133] As can be seen, the apparatus described in this optional embodiment can generate an authentication request corresponding to the target video based on the obtained user credential information, the second video information of the target video, and the device information of the electronic device, and send the authentication request to the server. Then, by parsing the request response information returned by the server, the authentication request result is obtained. If the authentication result indicates successful authentication, it is determined that the target video meets the preset permission conditions; otherwise, it is determined that the target video does not meet the preset permission conditions. The authentication operation can be performed before the video is pre-decoded, thereby improving the reliability of the permission verification of the user, the target video, and the electronic device, while improving the accuracy of the pre-decoding operation, which is conducive to more efficient use of the resources required for video parsing.
[0134] Please refer to Figure 6 for Embodiment 4. Figure 5 is a schematic diagram of the structure of an electronic device disclosed in an embodiment of the present invention. As shown in Figure 6, the electronic device 40 may include: a memory 401 storing executable program code; a processor 402 coupled to the memory 401; the processor 402 calls the executable program code stored in the memory 401 to execute some or all of the steps in the video playback method described in Embodiment 1 or Embodiment 2 of the present invention.
[0135] Example 5: This embodiment of the invention discloses a video playback system. Please refer to Figure 7, which is a schematic diagram of the structure of a video playback system disclosed in this embodiment. As shown in Figure 7, the video playback system includes a video playback device 30 as described in Example 3 of this invention, and a network-attached storage device 50 communicatively connected to the video playback device 30; wherein, the video playback device 30 pre-decodes the target video before video playback according to the video playback method described in Example 1 or Example 2 of this invention to achieve low-latency playback of the target video; or, as another optional implementation in this embodiment, please refer to Figure 8, which is a schematic diagram of the structure of another video playback system disclosed in this embodiment. As shown in Figure 8, the video playback system includes an electronic device 40 as described in Example 4 of this invention, and a network-attached storage device 50 communicatively connected to the electronic device 40; wherein, the electronic device 40 pre-decodes the target video before video playback according to the video playback method described in Example 1 or Example 2 of this invention to achieve low-latency playback of the target video.
[0136] Example 6: This embodiment of the invention discloses a computer storage medium storing computer instructions. When these computer instructions are invoked, they are used to execute some or all of the steps in the video playback method described in Example 1 or Example 2 of the invention.
[0137] Example 7: This embodiment of the invention discloses a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to perform some or all of the steps in the video playback method described in Example 1 or Example 2.
[0138] The device embodiments described above are merely illustrative. The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0139] Through the detailed description of the above embodiments, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, including read-only memory (ROM), random access memory (RAM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), one-time programmable read-only memory (OTPROM), electrically-Erasable Programmable Read-Only Memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, disk storage, magnetic tape storage, or any other computer-readable medium that can be used to carry or store data.
[0140] Finally, it should be noted that the video playback method, apparatus, electronic device, and system disclosed in the embodiments of the present invention are merely preferred embodiments of the present invention and are only used to illustrate the technical solutions of the present invention, not to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A video playback method, characterized in that, The method is applied to an electronic device with an application installed, and the electronic device is communicatively connected to a network attached storage device (NETS). The electronic device can access the NETS through the application. The method includes: predicting a target video that needs to be preloaded; when the target video meets preset permission conditions, performing a pre-decoding operation on the target video based on a pre-decoder to obtain pre-decoded data corresponding to the target video; wherein the pre-decoding operation includes parallel pre-decoding operation and PTS alignment operation; the parallel pre-decoding operation includes at least a video decoding operation, or the parallel pre-decoding operation includes at least the video decoding operation and further includes audio decoding operation and / or subtitle decoding operation; wherein the pre-decoded data includes video decoding data, and the video decoding data includes at least the first frame decoding data of the target video; storing the pre-decoded data in a memory buffer; migrating the decoding state information corresponding to the pre-decoded data to a determined main player based on a state transition algorithm; after detecting a playback command for the target video, reading the pre-decoded data from the memory buffer based on the decoding state information using the main player, and performing a playback operation on the pre-decoded data; wherein the playback operation includes at least a first frame rendering operation.
2. The video playback method according to claim 1, characterized in that, The step of performing a pre-decoding operation on the target video based on a pre-decoder to obtain pre-decoded data corresponding to the target video includes: determining a preloading strategy for the target video based on obtained strategy adjustment reference parameters; wherein the strategy adjustment reference parameters include at least one of network status information corresponding to the electronic device, device performance information corresponding to the electronic device, and battery status information corresponding to the electronic device; obtaining data to be decoded in the target video that matches the preloading strategy according to the preloading strategy; wherein the data to be decoded includes at least the first frame data corresponding to the target video; calling the pre-decoding interface corresponding to the pre-decoder to perform the parallel pre-decoding operation on the data to be decoded to obtain parallel decoded data corresponding to the target video; wherein the pre-decoder is a hardware decoder or a software decoder; and performing the PTS alignment operation on the parallel decoded data based on the PTS alignment algorithm to obtain the pre-decoded data corresponding to the target video.
3. The video playback method according to claim 2, characterized in that, The step of performing the parallel pre-decoding operation on the data to be decoded to obtain the parallel decoding data corresponding to the target video includes: determining the first keyframe of the data to be decoded based on the video metadata corresponding to the target video, and locating the first keyframe at the data reading position of the data to be decoded; wherein the first keyframe is the first frame to be rendered; determining the timestamp information corresponding to each frame data of the data to be decoded based on the video metadata; wherein the timestamp information corresponding to each frame data includes a decoding timestamp and a display timestamp; reading the frame data in the data to be decoded based on the data reading position; performing a video decoding operation on all the read frame data based on the decoding timestamp corresponding to each frame data to obtain a first video decoding buffer queue; wherein the first video decoding buffer queue includes frame decoding data; when the video data of the target video belongs to a complex encoding format, sorting the frame decoding data in the video decoding buffer queue based on the display timestamp corresponding to each frame data to obtain a second video decoding buffer queue; wherein the parallel decoding data includes parallel video decoding data, and the parallel video decoding data includes either the first video decoding buffer queue or the second video decoding buffer queue.
4. The video playback method according to claim 1, characterized in that, The decoding state information includes one or more combinations of the decoding position corresponding to the pre-decoding data, the timestamp information corresponding to the pre-decoding data, the cache position of the pre-decoding data in the memory cache, and the decoder configuration information corresponding to the decoder; wherein, the step of migrating the decoding state information corresponding to the pre-decoding data to the determined main player based on the state transition algorithm includes: performing a state transition operation on the decoding state information corresponding to the pre-decoding data; wherein, the state transition operation includes multiple transition steps; the state transition operation is used to migrate the decoding state information to the determined main player; during the process of performing the state transition operation on the decoding state information, when all the transition steps are executed successfully, the transition result corresponding to the state transition operation is determined to be a successful transition; when any of the transition steps fails, the transition result corresponding to the state transition operation is determined to be a failed transition, and a rollback operation for the state transition operation is triggered.
5. The video playback method according to claim 1, characterized in that, The step of performing a playback operation on the pre-decoded data includes: rendering the first frame decoded data based on the main player; and, when the pre-decoded data also includes audio decoded data and / or subtitle decoded data, synchronously playing the audio decoded data and / or subtitle decoded data matching the first frame decoded data based on the main player; detecting whether there is a playback adjustment instruction for the target video; wherein the playback adjustment instruction includes at least one of a variable speed playback instruction, a skip playback instruction, a loop playback instruction, a pause / resume playback instruction, a reverse playback instruction, and a combined adjustment instruction; when a playback adjustment instruction for the target video is detected, performing an adjustment playback operation on the target video based on the main player and the PTS alignment algorithm, according to the playback adjustment instruction; when no playback adjustment instruction for the target video is detected, performing a playback operation on the target video based on the main player.
6. The video playback method according to any one of claims 1-5, characterized in that, The prediction of the target video to be preloaded includes: collecting video prediction reference data of the user on the application; wherein, the video prediction reference data includes the user's corresponding behavior data and / or the first video information corresponding to the currently playing video; based on the behavior prediction algorithm, calculating the playback probability of multiple candidate videos according to the video prediction reference data; and selecting candidate videos from all the candidate videos whose playback probability is higher than or equal to a preset playback probability as the target videos to be preloaded.
7. The video playback method according to any one of claims 1-5, characterized in that, After predicting the target video that needs to be preloaded, the method further includes: obtaining user credential information, second video information of the target video, and device information of the electronic device; generating an authentication request corresponding to the target video based on the user credential information, the second video information, and the device information; sending the authentication request to the server corresponding to the application; upon receiving a request response information corresponding to the authentication request returned by the server, parsing the request response information to obtain an authentication request result; wherein, the authentication request result includes the authentication result corresponding to the target video; when the authentication result indicates successful authentication, determining that the target video meets preset permission conditions; when the authentication result indicates failed authentication, determining that the target video does not meet preset permission conditions.
8. A video playback device, characterized in that, The device is applied to an electronic device with an application installed, and the electronic device is communicatively connected to a network-attached storage device (NAT), which can access the NAT via the application. The device includes: a prediction module for predicting a target video that needs to be preloaded; and a pre-decoding module for performing a pre-decoding operation on the target video based on a pre-decoder when the target video is detected to meet preset permission conditions, to obtain pre-decoded data corresponding to the target video. The pre-decoding operation includes parallel pre-decoding and PTS alignment; the parallel pre-decoding operation includes at least a video decoding operation, or the parallel pre-decoding operation includes at least the video decoding... The operation also includes audio decoding and / or subtitle decoding; wherein the pre-decoding data includes video decoding data, and the video decoding data includes at least the first frame decoding data of the target video; a caching module is used to store the pre-decoding data in a memory cache; a migration module is used to migrate the decoding state information corresponding to the pre-decoding data to the determined main player based on a state migration algorithm; a playback module is used to, after detecting a playback instruction for the target video, read the pre-decoding data from the memory cache based on the main player and the decoding state information, and perform a playback operation on the pre-decoding data; wherein the playback operation includes at least a first frame rendering operation.
9. An electronic device, characterized in that, The electronic device includes: a memory storing executable program code; a processor coupled to the memory; the processor calling the executable program code stored in the memory to execute the video playback method as described in any one of claims 1-7.
10. A video playback system, characterized in that, The system includes a video playback device as described in claim 8, and a network-attached storage device communicatively connected to the video playback device; wherein the video playback device pre-decodes the target video before video playback according to the video playback method as described in any one of claims 1-7 to achieve low-latency playback of the target video; or, the system includes an electronic device as described in claim 9, and a network-attached storage device communicatively connected to the electronic device; wherein the electronic device pre-decodes the target video before video playback according to the video playback method as described in any one of claims 1-7 to achieve low-latency playback of the target video.
11. A computer storage medium, characterized in that, The computer storage medium stores computer instructions, which, when invoked, are used to execute the video playback method as described in any one of claims 1-7.