Video preview generation method and device, terminal equipment and storage medium

By calling the FFmpeg source code library to generate video preview images and displaying them in a QML application, the problem of the lack of efficient preview image generation for the GridView control is solved, improving the user experience and reducing resource consumption and maintenance costs.

CN120856922APending Publication Date: 2025-10-28SHENZHEN DONGRUI MEDICAL TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510741588.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-04
Publication Date
2025-10-28

AI Technical Summary

Technical Problem

In QML-based cross-platform application development, the GridView control lacks an efficient mechanism for generating video preview images, resulting in a poor user experience, high resource consumption, and high maintenance costs.

Method used

It calls the operation interface in the open-source multimedia FFmpeg source code library to generate a video preview image from video information, and uses an image display control to display the preview image in a grid view control. This includes extracting and parsing specified keyframes, saving them as low-resolution image files, and dynamically updating and managing the preview image in the user interface.

Benefits of technology

It improves user experience, reduces resource consumption and maintenance costs, and enables efficient generation of video preview images for the GridView control.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120856922A_ABST
    Figure CN120856922A_ABST
Patent Text Reader

Abstract

The invention is suitable for the technical field of videos, and provides a video preview generation method and device, terminal equipment and a storage medium, and the method comprises the steps: calling a plurality of operation interfaces in an open-source multimedia FFmpeg source code library, and obtaining video preview information corresponding to a video according to the video information of the video and a preview generation function, the video information at least comprises one of the following: a video storage directory and the last modification time of the video, and the video preview information comprises a video preview and a storage path of the video preview. And in response to a video display instruction for the video, displaying the video preview of the video through the image display control according to the video storage directory of the video and the storage path of the video preview. Through the method, the grid view control GridView has an efficient video preview generation mechanism under the default condition, so that the user experience is improved, and the resource consumption and the maintenance cost are reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of video technology, and in particular relates to a method, apparatus, terminal device and storage medium for generating video preview images. Background Technology

[0002] QML (Qt Meta-Object Language) is a declarative programming language used in the cross-platform application development framework Qt for building user interfaces. Currently, in QML-based cross-platform application development, the GridView control is the core component for displaying gridded content, and is commonly used to present multimedia resources such as images and video lists.

[0003] However, the GridView control lacks an efficient preview generation mechanism by default for loading video resources, resulting in poor user experience, high resource consumption, and high maintenance costs. Summary of the Invention

[0004] This application provides a method, apparatus, terminal device, and storage medium for generating video preview images. It can solve the problems of poor user experience, high resource consumption, and high maintenance costs in cross-platform application development based on the declarative programming language QML when loading video resources, due to the lack of an efficient preview image generation mechanism in the GridView control by default.

[0005] In a first aspect, embodiments of this application provide a method for generating a video preview image, the method comprising:

[0006] The system calls multiple operation interfaces in the open-source multimedia FFmpeg source code library to obtain the video preview image information corresponding to the video based on the video information and preview image generation function. The video information includes at least one of the following: video storage directory and video last modified time. The video preview image information includes: video preview image and video preview image storage path.

[0007] In response to a video display command for the video, the video preview image of the video is displayed through an image display control according to the video storage directory of the video and the storage path of the video preview image.

[0008] In one possible implementation of the first aspect, the step of calling multiple operation interfaces in the open-source multimedia FFmpeg source code library to obtain the video preview image information corresponding to the video based on the video information and the preview image generation function includes:

[0009] Based on the preview image generation function, the specified keyframes in the video are extracted and parsed through the open video interface and read video interface in the FFmpeg source code library to obtain the decoded frame information corresponding to the specified keyframes;

[0010] The decoded frame information is saved as a video preview image of the video using the image manipulation class Qimage;

[0011] The video preview image is saved in a hidden directory within the video storage directory of the video, thus obtaining the storage path of the video preview image.

[0012] In one possible implementation of the first aspect, before saving the decoded frame information as the video preview image of the video using the image manipulation class Qimage, the method includes:

[0013] If the video preview image of the video does not exist in the video storage directory of the video, then the video preview image of the video is generated directly.

[0014] If a video preview image of the video exists in the video storage directory of the video, then the last modified time of the video is obtained;

[0015] If the last modification time of the video is greater than or equal to a preset time threshold, the video preview image of the video is updated to obtain an updated video preview image.

[0016] If the last modification time of the video is less than the preset time threshold, the video preview image of the video will remain unchanged.

