Video decoding method and device, electronic equipment and storage medium
By determining the number of parallel decoding threads according to the target playback location of the video draft, the efficient parallel decoding of multi -track video data is realized, and the video editing jump stuck and the smoothness of the screen are solved Low problem.
Patent Information
- Application Number
- CN202310919485.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-25
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2043-07-25
AI Technical Summary
In audio and video non-computer scenarios, the centralized decoding of multi-track video data is usually done in serial decoding, resulting in the problem of jumping stuttering and the video screen cannot be displayed smoothly during the video editing process.
By responding to the jump instruction, determine the target playback location of the video draft, and determine the number of target threads according to the image resolution of the material fragment at the target playback location, and achieve parallel decoding of the material fragments of multiple video editing tracks.
Through parallel decoding, the stuck in the video jump is reduced, the smoothness of the video screen is improved, and the system resources are depleted due to parallel decoding.
Smart Images

Figure CN119383344A_ABST
Abstract
Description
Technical Field
[0001] 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
[0002] In an audio and video non-editing scenario, when it is necessary to simultaneously edit 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.
[0003] In the prior art, 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. Summary of the invention
[0004] The embodiments of the present disclosure provide a video decoding method, device, electronic device and storage medium to overcome the problems of jump jamming and video screen not being able to be displayed smoothly during the video editing jump process.
[0005] In a first aspect, an embodiment of the present disclosure provides a video decoding method, including:
[0006] 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 segment; a target number of threads is obtained according to image resolutions of at least two target material segments corresponding to the target playback position, and the target number of threads is the number of threads for the terminal device to parallelly decode the target material segments at the target playback position; 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.
[0007] In a second aspect, an embodiment of the present disclosure provides a video decoding device, including:
[0008] 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;
[0009] 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;
[0010] 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.
[0011] In a third aspect, an embodiment of the present disclosure provides an electronic device, including: a processor and a memory;
[0012] The memory stores computer-executable instructions;
[0013] The 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.
[0014] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, in which computer execution instructions are stored. When a processor executes the computer execution instructions, the video decoding method described in the first aspect and various possible designs of the first aspect is implemented.
[0015] 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 as described in the first aspect and various possible designs of the first aspect.
[0016] The video decoding method, device, electronic device and storage medium provided in this embodiment determine the target playback position of the video draft displayed in the terminal device by responding to the jump instruction, wherein 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 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 decode the target material clip at the target playback position in parallel; based on the target number of threads, the target material clip is decoded in parallel to generate the decoded image of the video draft at the target playback position. The number of threads for parallel decoding of the material clips on multiple video editing tracks is determined based on the image resolution corresponding to the target material clip at the target playback position. Since different image resolutions affect the resources consumed in 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. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. 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 creative labor.
[0018] Figure 1 An application scenario diagram of the video decoding method provided by the embodiment of the present disclosure;
[0019] Figure 2 The video decoding method provided by the present invention is shown in FIG. Figure 1 ;
[0020] Figure 3 for Figure 2 A flowchart of a specific implementation method of step S102 in the illustrated embodiment;
[0021] Figure 4 A schematic diagram of an equivalent orbital number provided in an embodiment of the present disclosure;
[0022] Figure 5 for Figure 3 A flowchart of a specific implementation method of step S1022 in the illustrated embodiment;
[0023] Figure 6 A schematic diagram of decoding time-consuming data provided by an embodiment of the present disclosure;
[0024] Figure 7 A schematic diagram of a decoding strategy determination process provided by an embodiment of the present disclosure;
[0025] Figure 8 The video decoding method provided by the present invention is shown in FIG. Figure 2 ;
[0026] Fig. 9 for Figure 8 A flowchart of a specific implementation method of step S202 in the illustrated embodiment;
[0027] Fig.10 A structural block diagram of a video decoding device provided by an embodiment of the present disclosure;
[0028] Fig.11 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure;
[0029] Fig.12 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0030] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.
[0031] 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.
[0032] The application scenarios of the embodiments of the present disclosure are explained below:
[0033] Figure 1 This is an application scenario diagram of the video decoding method provided by the embodiment of the present disclosure. The video decoding method provided by the embodiment of the present disclosure can be applied to an application with a video editing function, and more specifically, 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 service end corresponding to the above-mentioned application, or other electronic devices with similar functions. Figure 1As shown in , taking a terminal device as an example, a target application for video editing is running in the terminal device. After loading the project file or draft file corresponding to the video draft 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. Specifically, each video editing track (such as Track_1, Track_2 and Track_3 shown in the figure) contains one or more material clips constituting the video draft (such as clips c1, c2, c3 and c4 shown in the figure), and the layer of the material clips located 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 turn in the output video finally generated based on the layer where it is located. Furthermore, in the video editing interface, users 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.
[0034] Furthermore, in the above-mentioned video editing process, when the user jumps (seeks) the video to a specified playback position (for example, the T_1 position in the figure) by operating the video editing interface, the terminal device will centrally decode the material segments on all video editing tracks at the playback position. After the above-mentioned material segments are decoded, they are rendered on the screen according to the decoded images corresponding to each material segment, and the corresponding preview video is displayed in the preview window for the user to view.
[0035] In the prior art, the centralized decoding of multi-track video data is usually implemented by serial decoding, for example, the above-mentioned fragments c1, c3 and c4 are serially decoded in sequence, so as to obtain the video frame (decoded image) of the video draft at the playback position. However, the above-mentioned scheme in the prior art has 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 schemes, 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, the number of parallel decoding threads is too large and the amount of decoded data is too large, the decoding speed will drop rapidly, which is lower than the decoding speed of serial decoding, thereby causing the instability of the decoding process. Therefore, how to avoid the decrease in decoding speed caused by excessive consumption of parallel decoding resources during the jump process of multi-track video is a problem that needs to be solved urgently. The disclosed embodiment provides a wearing deviation detection method to solve the above problems.
[0036] refer to Figure 2 , Figure 2 The video decoding method provided by the present invention is shown in FIG. Figure 1 The method of this embodiment can be applied in a terminal device. The video decoding method includes:
[0037] 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.
[0038] For example, reference Figure 1 As shown in the application scenario diagram, 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. For details, please refer to Figure 1As shown, after receiving the jump instruction input by the user, the terminal device jumps the current playback position of the video draft to the target playback position corresponding to the jump instruction, wherein 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 material clips on each video editing track after superimposed display in real time.
[0039] 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 the draft file, and the specific implementation method of determining the corresponding playback timestamp (target playback position) based on the jump instruction are prior arts known to those skilled in the art, and will not be repeated here.
[0040] 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.
[0041] Exemplarily, after the target playback position is obtained, the material clip located at the target playback position is determined according to the target playback position. In a possible implementation, the target playback position corresponds to only one material clip, that is, among all the video editing tracks in the video draft, only one video editing track is provided with a material clip at the target playback position, and the other video editing tracks have no content at the target playback position. In this case, the material clip corresponding to the target playback position can be directly decoded by a single thread. In another possible implementation, the target playback position corresponds to at least two material clips, that is, at least two video editing tracks are provided with material clips at the target playback position. At this time, multiple threads are used to decode the above material clips at the same time, that is, at least two threads decode two material clips at the same time at least at one moment (threads and material clips are in a one-to-one relationship), that is, parallel decoding. In a possible implementation, when the number of target material clips is less than a preset value, the corresponding target number of threads is determined based on the number of target material clips. For example, if the number of target material clips is 3, the corresponding target number of threads is also determined to be 3, that is, 3 threads decode 3 target material clips respectively. In another possible implementation, the amount of data to be decoded is obtained based on the resolution of the target material segment, so as to determine the target number of threads matching the resolution, thereby avoiding excessive consumption of decoding resources and a decrease in decoding speed.
[0042] Specifically, in a possible implementation, Figure 3 As shown, the specific implementation of step S102 includes:
[0043] Step S1021: 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.
[0044] Exemplarily, the target material clip is a material clip set at the target playback position on the video editing track. The video data corresponding to the target material clip can be obtained by positioning on the video editing track according to the target playback position. Afterwards, based on the description information of the properties 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 according to the image resolution of each target material clip to obtain the equivalent track number, wherein 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.
[0045] In a possible implementation, a specific implementation of step S1021 includes:
[0046] Step S1021A: Obtain the standard resolution of the standard video frame.
[0047] 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.
[0048] Exemplarily, a standard video frame is an image based on the H.264 standard format, and the corresponding standard resolution is 1920×1080 (1080p). Taking the decoded data amount of one standard video frame as the benchmark, 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 decoded video frame corresponding to the target playback position) is equivalent to the decoded data amount of 4 standard video frames. Figure 4 A schematic diagram of an equivalent orbital number provided in an embodiment of the present disclosure, such as Figure 4As shown, at the target playback position P1 of the video draft, there correspond to two target material clips, namely target material clip clip_1 and target material clip clip_2 (shown as clip_1 and clip_2 in the figure), wherein the image resolution of target material clip clip_1 is 1080p, and the image resolution of 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 = 1, and the equivalent track number corresponding to the target material clip clip_2 = 4.
[0049] Furthermore, in a 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 1080p, the corresponding equivalent track number is 0.5. After that, the equivalent track numbers that are less than 1 are summed and rounded to obtain the corresponding merged equivalent track number, which is 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, so that it is used in the subsequent calculation of the target thread number.
[0050] Step S1022: Obtain a target number of threads according to the equivalent number of tracks of at least one target material segment.
[0051] Exemplarily, after determining the equivalent track number of each target material segment, the equivalent track number of each target material segment can be summed to obtain the sum of the equivalent track numbers, and then further based on the equivalent track numbers, the target thread number matching it is allocated. In a possible implementation, when the sum of the equivalent track numbers is less than the preset track number, that is, 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, and subsequent parallel decoding is performed.
[0052] In another possible implementation, when the number of equivalent tracks is greater than the preset number of tracks, the target material segment is decoded by a hybrid decoding method of first 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. Figure 5 As shown, the specific implementation of step S1022 includes:
[0053] Step S1022A: Obtain 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 characterize 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.
[0054] Step S1022B: query the decoding time consumption data according to the sum of the equivalent track numbers of each target material segment 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.
[0055] Step S1022C: Obtain a target number of threads based on at least one optimized number of threads.
[0056] For example, Figure 6 A schematic diagram of decoding time-consuming data provided by an embodiment of the present disclosure, referring to Figure 6 As shown, the decoding time-consuming data includes mapping instances #1 to #9, which respectively represent the mapping relationship between the number of threads and the decoding time of 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 when decoding 1 standard video frame in parallel is T1; mapping instance #2 (shown as #2 in the figure) indicates that the decoding time when decoding 2 standard video frames in parallel is T2; and similarly, mapping instance #9 (shown as #9 in the figure) indicates that the decoding time when decoding 9 standard video frames in parallel is T9. It should be noted that in the process of calling multiple threads for parallel decoding, based on 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 changes based on the above-mentioned hard parameters, operating system, decoding algorithm and other influencing factors. The decoding time-consuming data is used to record the mapping relationship between the number of threads and the decoding time for this terminal device. The decoding time consumption data may be obtained through pre-sample detection, or by recording the decoding time consumption in the previous video decoding process. The specific method for generating the decoding time consumption data is not introduced in this embodiment.
[0057] After obtaining the decoding time consumption data, query the decoding time consumption data according to the sum of the equivalent track numbers of each target material segment to obtain a combination of target thread numbers that can minimize the total decoding time of all the above target material segments, that is, the optimal decoding strategy. Figure 7 A schematic diagram of a decoding strategy determination process provided by an embodiment of the present disclosure is shown below in conjunction with Figure 7 The above process of determining the target number of threads is further described as follows: Figure 7As shown, after equivalent conversion of target clips clip_1, clip_2 and clip_3, the corresponding equivalent track numbers are track1_num=1, track2_num=3, and track3_num=1. After summing up the equivalent track numbers, the corresponding sum of equivalent track numbers is track_sum=5, which is the sum of the optimization threads. Afterwards, based on track_sum, the decoding time consumption data is looked up in a table, and at least two decoding strategies can be obtained as follows: decoding strategy A, through 5 threads (i.e., thread_num_1=5) to process the target material clips clip_1, target material clips clip_2 and target material clips clip_3, the corresponding decoding time consumption is 0.5 seconds (i.e., T=0.5); decoding strategy B, through 2 threads (i.e., thread_num_1=2) to process the target material clips clip_1 and target material clips clip_3, the corresponding decoding time length is 0.15 seconds, and then through 2 threads (thread_num_2=3) to process the target material clip clip_2, the corresponding decoding time length is 0.2 seconds, then the total decoding time consumption corresponding to decoding strategy B is 0.35 seconds (i.e., T=0.35). Obviously, the decoding time consumption of decoding strategy B is less than the decoding time consumption of decoding strategy A. That is, the sum of the decoding times corresponding to the number of threads optimized in decoding strategy B is less than the sum of the decoding times corresponding to the number of threads optimized in decoding strategy A. Of course, it can be understood 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, through the production line decoding time consumption data, different decoding methods are combined to obtain a decoding strategy with the shortest decoding time (shown in the figure as judged by the IF() conditional function), and the corresponding combination of the number of optimized 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" form.
[0058] In the steps of this embodiment, by querying the decoding time-consuming data, at least one optimized thread number is obtained, and with the shortest decoding time as the goal, different optimized thread numbers are combined to obtain the optimal decoding strategy, and ultimately the purpose of dynamically obtaining the best decoding strategy according to different video drafts is achieved, thereby improving the speed of parallel decoding during the jump operation of video drafts for multiple video editing tracks.
[0059] 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.
[0060] Exemplarily, after obtaining the target number of threads, the terminal device performs parallel decoding on the target material fragments 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 fragment to obtain a decoded image, or it can perform multiple parallel decodings to implement hybrid decoding based on the "parallel decoding-serial decoding" form 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 fragments based on the target number of threads can achieve the most efficient video decoding process, increase the speed of generating decoded images at the target playback position, and reduce the jamming caused by the decoding process.
[0061] In this embodiment, by responding to a jump instruction, the target playback position of the video draft displayed in the terminal device is determined, wherein 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 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 decode the target material clip at the target playback position in parallel; 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 for parallel decoding of material clips on multiple video editing tracks is determined based on the image resolution corresponding to the target material clip at the target playback position. Since different image resolutions affect the resources consumed in 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 system resource exhaustion caused by parallel decoding while achieving parallel decoding, reducing the jamming during the video jump process, and improving the smoothness of the video picture.
[0062] refer to Figure 8 , Figure 8 The video decoding method provided by the present invention is shown in FIG. Figure 2 In this embodiment Figure 2 On the basis of the embodiment shown, a step of generating decoding time-consuming data is further added, and step S102 is further refined. The video decoding method includes:
[0063] Step S201: Acquire a sample video including at least two video editing tracks, each of which includes at least one material clip.
[0064] 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.
[0065] For example, in combination Figure 2 In the embodiment shown, in the process of determining the target number of threads used when decoding the target material clip, it is necessary to use the pre-generated decoding time consumption data as a priori knowledge to perform a table lookup, so as to achieve the purpose of quickly determining the optimal decoding strategy. Figure 2 On the basis of the embodiment shown, a process of generating decoding time-consuming data, namely steps S201-S203, is added. However, it should be noted that the process of generating decoding time-consuming data can be independent of the subsequent process of using the decoding time-consuming data and executed asynchronously.
[0066] Specifically, first, a sample video is obtained on the terminal device side. Similar to the 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 consumed for each decoding process, that is, the decoding time, is recorded. At the same time, based on the hard parameters, operating system, decoding algorithm and other factors of the terminal device, using different numbers of threads for decoding will cause changes in the decoding time. Correspondingly, the terminal device can also reversely record the number of threads according to 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.
[0067] For example, Fig. 9 As shown, the specific implementation of step S202 includes:
[0068] Step S2021: Obtain at least one material segment corresponding to the current decoding position of the sample video.
[0069] Step S2022: decoding a current video frame of at least one material segment based on the current number of threads to obtain a corresponding current decoding duration.
[0070] Step S2023: 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.
[0071] The above steps S2021 to S2023 may be executed cyclically until a preset termination condition such as the end of the 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, first, the amount of decoded data of one or more material segments corresponding to the current decoding position (i.e., the current video playback position) of the sample video is obtained. The amount of decoded data is, for example, Figure 2The equivalent number of tracks in the illustrated embodiment. Then, based on the current number of threads, the current video frame of the material segment of the corresponding number and amount of decoded data (the sum of the equivalent number of tracks) is decoded to obtain the corresponding current decoding duration. Then, the current decoding duration is compared with the last decoding duration of the material segment. If the current decoding duration is longer than the previous decoding duration, the number of threads is reduced, for example, the number of threads is reduced by 1; if the current decoding duration is shorter than the previous decoding duration, the number of threads is increased, for example, the number of threads is increased by 1, thereby realizing the action adjustment of the number of threads to achieve the purpose of reducing the decoding duration corresponding to the next material segment. In the above process, the number of parallel threads is continuously updated to achieve an optimal value for a specific amount of decoded data (equivalent number of tracks).
[0072] Step S203: Generate decoding time consumption data according to the decoding time and the corresponding number of parallel threads.
[0073] 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 to perform 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 the 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.
[0074] At the same time, it should be noted that the above-mentioned process of generating decoding time-consuming data can also be executed synchronously with the subsequent process of video decoding based on the decoding time-consuming data, that is, according to the decoding time of video decoding based on the decoding time-consuming data, the above-mentioned decoding time-consuming data can be further dynamically updated, thereby realizing continuous and dynamic updating of the decoding time-consuming data, so that the decoding time-consuming data can more accurately reflect the performance characteristics of the terminal device in the process of multi-track video decoding, and improve the efficiency of video decoding based on decoding time-consuming data.
[0075] 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.
[0076] Step S205: 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.
[0077] Step S206: Obtain the operating status information of the terminal device.
[0078] Step S207: According to the operation 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.
[0079] 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 segment.
[0080] Exemplarily, in a possible implementation, when the terminal device runs the target application for editing the video draft, the terminal device may also dynamically run other applications and services at the same time, which will cause the resources (available resources) of the terminal device that can be used for video decoding to change, and the decoding strategy determined in the previous step can only be implemented based on the available resources of the terminal device, so it is also affected by the change of the available resources. Therefore, in this embodiment, the running state 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 running state information, the current available resources of the terminal device are obtained, and the available resources include available thread resources and / or available memory resources, wherein, exemplarily, the available resources can be represented by an identifier representing a gear, for example, a first gear representing a large amount of available resources, a second gear representing a medium amount of available resources, and a third gear representing a large amount of available resources. Further, the terminal device stores a plurality of decoding time-consuming data, which correspond to different available resources. After determining the current available resources, the terminal device determines the matching decoding time-consuming data based on the available resources, and then uses the matching decoding time-consuming data to determine the corresponding target number of threads. The process of using the decoding time-consuming data to determine the corresponding target number of threads is Figure 2 The illustrated embodiment has been described in detail and will not be described again in detail here.
[0081] In the steps of this embodiment, the current operating status information of the terminal device is obtained to determine the current available resource amount, and the decoding strategy (target number of threads) that matches the available resource amount is determined based on the available resource amount. Since the impact of the terminal device itself on resource occupancy is taken into account, the efficiency and speed of video decoding can be further improved, and the freeze during video jumping can be reduced.
[0082] 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.
[0083] In this embodiment, the implementation method of step S209 is the same as that of the present disclosure. Figure 2 The implementation method of step S103 in the illustrated embodiment is the same and will not be described in detail here.
[0084] Corresponding to the video decoding method of the above embodiment, Fig.10 This 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.
[0085] Reference Fig.10 , the video decoding device 3 comprises:
[0086] A response module 31 is used to determine 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 track includes at least one material clip;
[0087] A processing module 32, 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, 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;
[0088] The generating module 33 is used 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.
[0089] In one embodiment of the present disclosure, the processing module 32 is specifically used to: obtain the equivalent track number of the target material segment according to the image resolution of the target material segment, the equivalent track number represents the number of standard video frames with standard resolution equivalent to the video frames in the target material segment; obtain the target thread number according to the equivalent track number of at least one target material segment.
[0090] In one embodiment of the present disclosure, when the processing module 32 obtains the equivalent number of tracks of the target material clip according to 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 according to the ratio of the image resolution of the target material clip and the standard resolution of the standard video frame.
[0091] 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 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 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 fragment, and obtain at least one optimized number of threads, wherein the sum of 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 at least one optimized number of threads is the shortest; obtain the target number of threads based on at least one optimized number of threads.
[0092] 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 according to 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 according to the equivalent number of tracks of at least one target material fragment, it is specifically used to: obtain the target number of threads according to the equivalent number of tracks of at least one target material fragment and the available resource amount.
[0093] 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.
[0094] In one embodiment of the present disclosure, the processing module 32 is also 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 according to the decoding time, the decoding time representing the average decoding time of a single track; generate decoding time consumption data according to the decoding time and the corresponding number of parallel threads.
[0095] 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.
[0096] 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.
[0097] Fig.11 A schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure is shown in FIG. Fig.11 As shown, the electronic device 4 includes:
[0098] A processor 41, and a memory 42 communicatively connected to the processor 41;
[0099] The memory 42 stores computer executable instructions;
[0100] The processor 41 executes the computer execution instructions stored in the memory 42 to implement the following Figure 2-Figure 9 The video decoding method in the illustrated embodiment.
[0101] Optionally, the processor 41 and the memory 42 are connected via a bus 43 .
[0102] For related instructions, please refer to Figure 2-Figure 9 The relevant descriptions and effects corresponding to the steps in the corresponding embodiments can be understood, and no further elaboration is made here.
[0103] The present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, which are used to implement the present invention when executed by a processor. Figure 2-Figure 9 The video decoding method provided by any one of the corresponding embodiments.
[0104] In order to implement the above embodiment, the embodiment of the present disclosure also provides an electronic device.
[0105] refer to Fig.12 , which shows a schematic diagram of the structure of an electronic device 900 suitable for implementing the embodiment of the present disclosure, and 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, notebook computers, digital broadcast receivers, personal digital assistants (PDAs), tablet computers (Portable Android Devices, PADs), portable multimedia players (PMPs), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Fig.12 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0106] like Fig.12 As shown, 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 to a random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the electronic device 900 are also stored. 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.
[0107] Typically, the following devices may be connected to the I / O interface 905: input devices 906 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 907 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 908 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 909. The communication device 909 may allow the electronic device 900 to communicate with other devices wirelessly or by wire to exchange data. Although Fig.12 The electronic device 900 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0108] 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 contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 909, or installed from a storage device 908, or installed from a 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 executed.
[0109] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0110] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0111] 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.
[0112] 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 an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via 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).
[0113] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0114] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware. The name of a unit does not limit the unit itself in some cases. For example, the first acquisition unit may also be described as a "unit for acquiring at least two Internet Protocol addresses".
[0115] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0116] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0117] In a first aspect, according to one or more embodiments of the present disclosure, a video decoding method is provided, including:
[0118] 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 segment; a target number of threads is obtained according to image resolutions of at least two target material segments corresponding to the target playback position, and the target number of threads is the number of threads for the terminal device to parallelly decode the target material segments at the target playback position; 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.
[0119] According to one or more embodiments of the present disclosure, obtaining the target number of threads according to the image resolutions of at least two target material clips corresponding to the target playback position includes: obtaining the number of equivalent tracks of the target material clip according to the image resolution of the target material clip, the number of equivalent 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 according to the number of equivalent tracks of at least one of the target material clips.
[0120] According to one or more embodiments of the present disclosure, obtaining the equivalent number of tracks of the target material clip according to the image resolution of the target material clip includes: acquiring the standard resolution of a standard video frame; and obtaining the equivalent number of tracks 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.
[0121] According to one or more embodiments of the present disclosure, the target number of threads is obtained according to the equivalent track number of at least one target material fragment, including: 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 according to the sum of the equivalent track numbers of each target material fragment, and obtaining 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 according to the at least one optimized number of threads.
[0122] According to one or more embodiments of the present disclosure, the method further includes: acquiring operating status information of the terminal device; obtaining the current available resource amount of the terminal device based on the operating status information, the available resource amount including available thread resources and / or available memory resources; obtaining the target number of threads based on the equivalent track number of at least one of the target material fragments, including: obtaining the target number of threads based on the equivalent track number of at least one of the target material fragments and the available resource amount.
[0123] 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.
[0124] According to one or more embodiments of the present disclosure, the method also 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.
[0125] 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.
[0126] In a second aspect, according to one or more embodiments of the present disclosure, a video decoding device is provided, including:
[0127] 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;
[0128] 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;
[0129] 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.
[0130] According to one or more embodiments of the present disclosure, the processing module is specifically used to: obtain the equivalent track number of the target material segment according to the image resolution of the target material segment, the equivalent track number representing the number of standard video frames with standard resolution equivalent to the video frames in the target material segment; obtain the target thread number according to the equivalent track number of at least one of the target material segments.
[0131] According to one or more embodiments of the present disclosure, when the processing module obtains the equivalent number of tracks of the target material fragment according to the image resolution of the target material fragment, 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 fragment according to the ratio of the image resolution of the target material fragment and the standard resolution of the standard video frame.
[0132] 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 of the target material fragments, the processing module 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 track numbers of each of the target material fragments 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 obtain the target number of threads based on the at least one optimized number of threads.
[0133] 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 according to 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 according to the equivalent track number of at least one of the target material fragments, it is specifically used to: obtain the target number of threads according to the equivalent track number of at least one of the target material fragments and the available resource amount.
[0134] 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.
[0135] According to one or more embodiments of the present disclosure, the processing module is also 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 consumption data based on the decoding time and the corresponding number of parallel threads.
[0136] 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.
[0137] 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;
[0138] The memory stores computer-executable instructions;
[0139] 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.
[0140] 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 execution instructions. When a processor executes the computer execution instructions, the video decoding method described in the first aspect and various possible designs of the first aspect is implemented.
[0141] In a fifth aspect, according to one or more embodiments of the present disclosure, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, the video decoding method described in the first aspect and various possible designs of the first aspect is implemented.
[0142] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0143] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0144] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. A video decoding method, characterized in that: include: 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; 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, characterized in that The step of obtaining a target number of threads according to image resolutions of at least two target material segments corresponding to the target playback position includes: 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, characterized in that The obtaining, according to the image resolution of the target material segment, the equivalent number of tracks of the target material segment 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, characterized in that: The step of obtaining the target number of threads according to the equivalent number of tracks 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, characterized in that: 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, characterized in that 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, characterized in that 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, characterized in that 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 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, characterized in that: include: 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, characterized in that: include: 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, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the 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, characterized in that 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
Video playing method and device, electronic equipment and storage medium
CN113038276A
Panoramic video transmission method and device
CN113766235A
Video jump playing method and device, electronic equipment and storage medium
CN115802104A
Systems, apparatuses, and methods for a hardware and software system to automatically decompose a program to multiple parallel threads
US20130166886A1