ExtractFrames

Retrieve frames (as separate images) from a referenced video.

Frames are returned as encoded images in the array of blobs.

Parameters

  • video_ref: Reference to videos within the transaction (either the result of a FindVideo or an AddVideo) from which the corresponding frames will be retrieved.

  • frames: Array of frame indexes, or interval obbject (see below for more details).

  • [optional] as_format: Specify the format of the returned frames.

  • [optional] operations

Details

The frames to be extracted and returned can be specified in two ways: either by specifying the frames parameter with an array of frame indexes, or by passing an object (see examples below) with start, stop, and step indexes.

Examples

Find the video with the “name” property equal to “my_video_1”, and returns 1st, 10th, and 100th frames of it:

[ {
      "FindVideo": {
          "_ref": 1,
          "unique": true,
          "constraints" : {
              "name" : ["==", "my_video_1"},
          }
      }
}, {
      "ExtractFrames": {
          "video_ref": 1,
          "frames" : [0, 9, 99]
      }
}]

Find the video with the “name” property equal to “my_video_1”, and return 1 every 5 frames in the range between the 1st and the 100th frame with 1080p resolution as “PNG”:

[ {
    "FindVideo": {
        "_ref": 1,
        "constraints" : {
            "name" : ["==", "Family Guy"},
        },
        "unique": true,
    }
}, {
    "ExtractFrames": {
        "video_ref": 1,
        "as_format": "png",
        "frames": {
            "start": 0,
            "stop" : 99,
            "step" : 5
        },
        "operations": [
            {
                "type": "resize",
                "width":  1920,
                "height": 1080
            }
        ]
    }
}]