[0017] In one possible implementation of the first aspect, the response to a video display instruction for the video, displaying the video preview image of the video via an image display control according to the video storage directory of the video and the storage path of the video preview image, includes:

[0018] Use the video storage directory of the video as the target directory path of the grid view control where the image display control is located;

[0019] The storage path of the video preview image is used as the resource path of the image display control;

[0020] The video preview image is displayed using the image display control.

[0021] In one possible implementation of the first aspect, before calling multiple operation interfaces in the open-source multimedia FFmpeg source code library to obtain the video preview image information corresponding to the video based on the video information and preview image generation function, the method includes:

[0022] Obtain the FFmpeg source code library;

[0023] By building a system configuration tool, the FFmpeg source code library is integrated into the project source code, so that when generating the video preview image of the video, multiple operation interfaces in the FFmpeg source code library are called, wherein the project source code is used to display the video.

[0024] In one possible implementation of the first aspect, after displaying the video preview image of the video via the image display control, the method further includes:

[0025] Add a text display control to the grid view control;

[0026] The text display control displays the video's storage directory or the video's name.

[0027] In one possible implementation of the first aspect, during the process of displaying the video preview image of the video via the image display control, the method further includes:

[0028] Set a preload control in the grid view control, and set the number of data items in the preload control to twice the height of the visible area.

[0029] Secondly, embodiments of this application provide a video preview image generation apparatus, comprising:

[0030] The generation module is used to call multiple operation interfaces in the open-source multimedia FFmpeg source code library, and obtain the video preview image information corresponding to the video based on the video information and preview image generation function. The video information includes at least one of the following: video storage directory and video last modified time. The video preview image information includes: video preview image and video preview image storage path.

[0031] The display module is used to respond to the video display command for the video, and display the video preview image of the video through the image display control according to the video storage directory of the video and the storage path of the video preview image.

[0032] Thirdly, embodiments of this application provide a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the video preview image generation method described in any of the above claims.

[0033] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the video preview image generation method described in any of the preceding claims.

[0034] Fifthly, embodiments of this application provide a computer program product that, when run on a terminal device, causes the terminal device to execute the video preview image generation method described in any one of the first aspects.

[0035] The beneficial effects of the embodiments of this application compared with the prior art are:

[0036] This application provides a method for generating video preview images. The method includes: calling multiple operation interfaces in the open-source multimedia FFmpeg source code library; obtaining video preview image information corresponding to the video based on the video information and a preview image generation function; wherein the video information includes at least one of the following: video storage directory and video last modified time; and the video preview image information includes: the video preview image and the storage path of the video preview image. Responding to a video display command for the video, the method displays the video preview image of the video through an image display control based on the video storage directory and the storage path of the video preview image. This method enables the GridView control to have an efficient video preview image generation mechanism by default, thereby improving user experience and reducing resource consumption and maintenance costs. Attached Figure Description

[0037] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0038] Figure 1 This is a flowchart illustrating a method for generating a video preview image according to an embodiment of this application;

[0039] Figure 2 This is a flowchart illustrating a method for generating a video preview image according to another embodiment of this application;

[0040] Figure 3This is a schematic diagram of the structure of a video preview image generation device provided in an embodiment of this application;

[0041] Figure 4 This is a schematic diagram of the structure of a terminal device provided in an embodiment of this application. Detailed Implementation

[0042] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.

[0043] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.

[0044] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0045] As used in this application specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if detected [the described condition or event]" may be interpreted, depending on the context, as meaning "once determined," "in response to determination," "once detected [the described condition or event]," or "in response to detection [the described condition or event]."

[0046] Furthermore, in the description of this application and the appended claims, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0047] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.

[0048] When loading video resources, the GridView control lacks an efficient preview image generation mechanism by default, resulting in the following problems:

[0049] (1) Poor user experience. If no preview image is displayed when the video loads, the user interface will be blank or a static placeholder, making it impossible to intuitively display the video content and reducing user interaction efficiency. Especially in scenarios such as video libraries and live streaming platforms, the lack of a preview image will significantly weaken the effect of information transmission.

[0050] (2) High resource consumption and maintenance costs. Traditional solutions, especially on the Linux operating system, require developers to manually generate and store the first frame thumbnail of the video, increasing additional storage space and computing resource overhead, and making it difficult to dynamically adapt to updates in video content. For example, if the video content changes frequently, static preview images need to be generated repeatedly, leading to increased maintenance costs.

