Video keyframe extraction

Updated at:

The Video Keyframe Extraction operator uses scene detection to identify shot changes in a video, extracting a representative frame from each scene as an image keyframe. This operator is suitable for use cases such as video content archiving, intelligent tagging, and reverse image search for videos. This topic describes how to configure the Video Keyframe Extraction operator.

Prerequisites

  • You must purchase the unstructured data feature for your instance to use workflows.

  • You have created a workflow. For more information, see Create and manage workflows.

Permissions

In a Basic project, project administrators, developers, analysts, and custom project roles with the Dataset - Use permission can use any dataset in the project as the operator's input and output.

Supported file formats

The Video Keyframe Extraction operator can process the following file formats: MP4, AVI, MKV, MOV, WebM, FLV, TS, WMV, 3GP, and MPEG.

Procedure

  1. In the top navigation bar of the Dataphin homepage, choose Develop > Data Development.

  2. In the top navigation bar of the Develop page, select a Project.

  3. In the left-side navigation pane, choose Data Processing > Workflow. In the Workflow list, click the target workflow to open its canvas. From the Operator library on the left, drag the Video Keyframe Extraction operator to the canvas, and then configure its parameters in the Video Keyframe Extraction panel on the right.

    Parameter

    Description

    Step Name

    The name can be up to 256 characters long and can contain any characters.

    Input settings

    Dataset

    Select the dataset to process. You can only select a hybrid dataset. After you select a dataset, you must also select a version. By default, the first version in ascending order is selected.

    If the operator is downstream of another, its input dataset is typically the output dataset of the upstream operator.

    Input Field

    Select a field from the input dataset that contains the storage URL of the video to be processed. You can only select fields for which the Is URL parameter is set to Yes.

    Filter Condition (Optional)

    Enter a filter condition, which is the expression used in a SQL WHERE clause. You can use system variables, such as the business date variable ${bizdate}.

    Operator settings

    Image Content Understanding

    If you enable this feature, the system calls a large language model (LLM) to analyze the content of the extracted keyframes. You must also enter a prompt of up to 2,000 characters.

    Model

    This parameter is available only when Image Content Understanding is enabled. Select the model to use for this operator. You can select an Enabled model of the Vision (Image and Video) type in Intelligent Application Management > Model Configuration.

    Note

    Output settings

    Dataset

    You can select a hybrid dataset as the output dataset. You can also select other versions of the source dataset. After you select a dataset, you must also select a version. By default, the first version in ascending order is selected.

    File Output Path

    The output path uses the selected dataset's file storage directory as a prefix. You can specify a subdirectory to store the output. The output for each source video file is stored in a separate subdirectory.

    Load Policy

    If the selected output dataset's metadata table contains a primary key, Update upon primary key conflict is selected by default. If no primary key exists, append data is selected by default.

    • Append data: Appends new data to the destination table. A primary key or constraint conflict causes an error.

    • Update upon primary key conflict: If a primary key or constraint conflict occurs, the system deletes the entire row with the conflicting primary key before inserting the new data.

    • Overwrite: Deletes all data from the destination table before writing the new data.

    Field Mapping

    The Video Keyframe Extraction operator produces the following fixed output fields:

    • source_video_url: The storage URL of the original video.

    • keyframe_sequence: The sequence number of the keyframe.

    • keyframe_url: The storage URL of the keyframe image.

    • keyframe_content: The content understanding result for the keyframe image.

    • keyframe_id: The unique ID of the keyframe, used for unique identification by downstream operators.

    In real-time and online workflows, the Video Keyframe Extraction operator uses a 1:N output model, where a single input event generates multiple keyframes. The extraction results are stored in the keyframes array field, which can be used as the iteration source for the ForEach loop operator to process each keyframe individually with downstream operators. The default iteration variable for the ForEach loop operator is keyframe.

    By default, the operator's output fields are mapped to fields with the same names in the output dataset. You can also manually select destination fields for custom mapping. In addition, you can map pass-through fields from the source dataset to the destination dataset. You can manage field mappings in the following ways:

    • Add Output Field: Click to add a new, empty field mapping.

    • Batch Mapping: Click to choose between bulk manual mapping, mapping by name, or mapping by row.

    • Delete: Click the Delete icon to remove the corresponding field mapping. You cannot delete mappings for the operator's fixed output fields.

  4. After you complete the configuration, click Save in the toolbar at the top of the canvas.

    After configuring a single operator, you can continue to build your workflow by connecting it to upstream or downstream operators.