Video frame previewing method and device, terminal equipment and readable storage medium
By checking whether the data buffer stores the target video frame image in the terminal device, and deciding whether to display or decode directly based on the results, the problem of low video frame preview efficiency is solved and the user experience is improved.
Patent Information
- Application Number
- CN202311421550.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-30
- Publication Date
- 2025-05-02
AI Technical Summary
When the terminal starts the video frame image preview function, it needs to decode frame by frame from the keyframe, resulting in slow display efficiency of the preview screen and affecting the user experience.
By responding to the user's preview request, the target video frame image is determined and checking whether the terminal's data buffer stores the target video frame image. If storage exists, it is displayed directly; otherwise, the video frame sequence is decoded from the previous keyframe of the target video frame until the target video frame image is obtained and displayed.
It improves the efficiency of previewing video frame images, reduces unnecessary decoding processes, and improves user experience.
Smart Images

Figure CN119922374A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of terminal technology, and in particular to a video frame preview method, apparatus, terminal device and readable storage medium. Background Art
[0002] In recent years, with the continuous development of terminal technology, more and more users are accustomed to using terminals to watch videos. When using terminals to watch videos, users often need to preview the video frame images that can be displayed when the video is played to different time nodes, so as to roughly understand the content of the entire video playback, so as to select the more interesting part of the video for playback.
[0003] In the related art, when a terminal starts a video frame image preview function, it needs to start from a key frame each time and decode to a preview target frame in sequence, which results in a slow display efficiency of the preview screen and affects user usage. Summary of the invention
[0004] In order to overcome the problems existing in the related art, the present disclosure provides a video frame preview method, apparatus, terminal device and readable storage medium.
[0005] A first aspect of the present disclosure provides a video frame preview method, comprising:
[0006] In response to a preview request for a current video frame sequence, determining a target video frame image indicated by the preview request;
[0007] Determine whether the target video frame image is stored in the data buffer of the terminal; wherein the data buffer stores the historical decoding data of the video frame sequence;
[0008] If the target video frame image is stored in the data buffer of the terminal, the target video frame image is displayed.
[0009] Optionally, determining whether the data buffer of the terminal stores the target video frame image includes:
[0010] Obtain the timestamp of the first video frame image most recently decoded by the terminal;
[0011] If the target video frame image belongs to the reference image frame set corresponding to the first video frame image, it is determined that the data buffer stores the target video frame image.
[0012] Optionally, the method further includes:
[0013] If the timestamp of the target video frame image is less than the timestamp of the first video frame image, and the target video frame image does not belong to the reference image frame set corresponding to the first video frame image, the video frame sequence is decoded to obtain the target video frame image; or,
[0014] If the target video frame image is not stored in the data buffer, the video frame sequence is decoded to obtain the target video frame image.
[0015] Optionally, decoding the video frame sequence to obtain the target video frame image includes:
[0016] Starting from a previous key frame of the target video frame, decoding the video frame images in the video frame sequence in sequence;
[0017] Determine whether the decoded video frame image is the target video frame image;
[0018] If the decoded video frame image is not the target video frame image, storing the decoded video frame image in the data buffer;
[0019] If the decoded video frame image is the target video frame image, the target video frame image is displayed.
[0020] Optionally, storing the decoded video frame image into the data buffer includes:
[0021] Determine whether there is free buffer space in the data buffer;
[0022] If there is free buffer space in the data buffer, storing the decoded video frame image in the data buffer;
[0023] If there is no free buffer space in the data buffer, release the memory space occupied by the historical decoding data of the second video frame image in the data buffer; and store the decoded video frame image in the data buffer; wherein the second video frame image is: the video frame image with the smallest timestamp among the multiple video frame images stored in the data buffer.
[0024] Optionally, storing the decoded video frame image into the data buffer includes:
[0025] The timestamp corresponding to the decoded video frame image and the index of the decoder output buffer are stored in the data buffer;
[0026] If the target video frame image is stored in the data buffer of the terminal, displaying the target video frame image comprises:
[0027] If the data buffer stores a timestamp corresponding to the target video frame image, determine the index of the decoder output buffer corresponding to the timestamp of the target video frame image, and based on the index of the decoder output buffer corresponding to the target video frame image stored in the data buffer, call the target video frame image for display.
[0028] Optionally, in response to a preview request for a currently played video frame sequence, determining a target video frame image indicated by the preview request includes:
[0029] In response to a preview request for the video frame sequence, obtaining first time information carried in the preview request;
[0030] Based on the timestamps of multiple video frame images in the video frame sequence and the first time information, a target video frame image indicated by the preview request is determined, wherein a time difference between the timestamp of the target video frame image and the time indicated by the first time information is a minimum difference among the time differences corresponding to the multiple video frame images.
[0031] Optionally, determining whether the target video frame image belongs to a reference image frame set corresponding to the first video frame image includes:
[0032] Obtaining the frame rate of the video frame sequence;
[0033] Based on the number of frames of video frame images that the data buffer is allowed to store and the frame rate, determining a buffering duration of a plurality of video frame images that the data buffer is allowed to store;
[0034] Determining a reference time period corresponding to the reference image frame set according to the timestamp of the first video frame image and the buffering duration;
[0035] According to whether the time indicated by the first time information carried in the preview request currently received by the terminal is within the reference time period, it is determined whether the target video frame image belongs to the reference image frame set corresponding to the first video frame image.
[0036] According to a second aspect of the present disclosure, a communication device is provided, including:
[0037] A first determination module is configured to determine, in response to a preview request for a current video frame sequence, a target video frame image indicated by the preview request;
[0038] A second determination module is configured to determine whether the data buffer of the terminal stores the target video frame image; wherein the data buffer stores the historical decoding data of the video frame sequence;
[0039] The display module is configured to display the target video frame image if the target video frame image is stored in the data buffer of the terminal.
[0040] Optionally, the second determining module is further configured to:
[0041] Obtain the timestamp of the first video frame image most recently decoded by the terminal;
[0042] If the timestamp of the target video frame image is less than the timestamp of the first video frame image, determine whether the target video frame image belongs to a reference image frame set corresponding to the first video frame image; wherein the reference image frame set includes: N video frame images that are located before the first video frame image in the video frame sequence and are closest to the first video frame image; N is the number of video frame images that the data buffer is allowed to store;
[0043] If the target video frame image belongs to the reference image frame set corresponding to the first video frame image, it is determined that the data buffer stores the target video frame image.
[0044] Optionally, the second determining module is further configured to:
[0045] If the target video frame image is not stored in the data buffer, the video frame sequence is decoded to obtain the target video frame image.
[0046] Optionally, the second determining module is further configured to:
[0047] Starting from a previous key frame of the target video frame, decoding the video frame images in the video frame sequence in sequence;
[0048] Determine whether the decoded video frame image is the target video frame image;
[0049] If the decoded video frame image is not the target video frame image, storing the decoded video frame image in the data buffer;
[0050] If the decoded video frame image is the target video frame image, the target video frame image is displayed.
[0051] Optionally, the second determining module is further configured to:
[0052] Determine whether there is free buffer space in the data buffer;
[0053] If there is free buffer space in the data buffer, storing the decoded video frame image in the data buffer;
[0054] If there is no free buffer space in the data buffer, release the memory space occupied by the historical decoding data of the second video frame image in the data buffer; and store the decoded video frame image in the data buffer; wherein the second video frame image is: the video frame image with the smallest timestamp among the multiple video frame images stored in the data buffer.
[0055] Optionally, the second determining module is further configured to:
[0056] The timestamp corresponding to the decoded video frame image and the index of the decoder output buffer are stored in the data buffer;
[0057] If the target video frame image is stored in the data buffer of the terminal, displaying the target video frame image comprises:
[0058] If the data buffer stores a timestamp corresponding to the target video frame image, determine the index of the decoder output buffer corresponding to the timestamp of the target video frame image, and based on the index of the decoder output buffer corresponding to the target video frame image stored in the data buffer, call the target video frame image for display.
[0059] Optionally, the first determining module is further configured to:
[0060] In response to a preview request for the video frame sequence, obtaining first time information carried in the preview request;
[0061] Based on the timestamps of multiple video frame images in the video frame sequence and the first time information, a target video frame image indicated by the preview request is determined, wherein a time difference between the timestamp of the target video frame image and the time indicated by the first time information is a minimum difference among the time differences corresponding to the multiple video frame images.
[0062] Optionally, the second determining module is further configured to:
[0063] Obtaining the frame rate of the video frame sequence;
[0064] Based on the number of frames of video frame images that the data buffer is allowed to store and the frame rate, determining a buffering duration of a plurality of video frame images that the data buffer is allowed to store;
[0065] Determining a reference time period corresponding to the reference image frame set according to the timestamp of the first video frame image and the buffering duration;
[0066] According to whether the time indicated by the first time information carried in the preview request currently received by the terminal is within the reference time period, it is determined whether the target video frame image belongs to the reference image frame set corresponding to the first video frame image.
[0067] According to a third aspect of the present disclosure, a terminal device is provided, including:
[0068] a memory for storing processor-executable instructions;
[0069] A processor connected to the memory;
[0070] Wherein, the processor is configured to execute the video frame preview method as described in any embodiment of the first aspect of the present disclosure.
[0071] A fourth aspect of the present disclosure provides a non-temporary computer-readable storage medium. When the instructions in the storage medium are executed by a processor of a terminal device, the terminal device can execute the video frame preview method as described in any embodiment of the first aspect of the present disclosure.
[0072] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:
[0073] In the disclosed embodiments, by responding to a user's preview request for a current video frame sequence, the target video frame image indicated by the user's preview request can be determined; by determining whether the target video frame image is stored in a data buffer in the terminal, it can be determined whether the target video frame image is included in the historical decoded data already stored in the terminal; when the target video frame image is stored in the data buffer, that is, when the historical decoded data stored in the terminal includes the target video frame image, the target video frame image can be directly displayed based on the target video frame image stored in the data buffer, without the need to decode the target video frame from the video frame sequence, thereby improving the efficiency of video frame image preview and effectively enhancing the user experience.
[0074] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0075] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0076] Figure 1 It is a schematic diagram of a video frame preview interface according to an exemplary embodiment of the present disclosure.
[0077] Figure 2 A schematic diagram of a decoder according to an exemplary embodiment of the present disclosure is shown in FIG. Figure 1
[0078] Figure 3 The diagram is a structural diagram of a video frame sequence according to an exemplary embodiment of the present disclosure.
[0079] Figure 4 The following is a flow chart of a video frame preview method according to an exemplary embodiment of the present disclosure. Figure 1 .
[0080] Figure 5 The following is a flow chart of a video frame preview method according to an exemplary embodiment of the present disclosure. Figure 2 .
[0081] Figure 6 A schematic diagram of a decoder according to an exemplary embodiment of the present disclosure is shown in FIG. Figure 2 .
[0082] Figure 7 The figure is a schematic diagram of the structure of a video frame preview device according to an exemplary embodiment of the present disclosure.
[0083] Figure 8 The present invention is a block diagram of a terminal device according to an exemplary embodiment of the present invention. DETAILED DESCRIPTION
[0084] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices consistent with some aspects of the present disclosure as detailed in the appended claims.
[0085] Figure 1 FIG. 1 is a schematic diagram of a video frame preview interface according to an exemplary embodiment of the present disclosure. Figure 1 As shown, in the video frame preview interface of the terminal, the long strip UI (user interface) at the bottom is a video progress bar 11, and the UI at the top is a video area 12, which is used to display the video frame image of the video. When the video progress bar 11 at the bottom is slid, the terminal can calculate the video preview time point corresponding to the position of the pointer 111 of the video progress bar 11, and then display the video frame image corresponding to the video preview time point in the upper video area 12. The faster and smoother the video frame image is displayed, the better the user experience.
[0086] To implement the above-mentioned video frame preview function, the video frame image may be decoded by a decoder in the terminal. Figure 2A schematic diagram of a decoder according to an exemplary embodiment of the present disclosure is shown in FIG. Figure 1 .like Figure 2 As shown, the decoder 20 usually includes multiple input buffers and multiple output buffers. Assume that the decoder 20 has a processing unit 21, 4 input buffers (respectively recorded as In1, In2, In3 and In4, indexed from 1 to 4); 16 output buffers (respectively recorded as Out1, Out2, ..., Out16, indexed from 1 to 16). During the decoding process, if all input buffers and output buffers are filled with data, the terminal can no longer input data to the decoder 20. At this time, decoding can only continue by consuming the data in the output buffer of the decoder 20. Therefore, the decoder 20 usually has two threads, namely the input thread 22 and the output thread 23.
[0087] The input thread 22 continuously obtains the index of the input buffer, writes data into the input buffer after obtaining the index of the input buffer, and then sends the data to the processing unit 21 of the decoder 20 for decoding. The decoded data enters the output buffer, and the output thread 23 continuously obtains the index of the output buffer storing the decoded data, consumes the data in the output buffer after obtaining the index of the output buffer, and then releases the buffer index to the decoder 20.
[0088] Figure 3 FIG. 1 is a schematic diagram showing a structure of a video frame sequence according to an exemplary embodiment of the present disclosure. Figure 3 As shown, multiple video frame images can be arranged in the order corresponding to the frame numbers, wherein the video frame images with frame numbers 1 and 13 can be I frames (illustrated as I, i.e., key frames), the video frame images with frame numbers 5, 9 and 17 can be P frames (illustrated as P, i.e., forward reference frames), and the video frame images with the remaining frame numbers can be B frames (illustrated as B, i.e., bidirectional reference frames).
[0089] In the related art, a video frame preview is implemented by decoding frame by frame starting from a key frame. Figure 2 The structure shown in the figure introduces the related art Figure 3 The preview process of the video frame sequence.
[0090] Assuming that the user wants to preview the video frame image at the target time point 1 (frame number 11, the 11th frame), the input thread 22 first locates the 1st frame (frame number 1, which is a key frame, and decoding must start from the key frame), and then sequentially sends the 1st, 2nd, 3rd, 4th, 5th, 6th, 7th, 8th, 9th, 10th, and 11th frames to the decoder 20. The decoder 20 decodes the video frame images that are sequentially input. The output thread 23 keeps checking whether there is an available output buffer. Once there is, it immediately controls the output buffer and takes out the index of the output buffer, and then compares the timestamp of the video frame image stored in the output buffer with the target time point 1. If it is greater than or equal to the target time point 1, the video frame image in the output buffer is displayed, otherwise the data is discarded and the index of the output buffer is released. When the decoder 20 decodes the 1st, 2nd, 3rd, 4th, 5th, 6th, 7th, 8th, 9th, and 10th frames, the video frame images corresponding to these frames will be immediately taken away and discarded by the output thread 23 until the 11th frame is decoded, and the 11th video frame image corresponding to the target time point 1 is displayed, and the decoding is completed.
[0091] After decoding, all output buffers are empty. At this time, if the user slightly moves the video progress bar forward and wants to display the video frame image of the target time point 2 (frame number 8, the 8th frame), the input thread 22 needs to be repositioned to the 1st frame, and then the 1st, 2nd, 3rd, 4th, 5th, 6th, 7th, and 8th frames are sent to the decoder 20 in sequence. The decoder 20 repeatedly decodes the video frame images input in sequence until the 8th frame is decoded and the 8th video frame image corresponding to the target time point 2 is displayed, and the decoding is completed.
[0092] It can be seen that in the related art, for previewing a video within a small range, decoding needs to start from a key frame each time, which is inefficient and affects user usage.
[0093] The present invention provides a video frame preview method. Figure 4 The following is a flow chart of a video frame preview method according to an exemplary embodiment of the present disclosure. Figure 1 ,like Figure 4 As shown, the video frame preview method includes:
[0094] Step S401, in response to a preview request for a current video frame sequence, determining a target video frame image indicated by the preview request;
[0095] Step S402, determining whether the data buffer of the terminal stores the target video frame image; wherein the data buffer stores the historical decoding data of the video frame sequence;
[0096] Step S403: If the target video frame image is stored in the data buffer of the terminal, the target video frame image is displayed.
[0097] In the embodiment of the present disclosure, the method can be applied to a terminal device, and the terminal device can be a smart phone, a tablet computer, etc., which is not specifically limited in the embodiment of the present disclosure.
[0098] In step S401, the user may trigger a preview request for the current video frame sequence by touching the video progress bar or pressing a button, etc. Subsequently, the terminal device may respond to the preview request and determine the target video frame image indicated by the preview request.
[0099] The preview request may carry time information, and the time information may at least indicate the time point when the user requests the preview.
[0100] Based on the time information, the terminal can determine the target video frame image in the current video frame sequence.
[0101] In some embodiments, the preview request may carry other information for determining the target video frame image.
[0102] Here, the target video frame image may be an image determined according to the preview request and required to be displayed to the user by the terminal.
[0103] It is understandable that determining the target video frame image may include determining information associated with the target video frame image. The information associated with the target video frame may include target video frame image data information, target video frame image timestamp, etc., which is not specifically limited.
[0104] In step S402, after the terminal device determines the target video frame image in step S401, it can obtain information associated with the target video frame image; then, the terminal can execute step S402 to determine whether the terminal's data buffer stores the target video frame image based on the information associated with the target video frame image.
[0105] The data buffer stores historical decoding data of the video frame sequence.
[0106] It is understandable that the data buffer in the terminal device can be connected to the decoder and store the data of the video frame image decoded by the decoder. The data buffer can be connected to the decoder through the processing unit in the terminal device, which is not specifically limited.
[0107] The decoded video frame image may be video frame image data or information associated with the video frame image (eg, a timestamp corresponding to the video frame image and an index of a decoder output buffer), which is not specifically limited.
[0108] Based on the target video frame image and all decoded video frame images stored in the data buffer, it can be determined whether the decoded target video frame image is stored in the data buffer of the terminal.
[0109] In step S403, after determining that the target video frame image is stored in the data buffer, the terminal device may acquire the target video frame image to display the target video frame image to the user.
[0110] It can be understood that what is stored in the data buffer is the decoded video frame image. When the decoded target video frame image exists in the data buffer, the terminal can directly call the target video frame image, thereby eliminating the need to decode the current video frame sequence starting from the key frame, thereby effectively improving the efficiency of video frame image preview.
[0111] In the disclosed embodiments, by responding to a user's preview request for a current video frame sequence, the target video frame image indicated by the user's preview request can be determined; by determining whether the target video frame image is stored in a data buffer in the terminal, it can be determined whether the target video frame image is included in the historical decoded data already stored in the terminal; when the target video frame image is stored in the data buffer, that is, when the historical decoded data stored in the terminal includes the target video frame image, the target video frame image can be directly displayed based on the target video frame image stored in the data buffer, without the need to decode the target video frame from the video frame sequence, thereby improving the efficiency of video frame image preview and effectively enhancing the user experience.
[0112] Optional, Figure 5 The following is a flow chart of a video frame preview method according to an exemplary embodiment of the present disclosure. Figure 2 ,like Figure 5 As shown, the step S402 of determining whether the data buffer of the terminal stores the target video frame image includes:
[0113] Step S501, obtaining the timestamp of the first video frame image most recently decoded by the terminal;
[0114] Step S502: if the timestamp of the target video frame image is less than the timestamp of the first video frame image, determine whether the target video frame image belongs to a reference image frame set corresponding to the first video frame image; wherein the reference image frame set includes: N video frame images that are located before the first video frame image in the video frame sequence and are closest to the first video frame image; N is the number of video frame images that the data buffer is allowed to store;
[0115] Step S503: If the target video frame image belongs to the reference image frame set corresponding to the first video frame image, it is determined that the data buffer stores the target video frame image.
[0116] In the embodiment of the present disclosure, after acquiring the target video frame image through step S401, the terminal device may execute steps S501 to S503 to determine whether the target video frame image is stored in the data buffer.
[0117] In step S501, the terminal device may obtain the timestamp of the first video frame image obtained by the most recent decoding.
[0118] The first video frame image may be a target video frame image indicated by any preview request before the current preview request, and the terminal device decodes the video frame sequence in response to the preview request.
[0119] In one embodiment, obtaining the first video frame image most recently decoded by the terminal includes: the terminal device may obtain the timestamp of the first video frame image most recently decoded and displayed.
[0120] It is worth noting that, assuming that the terminal device receives two (historical) preview requests before receiving the current preview request, wherein the terminal device responds to the first (historical) preview request and decodes the video frame sequence to obtain the video frame image indicated by the preview request, then the video frame image is the first video frame image. If the data buffer stores the video frame image indicated by the second (historical) preview request, in response to the second (historical) preview request, the terminal device does not need to decode the video frame sequence and can directly display the relevant information of the video frame image stored in the data buffer; at this time, the first video frame image most recently decoded by the terminal device is still the video frame image indicated by the first (historical) preview request.
[0121] In one embodiment, when the terminal device decodes a video frame sequence, it stores the timestamp of the decoded video frame image and related information of the video frame image (such as the video frame sequence number information corresponding to the video frame image, etc.). After receiving the current preview request, the terminal can determine the first video frame image obtained by the terminal's most recent decoding based on the pre-stored timestamp of the decoded video frame image and related information of the video frame image.
[0122] In step S502, after acquiring the information of the first video frame image, the terminal device may compare the timestamp of the target video frame image with the timestamp of the first video frame image. If the timestamp of the target video frame image is less than the timestamp of the first video frame image, it may continue to determine whether the target video frame image belongs to the reference image frame set corresponding to the first video frame image.
[0123] The reference image frame set includes: N video frame images that are located before the first video frame image in the video frame sequence and are closest to the first video frame image; N is the number of video frame images that the data buffer is allowed to store.
[0124] It can be understood that the multiple video frame images included in the video frame sequence have different timestamps respectively, and the different timestamps can indicate that the video frame images have different positions in the video frame sequence. When the timestamp of the target video frame image is less than the timestamp of the first video frame image, it can be determined that the position of the target video frame image is in front of the position of the first video frame image.
[0125] When the position of the target video frame image is ahead of the position of the first video frame image, it can be determined whether the target image frame belongs to a reference image frame set corresponding to the first video frame image.
[0126] It is understandable that a data buffer is provided in the terminal device, and the data buffer is used to store decoded data. When the terminal device decodes the first video frame image most recently, the video frame image decoded before the first video frame image can be stored in the data buffer.
[0127] It is understandable that the data buffer allows N video frame images that are before the first video frame image and adjacent to the first video frame image to be stored. That is, before the first video frame image, at most only the N video frame images closest to the first video frame image can be decoded and stored in the data buffer, so that the N video frame images closest to the first video frame image are confirmed as the reference video frame set of the first video frame image.
[0128] Exemplarily, when the first video frame image is the twentieth frame of the video frame sequence, the data buffer allows ten video frame images to be stored, then the reference video frame set of the first video frame image is the ninth frame to the nineteenth frame.
[0129] Therefore, by determining that the target video image is before the first video frame image, it is possible to further determine whether the position of the target video frame image satisfies the N video frame images closest to the first video frame image, that is, to determine whether the target video frame image belongs to the reference image frame set corresponding to the first video frame image.
[0130] The position of the target video frame image may be determined according to the time information of the target video frame image.
[0131] Exemplarily, the number of the video frame image in the video frame sequence to which the target video frame image belongs may be determined by the timestamp of the video frame image and the frame rate of the video frame sequence.
[0132] Exemplarily, assuming that the number of video frame images that the data buffer allows to store is 16 frames, and the first video frame image obtained by the most recent decoding is the 47th frame, then the data buffer can store video frame images from the 31st to the 46th frames, and the reference image frame set corresponding to the first video frame image is the 31st to the 46th frames. At this time, the preview request for the current video frame sequence indicates that the target video frame image is the 45th frame, and it can be determined that the target video frame image belongs to the reference image frame set corresponding to the first video frame image, and the video frame image of the 45th frame is directly retrieved for display. At this time, a preview request is generated again, and the preview request indicates that the target video frame image is the 29th frame. Since the first video frame image obtained by the last decoding is the 47th frame, and the reference image frame set corresponding to the first video frame image is the 31st to the 46th frames, it can be determined that the 29th frame is not in the reference image frame set corresponding to the first video frame image.
[0133] In one embodiment, when the terminal device determines that the timestamp of the target video frame image is greater than the timestamp of the first video frame image, it can be determined that the data buffer does not store the target video frame image.
[0134] In step S403, after determining that the target video frame image belongs to the reference image frame set corresponding to the first video frame image, the terminal device may determine that the target video frame image is stored in the data buffer.
[0135] It can be understood that when it is determined that the target video frame image belongs to a reference image frame set corresponding to the first video frame image based on the position of the target video frame image, it can be determined that the target video frame image belongs to one of the N video frame images stored in the current data buffer, and then it is determined that the data buffer stores the target video frame image.
[0136] In the disclosed embodiment, by obtaining the timestamp of the first video frame image that was most recently decoded and displayed, the reference image frame set corresponding to the first video frame image can be obtained, and then when the timestamp of the target video frame image is less than the timestamp of the first video frame image and it is determined that the target video frame image belongs to the reference image frame set of the first image frame image, it can be determined whether the data buffer stores the target video frame image. In this process, it is possible to quickly determine whether the target video frame image is stored in the data buffer based on the position of the first video frame image that was most recently decoded and displayed, thereby achieving a quick response to the preview request and improving the efficiency of the video frame preview.
[0137] Optionally, the method further includes:
[0138] If the target video frame image is not stored in the data buffer, the video frame sequence is decoded to obtain the target video frame image.
[0139] In the embodiment of the present disclosure, when the terminal device determines that the data buffer does not store the target video frame image, it can clear the data in the data buffer and re-decode the video frame sequence to obtain the target video frame image.
[0140] In one embodiment, when the terminal device determines that the timestamp of the target video frame image is less than the timestamp of the first video frame image, and the target video frame image does not belong to the reference image frame set corresponding to the first video frame image, that is, the target video frame image is before the first video frame image, but the interval between the target video frame image and the first video frame image is greater than N video frame images, the data in the data buffer can be cleared and the video frame sequence can be decoded to obtain the target video frame image.
[0141] In one embodiment, when the timestamp of the target video frame image is greater than the timestamp of the first video frame image, the terminal device may determine that the data buffer does not store the target video frame image.
[0142] It should be noted that the terminal device may also determine that the target video frame image is not stored in the data buffer through other steps, and this is not specifically limited.
[0143] In the disclosed embodiment, by determining that the target video frame image is not stored in the data buffer, it can be determined that re-decoding is required to obtain the target video frame image, so that the target video frame image can be decoded as required to complete the video frame preview.
[0144] Optionally, decoding the video frame sequence to obtain the target video frame image includes:
[0145] Starting from a key frame preceding the target video frame, sequentially decoding the video frame images in the video frame sequence;
[0146] Determine whether the decoded video frame image is the target video frame image;
[0147] If the decoded video frame image is not the target video frame image, storing the decoded video frame image in the data buffer;
[0148] If the decoded video frame image is the target video frame image, the target video frame image is displayed.
[0149] In an embodiment of the present disclosure, if the target video frame image does not belong to a reference image frame set corresponding to the first video frame image, or the data buffer does not store the target video frame image, the terminal device may clear the historical decoding data in the data buffer and re-decode the video frame sequence.
[0150] It is understandable that the video frame image can be encoded in a GOP (group of pictures) manner, so that the video frame sequence can be composed of multiple GOPs. Among them, the first video frame image of each GOP must be an I frame (key frame), so that the GOP can be decoded independently.
[0151] Here, re-decoding the video frame sequence includes: acquiring a key frame that is before the target video frame and closest to the target video frame, and decoding the video frame images in the video frame sequence in sequence starting from the key frame.
[0152] For each decoded video frame image, the terminal device can determine whether the decoded video frame image is the target frame image. If the decoded video frame image is not the target video frame image, the decoded video frame image can be stored in the data buffer.
[0153] Here, when the terminal device obtains each decoded video frame image, it can compare the time information of the video frame image with the time information indicated by the preview request. If the time point in the time information of the video frame image is less than the time point in the time information indicated by the preview request, it can be determined that the video frame image is not the target video frame image and the video frame image is located before the target video frame image. The terminal device can store the video frame image in the data buffer.
[0154] If the time point in the time information of the video frame image is greater than or equal to the time point in the time information indicated by the preview request, the time difference between the time point corresponding to the video frame image and the time point indicated by the preview request is determined; if the time difference is less than the time difference between any two adjacent video frame images in the image frame sequence, it can be determined that the video frame image is the target video frame image, and thus the video frame image can be displayed.
[0155] In some embodiments, decoding the video frame sequence to obtain the target video frame image includes:
[0156] If the timestamp of the target video frame image is greater than the timestamp of the first video frame image, starting from a previous key frame of the target video frame, the video frame images in the video frame sequence are decoded in sequence;
[0157] Determine whether the decoded video frame image is the target video frame image;
[0158] If the decoded video frame image is not the target video frame image, storing the decoded video frame image in the data buffer;
[0159] If the decoded video frame image is the target video frame image, the target video frame image is displayed.
[0160] It is understandable that when the timestamp of the target video frame image is greater than the timestamp of the first video frame image, the data buffer does not store the target video frame image. A key frame that is before the target video frame and closest to the target video frame can be obtained, and the video frame images in the video frame sequence can be decoded in sequence starting from the key frame.
[0161] In the disclosed embodiment, by decoding the video frame sequence and confirming each decoded video frame image, on the one hand, when the decoded video frame image is not the target video frame image, the decoded video frame image can be stored in the data buffer, so that when the next preview request occurs, the data stored in the data buffer can be called to quickly complete the video frame preview; on the other hand, when the decoded video frame image is the target video frame image, the target video frame image can be displayed to complete the current video frame preview.
[0162] Optionally, storing the decoded video frame image into the data buffer includes:
[0163] Determine whether there is free buffer space in the data buffer;
[0164] If there is free buffer space in the data buffer, storing the decoded video frame image in the data buffer;
[0165] If there is no free buffer space in the data buffer, release the memory space occupied by the historical decoding data of the second video frame image in the data buffer; and store the decoded video frame image in the data buffer; wherein the second video frame image is: the video frame image with the smallest timestamp among the multiple video frame images stored in the data buffer.
[0166] In the disclosed embodiment, when the terminal device stores the decoded video frame image in the data buffer, first, it can determine whether there is free buffer space in the data buffer. When there is free buffer space in the data buffer, the decoded video frame image can be stored in the data buffer.
[0167] When there is no free buffer space in the data buffer, the historical decoding data of the second video frame image with the smallest timestamp among the multiple video frame images stored in the data buffer can be deleted from the data buffer based on the timestamps of the multiple video frame images stored in the data buffer to release the memory space occupied by the historical decoding data of the second video frame image in the data buffer.
[0168] After the data buffer releases the memory space occupied by the historical decoded data of the second video frame image, the video frame image currently decoded can be stored in the data buffer, thereby ensuring that the video frame image currently decoded can be stored in the data buffer.
[0169] In addition, by deleting the historical decoding data of the second video frame image, that is, deleting the historical data of the video frame image with the smallest timestamp in the current data buffer, the data buffer can delete the video frame image with a shorter decoding time to store more video frame images with a longer decoding time, thereby reducing the decoding time as much as possible and improving efficiency.
[0170] Exemplarily, the data buffer currently stores video frame images from the 2nd frame to the 9th frame. If the 2nd frame is deleted, even if the target video frame image corresponding to the next preview request is the 2nd frame, only 2 frames need to be decoded to obtain the target video frame image during re-decoding. If the 9th frame is deleted, the target video frame image corresponding to the next preview request is the 9th frame, and 9 frames need to be decoded to obtain the target video frame image during re-decoding.
[0171] In the embodiments of the present disclosure, by directly storing the decoded video frame image in the data buffer when there is free buffer space in the data buffer, each decoded video frame image can be saved; by deleting the video frame image with the smallest timestamp in the data buffer to release buffer space when there is no free buffer space in the data buffer, the video frame image currently decoded can be stored.
[0172] Optionally, storing the decoded video frame image into the data buffer includes:
[0173] The timestamp corresponding to the decoded video frame image and the index of the decoder output buffer are stored in the data buffer;
[0174] If the target video frame image is stored in the data buffer of the terminal, displaying the target video frame image comprises:
[0175] If the data buffer stores a timestamp corresponding to the target video frame image, determine the index of the decoder output buffer corresponding to the timestamp of the target video frame image, and based on the index of the decoder output buffer corresponding to the target video frame image stored in the data buffer, call the target video frame image for display.
[0176] It is understandable that the image data corresponding to the video frame image has a large amount of data, and storing the image data of each video frame image will occupy a large amount of buffer space. Therefore, the terminal device can only store the timestamp corresponding to each video frame image and the index of the decoder output buffer into the data buffer, thereby effectively reducing the storage amount of data in the data buffer and not increasing memory usage.
[0177] Furthermore, when the data buffer stores the timestamp corresponding to the target video image and the index of the decoder output buffer, the decoded target video frame image can be called based on the index of the decoder output buffer to display the target video frame image.
[0178] It can be understood that the index and timestamp of the decoder output buffer of each video frame image obtained by decoding are stored in the data buffer in the form of a combination (such as a structure); thereby, based on the timestamp of the video frame image, the index of the decoder output buffer corresponding to the timestamp can be determined, and then the decoded target video frame image can be called for display based on the index of the decoder output buffer of the video frame image.
[0179] In the disclosed embodiment, by storing the index of the decoder output buffer in the data buffer, video frame preview can be completed without increasing memory usage, and the system performance is more excellent.
[0180] Optionally, the step S401 of responding to a preview request for a currently played video frame sequence and determining a target video frame image indicated by the preview request includes:
[0181] In response to a preview request for the video frame sequence, obtaining first time information carried in the preview request;
[0182] Based on the timestamps of multiple video frame images in the video frame sequence and the first time information, a target video frame image indicated by the preview request is determined, wherein a time difference between the timestamp of the target video frame image and the time indicated by the first time information is a minimum difference among the time differences corresponding to the multiple video frame images.
[0183] In an embodiment of the present disclosure, the terminal device may obtain the first time information carried in the preview request in response to the preview request for the video frame sequence.
[0184] The first time information carried in the preview request may be the time, acquired by the terminal device, at which the user operates the terminal device to trigger the preview request.
[0185] The target video frame image indicated by the preview request may be determined based on the time information corresponding to the timestamps of a plurality of video frame images in the video frame sequence and the first time information.
[0186] The time difference between the timestamp of the target video frame image and the time point indicated by the first time information is the minimum difference among the time differences corresponding to the multiple video frame images. That is, the time difference between the timestamps of the multiple video frame images and the time indicated by the first time information can be obtained to obtain the time differences corresponding to the multiple video frame images. The video frame image corresponding to the minimum difference among the multiple time differences is the target video frame image.
[0187] Exemplarily, assuming that the timestamps of the multiple video frame images in the video frame sequence may be 0ms, 40ms, 80ms, ..., 400ms, etc., and the time indicated by the first time information may be 50ms, then the video frame image corresponding to 40ms may be the target video frame image.
[0188] In some embodiments, a video frame image that is later than the time indicated by the first time information and whose difference with the time indicated by the first time information is less than a preset threshold may also be set as the target image frame.
[0189] The preset threshold value may be set according to actual conditions and is not specifically limited thereto.
[0190] In one embodiment, the preset threshold may be the time difference between any two adjacent video frame images.
[0191] Exemplarily, taking the timestamps of the above-mentioned multiple video frame images as 0ms, 40ms, 80ms, ..., 400ms, etc., and the time point indicated by the first time information as 50ms, the video frame image corresponding to 80ms may be the target video frame image.
[0192] In the embodiment of the present disclosure, the target video frame image associated with the time indicated by the first time information can be determined through the timestamps of multiple video frame images and the time indicated by the first time information, thereby determining the video frame image to be displayed during video frame preview.
[0193] Optionally, the determining whether the target video frame image belongs to a reference image frame set corresponding to the first video frame image in step S502 includes:
[0194] Obtaining the frame rate of the video frame sequence;
[0195] Based on the number of frames of video frame images that the data buffer is allowed to store and the frame rate, determining a buffering duration of a plurality of video frame images that the data buffer is allowed to store;
[0196] Determining a reference time period corresponding to the reference image frame set according to the timestamp of the first video frame image and the buffering duration;
[0197] According to whether the time indicated by the first time information carried in the preview request currently received by the terminal is within the reference time period, it is determined whether the target video frame image belongs to the reference image frame set corresponding to the first video frame image.
[0198] In an embodiment of the present disclosure, the terminal device may obtain the frame rate of the video frame sequence based on the basic information of the video frame sequence.
[0199] Here, the step of obtaining the frame rate can be set according to actual needs and is not specifically limited.
[0200] Based on the frame rate, the time interval between any two adjacent video frame images in the video frame sequence can be determined; based on the time interval and the number of video frame images allowed to be stored in the data buffer, the terminal device can determine the buffering duration of multiple video frame images allowed to be stored in the data buffer.
[0201] The buffering duration refers to the duration of a video formed by multiple video frame images that the data buffer is allowed to store.
[0202] According to the timestamp of the first video frame image and the buffering duration, a reference time period corresponding to the reference image frame set may be determined.
[0203] It can be understood that the reference image frame set is the video frame image located before the first video frame image, therefore, the reference time period is a time period before the timestamp of the first video frame image, and the length of the reference time period is equal to the buffering duration.
[0204] According to whether the time indicated by the first time information carried by the currently received preview request is within the reference time period, it can be determined whether the target video frame image belongs to the reference image frame set corresponding to the first video frame image.
[0205] In the embodiment of the present disclosure, by acquiring the frame rate of the video frame sequence, the reference time period of the reference image frame set corresponding to the first video frame image that can be stored in the data buffer can be determined, so that when the time indicated by the first time information carried by the preview request is within the reference time period, it can be determined that the target video frame image belongs to the reference image frame set corresponding to the first video frame image, which is more efficient and convenient.
[0206] The following is a specific example to introduce the video frame preview method in the embodiment of the present disclosure.
[0207] Figure 6 A schematic diagram of a decoder according to an exemplary embodiment of the present disclosure is shown in FIG. Figure 2 .like Figure 6 As shown, a data buffer 24 can be added to the output thread 23 of the decoder 20. The data buffer 24 can cache the index of the output buffer obtained by the output thread 23 from the decoder. The data buffer 24 can also send the index of the output buffer corresponding to the required video frame image to the output thread 23 after completing the search of the stored index. The output thread 23 can inform the decoder 20 of the index of the output buffer corresponding to the video frame image to be displayed, and can also inform the decoder 20 of the index of the released output buffer.
[0208] Combination Figure 6 The structure shown, and Figure 3 The image frame sequence shown is used to describe in detail the video frame preview method in the embodiment of the present disclosure.
[0209] Assuming that the user wants to preview the video frame image at the target time point 1 (frame number 11, the 11th frame), the input thread 22 first locates the 1st frame (frame number 1, which is a key frame, and decoding must start from the key frame), and then sequentially sends the 1st, 2nd, 3rd, 4th, 5th, 6th, 7th, 8th, 9th, 10th, and 11th frames to the decoder 20. The decoder 20 decodes the video frame images that are sequentially input. The output thread 23 keeps checking whether there is an available output buffer. Once there is, it immediately controls the output buffer and takes out the index of the output buffer. Then the timestamp of the video frame image decoded from the output buffer is compared with the target time point 1. If it is greater than or equal to the target time point 1, the image data in the output buffer is displayed, and the decoding is completed.
[0210] If the timestamp of the video frame image corresponding to the output buffer is less than the target time point 1, the terminal device first determines whether the data buffer 24 is full. If the data buffer 24 is not full, the index and timestamp of the newly obtained output buffer are added to the data buffer 24; if the data buffer 24 is full, the terminal device searches for the index of the output buffer with the smallest timestamp in the data buffer 24, and discards the index of the output buffer with the smallest timestamp. Then, the terminal device adds the index and timestamp of the newly obtained output buffer to the data buffer 24.
[0211] According to the above process, after the terminal device controls the output thread 23 to obtain the index of the output buffer for decoding the 11th frame of video frame image, the 11th frame of video frame image can be called and displayed based on the index of the output buffer corresponding to the 11th frame. At this time, when the data buffer 24 can store the index and timestamp of the output buffer corresponding to 16 frames of video frame image, the index and timestamp of the output buffer corresponding to the 1st, 2nd, 3rd, 4th, 5th, 6th, 7th, 8th, 9th, and 10th frames of video frame image are all stored in the data buffer 24.
[0212] At this time, the user slightly moves the video progress bar forward and wants to display the video frame image of the target time point 2 (frame number 8, the 8th frame). The terminal device can first search in the data buffer 24 whether there is a timestamp and an index of the output buffer of the target video frame image corresponding to the target time point 2. From the above process of displaying the video frame image of the target time point 1, it can be seen that the current data buffer stores the index and timestamp of the output buffer corresponding to the video frame images of the 1st to 10th frames, so there is an index of the output buffer corresponding to the 8th frame of the video frame image. Therefore, the index of the output buffer corresponding to the 8th frame of the video frame image can be obtained and the 8th frame of the video frame image can be called to display the target video frame image corresponding to the target time point 2. In this process, the terminal device can directly take out the index of the output buffer of the 8th frame of the video frame image from the data buffer 24 without re-decoding, and the effect of real-time display can be achieved.
[0213] Assuming that the source video is 30fps, the storage size of the data buffer 24 is equivalent to the size of the index and timestamp of the output buffer corresponding to 16 video frames, and the data buffer 24 can cache about 533ms of video data. In other words, when the target time point corresponding to the current preview request is within 533ms before the target time point corresponding to the previous preview request, real-time display can be achieved. In addition, because the data buffer 24 stores integer variables instead of real image data, it will not increase memory usage.
[0214] The present disclosure provides a video frame preview device. Figure 7 is a structural diagram of a video frame preview device according to an exemplary embodiment of the present disclosure. Figure 7 As shown, the video frame preview device 700 includes:
[0215] A first determination module 701 is configured to, in response to a preview request for a current video frame sequence, determine a target video frame image indicated by the preview request;
[0216] The second determination module 702 is configured to determine whether the data buffer of the terminal stores the target video frame image; wherein the data buffer stores the historical decoding data of the video frame sequence;
[0217] The display module 703 is configured to display the target video frame image if the target video frame image is stored in the data buffer of the terminal.
[0218] Optionally, the second determining module 702 is further configured to:
[0219] Obtain the timestamp of the first video frame image most recently decoded by the terminal;
[0220] If the timestamp of the target video frame image is less than the timestamp of the first video frame image, determine whether the target video frame image belongs to a reference image frame set corresponding to the first video frame image; wherein the reference image frame set includes: N video frame images that are located before the first video frame image in the video frame sequence and are closest to the first video frame image; N is the number of video frame images that the data buffer is allowed to store;
[0221] If the target video frame image belongs to the reference image frame set corresponding to the first video frame image, it is determined that the data buffer stores the target video frame image.
[0222] Optionally, the second determining module 702 is further configured to:
[0223] If the target video frame image is not stored in the data buffer, the video frame sequence is decoded to obtain the target video frame image.
[0224] Optionally, the second determining module 702 is further configured to:
[0225] Starting from a previous key frame of the target video frame, decoding the video frame images in the video frame sequence in sequence;
[0226] Determine whether the decoded video frame image is the target video frame image;
[0227] If the decoded video frame image is not the target video frame image, storing the decoded video frame image in the data buffer;
[0228] If the decoded video frame image is the target video frame image, the target video frame image is displayed.
[0229] Optionally, the second determining module 702 is further configured to:
[0230] Determine whether there is free buffer space in the data buffer;
[0231] If there is free buffer space in the data buffer, storing the decoded video frame image in the data buffer;
[0232] If there is no free buffer space in the data buffer, release the memory space occupied by the historical decoding data of the second video frame image in the data buffer; and store the decoded video frame image in the data buffer; wherein the second video frame image is: the video frame image with the smallest timestamp among the multiple video frame images stored in the data buffer.
[0233] Optionally, the second determining module 702 is further configured to:
[0234] The timestamp corresponding to the decoded video frame image and the index of the decoder output buffer are stored in the data buffer;
[0235] If the target video frame image is stored in the data buffer of the terminal, displaying the target video frame image comprises:
[0236] If the data buffer stores a timestamp corresponding to the target video frame image, determine the index of the decoder output buffer corresponding to the timestamp of the target video frame image, and based on the index of the decoder output buffer corresponding to the target video frame image stored in the data buffer, call the target video frame image for display.
[0237] Optionally, the first determining module 701 is further configured to:
[0238] In response to a preview request for the video frame sequence, obtaining first time information carried in the preview request;
[0239] Based on the timestamps of multiple video frame images in the video frame sequence and the first time information, a target video frame image indicated by the preview request is determined, wherein a time difference between the timestamp of the target video frame image and the time indicated by the first time information is a minimum difference among the time differences corresponding to the multiple video frame images.
[0240] Optionally, the second determining module 702 is further configured to:
[0241] Obtaining the frame rate of the video frame sequence;
[0242] Based on the number of frames of video frame images that the data buffer is allowed to store and the frame rate, determining a buffering duration of a plurality of video frame images that the data buffer is allowed to store;
[0243] Determining a reference time period corresponding to the reference image frame set according to the timestamp of the first video frame image and the buffering duration;
[0244] According to whether the time indicated by the first time information carried in the preview request currently received by the terminal is within the reference time period, it is determined whether the target video frame image belongs to the reference image frame set corresponding to the first video frame image.
[0245] Figure 8 1 is a block diagram of a terminal device according to an exemplary embodiment of the present disclosure. For example, the terminal device may be a smart phone, a tablet computer, etc.
[0246] Reference Figure 8The terminal device 80 may include one or more of the following components: a processing component 83, a memory 84, a power component 85, a multimedia component 86, an audio component 87, an input / output (I / O) interface 88, a sensor component 89, and a communication component 810.
[0247] The processing component 83 generally controls the overall operation of the terminal device 80, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 83 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 83 may include one or more modules to facilitate the interaction between the processing component 83 and other components. For example, the processing component 83 may include a multimedia module to facilitate the interaction between the multimedia component 86 and the processing component 83.
[0248] The memory 84 is configured to store various types of data to support operations on the terminal device 80. Examples of such data include instructions for any application or method operating on the terminal device 80, contact data, phone book data, messages, pictures, videos, etc. The memory 84 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0249] The power supply component 85 provides power to various components of the terminal device 80. The power supply component 85 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the terminal device 80.
[0250] The multimedia component 86 includes a screen that provides an output interface between the terminal device 80 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 86 includes a front camera and / or a rear camera. When the terminal device 80 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and the rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0251] The audio component 87 is configured to output and / or input audio signals. For example, the audio component 87 includes a microphone (MIC), and when the terminal device 80 is in an operation mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 84 or sent via the communication component 810. In some embodiments, the audio component 87 also includes a speaker for outputting audio signals.
[0252] I / O interface 88 provides an interface between processing component 83 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button and lock button.
[0253] The sensor assembly 89 includes one or more sensors for providing various aspects of status assessment for the terminal device 80. For example, the sensor assembly 89 can detect the open / closed state of the terminal device 80, the relative positioning of the components, such as the display and keypad of the terminal device 80, and the sensor assembly 89 can also detect the position change of the terminal device 80 or a component of the terminal device 80, the presence or absence of contact between the user and the terminal device 80, the orientation or acceleration / deceleration of the terminal device 80, and the temperature change of the terminal device 80. The sensor assembly 89 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 89 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 89 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0254] The communication component 810 is configured to facilitate wired or wireless communication between the terminal device 80 and other devices. The terminal device 80 can access a wireless network based on a communication standard, such as Wi-Fi, 4G or 5G, or a combination thereof. In an exemplary embodiment, the communication component 810 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 810 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0255] In an exemplary embodiment, the terminal device 80 can be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to perform the above method.
[0256] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 84 including instructions, and the instructions can be executed by the processor 820 of the terminal device 80 to complete the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0257] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0258] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A video frame preview method, characterized in that: include: In response to a preview request for a current video frame sequence, determining a target video frame image indicated by the preview request; Determine whether the target video frame image is stored in the data buffer of the terminal; wherein the data buffer stores the historical decoding data of the video frame sequence; If the target video frame image is stored in the data buffer of the terminal, the target video frame image is displayed.
2. The method according to claim 1, characterized in that The determining whether the data buffer of the terminal stores the target video frame image comprises: Obtain the timestamp of the first video frame image most recently decoded by the terminal; If the timestamp of the target video frame image is less than the timestamp of the first video frame image, determine whether the target video frame image belongs to a reference image frame set corresponding to the first video frame image; wherein the reference image frame set includes: N video frame images that are located before the first video frame image in the video frame sequence and are closest to the first video frame image; N is the number of video frame images that the data buffer is allowed to store; If the target video frame image belongs to the reference image frame set corresponding to the first video frame image, it is determined that the data buffer stores the target video frame image.
3. The method according to claim 1 or 2, characterized in that: The method further comprises: If the target video frame image is not stored in the data buffer, the video frame sequence is decoded to obtain the target video frame image.
4. The method according to claim 3, characterized in that The decoding of the video frame sequence to obtain the target video frame image includes: Starting from a previous key frame of the target video frame, decoding the video frame images in the video frame sequence in sequence; Determine whether the decoded video frame image is the target video frame image; If the decoded video frame image is not the target video frame image, storing the decoded video frame image in the data buffer; If the decoded video frame image is the target video frame image, the target video frame image is displayed.
5. The method according to claim 4, characterized in that The step of storing the decoded video frame image into the data buffer comprises: Determine whether there is free buffer space in the data buffer; If there is free buffer space in the data buffer, storing the decoded video frame image in the data buffer; If there is no free buffer space in the data buffer, release the memory space occupied by the historical decoding data of the second video frame image in the data buffer; and store the decoded video frame image in the data buffer; wherein the second video frame image is: the video frame image with the smallest timestamp among the multiple video frame images stored in the data buffer.
6. The method according to claim 5, characterized in that The step of storing the decoded video frame image into the data buffer comprises: The timestamp corresponding to the decoded video frame image and the index of the decoder output buffer are stored in the data buffer; If the target video frame image is stored in the data buffer of the terminal, displaying the target video frame image comprises: If the data buffer stores a timestamp corresponding to the target video frame image, determine the index of the decoder output buffer corresponding to the timestamp of the target video frame image, and based on the index of the decoder output buffer corresponding to the target video frame image stored in the data buffer, call the target video frame image for display.
7. The method according to claim 2, characterized in that The step of determining, in response to a preview request for a currently played video frame sequence, a target video frame image indicated by the preview request comprises: In response to a preview request for the video frame sequence, obtaining first time information carried in the preview request; Based on the timestamps of multiple video frame images in the video frame sequence and the first time information, a target video frame image indicated by the preview request is determined, wherein a time difference between the timestamp of the target video frame image and the time indicated by the first time information is a minimum difference among the time differences corresponding to the multiple video frame images.
8. The method according to claim 2, characterized in that: The determining whether the target video frame image belongs to a reference image frame set corresponding to the first video frame image includes: Obtaining a frame rate of the video frame sequence; Based on the number of frames of video frame images that the data buffer is allowed to store and the frame rate, determining a buffering duration of a plurality of video frame images that the data buffer is allowed to store; Determining a reference time period corresponding to the reference image frame set according to the timestamp of the first video frame image and the buffering duration; According to whether the time indicated by the first time information carried in the preview request currently received by the terminal is within the reference time period, it is determined whether the target video frame image belongs to the reference image frame set corresponding to the first video frame image.
9. A video frame preview device, characterized in that: include: A first determination module is configured to determine, in response to a preview request for a current video frame sequence, a target video frame image indicated by the preview request; A second determination module is configured to determine whether the data buffer of the terminal stores the target video frame image; wherein the data buffer stores the historical decoding data of the video frame sequence; The display module is configured to display the target video frame image if the target video frame image is stored in the data buffer of the terminal.
10. A terminal device, characterized in that: include: a memory for storing processor-executable instructions; A processor connected to the memory; The processor is configured to execute the video frame preview method as described in any one of claims 1 to 8.
11. A non-transitory computer-readable storage medium, characterized in that: When the instructions in the storage medium are executed by a processor of a computer, the terminal device is enabled to execute the video frame preview method as described in any one of claims 1 to 8.