[0051] (3) While existing QML components (such as the video output component VideoOutput or the media player MediaPlayer) support video playback, when they are directly integrated into the GridView control, complex state management (such as listening to the StatusChanged signal) is required to capture the first frame. In addition, insufficient multi-threading and memory optimization may cause the user interface to lag.

[0052] (4) Different operating systems and hardware support video decoding differently. Some devices may fail to generate preview images due to decoding failure, and the existing solutions lack a unified error handling mechanism.

[0053] To address the aforementioned problems, this application proposes a method for generating video preview images. Based on the open-source multimedia FFmpeg source code library, the method extracts frames from the video and generates a lightweight video preview image, which is saved as a hidden file in the current video path. Then, the Video control in the GridView control is replaced with an Image control, and the resource path of the Image control is changed to the path of the video preview image generated by the FFmpeg source code library, thus completing the loading of the video preview image.

[0054] See also Figure 1 , Figure 1 This is a flowchart illustrating a method for generating a video preview image according to an embodiment of this application. The method includes:

[0055] S11. Call multiple operation interfaces in the open-source multimedia FFmpeg source code library, and obtain the video preview image information corresponding to the video based on the video information and preview image generation function. The video information includes at least one of the following: video storage directory and video last modified time. The video preview image information includes: video preview image and video preview image storage path.

[0056] S12. Responding to the video display command for the video, display the video preview image of the video through the image display control according to the video storage directory and the storage path of the video preview image.

[0057] It should be noted that in this embodiment, the executing entity can be a terminal device such as a server, and there are no specific limitations on this.

[0058] In step S11, the FFmpeg source code library is an open-source multimedia processing framework. This library provides rich operation interfaces, filters, tools, etc., supporting operations such as recording and converting digital audio and video. The operation interfaces are collections of functions or methods in the FFmpeg source code library used to implement specific functions. These interfaces can be called to perform operations such as decoding, encoding, transcoding, and screenshotting of audio and video. In this embodiment, the operation interfaces can be an open video interface (avformat_open_input) for opening video files, a read video interface (av_read_frame) for reading video files, etc.

[0059] Video information includes data related to the video, such as the video storage directory and the video's last modified time. The video storage directory is the path to the directory where video files are stored, indicating their location within the system; this directory allows you to locate the corresponding video file. The video's last modified time is the exact time the video file was last modified. This video information is helpful for managing and operating video files.

[0060] The preview image generation function is implemented based on the operation interface in the FFmpeg source code library. It generates a video preview image based on the video information. A pre-written preview image generation function then calls the relevant operation interface in the FFmpeg source code library to process the video and obtain the corresponding video preview image information. This video preview image information includes the video preview image itself and its storage path. The video preview image is a brief representation of the video content, usually a representative image, allowing users to quickly understand the general content of the video. The storage path of the video preview image is the directory where the video preview image files are stored, indicating the location of the video preview image in the system.

[0061] Further, in step S11, multiple operation interfaces in the open-source multimedia FFmpeg source code library are called to obtain the video preview image information corresponding to the video based on the video information and preview image generation function, including:

[0062] Based on the preview image generation function, the specified keyframes in the video are extracted and parsed through the open video and read video interfaces in the FFmpeg source code library to obtain the decoded frame information corresponding to the specified keyframes.

[0063] The decoded frame information is saved as a video preview image of the video using the Qimage image manipulation class.

[0064] Save the video preview image in a hidden directory within the video's storage directory to obtain the storage path of the video preview image.

[0065] The "Open Video" interface, or `avformat_open_input`, is the FFmpeg source code library's interface for opening video streams. The "Read Video" interface, or `av_read_frame`, is the same FFmpeg source code library's interface for reading and parsing video streams. The "Specify Keyframe" option specifies a pre-defined video frame used to generate the preview image. The specified keyframe can be the first frame, the last frame, or the most representative frame of the video stream. The "Decode Frame Information" option provides the image information obtained after decoding the specified keyframe. The "Qimage" class, a FFmpeg source code library interface, is used to save the decoded frame information as an image file. The "Qimage" class can save the decoded frame information as a low-resolution (e.g., 320×180) JPEG or PNG image file.

