Video processing method and apparatus and terminal device
By obtaining and rendering video frames in the cache in the order of time stamps from large to small, the problem of low video reversal efficiency in the prior art is solved, and an efficient video reversal effect is achieved.
Patent Information
- Application Number
- PCT/CN2024/139571
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-01-30
- Filing Date
- 2024-12-16
- Publication Date
- 2025-08-07
AI Technical Summary
In the prior art, the efficiency of video reversal playback is low, mainly because the decoder can only decode video frames backward, resulting in redundant decoding and high complexity.
By acquiring multiple video segments of video material, decoding order is determined based on the timestamp of the video frame, video frames and timestamps are stored in the cache, and video frames are obtained and rendered in the order of timestamps from large to small, so as to achieve video reversal playback.
It reduces the complexity of video replay, improves the efficiency of video replay, avoids redundant decoding, and achieves efficient video replay effect.
Smart Images

Figure CN2024139571_07082025_PF_FP_ABST
Abstract
Description
Video processing method, device and terminal equipment
[0001] This application claims priority to Chinese Patent Application No. 202410132428.5 filed on January 30, 2024, and the contents of the above-mentioned Chinese patent application disclosure are hereby incorporated by reference in their entirety as a part of this application. Technical Field
[0002] The embodiments of the present disclosure relate to a video processing method, apparatus, and terminal device. Background Art
[0003] Reverse video playback means playing a normally recorded video in reverse order, making the picture look different from the video played forward.
[0004] Terminal devices can reverse playback of a single, complete video clip. For example, the terminal device can adjust the timestamps of the video clip's frames so that the first frame played on the timeline is the last frame of the clip. This allows the video clip to play in reverse as the timeline moves forward. However, the decoder can only decode frames backward, resulting in low efficiency for reverse playback of edited videos. Summary of the Invention
[0005] The present disclosure provides a video processing method, apparatus, and terminal device for solving one or more technical problems in the prior art.
[0006] In a first aspect, the present disclosure provides a video processing method, the video processing method comprising:
[0007] Get the video material in the video;
[0008] Decoding the video material to obtain multiple video frames corresponding to the video material;
[0009] Storing a plurality of video frames corresponding to the video material and a timestamp corresponding to each video frame in a cache corresponding to the video material;
[0010] The video frames of the video material are obtained in a cache corresponding to the video material in descending order of timestamps, and the video frames are rendered and displayed based on the video frames of the video material to achieve reverse playback of the video.
[0011] In a second aspect, the present disclosure provides a video processing device, comprising a first acquisition module, a decoding module, a storage module, a second acquisition module, and a display module, wherein:
[0012] The first acquisition module is used to acquire video material in the video;
[0013] The decoding module is used to decode the video material to obtain multiple video frames corresponding to the video material;
[0014] The storage module is used to store multiple video frames corresponding to the video material and a timestamp corresponding to each video frame in a cache corresponding to the video material;
[0015] The second acquisition module is used to acquire video frames of the video material in a cache corresponding to the video material in descending order of timestamps;
[0016] The display module is used to render and display the video frames based on the video frames of the video material, so as to achieve reverse playback of the video.
[0017] In a third aspect, an embodiment of the present disclosure provides a terminal device including: a processor and a memory;
[0018] The memory stores computer-executable instructions;
[0019] The processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the video processing method as described in the first aspect and various possible aspects of the first aspect.
[0020] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the video processing method as described in the first aspect and various possible aspects of the first aspect are implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0022] FIG1 is a schematic diagram of an application scenario provided by an embodiment of the present disclosure;
[0023] FIG2 is a flow chart of a video processing method provided by an embodiment of the present disclosure;
[0024] FIG3 is a schematic diagram of a timeline reverse playback provided by an embodiment of the present disclosure;
[0025] FIG4 is a schematic diagram of a cache provided by an embodiment of the present disclosure;
[0026] FIG5 is a schematic diagram of a first video segment and a second video segment provided by an embodiment of the present disclosure;
[0027] FIG6 is a schematic diagram of storing video frames in a cache according to an embodiment of the present disclosure;
[0028] FIG7 is a schematic diagram of a method for reverse playback of audio material provided by an embodiment of the present disclosure;
[0029] FIG8 is a schematic diagram of a process for determining target audio data provided by an embodiment of the present disclosure;
[0030] FIG9 is a schematic diagram of a process for storing target audio data provided by an embodiment of the present disclosure;
[0031] FIG10 is a schematic diagram of a video processing method according to an embodiment of the present disclosure;
[0032] FIG11 is a schematic structural diagram of a video processing device provided by an embodiment of the present disclosure;
[0033] FIG12 is a schematic structural diagram of a terminal device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0034] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all possible embodiments consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
[0035] To facilitate understanding, the concepts involved in the embodiments of the present disclosure are explained below.
[0036] Terminal device: is a device with wireless transceiver function. The terminal device can be deployed on land, including indoors or outdoors, handheld, wearable or vehicle-mounted. The terminal device can be a mobile phone, a tablet computer, a computer with wireless transceiver function, a virtual reality (VR) terminal device, an augmented reality (AR) terminal device, a wireless terminal in industrial control, a vehicle-mounted terminal device, a wireless terminal in self-driving, a wireless terminal device in remote medical, a wireless terminal device in smart grid, a wireless terminal device in transportation safety, a wireless terminal device in smart city, a wireless terminal device in smart home, a wearable terminal device, etc. The terminal device involved in the embodiments of the present disclosure can also be called a terminal, user equipment (UE), an access terminal device, a vehicle-mounted terminal, an industrial control terminal, a UE unit, a UE station, a mobile station, a mobile station, a remote station, a remote terminal device, a mobile device, a UE terminal device, a wireless communication device, a UE agent or a UE device, etc. Terminal devices can also be fixed or mobile.
[0037] In related art, video reversal refers to playing a normally recorded video in reverse order, so that the picture presents a different effect than the video played forward. For example, if the video shows an object moving from left to right, the reversed video of the video can show the object moving from right to left. Currently, terminal devices can perform reverse playback processing on a single complete video material. For example, the terminal device can adjust the playback order of the video frames in the video so that the timestamp of the last video frame in the video is the smallest and the timestamp of the first video frame in the video is the largest. In this way, when the terminal device plays the video in order from small to large timestamps, the video material can achieve a reverse playback effect. However, the decoder can only decode frames backward. For example, when the terminal device obtains the last video frame, it needs to decode the video frame before the last video frame once. When the terminal device obtains the second-to-last video frame, it needs to decode the video frame before the second-to-last video frame again. This causes the terminal device to repeatedly decode the video frames in the video. Therefore, the complexity of video reversal is high, which leads to low efficiency of video reversal.
[0038] In order to solve the technical problems in the related art, the embodiment of the present disclosure provides a video processing method, wherein a terminal device can obtain video material in a video, the terminal device can determine multiple video segments corresponding to the video material, and determine the decoding order corresponding to the multiple video segments according to the timestamps of the video frames in each video segment. The terminal device can decode the multiple video segments according to the decoding order corresponding to the multiple video segments to obtain multiple video frames of the video material, and store the multiple video frames corresponding to the video material and the timestamps corresponding to each video frame in the cache corresponding to the video material. The terminal device can obtain the video frames of the video material in the order of timestamps from large to small in the cache corresponding to the video material, and render and display the video frames based on the video frames of the video material, thereby playing the video in reverse. In the above method, since the cache corresponding to the video material can store multiple video frames corresponding to the video material decoded by the terminal device, the terminal device can obtain the video frames from back to front (i.e., timestamps from large to small) in the cache, thereby playing the video in reverse. In this way, redundant decoding can be avoided, the complexity of video playback can be reduced, and the efficiency of video playback can be improved.
[0039] The application scenario of the embodiment of the present disclosure is described below with reference to FIG1 .
[0040] FIG1 is a schematic diagram of an application scenario provided by an embodiment of the present disclosure. Please refer to FIG1 , which includes: a timeline. The timeline includes video material 1, video material 2, and a play head. The play head can indicate the video frame being played. The play head can be moved from back to front along the timeline, so that the video frames in video material 1 and video material 2 can be played from back to front on the timeline. In this way, the terminal device does not need to adjust the order of the video frames in video material 1 and video material 2 to achieve the effect of video reverse playback, thereby reducing the complexity of video reverse playback and improving the efficiency of editing video reverse playback.
[0041] It should be noted that FIG1 is only an example of an application scenario of the embodiment of the present disclosure, and does not limit the application scenario of the embodiment of the present disclosure.
[0042] The following detailed description of the technical solution of the present disclosure and how the technical solution of the present disclosure solves the above-mentioned technical problems is provided with specific embodiments. The following specific embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. The embodiments of the present disclosure will be described below in conjunction with the accompanying drawings.
[0043] FIG2 is a flow chart of a video processing method provided by an embodiment of the present disclosure. Referring to FIG2 , the method may include:
[0044] S201: Obtain video material in the video.
[0045] The execution subject of the embodiment of the present disclosure may be a terminal device, or a video processing device provided in the terminal device. The video processing device may be implemented based on software, or based on a combination of software and hardware, which is not limited in the embodiment of the present disclosure.
[0046] The video may be a video to be played back, and the video may include at least one video material. For example, the video may include one video material, or may include multiple video materials, which form a picture of the video.
[0047] Optionally, the video material may be a video material to be played back. For example, when editing a video, the video track corresponding to the video may include at least one video material. When the terminal device performs reverse playback, each video material in the video track may be a video material to be played back.
[0048] The timeline of the video editor can include video materials of the video. The timeline can be a horizontal line on the video editing page, which is used to display the order and duration of the video materials on the timeline. For example, a user can add at least one video material to the timeline, wherein each video material can be a video material to be played back. For example, the timeline can include multiple materials such as multiple videos, audios, and images, and the user can move multiple materials to different positions to adjust the playback order and duration of the multiple materials. For example, the larger the proportion of the material on the timeline, the longer the duration of the material, and the smaller the proportion of the material on the timeline, the shorter the duration of the material. For example, in the embodiment shown in Figure 1, the timeline includes video material 1 and video material 2, and video material 1 is played first on the timeline, and video material 2 is played later on the timeline.
[0049] It should be noted that the terminal device may obtain the video material to be played back in the video track, or may obtain the video material to be played back in any feasible implementation method, and the embodiments of the present disclosure are not limited to this.
[0050] Next, the process of reversing the timeline during video editing will be described with reference to FIG3 .
[0051] FIG3 is a schematic diagram of a timeline reverse playback provided by an embodiment of the present disclosure. Please refer to FIG3 , which includes a timeline. The timeline may include the start frame, end frame, and play point of the video (the video frames between the start frame and the end frame are not shown in FIG3 ). At the current moment, the play point is at one position on the timeline, and at the next moment after the current moment, the play point is at another position on the timeline, wherein, on the timeline, the position of the play point at the next moment is before the position of the play point at the current moment. In this way, based on the play point moving from back to front on the timeline, the reverse playback effect of the video from the end frame to the start frame is achieved.
[0052] S202: Decode the video material to obtain multiple video frames corresponding to the video material.
[0053] Optionally, the video frame may be a video frame in a video material. The terminal device may decode the video material based on the following feasible implementation method: determining multiple video segments corresponding to the video material, determining a decoding order corresponding to the multiple video segments based on the timestamps of the video frames in each video segment, and decoding the multiple video segments based on the decoding order to obtain multiple video frames of the video material.
[0054] Optionally, the video material may include multiple video segments. For example, when a terminal device encodes the video material, the terminal device may divide the video material into multiple groups of pictures (GOPs) and encode each GOP. When the terminal device decodes the video material, the terminal device decodes the video material in units of GOPs. For example, if the video material may include 1000 video frames, the terminal device may divide the video into 20 video segments, each of which may include 50 video frames.
[0055] It should be noted that the terminal device can divide the video material into multiple video segments based on the encoded I frame, and the terminal device can also determine the multiple video segments corresponding to the video material based on any other feasible implementation method. The embodiment of the present disclosure does not limit this.
[0056] Optionally, the decoding order may be the order in which the terminal device decodes the multiple video segments. For example, the terminal device may decode the video material based on the video segment as a unit, and therefore, the decoding order may be the order in which the terminal device decodes the video segments. Optionally, the terminal device may determine the decoding order corresponding to the multiple video segments based on the timestamps of the video frames in the video segments. For example, the terminal device may determine the decoding order corresponding to the multiple video segments based on the timestamp of the first video frame in each video segment, or the terminal device may determine the decoding order corresponding to the multiple video segments based on the timestamp of the last video frame in each video segment. It should be noted that the terminal device may also determine the decoding order corresponding to the multiple video segments based on any other feasible implementation method.
[0057] For example, the video material includes video segment A, video segment B and video segment C. When the terminal device decodes the video material, each video segment can be a decoding unit (the decoding unit includes the encoding of all video frames of the video segment), the timestamp of the first video frame of video segment A is timestamp 1, the timestamp of the first video frame of video segment B is timestamp 2, and the timestamp of the first video frame of video segment C is timestamp 3. If timestamp 1 is less than timestamp 2, and timestamp 2 is less than timestamp 3, the terminal device can determine the decoding order as: video segment C-video segment B-video segment C, that is, the terminal device can first decode the video frames in video segment C, then decode the video frames in video segment B, and finally decode the video frames in video segment C. In this way, pressure on the cache can be avoided.
[0058] It should be noted that the decoding order between multiple video segments can be determined based on the timestamps of the video segments (timestamps from large to small, decoding order from front to back). In this way, the terminal device can decode the video material from back to front in a timely manner, thereby improving the editing efficiency of reverse video playback.
[0059] Among them, the terminal device decodes the multiple video segments according to the decoding order corresponding to the multiple video segments to obtain multiple video frames of the video material. Specifically, it can be: obtaining the number of multiple video frames stored in the cache, and when the number of multiple video frames stored in the cache is less than a preset threshold, decoding the multiple video segments to obtain multiple video frames.
[0060] Optionally, the cache may be a cache corresponding to a video material. For example, if the timeline includes video material 1 and video material 2, the terminal device may generate a cache for video material 1 and a cache for video material 2, wherein the cache for video material 1 may store decoded video frames of video material 1, and the cache for video material 2 may store decoded video frames of video material 2.
[0061] Next, the cache corresponding to the video material will be described with reference to FIG4 .
[0062] FIG4 is a schematic diagram of a cache provided by an embodiment of the present disclosure. Please refer to FIG4 , which includes: a timeline for video editing. The timeline may include video material 1 and video material 2. When the terminal device (not shown in FIG4 ) determines that the timeline includes two video materials, it may create cache A and cache B, wherein cache A is used to store the decoded video frames of video material 1, and cache B is used to store the decoded video frames of video material B. In this way, the terminal device can perform reverse playback processing on all video materials on the timeline in parallel, thereby improving the efficiency of reverse playback editing of the video.
[0063] Optionally, the terminal device may create a decoding thread and decode the video material based on the decoding thread. For example, if the number of video frames in the decoding buffer is less than a preset threshold, the decoding thread may trigger a decoding condition, and the terminal device may decode the video material corresponding to the buffer based on the decoder.
[0064] It should be noted that since the decoder can only start decoding from the first frame of each decoding unit (the decoding unit may include the encoding of the video frame of the video segment), in order to avoid the decoder switching between decoding units, the terminal device can control the decoder to decode the video frame of the current decoding unit before decoding the video frames of other decoding units. This can reduce the use cost of the decoder.
[0065] It should be noted that the terminal device can obtain the number of multiple video frames in the cache based on any feasible implementation method, and the embodiments of the present disclosure are not limited to this.
[0066] Among them, when the number of multiple video frames stored in the cache is less than a preset threshold, the terminal device can decode the multiple video segments to obtain multiple video frames based on the following feasible implementation method: determine the first video segment currently being decoded, determine the second video segment from the multiple video segments based on the first video segment and the decoding order, and when the decoding of the first video segment is completed, decode the second video segment until the number of multiple video frames stored in the cache is greater than or equal to the preset threshold.
[0067] The first video segment may be a video segment currently being decoded. For example, the video material may include video segment A and video segment B. If the terminal device is decoding a video frame in video segment A, the terminal device may determine that the first video segment is video segment A. If the terminal device is decoding a video frame in video segment B, the terminal device may determine that the first video segment is video segment B.
[0068] The second video segment is adjacent to the first video segment and is located after the first video segment in the decoding order. For example, the decoding order may be video segment A, video segment B, and video segment C. If the first video segment is video segment A, the second video segment may be video segment B. If the first video segment is video segment B, the second video segment may be video segment C.
[0069] The first video segment and the second video segment are described below with reference to FIG5 .
[0070] FIG5 is a schematic diagram of a first video segment and a second video segment provided by an embodiment of the present disclosure. Referring to FIG5 , it includes: a timeline for video editing. The timeline includes video material. A terminal device (not shown in FIG5 ) can determine multiple video segments corresponding to the video material, wherein the decoding units corresponding to the multiple video segments may include decoding unit 1, decoding unit 2, decoding unit 3, and decoding unit 4, wherein the decoding units may include encoding of video frames in the video segments.
[0071] Referring to Figure 5 , the terminal device can determine the decoding order based on the timestamps of multiple video frames in the decoding units as follows: decoding unit 4 - decoding unit 3 - decoding unit 2 - decoding unit 1. If the terminal device is currently decoding the encoded video frame in decoding unit 3, the terminal device can determine that the video segment corresponding to decoding unit 3 is the first video segment, and the video segment corresponding to decoding unit 2 is the second video segment. In this way, when the terminal device plays the video in reverse, the terminal device does not need to perform redundant decoding processing on the video frames, thereby improving the editing efficiency of reverse video playback.
[0072] Optionally, the terminal device may decode the second video segment after decoding of the first video segment is completed. For example, in the embodiment shown in FIG5 , the terminal device decodes the video frames in decoding unit 2 after decoding of all video frames in decoding unit 3 is completed. This avoids decoding redundancy and improves decoding efficiency.
[0073] It should be noted that when the terminal device decodes the second video segment, if the number of multiple video frames stored in the cache when the decoding of the second video segment is completed is greater than or equal to the preset threshold, the terminal device can stop decoding other video segments until the number of video frames in the cache is less than the preset threshold, and then decode other video segments. If the number of multiple video frames stored in the cache when the decoding of the second video segment is completed is less than the preset threshold, the terminal device can decode the video segment that is adjacent to the second video segment and is located after the second video segment in the decoding order.
[0074] It should be noted that since the decoder can only decode frames backward (for example, the decoding unit includes 5 video frames, the decoder can decode from the first video frame. If the decoder stops decoding when it decodes to the third video frame, the decoder still needs to decode from the first video frame the next time it decodes the decoding unit), the terminal device can obtain the number of video frames in the cache after completing decoding the video frame in the decoding unit currently being decoded, and then determine whether the number of video frames is greater than a preset threshold. This can avoid redundant decoding of video frames and improve the efficiency of video decoding.
[0075] S203: Store multiple video frames corresponding to the video material and a timestamp corresponding to each video frame in a buffer corresponding to the video material.
[0076] Optionally, each video frame may include a timestamp. Therefore, when the terminal device stores the video frames of the video material, it may also store the timestamp of each video frame in the cache corresponding to the video material, and then may play the video material in reverse based on the timestamp.
[0077] 6 , the process of storing multiple video frames corresponding to the video material in the buffer corresponding to the video material will be described below.
[0078] FIG6 is a schematic diagram of a method for storing video frames in a cache according to an embodiment of the present disclosure. Referring to FIG6 , the method includes: decoding unit 1, decoding unit 2, and decoding unit 3 corresponding to the video material, wherein the decoding order is: decoding unit 3 - decoding unit 2 - decoding unit 1. The terminal device (not shown in FIG6 ) can decode the video frames in decoding unit 3 (the decoding order is the first frame of decoding unit 3 - the last frame of decoding unit 3) to obtain video frame C1, video frame C2, and video frame C3, and store video frame C1, video frame C2, and video frame C3 in the cache.
[0079] Please refer to Figure 6. After the terminal device completes decoding the video frame of decoding unit 3, it can decode the video frame in decoding unit 2 (the decoding order is the first frame of decoding unit 2-the last frame of decoding unit 2), and obtain video frame B1, video frame B2 and video frame B3, and store video frame B1, video frame B2 and video frame B3 in the cache.
[0080] As shown in Figure 6, after the terminal device completes decoding the video frames in decoding unit 2, it can decode the video frames in decoding unit 1 (the decoding order is from the first frame of decoding unit 1 to the last frame of decoding unit 1), obtaining video frames A1, A2, and A3, and storing video frames A1, A2, and A3 in the cache. This allows the terminal device to retrieve the decoded video frames in the cache without repeated decoding, improving the efficiency of reverse video playback.
[0081] It should be noted that, in the embodiment shown in FIG6 , when the terminal device stores the decoded video frames in the cache, it may also store the timestamp of each video frame in the cache, and the timestamp may be the timestamp of the video frame in the video material.
[0082] S204: Obtain video frames of the video material in a cache corresponding to the video material in descending order of timestamps, and render and display the video frames based on the video frames of the video material to achieve reverse playback of the video.
[0083] Among them, when the terminal device plays the video in reverse, it can obtain video frames from the cache corresponding to the video material of the video. The order of obtaining the video frames is from large to small timestamps. When the terminal device obtains the video frame, it can render and display the video frame, so that the terminal device can play the video in reverse. For example, the order of obtaining frames in the cache corresponding to multiple video materials of the terminal device is from large to small timestamps. The terminal device can render the video frames of the reversed video in sequence according to the multiple video frames of the multiple video materials (for example, the terminal device can synthesize multiple video frames with the same timestamp between multiple video materials to obtain the video frame of the reversed video corresponding to the timestamp), and then the video can be played in reverse.
[0084] Among them, the terminal device can obtain video frames of the video material in the cache corresponding to the video material in the order of timestamps from large to small, and render and display the video frames according to the following feasible implementation method: obtain the video frames corresponding to each video material from the cache corresponding to each video material on the video track in reverse order of the timeline, render and synthesize the video frames of multiple video materials on the video track on the timeline to obtain multiple preview frame images, and display the multiple preview frame images in reverse order on the timeline.
[0085] Among them, since the video frames in the cache are stored in order of timestamps from small to large, the terminal device can take frames from the cache based on the reverse order of the timeline (that is, take frames in order of timestamps from large to small).
[0086] The preview frame image may be a preview frame corresponding to a time point on the timeline. For example, when a user previews a reverse playback effect of a video, the video frame played at each time point is the preview frame image corresponding to that time point.
[0087] Among them, for any time point on the timeline, the terminal device can obtain a preview frame image according to the following feasible implementation method: determine the target video frame corresponding to the time point of multiple video materials on the video track, render and synthesize the multiple target video frames, and obtain the preview frame image corresponding to the time point.
[0088] The target video frame may be the video frame corresponding to the video material at that time point. For example, the video material may include multiple video frames, each of which includes a corresponding timestamp. If the time point corresponds to the timestamp of video frame 1, the target video frame corresponding to that time point may be video frame 1. If the time point corresponds to the timestamp of video frame 2, the target video frame corresponding to that time point may be video frame 2.
[0089] For example, since a video may include multiple video materials, during the video editing process, for each time point on the timeline, the terminal device can synthesize all video frames at that time point to obtain a preview frame image at that time point. For example, the timeline includes video material 1 and video material 2 at a time point. The terminal device can obtain the target video frame A of video material 1 at that time point, and the target video frame B of video material 2 at that time point. The terminal device can render and synthesize the target video frame A and the target video frame B to obtain a preview frame image at that time point. When the user previews the reverse playback effect of the video, if the preview position is at that time point, the terminal device can display the preview frame image.
[0090] Optionally, the terminal device can display multiple preview frames in reverse order on the timeline. For example, the timeline can include a play point that determines the preview frame to be played. The play point can move from back to front on the timeline. Therefore, the terminal device can play multiple preview frames in reverse order on the timeline. For example, if the next time point after the play point on the timeline is before the current time point, the preview frames can be played in reverse order, thereby achieving a reverse video playback effect.
[0091] The disclosed embodiments provide a video processing method in which a terminal device can obtain video material from a video and determine multiple video segments corresponding to the video material. The terminal device can determine a decoding order corresponding to the multiple video segments based on the timestamps of the video frames in each video segment. When the number of video frames stored in a cache is less than a preset threshold, the terminal device can decode the multiple video segments to obtain multiple video frames. The terminal device can store the multiple video frames corresponding to the video material and the timestamps corresponding to the video frames in a cache corresponding to the video material in ascending order of the timestamps. The terminal device can obtain the video frames corresponding to the video materials on the video track from the cache corresponding to the video materials in reverse timeline order, render and synthesize the video frames of the multiple video materials on the video track on the timeline, obtain multiple preview frame images, and display the multiple preview frame images in reverse timeline order. In this way, since the cache corresponding to the video material can store the multiple video frames corresponding to the video material decoded by the terminal device, the terminal device does not need to perform redundant decoding when playing the video in reverse. Furthermore, the terminal device can perform reverse editing on the timeline without adjusting the playback order of the video frames. This reduces the complexity of video reverse playback and improves the efficiency of video reverse playback.
[0092] Based on the embodiment shown in Figure 2, the video can also include audio material. The above video processing method also includes a method for reverse playback of the audio material. Below, in combination with Figure 7, the method for reverse playback of the audio material by the terminal device is explained.
[0093] FIG7 is a schematic diagram of a method for reverse playback of audio material provided by an embodiment of the present disclosure. Referring to FIG7 , the method process may include:
[0094] S701: Decode the audio material to obtain a plurality of audio sample data corresponding to the audio material and a timestamp corresponding to each audio sample data.
[0095] Optionally, the audio sampling data may be audio data in an audio material. For example, the audio sampling data may be an audio frame in the audio material, or may be multiple audio frames in the audio data, which is not limited in the present embodiment.
[0096] Optionally, the timestamp corresponding to the audio sample data may indicate the playback position of the audio sample data in the audio material. After the terminal device decodes the audio material, it may obtain multiple audio sample data and the timestamp of each audio sample data.
[0097] S702: Perform front-to-back flipping processing on multiple sampling points in each audio sampling data to obtain target audio data corresponding to each audio sampling data.
[0098] Among them, audio decoding is different from video decoding. Video decoding needs to start decoding from the first frame, while audio decoding can be decoded at any time point. However, audio playback has high requirements on the continuity of audio data, otherwise it will result in poor audio effects. Therefore, when playing the audio in reverse, the continuity of the audio data needs to be guaranteed.
[0099] Optionally, the target audio data may be audio data obtained by flipping the audio sample data forward and backward. For example, for any audio sample data of the audio material, the terminal device may flip multiple sampling points in the audio sample data forward and backward to obtain the target audio data. For example, the audio sample data may include sampling point 1, sampling point 2, and sampling point 3, where the order of the three sampling points is sampling point 1-sampling point 2-sampling point 3. The terminal device may flip the sampling points of the audio sample data forward and backward to obtain the target audio data, where the order of the three sampling points in the target audio data is sampling point 3-sampling point 2-sampling point 1.
[0100] 8 , a process in which the terminal device flips multiple sampling points of the audio sample data back and forth to obtain target audio data will be described in detail.
[0101] FIG8 is a schematic diagram of a process for determining target audio data provided by an embodiment of the present disclosure. Please refer to FIG8 , which includes: audio frame A and audio frame B. Among them, audio frame A includes continuous sampling point 1, sampling point 2, sampling point 3 and sampling point 4, and audio frame B includes continuous sampling point 5, sampling point 6, sampling point 7 and sampling point 8. The terminal device (not shown in FIG8 ) can perform audio flip processing on audio frame A and audio frame B to obtain target audio data a corresponding to audio frame A, and target audio data b corresponding to audio frame B. Among them, the target audio data a includes continuous sampling point 4, sampling point 3, sampling point 2 and sampling point 1, and the target audio data b includes continuous sampling point 8, sampling point 7, sampling point 6 and sampling point 5.
[0102] It should be noted that the terminal device may also perform audio inversion processing on the audio sampling data based on any feasible implementation method to obtain target audio data corresponding to the audio sampling data, and the embodiments of the present disclosure are not limited to this.
[0103] S703: Perform reverse playback processing on the audio material according to the multiple target audio data and the time stamp of each target audio data.
[0104] The timestamp of the target audio data may be the timestamp of the audio sample data corresponding to the target audio data. For example, a terminal device decodes audio material to obtain audio sample data A and audio sample data B, where the timestamp of audio sample data A is timestamp 1 and the timestamp of audio sample data B is timestamp 2. If the terminal device performs audio flipping on audio sample data A to obtain target audio data a, the timestamp of target audio data a is timestamp 1. If the terminal device performs audio flipping on audio sample data B to obtain target audio data b, the timestamp of target audio data b is timestamp 2.
[0105] Optionally, the reverse playback progress of the audio material can be the same as the reverse playback progress of the video material. For example, if the length of the video material is the same as the length of the audio material, and the position of the video material on the timeline is the same as the position of the audio material on the timeline, when the terminal device reverses the video material, the terminal device can also reverse the audio material at the same time.
[0106] Among them, the terminal device performs reverse playback of the audio material based on multiple target audio data and the timestamp of each target audio data. Specifically, it can be as follows: multiple target audio data are stored in a cache stack in ascending order of the timestamp of the target audio data, starting from the top of the cache stack, the target audio data in the cache stack are read in sequence, and the target audio data are played in sequence, thereby realizing reverse playback of the audio in the video.
[0107] The target audio data at the top of the cache stack has the largest timestamp. For example, a terminal device can generate a cache stack associated with audio material. After the terminal device obtains the target audio data, the target audio data can be stored in the cache stack. The timestamp of the target audio data at the top of the cache stack is the largest, and the timestamp of the target audio data at the bottom of the cache stack is the smallest. That is, the timestamp of the target audio data increases from the bottom to the top of the cache stack. In this way, the terminal device can play the audio material in reverse order on the timeline, thereby achieving reverse playback of the video.
[0108] 9 , the process of storing target audio data in the terminal device will be described below.
[0109] Figure 9 is a schematic diagram of a process for storing target audio data provided by an embodiment of the present disclosure. Please refer to Figure 9, which includes: audio frame 1, audio frame 2, audio frame 3 and a cache stack. The timestamp of audio frame 1 is less than the timestamp of audio frame 2, and the timestamp of audio frame 2 is less than the timestamp of audio frame 3. Among them, the terminal device (not shown in Figure 9) can perform audio flip processing on audio frame 1 to obtain target audio data A, the terminal device can perform audio flip processing on audio frame 2 to obtain target audio data B, and the terminal device can perform audio flip processing on audio frame 3 to obtain target audio data C. The terminal device can first store the target audio data A in the cache stack, then store the target audio data B, and finally store the target audio data C. In this way, the timestamp of the target audio data C at the top of the cache stack is the largest, and the timestamp of the target audio data A at the bottom of the cache stack is the smallest.
[0110] The disclosed embodiment provides a method for reversing audio material, which decodes the audio material to obtain multiple audio sampling data corresponding to the audio material and a timestamp corresponding to each audio sampling data, performs back-and-forth flipping on multiple sampling points in each audio sampling data to obtain target audio data corresponding to each audio sampling data, stores the multiple target audio data in a cache stack in ascending order of the timestamps of the target audio data, reads the target audio data in the cache stack in sequence starting from the top of the cache stack, and performs reverse playback on the read target audio data. In this way, when a terminal device displays multiple preview frame images in reverse order on a timeline, it can also play the audio of the video in reverse order. Moreover, since the terminal device can perform back-and-forth flipping on multiple sampling points of the audio sampling data, the continuity of the target audio data after the audio flipping is better, thereby improving the effect of audio reversal.
[0111] Based on any one of the above embodiments, the process of the above video processing method will be described below with reference to FIG10 .
[0112] Figure 10 is a process diagram of a video processing method provided by an embodiment of the present disclosure. Please refer to Figure 10, including a timeline. The timeline includes video material. The terminal device (not shown in Figure 10) can generate a cache corresponding to the video material. The video material includes a decoding unit 1, a decoding unit 2 and a decoding unit 3, wherein each decoding unit includes the encoding of the video frame in the video segment of the video material. The decoding order between the decoding units is: decoding unit 3-decoding unit 2-decoding unit 1. The terminal device can decode the video frame in the decoding unit 3 to obtain video frame C1, video frame C2 and video frame C3, and store video frame C1, video frame C2 and video frame C3 in the cache.
[0113] Please refer to Figure 10. When the playback point moves from back to front on the timeline, the video frame corresponding to the time point where the playback point is located is video frame C3. Therefore, the terminal device can obtain video frame C3 in the cache and play video frame C3 (it should be noted that the timeline of the embodiment shown in Figure 10 includes one video material. If the timeline includes multiple video materials, multiple video frames at the time point need to be synthesized). After the terminal device completes decoding the video frame in decoding unit 3, the terminal device can decode the video frame in decoding unit 2 to obtain video frame B1, video frame B2 and video frame B3, and store video frame B1, video frame B2 and video frame B3 in the cache.
[0114] Please refer to Figure 10. After the terminal device completes decoding the video frames in decoding unit 2, the terminal device can decode the video frames in decoding unit 1 to obtain video frames A1, video frames A2, and video frames A3, and store video frames A1, video frames A2, and video frames A3 in the cache. As the playback point moves, the terminal device can obtain video frames such as video frames C2 and video frames C1 in the cache in descending order of timestamps, and then can play the video in reverse. In this way, the video can be played in reverse on the timeline. Moreover, since the terminal device includes a cache corresponding to the video material, the terminal device does not need to repeatedly decode the video frames, which reduces the complexity of video reverse editing and improves the efficiency of video reverse editing.
[0115] FIG11 is a schematic diagram of the structure of a video processing device provided by an embodiment of the present disclosure. Referring to FIG11 , the video processing device 110 includes a first acquisition module 111, a decoding module 112, a storage module 113, a second acquisition module 114, and a display module 115, wherein:
[0116] The first acquisition module 111 is used to acquire video material in the video;
[0117] The decoding module 112 is used to decode the video material to obtain multiple video frames corresponding to the video material;
[0118] The storage module 113 is configured to store a plurality of video frames corresponding to the video material and a timestamp corresponding to each video frame in a cache corresponding to the video material;
[0119] The second acquisition module 114 is configured to acquire video frames of the video material in a cache corresponding to the video material in descending order of timestamps;
[0120] The display module 115 is configured to render and display the video frames based on the video frames of the video material, so as to achieve reverse playback of the video.
[0121] According to one or more embodiments of the present disclosure, the second acquisition module 114 is specifically configured to:
[0122] Obtain the video frames corresponding to the video materials on the video track from the cache corresponding to the video materials in reverse order of the timeline;
[0123] According to one or more embodiments of the present disclosure, the display module 115 is specifically configured to:
[0124] Performing rendering and synthesis processing on the video frames of the multiple video materials on the video track on the timeline to obtain multiple preview frame images;
[0125] The plurality of preview frame images are displayed in reverse order on the timeline.
[0126] According to one or more embodiments of the present disclosure, the display module 115 is specifically configured to:
[0127] Determine a target video frame corresponding to the plurality of video materials on the video track at the time point;
[0128] Rendering and synthesizing the multiple target video frames to obtain a preview frame image corresponding to the time point.
[0129] According to one or more embodiments of the present disclosure, the decoding module 112 is specifically configured to:
[0130] Determining a plurality of video segments corresponding to the video material;
[0131] determining a decoding order corresponding to the plurality of video segments according to a timestamp of a video frame in each video segment;
[0132] The multiple video segments are decoded according to a decoding order corresponding to the multiple video segments to obtain multiple video frames of the video material.
[0133] According to one or more embodiments of the present disclosure, the decoding module 112 is specifically configured to:
[0134] Obtaining the number of multiple video frames stored in the cache;
[0135] When the number of the multiple video frames stored in the cache is less than a preset threshold, the multiple video segments are decoded to obtain the multiple video frames.
[0136] According to one or more embodiments of the present disclosure, the decoding module 112 is specifically configured to:
[0137] Determining a first video segment currently being decoded;
[0138] determining a second video segment from the plurality of video segments according to the first video segment and the decoding order, and decoding the second video segment when decoding of the first video segment is completed until the number of the plurality of video frames stored in the cache is greater than or equal to the preset threshold;
[0139] The second video segment is adjacent to the first video segment and is located after the first video segment in the decoding order.
[0140] According to one or more embodiments of the present disclosure, the second acquisition module 114 is further configured to:
[0141] Decoding the audio material to obtain a plurality of audio sample data corresponding to the audio material and a timestamp corresponding to each audio sample data;
[0142] Performing a front-to-back flipping process on a plurality of sampling points in each audio sampling data to obtain target audio data corresponding to each audio sampling data;
[0143] The audio material is played back in reverse according to a plurality of target audio data and a time stamp of each target audio data.
[0144] According to one or more embodiments of the present disclosure, the second acquisition module 114 is specifically configured to:
[0145] Storing the plurality of target audio data in a cache stack in ascending order of the timestamps of the target audio data, wherein the timestamp of the target audio data at the top of the cache stack is the largest;
[0146] Starting from the top of the cache stack, the target audio data in the cache stack are read in sequence, and the target audio data are played in sequence.
[0147] The video processing device provided in this embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effects are similar and will not be described in detail in this embodiment.
[0148] FIG12 is a schematic diagram of the structure of a terminal device provided by an embodiment of the present disclosure. Please refer to FIG12, which shows a schematic diagram of the structure of a terminal device 1200 suitable for implementing an embodiment of the present disclosure. The terminal device may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, personal digital assistants (PDAs), tablet computers (Portable Android Devices, PADs), portable multimedia players (PMPs), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), and fixed terminals such as digital TVs and desktop computers. The terminal device shown in FIG12 is merely an example and should not impose any limitations on the functions and scope of use of the embodiments of the present disclosure.
[0149] As shown in FIG12 , terminal device 1200 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 1201, which can perform various appropriate actions and processes based on programs stored in a read-only memory (ROM) 1202 or programs loaded from a storage device 1208 into a random access memory (RAM) 1203. RAM 1203 also stores various programs and data required for the operation of terminal device 1200. Processing device 1201, ROM 1202, and RAM 1203 are interconnected via a bus 1204. An input / output (I / O) interface 1205 is also connected to bus 1204.
[0150] Typically, the following devices may be connected to the I / O interface 1205: an input device 1206 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 1207 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 1208 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1209. The communication device 1209 may allow the terminal device 1200 to communicate with other devices wirelessly or by wire to exchange data. Although FIG12 illustrates a terminal device 1200 having various devices, it should be understood that not all of the illustrated devices are required to be implemented or present. More or fewer devices may alternatively be implemented or present.
[0151] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network via the communication device 1209, or installed from the storage device 1208, or installed from the ROM 1202. When the computer program is executed by the processing device 1201, the above-mentioned functions defined in the method of the embodiment of the present disclosure are performed.
[0152] It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, device, or component. In the present disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof.
[0153] The computer-readable medium may be included in the terminal device, or may exist independently without being incorporated into the terminal device.
[0154] The computer-readable medium carries one or more programs. When the one or more programs are executed by the terminal device, the terminal device executes the method shown in the above embodiment.
[0155] An embodiment of the present disclosure provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions. When a processor executes the computer-executable instructions, various methods that may be involved in the above embodiments are implemented.
[0156] An embodiment of the present disclosure provides a computer program product, including a computer program, which implements various possible methods involved in the above embodiments when executed by a processor.
[0157] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages, or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet Service Provider).
[0158] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0159] The units involved in the embodiments described in this disclosure may be implemented in software or hardware. In some cases, the name of a unit does not limit the unit itself. For example, the first acquisition unit may also be described as a "unit for acquiring at least two Internet Protocol addresses."
[0160] The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, and without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.
[0161] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0162] It should be noted that the modifications of "one" and "multiple" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, they should be understood as "one or more".
[0163] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0164] It is understandable that before using the technical solutions disclosed in the various embodiments of this disclosure, the type, scope of use, usage scenarios, etc. of the personal information involved in this disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0165] For example, in response to receiving an active request from the user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thereby, the user can independently choose whether to provide personal information to the software or hardware such as the terminal device, application, server or storage medium that performs the operation of the technical solution of the present disclosure based on the prompt message. As an optional but non-limiting implementation method, in response to receiving an active request from the user, the method of sending the prompt message to the user can be, for example, a pop-up window, and the prompt information can be presented in the form of text in the pop-up window. In addition, the pop-up window can also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the terminal device.
[0166] It is understandable that the above notification and user authorization process are merely illustrative and do not limit the implementation of the present disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0167] It is understood that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws and regulations. Data may include information, parameters and messages, such as flow switching indication information.
[0168] In a first aspect, an embodiment of the present disclosure provides a video processing method, the video processing method comprising:
[0169] Get the video material in the video;
[0170] Decoding the video material to obtain multiple video frames corresponding to the video material;
[0171] Storing a plurality of video frames corresponding to the video material and a timestamp corresponding to each video frame in a cache corresponding to the video material;
[0172] The video frames of the video material are obtained in a cache corresponding to the video material in descending order of timestamps, and the video frames are rendered and displayed based on the video frames of the video material to achieve reverse playback of the video.
[0173] According to one or more embodiments of the present disclosure, obtaining video frames of the video material in a cache corresponding to the video material in descending order of timestamps, and rendering and displaying the video frames based on the video frames of the video material includes:
[0174] Obtain the video frames corresponding to the video materials on the video track from the cache corresponding to the video materials in reverse order of the timeline;
[0175] Performing rendering and synthesis processing on the video frames of the multiple video materials on the video track on the timeline to obtain multiple preview frame images;
[0176] The plurality of preview frame images are displayed in reverse order on the timeline.
[0177] According to one or more embodiments of the present disclosure, for any time point on the timeline, rendering and synthesizing video frames of multiple video materials on the video track on the timeline to obtain multiple preview frame images includes:
[0178] Determine a target video frame corresponding to the plurality of video materials on the video track at the time point;
[0179] Rendering and synthesizing the multiple target video frames to obtain a preview frame image corresponding to the time point.
[0180] According to one or more embodiments of the present disclosure, decoding the video material to obtain multiple video frames corresponding to the video material includes:
[0181] Determining a plurality of video segments corresponding to the video material;
[0182] determining a decoding order corresponding to the plurality of video segments according to a timestamp of a video frame in each video segment;
[0183] The multiple video segments are decoded according to a decoding order corresponding to the multiple video segments to obtain multiple video frames of the video material.
[0184] According to one or more embodiments of the present disclosure, decoding the multiple video segments according to the decoding order corresponding to the multiple video segments to obtain the multiple video frames of the video material includes:
[0185] Obtaining the number of multiple video frames stored in the cache;
[0186] When the number of the multiple video frames stored in the cache is less than a preset threshold, the multiple video segments are decoded to obtain the multiple video frames.
[0187] According to one or more embodiments of the present disclosure, decoding the multiple video segments to obtain the multiple video frames includes:
[0188] Determining a first video segment currently being decoded;
[0189] determining a second video segment from the plurality of video segments according to the first video segment and the decoding order, and decoding the second video segment when decoding of the first video segment is completed until the number of the plurality of video frames stored in the cache is greater than or equal to the preset threshold;
[0190] The second video segment is adjacent to the first video segment and is located after the first video segment in the decoding order.
[0191] According to one or more embodiments of the present disclosure, the video also includes audio material, and when the video material on the video track is played back in reverse, the method further includes:
[0192] Decoding the audio material to obtain a plurality of audio sample data corresponding to the audio material and a timestamp corresponding to each audio sample data;
[0193] Performing a front-to-back flipping process on a plurality of sampling points in each audio sampling data to obtain target audio data corresponding to each audio sampling data;
[0194] The audio material is played back in reverse according to a plurality of target audio data and a time stamp of each target audio data.
[0195] According to one or more embodiments of the present disclosure, the reverse playback of the audio material according to the plurality of target audio data and the timestamp of each target audio data includes:
[0196] Storing the plurality of target audio data in a cache stack in ascending order of the timestamps of the target audio data, wherein the timestamp of the target audio data at the top of the cache stack is the largest;
[0197] Starting from the top of the cache stack, the target audio data in the cache stack are read in sequence, and the target audio data are played in sequence.
[0198] In a second aspect, an embodiment of the present disclosure provides a video processing device, comprising a first acquisition module, a decoding module, a storage module, a second acquisition module, and a display module, wherein:
[0199] The first acquisition module is used to acquire video material in the video;
[0200] The decoding module is used to decode the video material to obtain multiple video frames corresponding to the video material;
[0201] The storage module is used to store multiple video frames corresponding to the video material and a timestamp corresponding to each video frame in a cache corresponding to the video material;
[0202] The second acquisition module is used to acquire video frames of the video material in a cache corresponding to the video material in descending order of timestamps;
[0203] The display module is used to render and display the video frames based on the video frames of the video material, so as to achieve reverse playback of the video.
[0204] According to one or more embodiments of the present disclosure, the second acquisition module is specifically configured to:
[0205] Obtain the video frames corresponding to the video materials on the video track from the cache corresponding to the video materials in reverse order of the timeline;
[0206] According to one or more embodiments of the present disclosure, the display module is specifically used for:
[0207] Performing rendering and synthesis processing on the video frames of the multiple video materials on the video track on the timeline to obtain multiple preview frame images;
[0208] The plurality of preview frame images are displayed in reverse order on the timeline.
[0209] According to one or more embodiments of the present disclosure, the display module is specifically used for:
[0210] Determine a target video frame corresponding to the plurality of video materials on the video track at the time point;
[0211] Rendering and synthesizing the multiple target video frames to obtain a preview frame image corresponding to the time point.
[0212] According to one or more embodiments of the present disclosure, the decoding module is specifically configured to:
[0213] Determining a plurality of video segments corresponding to the video material;
[0214] determining a decoding order corresponding to the plurality of video segments according to a timestamp of a video frame in each video segment;
[0215] The multiple video segments are decoded according to a decoding order corresponding to the multiple video segments to obtain multiple video frames of the video material.
[0216] According to one or more embodiments of the present disclosure, the decoding module is specifically configured to:
[0217] Obtaining the number of multiple video frames stored in the cache;
[0218] When the number of the multiple video frames stored in the cache is less than a preset threshold, the multiple video segments are decoded to obtain the multiple video frames.
[0219] According to one or more embodiments of the present disclosure, the decoding module is specifically configured to:
[0220] Determining a first video segment currently being decoded;
[0221] determining a second video segment from the plurality of video segments according to the first video segment and the decoding order, and decoding the second video segment when decoding of the first video segment is completed until the number of the plurality of video frames stored in the cache is greater than or equal to the preset threshold;
[0222] The second video segment is adjacent to the first video segment and is located after the first video segment in the decoding order.
[0223] According to one or more embodiments of the present disclosure, the second acquisition module is further configured to:
[0224] Decoding the audio material to obtain a plurality of audio sample data corresponding to the audio material and a timestamp corresponding to each audio sample data;
[0225] Performing a front-to-back flipping process on a plurality of sampling points in each audio sampling data to obtain target audio data corresponding to each audio sampling data;
[0226] The audio material is played back in reverse according to a plurality of target audio data and a time stamp of each target audio data.
[0227] According to one or more embodiments of the present disclosure, the second acquisition module is specifically configured to:
[0228] Storing the plurality of target audio data in a cache stack in ascending order of the timestamps of the target audio data, wherein the timestamp of the target audio data at the top of the cache stack is the largest;
[0229] Starting from the top of the cache stack, the target audio data in the cache stack are read in sequence, and the target audio data are played in sequence.
[0230] In a third aspect, an embodiment of the present disclosure provides a terminal device including: a processor and a memory;
[0231] The memory stores computer-executable instructions;
[0232] The processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the video processing method as described in the first aspect and various possible aspects of the first aspect.
[0233] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the video processing method as described in the first aspect and various possible aspects of the first aspect are implemented.
[0234] The present disclosure provides a video processing method, apparatus and terminal device, wherein the terminal device can obtain video material in a video, decode the video material, and obtain multiple video frames corresponding to the video material. The terminal device can store multiple video frames corresponding to the video material and timestamps corresponding to each video frame in a cache corresponding to the video material. The terminal device can obtain video frames of the video material in the cache corresponding to the video material in descending order of timestamps, and render and display the video frames based on the video frames of the video material to achieve reverse playback of the video. In the above method, although the decoder can only decode frames backward, since multiple video frames corresponding to the video material can be stored in the cache, the terminal device can obtain video frames from back to front (i.e., timestamps from large to small) in the cache, and then perform reverse playback on the video material. In this way, the terminal device does not need to repeatedly decode the video frames in the video material, thereby reducing the complexity of video reverse playback and improving the efficiency of video reverse playback.
[0235] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by the specific combination of the above-mentioned technical features, but should also cover other technical solutions formed by any combination of the above-mentioned technical features or their equivalent features without departing from the above-mentioned disclosed concepts. For example, the above-mentioned features are replaced with (but not limited to) technical features with similar functions disclosed in the present disclosure to form a technical solution. In addition, although the operations are described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, although several specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Certain features described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination.
[0236] Although the subject matter has been described in language specific to structural features and / or methodological logical acts, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are merely example forms of implementing the claims.
Claims
1. A video processing method, comprising: Get the video material in the video; Decoding the video material to obtain multiple video frames corresponding to the video material; Storing a plurality of video frames corresponding to the video material and a timestamp corresponding to each video frame in a cache corresponding to the video material; The video frames of the video material are obtained in a cache corresponding to the video material in descending order of timestamps, and the video frames are rendered and displayed based on the video frames of the video material to achieve reverse playback of the video.
2. The method according to claim 1, wherein Obtaining video frames of the video material in a cache corresponding to the video material in descending order of timestamps, and rendering and displaying the video frames based on the video frames of the video material, including: Obtain the video frames corresponding to the video materials on the video track from the cache corresponding to the video materials in reverse order of the timeline; Performing rendering and synthesis processing on the video frames of the multiple video materials on the video track on the timeline to obtain multiple preview frame images; The plurality of preview frame images are displayed in reverse order on the timeline.
3. The method according to claim 2, wherein: For any time point on the timeline, rendering and synthesizing the video frames of the multiple video materials on the video track on the timeline to obtain multiple preview frame images, including: Determine a target video frame corresponding to the plurality of video materials on the video track at the time point; Rendering and synthesizing the multiple target video frames to obtain a preview frame image corresponding to the time point.
4. The method according to any one of claims 1 to 3, wherein: The decoding process of the video material to obtain a plurality of video frames corresponding to the video material includes: Determining a plurality of video segments corresponding to the video material; determining a decoding order corresponding to the plurality of video segments according to a timestamp of a video frame in each video segment; The multiple video segments are decoded according to a decoding order corresponding to the multiple video segments to obtain multiple video frames of the video material.
5. The method according to claim 4, wherein The decoding process of the plurality of video segments according to the decoding order corresponding to the plurality of video segments to obtain the plurality of video frames of the video material includes: Obtaining the number of multiple video frames stored in the cache; When the number of the multiple video frames stored in the cache is less than a preset threshold, the multiple video segments are decoded to obtain the multiple video frames.
6. The method according to claim 5, wherein: The decoding the multiple video segments to obtain the multiple video frames includes: Determining a first video segment currently being decoded; determining a second video segment from the plurality of video segments according to the first video segment and the decoding order, and decoding the second video segment when decoding of the first video segment is completed until the number of the plurality of video frames stored in the cache is greater than or equal to the preset threshold; The second video segment is adjacent to the first video segment and is located after the first video segment in the decoding order.
7. The method according to any one of claims 1 to 3, wherein: The video also includes audio material, and when the video material on the video track is played back in reverse, the method further includes: Decoding the audio material to obtain a plurality of audio sample data corresponding to the audio material and a timestamp corresponding to each audio sample data; Performing a front-to-back flipping process on a plurality of sampling points in each audio sampling data to obtain target audio data corresponding to each audio sampling data; The audio material is played back in reverse according to a plurality of target audio data and a time stamp of each target audio data.
8. The method according to claim 7, wherein: The performing reverse playback processing on the audio material according to the plurality of target audio data and the timestamp of each target audio data includes: Storing the plurality of target audio data in a cache stack in ascending order of the timestamps of the target audio data, wherein the timestamp of the target audio data at the top of the cache stack is the largest; Starting from the top of the cache stack, the target audio data in the cache stack are read in sequence, and the target audio data are played in sequence.
9. A video processing device, comprising a first acquisition module, a decoding module, a storage module, a second acquisition module, and a display module, wherein: The first acquisition module is configured to acquire video material in the video; The decoding module is configured to decode the video material to obtain a plurality of video frames corresponding to the video material; The storage module is configured to store a plurality of video frames corresponding to the video material and a timestamp corresponding to each video frame in a cache corresponding to the video material; The second acquisition module is configured to acquire video frames of the video material in a cache corresponding to the video material in descending order of timestamps; The display module is configured to render and display the video frames based on the video frames of the video material to achieve reverse playback of the video.
10. A terminal device comprising: processor and memory; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the video processing method according to any one of claims 1 to 8.
11. A computer-readable storage medium, wherein: The computer-readable storage medium stores computer-executable instructions. When a processor executes the computer-executable instructions, the video processing method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Video processing method and device, terminal and storage medium
CN109819317A
Video reverse playing method and device, video reverse playing data processing method and device and computer equipment
CN110351553A
Reverse playing method and device of vehicle-mounted video, electronic equipment and medium
CN114650452A
Video reverse playing method and system, terminal and storage medium
CN115967843A
Remote fast forward and rewind functionality for client devices
US20100064054A1