Video decoding method and apparatus, electronic device, and storage medium
By calculating the number of parallel decoding threads according to the target playback location of the video draft and the image resolution of material fragments in the video editorial jump process to achieve the efficient parallel decoding of multi -track video data The low problem improved the smoothness of the video screen.
Patent Information
- Application Number
- PCT/CN2024/107668
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-07-25
- Filing Date
- 2024-07-25
- Publication Date
- 2025-01-30
AI Technical Summary
In non-computer audio and video scenarios, the centralized decoding of multi-track video data leads to low decoding efficiency, resulting in problems such as stuttering jumps and inability to display the video screen smoothly during the video editing process.
By responding to the jump instruction, determine the target playback location of the video draft, and calculate the number of target threads according to the image resolution of the material fragment at the target playback location to achieve parallel decoding of the target material fragment and generate decoding images.
Improved the efficiency of video decoding, reducing the stuck during the video jump, and ensuring the smooth display of the video screen.
Smart Images

Figure CN2024107668_30012025_PF_FP_ABST
Abstract
Description
Video decoding method, device, electronic device and storage medium
[0001] This application claims priority to the Chinese invention patent application entitled “Video decoding method, device, electronic device and storage medium.” and application number 202310919485.3, filed on July 25, 2023. The entire contents of that application are incorporated by reference into this application. Technical Field
[0002] The embodiments of the present disclosure relate to the field of video processing technology, and in particular to a video decoding method, device, electronic device, and storage medium. Background Art
[0003] In an audio and video non-editing scenario, when it is necessary to simultaneously edit the video content on multiple video editing tracks in a video, jumping to a specified position in the video will trigger the terminal device to centrally decode the video data at the specified position in the video.
[0004] In the related art, the centralized decoding of multi-track video data in the above scenario is usually achieved through serial decoding. However, the overall decoding efficiency of serial decoding is low, resulting in problems such as jump jams and inability to display the video smoothly during video editing.
[0005] Summary of the Invention
[0006] The embodiments of the present disclosure provide a video decoding method, device, electronic device, and storage medium to overcome problems such as jump jamming and video screen not being able to be displayed smoothly during video editing and jumping.
[0007] In a first aspect, an embodiment of the present disclosure provides a video decoding method, the method comprising: determining a target playback position of a video draft displayed in a terminal device in response to a jump instruction, wherein the video draft corresponds to at least two video editing tracks, and the video editing tracks include at least one material segment; obtaining a target number of threads based on image resolutions of at least two target material segments corresponding to the target playback position, the target number of threads being the number of threads for the terminal device to parallel decode the target material segments at the target playback position; and performing parallel decoding on the target material segments based on the target number of threads to generate a decoded image of the video draft at the target playback position.
[0008] In a second aspect, an embodiment of the present disclosure provides a video decoding device, comprising: a response module for determining a target playback position of a video draft displayed in a terminal device in response to a jump instruction, wherein the video draft corresponds to at least two video editing tracks, and the video editing tracks include at least one material clip; a processing module for obtaining a target number of threads based on image resolutions of at least two target material clips corresponding to the target playback position, wherein the target number of threads is the number of threads for the terminal device to parallel decode the target material clip at the target playback position; a generation module for performing parallel decoding on the target material clip based on the target number of threads to generate a decoded image of the video draft at the target playback position.
[0009] In a third aspect, an embodiment of the present disclosure provides an electronic device comprising: a processor and a memory; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the video decoding method described in the first aspect and various possible designs of the first aspect.
[0010] 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 decoding method described in the first aspect and various possible designs of the first aspect is implemented.
[0011] In a fifth aspect, an embodiment of the present disclosure provides a computer program product, including a computer program, which, when executed by a processor, implements the video decoding method described in the first aspect and various possible designs of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure or related technologies, the following is a brief introduction to the drawings required for use in the embodiments or related technical descriptions. 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.
[0013] FIG1 is a diagram illustrating an application scenario of a video decoding method provided by an embodiment of the present disclosure;
[0014] FIG2 is a flowchart diagram 1 of a video decoding method provided by an embodiment of the present disclosure;
[0015] FIG3 is a flowchart of a specific implementation method of step S102 in the embodiment shown in FIG2 ;
[0016] FIG4 is a schematic diagram of an equivalent orbital number provided by an embodiment of the present disclosure;
[0017] FIG5 is a flowchart of a specific implementation method of step S1022 in the embodiment shown in FIG3 ;
[0018] FIG6 is a schematic diagram of decoding time-consuming data provided by an embodiment of the present disclosure;
[0019] FIG7 is a schematic diagram of a process for determining a decoding strategy provided by an embodiment of the present disclosure;
[0020] FIG8 is a second flow chart of a video decoding method provided by an embodiment of the present disclosure;
[0021] FIG9 is a flowchart of a specific implementation of step S202 in the embodiment shown in FIG8 ;
[0022] FIG10 is a structural block diagram of a video decoding device provided by an embodiment of the present disclosure;
[0023] FIG11 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure;
[0024] FIG12 is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0025] To make the objectives, technical solutions, and advantages of the embodiments of the present disclosure more clear, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present disclosure without making any creative efforts shall fall within the scope of protection of the present disclosure.
[0026] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0027] The following explains the application scenarios of the embodiments of the present disclosure:
[0028] Figure 1 is an application scenario diagram of the video decoding method provided by an embodiment of the present disclosure. The video decoding method provided by an embodiment of the present disclosure can be applied to an application with a video editing function. More specifically, it can be applied to an application scenario for editing multi-track videos. The execution subject of this embodiment can be a terminal device running the above-mentioned application with a video editing function, or a server running the server corresponding to the above-mentioned application, or other electronic devices that perform similar functions. Referring to Figure 1, taking a terminal device as an example, a target application for video editing is running in the terminal device. After the project file or draft file corresponding to the video draft is loaded through the target application, a multi-track editing page containing multiple video editing tracks is displayed in the video editing interface of the target application. The video draft is edited through the multi-track editing page, wherein the video draft is the video data in the editing state. After the video draft editing is completed, the video draft can be generated into an output video. In some embodiments, each video editing track (e.g., Track_1, Track_2, and Track_3 shown in the figure) contains one or more material clips that constitute a video draft (e.g., clips c1, c2, c3, and c4 shown in the figure). The layer of the material clips on the video editing track is determined according to the sequence number of the video editing track, so that each material clip is displayed in sequence in the final output video based on the layer it is located in. Furthermore, within the video editing interface, the user can manually add, delete, and modify the material clips that constitute the video draft on each video editing track as needed. The terminal device then synthesizes and encodes the edited material clips on each video editing track to obtain the final output video.
[0029] In some embodiments, during the video editing process, when a user seeks to a specified playback position (e.g., position T_1 in the figure) by operating the video editing interface, the terminal device collectively decodes all the clips on the video editing track at that playback position. After decoding of all the clips is complete, the terminal device renders the decoded image corresponding to each clip on the screen and displays the corresponding preview video in the preview window for the user to view.
[0030] In the related art, the centralized decoding of multi-track video data is usually achieved through serial decoding, for example, the above-mentioned fragments c1, c3 and c4 are serially decoded in sequence to obtain the video frame (decoded image) of the video draft at the playback position. However, the above-mentioned solutions in the related art have the problems of low execution efficiency and slow speed, which leads to an increase in the time consumption of the decoding process. On the other hand, in other related technical solutions, by decoding each material fragment in parallel, for example, decoding the above-mentioned fragments c1, c3 and c4 in parallel, when the amount of decoded data is small, a faster decoding speed can be achieved compared to serial decoding. However, when the resource consumption of parallel decoding is large, for example, when the number of parallel decoding threads is too large or the amount of decoded data is too large, the decoding speed will drop rapidly, and it will be lower than the decoding speed of serial decoding, thereby causing instability in the decoding process. Therefore, how to avoid the decrease in decoding speed due to excessive parallel decoding resource consumption during the jump process of multi-track video is a problem that needs to be solved urgently. The embodiment of the present disclosure provides a solution for wearing deviation detection to solve the above problem.
[0031] Referring to FIG2 , FIG2 is a flow chart of a video decoding method provided by an embodiment of the present disclosure. The method of this embodiment can be applied in a terminal device, and the video decoding method includes:
[0032] Step S101: In response to a jump instruction, determine a target playback position of a video draft displayed in a terminal device, wherein the video draft corresponds to at least two video editing tracks, and the video editing track includes at least one material clip.
[0033] Exemplarily, referring to the application scenario diagram shown in FIG1 , after the terminal device loads the video draft (project file or draft file) through the target application, multiple video editing tracks of the video draft are displayed in the video editing interface. Each video editing track contains at least one material clip, as shown in FIG1 . Afterwards, after the terminal device receives the jump instruction input by the user, it jumps the current playback position of the video draft to the target playback position corresponding to the jump instruction. Among them, the playback timestamp is the playback timestamp corresponding to the video draft, and each video editing track corresponds to the same playback timestamp coordinate. Therefore, according to the target playback position, while determining the playback timestamp of the video draft, the playback timestamp of each video editing track is also determined. Furthermore, at the target playback position, corresponding to at least two material clips, the terminal device will decode the material clips on each video channel at the target playback position and generate corresponding decoded images, thereby realizing a preview of the video draft, so that the user can observe the effect of the superimposed display of the material clips on each video editing track in real time.
[0034] Among them, the specific implementation method of loading multiple video editing tracks corresponding to the video draft and the material clips on the video editing tracks through the project file or draft file, and the specific implementation method of determining the corresponding playback timestamp (target playback position) based on the jump instruction are related technologies known to technical personnel in this field and will not be repeated here.
[0035] Step S102: obtaining a target number of threads according to image resolutions of at least two target material segments corresponding to the target playback position, where the target number of threads is the number of threads for the terminal device to decode the target material segments at the target playback position in parallel.
[0036] Exemplarily, after obtaining the target playback position, the clip located at the target playback position is determined based on the target playback position. In one possible implementation, the target playback position corresponds to only one clip. That is, among all video editing tracks in the video draft, only one video editing track has a clip set at the target playback position, and the other video editing tracks have no content at the target playback position. In this case, the clip corresponding to the target playback position can be directly decoded using a single thread. In another possible implementation, the target playback position corresponds to at least two clips. That is, at least two video editing tracks have clips set at the target playback position. In this case, multiple threads are used to decode the clips simultaneously. That is, at least two threads simultaneously decode two clips at at least one moment (a one-to-one relationship exists between threads and clips), i.e., parallel decoding. In one possible implementation, when the number of target clips is less than a preset value, a corresponding target number of threads is determined based on the number of target clips. For example, if the number of target clips is 3, the corresponding target number of threads is also determined to be 3, i.e., three threads decode the three target clips respectively. In another possible implementation, the amount of data to be decoded is obtained based on the resolution of the target material segment, thereby determining a target number of threads that matches the resolution, thereby avoiding excessive consumption of decoding resources and a decrease in decoding speed.
[0037] Specifically, in a possible implementation, as shown in FIG3 , the specific implementation of step S102 includes:
[0038] Step S1021: obtaining the equivalent track number of the target material clip according to the image resolution of the target material clip, where the equivalent track number represents the number of standard video frames with standard resolution equivalent to the video frames in the target material clip.
[0039] Exemplarily, the target material clip is a material clip set at the target playback position on the video editing track. By positioning on the video editing track according to the target playback position, the video data corresponding to the target material clip can be obtained. Afterwards, based on the description information of the attributes of the target material clip in the video data, the image resolution of the target material clip can be obtained, such as 3840×2160 (i.e. 4k), 1920×1080 (i.e. 1080p), etc. Afterwards, an equivalent conversion is performed based on the image resolution of each target material clip to obtain the equivalent track number. Among them, the equivalent track number represents the number of standard video frames with standard resolution that are equivalent to the video frames in the target material clip.
[0040] In a possible implementation, the specific implementation of step S1021 includes:
[0041] Step S1021A: Obtain the standard resolution of the standard video frame.
[0042] Step S1021B: Obtain the equivalent track number of the target material clip according to the ratio of the image resolution of the target material clip to the standard resolution of the standard video frame.
[0043] Exemplarily, a standard video frame is, for example, an image based on the H.264 standard format, and the corresponding standard resolution is 1920×1080 (1080p), with the decoded data amount of one standard video frame as the benchmark. Correspondingly, if the image resolution of the target material segment (the video frame corresponding to the target playback position) is 4k, the equivalent number of tracks is 4, that is, (the video frame corresponding to the decoded target playback position) is equivalent to the decoded data amount of 4 standard video frames. Figure 4 is a schematic diagram of an equivalent number of tracks provided by an embodiment of the present disclosure. As shown in Figure 4, at the target playback position P1 of the video draft, there are two target material segments, namely, target material segment clip_1 and target material segment clip_2 (shown as clip_1 and clip_2 in the figure). Among them, the image resolution of the target material clip clip_1 is 1080p, and the image resolution of the target material clip clip_2 is 4k; after equivalent conversion according to the standard resolution 1080p, the equivalent track number corresponding to the target material clip clip_1 is 1, and the equivalent track number corresponding to the target material clip clip_2 is 4.
[0044] Furthermore, in one possible implementation, when the image resolution of the target material clip is less than the standard resolution, it can be converted into a fraction or decimal. For example, if the image resolution is 480p, then based on the standard resolution of 1080p, the corresponding equivalent track number is 0.5. The equivalent track numbers that are less than 1 are then summed and rounded to obtain the corresponding combined equivalent track number, which is then used in the subsequent calculation of the target thread number. Alternatively, in another possible implementation, when the image resolution of the target material clip is less than the standard resolution, the corresponding equivalent track number is determined to be 1, which is then used in the subsequent calculation of the target thread number.
[0045] Step S1022: Obtain a target number of threads according to the equivalent number of tracks of at least one target material clip.
[0046] For example, after determining the equivalent track number for each target material segment, the equivalent track number for each target material segment can be summed to obtain the sum of the equivalent track numbers. Based on this sum of the equivalent track numbers, a target thread number that matches the sum can be allocated. In one possible implementation, when the sum of the equivalent track numbers is less than the preset number of tracks, meaning the amount of decoded data is small, the same target thread number can be determined directly based on the sum of the equivalent track numbers. For example, if the equivalent track number is 3, the corresponding target thread number is determined to be 3 for subsequent parallel decoding.
[0047] In another possible implementation, when the number of equivalent tracks exceeds the preset number of tracks, the target material segment is decoded using a hybrid decoding method that first performs parallel decoding and then serial decoding. Specifically, the optimal parallel decoding solution can be obtained by obtaining pre-generated decoding time consumption data and performing a table lookup. As shown in FIG5 , the specific implementation of step S1022 includes:
[0048] Step S1022A: Obtain decoding time consumption data corresponding to the terminal device, where the decoding time consumption data includes at least two mapping instances, and the mapping instance is used to represent the mapping relationship between the number of threads and the decoding time length of decoding a standard video frame in parallel based on the number of threads.
[0049] Step S1022B: query decoding time consumption data based on the sum of the equivalent track numbers of each target material clip to obtain at least one optimization thread number, wherein the sum of the at least one optimization thread number is equal to the sum of the equivalent track numbers, and the sum of the decoding time corresponding to the at least one optimization thread number is the shortest.
[0050] Step S1022C: Obtain a target number of threads based on at least one optimized number of threads.
[0051] For example, FIG6 is a schematic diagram of decoding time data provided by an embodiment of the present disclosure. Referring to FIG6 , the decoding time data includes mapping instances #1 to #9, which respectively represent the mapping relationship between the number of threads and the decoding time for decoding a standard video frame in parallel based on the number of threads. For example, in the figure, mapping instance #1 (shown as #1 in the figure) indicates that the decoding time for decoding one standard video frame in parallel is T1; mapping instance #2 (shown as #2 in the figure) indicates that the decoding time for decoding two standard video frames in parallel is T2; and similarly, mapping instance #9 (shown as #9 in the figure) indicates that the decoding time for decoding nine standard video frames in parallel is T9. It should be noted that in the process of calling multiple threads for parallel decoding, due to the influence of factors such as the hard parameters, operating system, and decoding algorithm of the terminal device, when the number of parallel decoding increases linearly, the corresponding decoding time does not increase synchronously and linearly, but varies based on the influencing factors such as the hard parameters, operating system, and decoding algorithm of the terminal device. The decoding time data is used to record the mapping relationship between the number of threads and decoding time for this terminal device. The decoding time consumption data can be obtained through pre-sample detection, or by recording the decoding time consumption in the previous video decoding process. The specific generation method of the decoding time consumption data is not introduced in this embodiment.
[0052] After obtaining the decoding time consumption data, the decoding time consumption data is queried according to the sum of the equivalent track numbers of each target material segment, and a combination of target thread numbers that can complete the total decoding time of all the above target material segments in the shortest is obtained, that is, the optimal decoding strategy. Figure 7 is a schematic diagram of a decoding strategy determination process provided by an embodiment of the present disclosure. The process of determining the target number of threads is further introduced below in conjunction with Figure 7. As shown in Figure 7, after the target material segment clip_1, the target material segment clip_2, and the target material segment clip_3 are equivalently converted, the corresponding equivalent track numbers are track1_num=1, track2_num=3, and track3_num=1 respectively. After summing the equivalent track numbers, the corresponding sum of the equivalent track numbers is track_sum=5, which is the sum of the optimized thread numbers. Then, based on track_sum, a table lookup of the decoding time data reveals at least two decoding strategies: Decoding Strategy A processes target clips clip_1, clip_2, and clip_3 using five threads (i.e., thread_num_1 = 5), resulting in a decoding time of 0.5 seconds (i.e., T = 0.5); Decoding Strategy B processes target clips clip_1 and clip_3 using two threads (i.e., thread_num_1 = 2), resulting in a decoding time of 0.15 seconds, and then processes target clip_2 using two threads (thread_num_2 = 3), resulting in a decoding time of 0.2 seconds. Therefore, the total decoding time for Decoding Strategy B is 0.35 seconds (i.e., T = 0.35). Clearly, the decoding time for Decoding Strategy B is less than that for Decoding Strategy A. That is, the sum of the decoding times corresponding to the optimized number of threads in Decoding Strategy B is less than the sum of the decoding times corresponding to the optimized number of threads in Decoding Strategy A. Of course, it is understandable that other decoding strategies can also be included through the combination of the number of threads, such as decoding strategy C, decoding strategy D, etc., which will not be described one by one in this embodiment. In short, by combining different decoding methods through the production line decoding time consumption data, a decoding strategy with the shortest decoding time (shown in the figure as judged by the IF() conditional function) can be obtained, and the corresponding combination of the optimized number of threads is the target number of threads. According to the specific strategy, the target number of threads can be a specific value or an array of multiple values, thereby realizing the description of the number of decoding threads in the hybrid decoding process of "parallel decoding-serial decoding".
[0053] In this embodiment, by querying decoding time data, at least one optimized thread number is obtained. With the goal of minimizing decoding time, different optimized thread numbers are combined to obtain the optimal decoding strategy. This ultimately achieves the goal of dynamically obtaining the optimal decoding strategy based on different video drafts, thereby improving the speed of parallel decoding during the jump operation of video drafts for multiple video editing tracks.
[0054] Step S103: decoding the target material segments in parallel based on the target number of threads to generate a decoded image of the video draft at the target playback position.
[0055] Exemplarily, after obtaining the target number of threads, the terminal device performs parallel decoding on the target material segment based on the target number of threads. Based on the specific composition of the target number of threads, the terminal device can directly perform parallel decoding based on multiple threads that match the resolution (decoded data volume) of the target material segment to obtain a decoded image, or it can perform multiple parallel decodings to achieve hybrid decoding based on the form of "parallel decoding-serial decoding" to obtain a decoded image. Since the target number of threads obtained based on the previous steps corresponds to the optimal decoding strategy, the shortest total decoding time can be achieved. Therefore, parallel decoding of the target material segment based on the target number of threads can achieve the most efficient video decoding process, increase the speed of generating the decoded image at the target playback position, and reduce the jamming caused by the decoding process.
[0056] In this embodiment, the target playback position of the video draft displayed in the terminal device is determined in response to a jump instruction. The video draft corresponds to at least two video editing tracks, and the video editing track includes at least one material clip. According to the image resolution of the at least two target material clips corresponding to the target playback position, the target number of threads is obtained, and the target number of threads is the number of threads for the terminal device to parallel decode the target material clip at the target playback position. Based on the target number of threads, the target material clip is decoded in parallel to generate a decoded image of the video draft at the target playback position. The number of threads used for parallel decoding of the material clips on multiple video editing tracks is determined based on the image resolution of the target material clip corresponding to the target playback position. Since different image resolutions affect the resources consumed by the decoding process, the target number of threads obtained based on the image resolution can achieve decoding threads that match the amount of decoded data, thereby avoiding the exhaustion of system resources caused by parallel decoding while achieving parallel decoding, reducing the jamming during the video jump process, and improving the smoothness of the video picture.
[0057] Referring to FIG8 , FIG8 is a second flow chart of a video decoding method provided by an embodiment of the present disclosure. Based on the embodiment shown in FIG2 , this embodiment further adds a step of generating decoding time-consuming data and further refines step S102 . The video decoding method includes:
[0058] Step S201: Acquire a sample video including at least two video editing tracks, each video editing track including at least one material clip.
[0059] Step S202: Decode the sample video and update the number of parallel threads when decoding the sample video according to the decoding time, where the decoding time represents the average decoding time of a single track.
[0060] For example, in conjunction with the description of the embodiment shown in FIG2 , in the process of determining the target number of threads to be used when decoding the target material clip, it is necessary to use pre-generated decoding time consumption data as prior knowledge for table lookup, thereby achieving the purpose of quickly determining the optimal decoding strategy. This embodiment, based on the embodiment shown in FIG2 , adds a process for generating decoding time consumption data, namely steps S201-S203. However, it should be noted that the process of generating decoding time consumption data can be independent of and asynchronously executed from the subsequent process of using the decoding time consumption data.
[0061] Specifically, first, a sample video is obtained on the terminal device side. Similar to a video draft, the sample video also has multiple video editing tracks, and each video editing track contains at least one material clip. Afterwards, the decoding of the sample video can be triggered by jumping at equal intervals, and the time taken for each decoding process, that is, the decoding time, is recorded. At the same time, based on factors such as the hard parameters, operating system, and decoding algorithm of the terminal device, using different numbers of threads for decoding will cause changes in the decoding time. Accordingly, the terminal device can also reversely record the number of threads based on the decoding time, thereby obtaining a mapping relationship between the decoding time and the corresponding number of parallel threads, that is, the decoding time data.
[0062] For example, as shown in FIG9 , the specific implementation of step S202 includes:
[0063] Step S2021: Obtain at least one material segment corresponding to the current decoding position of the sample video.
[0064] Step S2022: decoding the current video frame of at least one material clip based on the current number of threads to obtain a corresponding current decoding duration.
[0065] Step S2023: Based on the comparison result between the current decoding time and the previous decoding time, the number of parallel threads is updated to reduce the decoding time corresponding to the next material segment.
[0066] In some embodiments, steps S2021 to S2023 can be executed in a loop until a preset termination condition, such as the end of sample video playback, is met. In this embodiment, only one specific implementation of the cyclic polling is described in detail. For example, in this cyclic polling, the amount of decoded data of one or more material clips corresponding to the current decoding position (i.e., the current video playback position) of the sample video is first obtained. The decoded data amount is, for example, the number of equivalent tracks in the embodiment shown in FIG2 . Then, based on the current number of threads, the current video frame of the material clips with the corresponding number and decoded data amount (the sum of the equivalent track numbers) is decoded to obtain the corresponding current decoding duration. The current decoding duration is then compared with the previous decoding duration of the material clip. If the current decoding duration is longer than the previous decoding duration, the number of threads is reduced, for example, by subtracting 1 from the number of threads; if the current decoding duration is shorter than the previous decoding duration, the number of threads is increased, for example, by adding 1 to the number of threads, thereby adjusting the number of threads to achieve the purpose of reducing the decoding duration corresponding to the next material clip. In the above process, the number of parallel threads is continuously updated to reach an optimal value for a specific amount of decoding data (equivalent number of tracks).
[0067] Step S203: Generate decoding time consumption data according to the decoding time and the corresponding number of parallel threads.
[0068] Exemplarily, after the decoding process of material clips with different numbers and different amounts of decoded data, the terminal device records the optimal (shortest time-consuming) number of parallel threads corresponding to the material clips with different amounts of decoded data, and records it in the decoding time-consuming data. Afterwards, based on the decoding time-consuming data, when processing a combination of material clips with different amounts of decoded data, the corresponding number of parallel threads can be called for decoding to implement the decoding strategy with the shortest time. At the same time, in the above-mentioned process of processing sample videos, the decoding time used for parallel decoding of a standard video frame with different numbers of parallel threads can also be recorded, and a corresponding mapping instance can be generated and stored in the decoding time-consuming data, thereby realizing a hybrid decoding process based on the decoding time-consuming data.
[0069] At the same time, it should be noted that the above-mentioned process of generating decoding time data can also be executed synchronously with the subsequent process of video decoding based on the decoding time data. That is, the above-mentioned decoding time data can be further dynamically updated based on the decoding time of the video decoding based on the decoding time data, thereby achieving continuous and dynamic updating of the decoding time data. In this way, the decoding time data can more accurately reflect the performance characteristics of the terminal device during the multi-track video decoding process, thereby improving the efficiency of video decoding based on the decoding time data.
[0070] Step S204: In response to the jump instruction, determine the target playback position of the video draft displayed in the terminal device, wherein the video draft corresponds to at least two video editing tracks, and the video editing track includes at least one material clip.
[0071] Step S205: obtaining the equivalent track number of the target material clip according to the image resolution of the target material clip, where the equivalent track number represents the number of standard video frames with standard resolution equivalent to the video frames in the target material clip.
[0072] Step S206: Acquire the operating status information of the terminal device.
[0073] Step S207: According to the operation status information, the current available resource amount of the terminal device is obtained, where the available resource amount includes available thread resources and / or available memory resources.
[0074] Step S208: Obtain a target number of threads according to the number of equivalent tracks and the amount of available resources of at least one target material clip.
[0075] For example, in one possible implementation, while the terminal device is running the target application for editing the video draft, the terminal device may also dynamically run other applications and services at the same time. This will cause the resources (available resource amount) available for video decoding on the terminal device to change, and the decoding strategy determined in the previous step is based on the available resources of the terminal device and is therefore also affected by the change in the available resource amount. Therefore, in this embodiment, the operating status information of the terminal device is first obtained, such as the application currently running on the terminal device, the number of activated threads, etc. Then, based on the operating status information, the current available resource amount of the terminal device is obtained, and the available resource amount includes available thread resources and / or available memory resources. Among them, for example, the available resource amount can be represented by an identifier representing a gear, for example, a first gear indicating a large amount of available resources, a second gear indicating a medium amount of available resources, and a third gear indicating a large amount of available resources. Furthermore, the terminal device stores multiple decoding time consumption data, each corresponding to a different amount of available resources. After determining the current available resource amount, the terminal device determines matching decoding time data based on the available resource amount, and then uses the matching decoding time data to determine the corresponding target number of threads. The process of using the decoding time data to determine the corresponding target number of threads has been described in detail in the embodiment shown in Figure 2 and will not be repeated here.
[0076] In this embodiment, the current available resources are determined by obtaining the terminal device's current operating status information, and a matching decoding strategy (target number of threads) is determined based on the available resources. By taking into account the impact of the terminal device itself on resource usage, the efficiency and speed of video decoding can be further improved, and video lag during jumps can be reduced.
[0077] Step S209: decoding the target material segments in parallel based on the target number of threads to generate a decoded image of the video draft at the target playback position.
[0078] In this embodiment, the implementation of step S209 is the same as the implementation of step S103 in the embodiment shown in FIG. 2 of the present disclosure, and will not be described in detail here.
[0079] Corresponding to the video decoding method of the above embodiment, FIG10 is a structural block diagram of a video decoding device provided by an embodiment of the present disclosure. For ease of explanation, only the parts related to the embodiment of the present disclosure are shown. Referring to FIG10 , the video decoding device 3 includes:
[0080] A response module 31 is configured to determine, in response to a jump instruction, a target playback position of a video draft displayed in a terminal device, wherein the video draft corresponds to at least two video editing tracks, and each video editing track includes at least one material clip;
[0081] A processing module 32 is configured to obtain a target number of threads based on the image resolutions of at least two target material clips corresponding to the target playback position, where the target number of threads is the number of threads for the terminal device to decode the target material clips at the target playback position in parallel;
[0082] The generating module 33 is configured to decode the target material segments in parallel based on the target number of threads, and generate a decoded image of the video draft at the target playback position.
[0083] In one embodiment of the present disclosure, the processing module 32 is specifically configured to: obtain the equivalent track number of the target material clip according to the image resolution of the target material clip, where the equivalent track number represents the number of standard video frames with standard resolution that are equivalent to video frames in the target material clip; and obtain the target thread number according to the equivalent track number of at least one target material clip.
[0084] In one embodiment of the present disclosure, when the processing module 32 obtains the equivalent number of tracks of the target material clip based on the image resolution of the target material clip, it is specifically used to: obtain the standard resolution of the standard video frame; and obtain the equivalent number of tracks of the target material clip based on the ratio of the image resolution of the target material clip and the standard resolution of the standard video frame.
[0085] In one embodiment of the present disclosure, when the processing module 32 obtains the target number of threads based on the equivalent number of tracks of at least one target material clip, it is specifically used to: obtain decoding time consumption data corresponding to the terminal device, the decoding time consumption data includes at least two mapping instances, and the mapping instance is used to characterize the mapping relationship between the number of threads and the decoding time of a standard video frame decoded in parallel based on the number of threads; query the decoding time consumption data based on the sum of the equivalent number of tracks of each target material clip to obtain at least one optimized number of threads, wherein the sum of the at least one optimized number of threads is equal to the sum of the equivalent number of tracks, and the sum of the decoding time corresponding to the at least one optimized number of threads is the shortest; and obtain the target number of threads based on the at least one optimized number of threads.
[0086] In one embodiment of the present disclosure, the processing module 32 is further used to: obtain the operating status information of the terminal device; obtain the current available resource amount of the terminal device based on the operating status information, and the available resource amount includes available thread resources and / or available memory resources; when the processing module 32 obtains the target number of threads based on the equivalent number of tracks of at least one target material clip, it is specifically used to: obtain the target number of threads based on the equivalent number of tracks of at least one target material clip and the available resource amount.
[0087] In one embodiment of the present disclosure, the standard video frame is an image based on the H.264 standard format, and the standard resolution corresponding to the standard video frame is 1080P.
[0088] In one embodiment of the present disclosure, the processing module 32 is further used to: obtain a sample video including at least two video editing tracks, each video editing track including at least one material clip; decode the sample video, and update the number of parallel threads when decoding the sample video based on the decoding time, the decoding time representing the average decoding time of a single track; generate decoding time consumption data based on the decoding time and the corresponding number of parallel threads.
[0089] In one embodiment of the present disclosure, when the processing module 32 decodes a sample video and updates the number of parallel threads when decoding the sample video according to the decoding duration, it is specifically used to: obtain at least one material segment corresponding to the current decoding position of the sample video; decode the current video frame of the at least one material segment based on the current number of threads to obtain the corresponding current decoding duration; and update the number of parallel threads according to the comparison result of the current decoding duration with the previous decoding duration to reduce the decoding duration corresponding to the next material segment.
[0090] The response module 31, the processing module 32 and the generation module 33 are connected in sequence. The video decoding device 3 provided in this embodiment can implement the technical solution of the above method embodiment, and its implementation principle and technical effect are similar, which will not be described in detail in this embodiment.
[0091] FIG11 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure. As shown in FIG11 , the electronic device 4 includes:
[0092] A processor 41, and a memory 42 communicatively connected to the processor 41;
[0093] Memory 42 stores computer-executable instructions;
[0094] The processor 41 executes the computer-executable instructions stored in the memory 42 to implement the video decoding method in the embodiments shown in FIG. 2 to FIG. 9 .
[0095] Optionally, the processor 41 and the memory 42 are connected via a bus 43 .
[0096] The relevant explanations can be understood by referring to the relevant descriptions and effects corresponding to the steps in the embodiments corresponding to Figures 2 to 9, and no further details will be given here.
[0097] An embodiment of the present disclosure provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are executed by a processor, they are used to implement the video decoding method provided in any one of the embodiments corresponding to Figures 2 to 9 of the present disclosure.
[0098] In order to implement the above embodiment, the embodiment of the present disclosure further provides an electronic device.
[0099] Referring to FIG12 , there is shown a schematic diagram of the structure of an electronic device 900 suitable for implementing an embodiment of the present disclosure. The electronic device 900 may be a terminal device or a server. 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 (e.g., vehicle-mounted navigation terminals), and fixed terminals such as digital TVs and desktop computers. The electronic device shown in FIG12 is merely an example and should not limit the functionality and scope of use of the embodiments of the present disclosure.
[0100] As shown in Figure 12, the electronic device 900 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage device 908 into a random access memory (RAM) 903. Various programs and data required for the operation of the electronic device 900 are also stored in the RAM 903. The processing device 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0101] Typically, the following devices may be connected to the I / O interface 905: an input device 906 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 907 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 908 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 909. The communication device 909 may allow the electronic device 900 to communicate with other devices wirelessly or by wire to exchange data. Although FIG12 shows an electronic device 900 with various devices, it should be understood that it is not required to implement or have all of the devices shown. More or fewer devices may be implemented or have alternatively.
[0102] 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 909, or installed from the storage device 908, or installed from the ROM 902. When the computer program is executed by the processing device 901, the above-mentioned functions defined in the method of the embodiment of the present disclosure are performed.
[0103] 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.
[0104] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0105] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device executes the method shown in the above embodiment.
[0106] 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).
[0107] 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.
[0108] 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."
[0109] 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.
[0110] 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.
[0111] In a first aspect, according to one or more embodiments of the present disclosure, a video decoding method is provided, including:
[0112] In response to a jump instruction, a target playback position of a video draft displayed in a terminal device is determined, wherein the video draft corresponds to at least two video editing tracks, and the video editing tracks include at least one material clip; based on the image resolution of at least two target material clips corresponding to the target playback position, a target number of threads is obtained, and the target number of threads is the number of threads for the terminal device to parallel decode the target material clips at the target playback position; based on the target number of threads, the target material clips are decoded in parallel to generate a decoded image of the video draft at the target playback position.
[0113] According to one or more embodiments of the present disclosure, obtaining the target number of threads based on the image resolutions of at least two target material clips corresponding to the target playback position includes: obtaining the equivalent number of tracks of the target material clip based on the image resolution of the target material clip, the equivalent number of tracks representing the number of standard video frames with standard resolution that are equivalent to video frames in the target material clip; and obtaining the target number of threads based on the equivalent number of tracks of at least one of the target material clips.
[0114] According to one or more embodiments of the present disclosure, obtaining the equivalent number of tracks of the target material clip based on the image resolution of the target material clip includes: obtaining the standard resolution of a standard video frame; and obtaining the equivalent number of tracks of the target material clip based on the ratio of the image resolution of the target material clip to the standard resolution of the standard video frame.
[0115] According to one or more embodiments of the present disclosure, obtaining the target number of threads based on the equivalent track number of at least one target material fragment includes: obtaining decoding time consumption data corresponding to the terminal device, the decoding time consumption data including at least two mapping instances, and the mapping instance is used to characterize the mapping relationship between the number of threads and the decoding time of a standard video frame decoded in parallel based on the number of threads; querying the decoding time consumption data based on the sum of the equivalent track numbers of each target material fragment to obtain at least one optimized number of threads, wherein the sum of the at least one optimized number of threads is equal to the sum of the equivalent track numbers, and the sum of the decoding time corresponding to the at least one optimized number of threads is the shortest; and obtaining the target number of threads based on the at least one optimized number of threads.
[0116] According to one or more embodiments of the present disclosure, the method further includes: obtaining the operating status information of the terminal device; obtaining the current available resource amount of the terminal device based on the operating status information, and the available resource amount includes available thread resources and / or available memory resources; obtaining the target number of threads based on the equivalent track number of at least one target material fragment, including: obtaining the target number of threads based on the equivalent track number of at least one target material fragment and the available resource amount.
[0117] According to one or more embodiments of the present disclosure, the standard video frame is an image based on the H.264 standard format, and the standard resolution corresponding to the standard video frame is 1080P.
[0118] According to one or more embodiments of the present disclosure, the method further includes: obtaining a sample video including at least two video editing tracks, each of the video editing tracks including at least one material clip; decoding the sample video, and updating the number of parallel threads when decoding the sample video based on the decoding time, the decoding time representing the average decoding time of a single track; generating decoding time consumption data based on the decoding time and the corresponding number of parallel threads.
[0119] According to one or more embodiments of the present disclosure, the decoding of the sample video and updating the number of parallel threads when decoding the sample video according to the decoding duration include: obtaining at least one material segment corresponding to the current decoding position of the sample video; decoding the current video frame of the at least one material segment based on the current number of threads to obtain the corresponding current decoding duration; and updating the number of parallel threads according to the comparison result of the current decoding duration with the previous decoding duration to reduce the decoding duration corresponding to the next material segment.
[0120] In a second aspect, according to one or more embodiments of the present disclosure, a video decoding apparatus is provided, including:
[0121] a response module, configured to determine, in response to a jump instruction, a target playback position of a video draft displayed in a terminal device, wherein the video draft corresponds to at least two video editing tracks, and the video editing tracks include at least one material clip;
[0122] a processing module, configured to obtain a target number of threads according to image resolutions of at least two target material segments corresponding to the target playback position, the target number of threads being the number of threads for the terminal device to decode the target material segments at the target playback position in parallel;
[0123] A generating module is configured to perform parallel decoding on the target material segments based on the target number of threads, and generate a decoded image of the video draft at the target playback position.
[0124] According to one or more embodiments of the present disclosure, the processing module is specifically configured to: obtain the equivalent track number of the target material clip according to the image resolution of the target material clip, wherein the equivalent track number represents the number of standard video frames with standard resolution equivalent to the video frames in the target material clip; and obtain the target number of threads according to the equivalent track number of at least one of the target material clips.
[0125] According to one or more embodiments of the present disclosure, when the processing module obtains the equivalent number of tracks of the target material clip based on the image resolution of the target material clip, it is specifically used to: obtain the standard resolution of the standard video frame; and obtain the equivalent number of tracks of the target material clip based on the ratio of the image resolution of the target material clip to the standard resolution of the standard video frame.
[0126] According to one or more embodiments of the present disclosure, when the processing module obtains the target number of threads based on the equivalent track number of at least one target material fragment, it is specifically used to: obtain decoding time consumption data corresponding to the terminal device, the decoding time consumption data includes at least two mapping instances, and the mapping instance is used to characterize the mapping relationship between the number of threads and the decoding time length of a standard video frame decoded in parallel based on the number of threads; query the decoding time consumption data based on the sum of the equivalent track numbers of each target material fragment to obtain at least one optimized thread number, wherein the sum of the at least one optimized thread number is equal to the sum of the equivalent track numbers, and the sum of the decoding time lengths corresponding to the at least one optimized thread number is the shortest; and obtain the target thread number based on the at least one optimized thread number.
[0127] According to one or more embodiments of the present disclosure, the processing module is further used to: obtain the operating status information of the terminal device; obtain the current available resource amount of the terminal device based on the operating status information, and the available resource amount includes available thread resources and / or available memory resources; when the processing module obtains the target number of threads based on the equivalent track number of at least one target material fragment, it is specifically used to: obtain the target number of threads based on the equivalent track number of at least one target material fragment and the available resource amount.
[0128] According to one or more embodiments of the present disclosure, the standard video frame is an image based on the H.264 standard format, and the standard resolution corresponding to the standard video frame is 1080P.
[0129] According to one or more embodiments of the present disclosure, the processing module is further used to: obtain a sample video including at least two video editing tracks, each of the video editing tracks including at least one material clip; decode the sample video, and update the number of parallel threads when decoding the sample video based on the decoding time, the decoding time representing the average decoding time of a single track; generate decoding time-consuming data based on the decoding time and the corresponding number of parallel threads.
[0130] According to one or more embodiments of the present disclosure, when the processing module decodes the sample video and updates the number of parallel threads when decoding the sample video according to the decoding duration, it is specifically used to: obtain at least one material segment corresponding to the current decoding position of the sample video; decode the current video frame of the at least one material segment based on the current number of threads to obtain the corresponding current decoding duration; and update the number of parallel threads according to the comparison result of the current decoding duration with the previous decoding duration to reduce the decoding duration corresponding to the next material segment.
[0131] In a third aspect, according to one or more embodiments of the present disclosure, there is provided an electronic device, comprising: at least one processor and a memory;
[0132] The memory stores computer-executable instructions;
[0133] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the video decoding method described in the first aspect and various possible designs of the first aspect.
[0134] In a fourth aspect, according to one or more embodiments of the present disclosure, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer-executable instructions. When the processor executes the computer-executable instructions, the video decoding method described in the first aspect and various possible designs of the first aspect is implemented.
[0135] In a fifth aspect, according to one or more embodiments of the present disclosure, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the video decoding method as described in the first aspect and various possible designs of the first aspect.
[0136] The above description is merely a preferred embodiment of the present disclosure and an illustration of the technical principles employed. 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 also includes other technical solutions formed by any combination of the above-mentioned technical features or their equivalents without departing from the above-mentioned disclosed concepts. For example, a technical solution formed by replacing the above-mentioned features with (but not limited to) technical features with similar functions disclosed in this disclosure.
[0137] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details have been included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0138] 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 decoding method, comprising: In response to the jump instruction, determining a target playback position of a video draft displayed in a terminal device, wherein the video draft corresponds to at least two video editing tracks, and the video editing tracks include at least one material clip; Obtaining a target number of threads according to image resolutions of at least two target material segments corresponding to the target playback position, the target number of threads being the number of threads for the terminal device to decode the target material segments at the target playback position in parallel; and The target material segments are decoded in parallel based on the target number of threads to generate a decoded image of the video draft at the target playback position.
2. The method according to claim 1, wherein obtaining the target number of threads according to the image resolutions of at least two target material segments corresponding to the target playback position comprises: According to the image resolution of the target material clip, the equivalent track number of the target material clip is obtained, where the equivalent track number represents the number of standard video frames with standard resolution equivalent to the video frames in the target material clip; The target number of threads is obtained according to the equivalent number of tracks of at least one of the target material clips.
3. The method according to claim 2, wherein obtaining the equivalent track number of the target material clip according to the image resolution of the target material clip comprises: Get the standard resolution of the standard video frame; The equivalent track number of the target material segment is obtained according to the ratio of the image resolution of the target material segment to the standard resolution of the standard video frame.
4. The method according to claim 2, wherein obtaining the target number of threads according to the equivalent track number of at least one target material segment comprises: Obtaining decoding time consumption data corresponding to the terminal device, wherein the decoding time consumption data includes at least two mapping instances, and the mapping instance is used to represent a mapping relationship between the number of threads and the decoding time length of a standard video frame decoded in parallel based on the number of threads; According to the sum of the equivalent track numbers of each of the target material clips, query the decoding time consumption data to obtain at least one optimization thread number, wherein the sum of the at least one optimization thread number is equal to the sum of the equivalent track numbers, and the sum of the decoding time lengths corresponding to the at least one optimization thread number is the shortest; The target number of threads is obtained according to the at least one optimized number of threads.
5. The method according to claim 2, wherein the method further comprises: Obtaining operation status information of the terminal device; Obtaining, according to the running status information, the current available resource amount of the terminal device, wherein the available resource amount includes available thread resources and / or available memory resources; The step of obtaining the target number of threads according to the equivalent number of tracks of at least one target material segment comprises: The target number of threads is obtained according to the number of equivalent tracks of at least one target material segment and the amount of available resources.
6. The method according to claim 2, wherein the standard video frame is an image based on the H.264 standard format, and the standard resolution corresponding to the standard video frame is 1080P.
7. The method according to claim 1, wherein the method further comprises: Acquire a sample video including at least two video editing tracks, each of the video editing tracks including at least one material clip; Decoding the sample video, and updating the number of parallel threads when decoding the sample video according to a decoding duration, wherein the decoding duration represents an average decoding duration of a single track; Decoding time consumption data is generated according to the decoding time and the corresponding number of parallel threads.
8. The method according to claim 7, wherein decoding the sample video and updating the number of parallel threads when decoding the sample video according to the decoding duration comprises: Obtaining at least one material segment corresponding to a current decoding position of the sample video; Decoding a current video frame of the at least one material segment based on the current number of threads to obtain a corresponding current decoding duration; According to the comparison result between the current decoding time and the previous decoding time, the number of parallel threads is updated to reduce the decoding time corresponding to the next material segment.
9. A video decoding device, comprising: A response module, configured to determine, in response to a jump instruction, a target playback position of a video draft displayed in a terminal device, wherein the video draft corresponds to at least two video editing tracks, and the video editing tracks include at least one material clip; A processing module, configured to obtain a target number of threads according to image resolutions of at least two target material segments corresponding to the target playback position, wherein the target number of threads is the number of threads for the terminal device to decode the target material segments at the target playback position in parallel; A generation module is used to decode the target material fragments in parallel based on the target number of threads to generate a decoded image of the video draft at the target playback position.
10. An electronic 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 decoding 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, and when a processor executes the computer-executable instructions, the video decoding method according to any one of claims 1 to 8 is implemented.
12. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the video decoding method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Display device and video processing method
CN115529489A
Video jump playing method and device, electronic equipment and storage medium
CN115802104A
Video Player Instance Prioritization
US20130132966A1