[0066] Specifically, firstly, based on the written preview image generation function, the video file is parsed using the `avformat_open_input` and `av_read_frame` operation interfaces in the FFmpeg source code library, decoding a specified keyframe (which can be the first frame) to obtain the decoded frame information. Then, the decoded keyframe (i.e., the decoded frame information) is saved as a low-resolution image file, i.e., the video preview image, using the `Qimage` image manipulation class. Finally, the obtained video preview image is saved in the video storage directory where the video file is located, and the attribute of this video preview image file is set to hidden file, thus obtaining the storage path of the video preview image (i.e., the hidden directory within the corresponding video storage directory).

[0067] It should be understood that saving the decoded keyframes as low-resolution image files using the Qimage image manipulation class can reduce memory usage. Setting the video preview image file's attribute to a hidden file can reduce user interface clutter, simplify file management, and prevent others from easily viewing or accessing these files, thus protecting user privacy and security to a certain extent.

[0068] It should be noted that when extracting and parsing specified keyframes in a video using the open video and read video interfaces in the FFmpeg source code library, the operation interfaces avcodec_send_packet and avcodec_receive_frame in the FFmpeg source code library can be used to call hardware video acceleration processing interfaces of different platforms (such as the video acceleration interface VA-API or the video toolbox), thereby achieving hardware-accelerated decoding.

[0069] You can also enable a multi-threaded queue (QThreadPool) to handle decoding tasks and limit the number of videos processed at the same time (e.g., a maximum of 5 concurrent videos) to avoid memory spikes.

[0070] In one possible implementation, before calling multiple operation interfaces in the open-source multimedia FFmpeg source code library to obtain the video preview image information corresponding to the video based on the video information and preview image generation function, the method includes:

[0071] Obtain the FFmpeg source code library.

[0072] By building a system configuration tool, the FFmpeg source code library is integrated into the project source code, so that when generating a video preview image, multiple operation interfaces in the FFmpeg source code library are called. The project source code is used to display the video.

[0073] Before generating video preview images by calling multiple operation interfaces in the FFmpeg source code library, the FFmpeg source code library needs to be added to the project source code. The project source code is the source code currently being executed for the video display task. First, obtain the FFmpeg source code library package from the official website or by cloning the repository via Git to ensure that the FFmpeg source code library is complete and has not been tampered with. Then, add the FFmpeg source code library to the project source code using a build system configuration tool (such as the CMake compiler or the .pro file of the cross-platform application development framework Qt), and compile it together with the project source code to ensure system compatibility across multiple application platforms (Linux / Windows / macOS).

[0074] For example, adding the FFmpeg source code library to the project source code via Qt's .pro file is shown in the following example:

[0075] INCLUDEPATH+=$$PWD / ffmpeg / include LIBS+=-L$$PWD / ffmpeg / lib-lavformat-lavcodec-lavutil-lswscale.

[0076] Among them, the FFmpeg source code library can select the FFmpeg 4.x series. This source code can be maintained for a long time and supports various hardware encoding and decoding. It does not require modification of the source code during compilation, and the community provides verified compilation scripts.

[0077] In step S12, the video display command is a signal issued by the system or user to display a video preview image. Upon receiving the video display command, the system will locate and display the corresponding video preview image based on the video information in the command. Image display controls are components used in the user interface to display preview images, such as Image controls. These components allow the preview image to be displayed on the user interface.

[0078] Further, in step S12, in response to the video display instruction for the video, the video preview image of the video is displayed through the image display control according to the video storage directory and the storage path of the video preview image, including:

[0079] Set the video storage directory as the target directory path for the grid view control where the image display control is located.

[0080] Use the storage path of the video preview image as the resource path for the image display control.

[0081] The video preview image is displayed using the image display control.

[0082] The GridView control can manage the layout of multiple preview images and supports scrolling, pagination, and other operations. When a user or system issues a video display command, the system captures the command and parses the video-related information contained within it, such as the video's storage directory and the storage path of the video preview image. Then, the target directory path for the GridView control and the resource path for the image display control are set. Specifically, the video's storage directory is used as the target directory path for the GridView control for logical association; and the storage path of the video preview image is used as the resource path for the image display control, enabling the image display control to load the preview image. Then, the video file is located based on the video storage directory, and the preview image file is found based on the video preview image's storage path. Finally, the image display control renders and displays the video preview image on the user interface for viewing.

[0083] It is understood that this embodiment provides a method for generating video preview images, including: calling multiple operation interfaces in the open-source multimedia FFmpeg source code library; obtaining video preview image information corresponding to the video based on the video information and the preview image generation function; wherein the video information includes at least one of the following: video storage directory, video last modified time; and the video preview image information includes: video preview image, video preview image storage path. Responding to a video display command for the video, the video preview image is displayed through an image display control based on the video storage directory and the video preview image storage path. This method enables the GridView control to have an efficient video preview image generation mechanism by default, thereby improving user experience and reducing resource consumption and maintenance costs.

[0084] In one possible implementation, before saving the decoded frame information as a video preview image of the video using the image manipulation class Qimage, the method includes:

[0085] If the video preview image does not exist in the video storage directory, the video preview image will be generated directly.

[0086] If a video preview image of the video exists in the video storage directory, then obtain the video's last modified time.

[0087] If the last modification time of the video is greater than or equal to the preset time threshold, the video preview image will be updated to obtain the updated video preview image.

[0088] If the last modification time of the video is less than the preset time threshold, the video preview image will remain unchanged.

[0089] Before saving the decoded frame information as a video preview image of the video using the Qimage image manipulation class, it is necessary to scan all videos in the video storage directory to check whether the video preview image of each video already exists in the video storage directory.

[0090] If the video preview image is not found in the video storage directory, the decoded frame information of the video is directly saved as the video preview image using the Qimage image manipulation class.

[0091] If a video preview image of the video already exists in the video storage directory, it is necessary to obtain the last modified time of the video to determine whether the content of the video has been modified.

[0092] If the last modification time of the video is greater than or equal to a preset time threshold, it indicates that the video has been modified for a considerable period of time, and the original video preview image can no longer represent the video content. Therefore, the video preview image needs to be updated. This is achieved by using the Qimage image manipulation class to save the latest decoded frame information of the video as the updated video preview image. The preset time threshold is a pre-defined time period value indicating whether a new video preview image needs to be generated. In this embodiment, the preset time threshold is not specifically limited.

[0093] If the last modification time of the video is less than the preset time threshold, it means that the video has just been modified and there is no need to update the video preview image. In this case, the video preview image will remain unchanged.

[0094] It should be understood that the above method can be used to dynamically and selectively update the video preview image, thereby reducing program overhead, optimizing image loading speed, and reducing maintenance costs.

[0095] In one possible implementation, after displaying a video preview image of the video via an image display control, the method further includes:

[0096] Add a text display control to the grid view control.

[0097] Display the video's storage directory or the video's name using a text display control.

[0098] A text display control is a UI component that displays text information on the user interface. A text display control can be a label, textbox, or other component used to display text.

[0099] In this embodiment, a text display control is added to the grid view control. The text display control can display video-related information next to or below each video preview image, such as the video storage directory or video name. Displaying the video storage directory helps users understand the location of the video in the file system, and displaying the video name can directly identify the content of the video, making it easier for users to understand the relevant information of the video more intuitively, thereby enhancing the information transmission effect.

[0100] In one possible implementation, the method further includes, during the process of displaying a video preview image of the video via an image display control:

[0101] Set up a preload control in the grid view control and set the number of data items in the preload control to twice the height of the visible area.

[0102] Preload controls are user components or mechanisms used to preload data. Data is loaded into memory before the user needs to view or manipulate it, reducing user wait time and improving user experience. The number of data items is the total number of data items to be displayed in the grid view control; that is, in a video preview scenario, each data item corresponds to one video preview.

[0103] In this embodiment, a preloading control is set in the grid view control, and the number of data items in the preloading control can be set to twice the height of the visible area. Twice the height of the visible area is simply twice the height of the visible area; in this embodiment, the setting of the number of data items is not limited. That is, when the user scrolls the grid view, the preloading control caches all video preview images that are about to enter the visible area in advance. Thus, when the user scrolls these video preview images, since these data items have been preloaded, they can be displayed immediately, thereby reducing loading delays and blocking.

[0104] See also Figure 2 , Figure 2 This is a flowchart illustrating a method for generating a video preview image according to another embodiment of this application. Figure 2 In step S21, the FFmpeg source code library is added to the project source code. In step S22, multiple operation interfaces from the open-source multimedia FFmpeg source code library are called to obtain the video preview image information corresponding to the video based on the video information and preview image generation function. In step S23, the video preview image is displayed using an Image control in the GridView control. In step S24, the layout and display of the user interface are completed.

[0105] It should be noted that the completed grid view control can also be packaged into a template file for easy porting and reuse in the future.

[0106] It should be noted that the video preview image generation method provided in this embodiment solves the problem of the GridView control in QML being unable to display video preview images by efficiently generating video preview images, dynamic cache management, and cross-platform compatibility optimization. This method can be widely applied in the following fields: (1) Streaming media video platforms, video-on-demand platforms, or live streaming platforms that need to display a massive video list. In these platforms, users need to quickly preview content and select playback. (2) Mobile or cross-platform applications that need to smoothly display video lists under limited hardware resources. (3) Embedded devices that support low memory usage and long-term use (such as network video recorders (NVRs) and digital video recorders (DVRs).

[0107] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0108] Corresponding to the method for generating a video preview image in the above embodiment, Figure 3 This diagram illustrates a structural schematic of a video preview image generation apparatus according to an embodiment of this application. For ease of explanation, only the parts relevant to the embodiment of this application are shown.

[0109] Reference Figure 3 The video preview image generation device 3 in this embodiment includes:

[0110] The generation module 31 is used to call multiple operation interfaces in the open-source multimedia FFmpeg source code library to obtain the video preview image information corresponding to the video based on the video information and preview image generation function. The video information includes at least one of the following: video storage directory and video last modified time. The video preview image information includes: video preview image and video preview image storage path.

[0111] Display module 32 is used to respond to video display commands for the video, and to display the video preview image of the video through image display controls according to the video storage directory and the storage path of the video preview image.

[0112] It is understood that this embodiment provides a video preview image generation device. This device 3, through a generation module 31, calls multiple operation interfaces in the open-source multimedia FFmpeg source code library to obtain video preview image information corresponding to the video based on the video information and the preview image generation function. The video information includes at least one of the following: video storage directory and video last modified time. The video preview image information includes: the video preview image and its storage path. The display module 32 responds to video display commands for the video and displays the video preview image through an image display control based on the video storage directory and the storage path of the video preview image. This video preview image generation device 3 enables the GridView control to have an efficient video preview image generation mechanism by default, thereby improving user experience and reducing resource consumption and maintenance costs.

[0113] Furthermore, the generation module 31 includes:

[0114] The decoding unit is used to extract and parse specified keyframes in the video based on the preview image generation function, through the open video interface and read video interface in the FFmpeg source code library, to obtain the decoded frame information corresponding to the specified keyframes.

[0115] The generation unit is used to save the decoded frame information as a video preview image of the video using the image manipulation class Qimage.

[0116] The storage unit is used to save the video preview image in a hidden directory within the video storage directory, thus obtaining the storage path of the video preview image.

[0117] Furthermore, the video preview image generation device 3 includes:

[0118] The initial generation module is used to directly generate a video preview image of the video if the video preview image does not exist in the video storage directory.

[0119] The time acquisition module is used to obtain the last modified time of a video if a video preview image of the video exists in the video storage directory.

[0120] The update generation module is used to update the video preview image if the last modification time of the video is greater than or equal to a preset time threshold, thus obtaining the updated video preview image.

[0121] The fixed generation module ensures that the video preview remains unchanged if the last modification time of the video is less than a preset time threshold.

[0122] Furthermore, the display module 32 includes:

[0123] The first determining unit is used to set the video storage directory of the video as the target directory path of the grid view control where the image display control is located.

[0124] The second determining unit is used to use the storage path of the video preview image as the resource path of the image display control.

[0125] The display unit is used to display a video preview image of the video through an image display control.

[0126] Furthermore, the video preview image generation device 3 includes:

[0127] The source code repository acquisition module is used to obtain the FFmpeg source code repository.

[0128] The source code library integration module is used to integrate the FFmpeg source code library into the project source code through the build system configuration tool. This allows multiple operation interfaces in the FFmpeg source code library to be called when generating video preview images of videos. The project source code is used to display the video.

[0129] Furthermore, the video preview image generation device 3 also includes:

[0130] The first module is used to add text display controls to the grid view control.

[0131] The second display module is used to display the video storage directory or video name of the video through a text display control.

[0132] Furthermore, the video preview image generation device 3 also includes:

[0133] The second module is used to set up a preloaded control in the grid view control and set the number of data items in the preloaded control to twice the height of the visible area.

[0134] It should be noted that the information interaction and execution process between the modules in the above-mentioned video preview image generation device 3 are based on the same concept as the method embodiment of this application. For details on their specific functions and technical effects, please refer to the method embodiment section, which will not be repeated here.

[0135] This application also provides a terminal device, such as... Figure 4 As shown, Figure 4 This is a schematic diagram of the structure of a terminal device provided in an embodiment of this application. (Refer to...) Figure 4 The terminal device 4 in this embodiment includes a memory 41, a processor 42, and a computer program stored in the memory 41 and executable on the processor 42. When the processor 42 executes the computer program, it implements the steps in the method embodiment for generating a video preview image of any of the above-mentioned items.

[0136] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps described in the various method embodiments above.

[0137] This application provides a computer program product that, when run on a mobile terminal, enables the mobile terminal to implement the steps described in the above-described method embodiments.

[0138] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. A computer-readable medium can include at least: any entity or device capable of carrying computer program code to a photographic device / terminal device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electrical carrier signals or telecommunication signals.

[0139] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0140] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0141] In the embodiments provided in this application, it should be understood that the disclosed apparatus / network devices and methods can be implemented in other ways. For example, the apparatus / network device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0142] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0143] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.

Claims

1. A method for generating a video preview image, characterized in that, include: The system calls multiple operation interfaces in the open-source multimedia FFmpeg source code library to obtain the video preview image information corresponding to the video based on the video information and preview image generation function. The video information includes at least one of the following: video storage directory and video last modified time. The video preview image information includes: video preview image and video preview image storage path. In response to a video display command for the video, the video preview image of the video is displayed through an image display control according to the video storage directory of the video and the storage path of the video preview image.

2. The method for generating a video preview image as described in claim 1, characterized in that, The process involves calling multiple operation interfaces from the open-source multimedia FFmpeg source code library to obtain the video preview image information corresponding to the video based on the video information and preview image generation function, including: Based on the preview image generation function, the specified keyframes in the video are extracted and parsed through the open video interface and read video interface in the FFmpeg source code library to obtain the decoded frame information corresponding to the specified keyframes; The decoded frame information is saved as a video preview image of the video using the image manipulation class Qimage; The video preview image is saved in a hidden directory within the video storage directory of the video, thus obtaining the storage path of the video preview image.

3. The method for generating a video preview image as described in claim 2, characterized in that, Before saving the decoded frame information as the video preview image of the video using the image manipulation class Qimage, the method includes: If the video preview image of the video does not exist in the video storage directory of the video, then the video preview image of the video is generated directly. If a video preview image of the video exists in the video storage directory of the video, then the last modified time of the video is obtained; If the last modification time of the video is greater than or equal to a preset time threshold, the video preview image of the video is updated to obtain an updated video preview image. If the last modification time of the video is less than the preset time threshold, the video preview image of the video will remain unchanged.

4. The method for generating a video preview image as described in claim 3, characterized in that, The response to the video display instruction for the video, based on the video storage directory and the storage path of the video preview image, displays the video preview image of the video through an image display control, including: Use the video storage directory of the video as the target directory path of the grid view control where the image display control is located; The storage path of the video preview image is used as the resource path of the image display control; The video preview image is displayed using the image display control.

5. The method for generating a video preview image as described in claim 4, characterized in that, Before calling multiple operation interfaces in the open-source multimedia FFmpeg source code library to obtain the video preview image information corresponding to the video based on the video information and preview image generation function, the method includes: Obtain the FFmpeg source code library; By building a system configuration tool, the FFmpeg source code library is integrated into the project source code, so that when generating the video preview image of the video, multiple operation interfaces in the FFmpeg source code library are called, wherein the project source code is used to display the video.

6. The method for generating a video preview image as described in claim 5, characterized in that, After displaying the video preview image of the video via the image display control, the method further includes: Add a text display control to the grid view control; The text display control displays the video's storage directory or the video's name.

7. The method for generating a video preview image as described in claim 6, characterized in that, In the process of displaying the video preview image of the video through the image display control, the method further includes: Set a preload control in the grid view control, and set the number of data items in the preload control to twice the height of the visible area.

8. A device for generating a video preview image, characterized in that, include: The generation module is used to call multiple operation interfaces in the open-source multimedia FFmpeg source code library, and obtain the video preview image information corresponding to the video based on the video information and preview image generation function. The video information includes at least one of the following: video storage directory and video last modified time. The video preview image information includes: video preview image and video preview image storage path. The display module is used to respond to the video display command for the video, and display the video preview image of the video through the image display control according to the video storage directory of the video and the storage path of the video preview image.

9. A terminal device, characterized in that, The method includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the method as claimed in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method as described in any one of claims 1 to 7.