Skip to content

get_images async

get_images(
    image_selector_type: ImageSelectorType,
    start_timestamp: Timestamp,
    end_timestamp: Timestamp,
    format: Format,
    *,
    config_overrides: Optional[AsyncKinesisVideoArchivedMediaClientConfig] = None,
    stream_name: Optional[StreamName] = None,
    stream_arn: Optional[ResourceARN] = None,
    sampling_interval: Optional[SamplingInterval] = None,
    format_config: Optional[FormatConfig] = None,
    width_pixels: Optional[WidthPixels] = None,
    height_pixels: Optional[HeightPixels] = None,
    max_results: Optional[GetImagesMaxResults] = None,
    next_token: Optional[NextToken] = None,
) -> GetImagesOutput

Retrieves a list of images corresponding to each timestamp for a given time range, sampling interval, and image format configuration.

Parameters:

  • stream_name (Optional[StreamName], default: None ) –

    The name of the stream from which to retrieve the images. You must specify either the StreamName or the StreamARN.

  • stream_arn (Optional[ResourceARN], default: None ) –

    The Amazon Resource Name (ARN) of the stream from which to retrieve the images. You must specify either the StreamName or the StreamARN.

  • image_selector_type (ImageSelectorType) –

    The origin of the Server or Producer timestamps to use to generate the images.

  • start_timestamp (Timestamp) –

    The starting point from which the images should be generated. This StartTimestamp must be within an inclusive range of timestamps for an image to be returned.

  • end_timestamp (Timestamp) –

    The end timestamp for the range of images to be generated. If the time range between StartTimestamp and EndTimestamp is more than 300 seconds above StartTimestamp, you will receive an IllegalArgumentException.

  • sampling_interval (Optional[SamplingInterval], default: None ) –

    The time interval in milliseconds (ms) at which the images need to be generated from the stream. The minimum value that can be provided is 200 ms (5 images per second). If the timestamp range is less than the sampling interval, the image from the startTimestamp will be returned if available.

  • format (Format) –

    The format that will be used to encode the image.

  • format_config (Optional[FormatConfig], default: None ) –

    The list of a key-value pair structure that contains extra parameters that can be applied when the image is generated. The FormatConfig key is the JPEGQuality, which indicates the JPEG quality key to be used to generate the image. The FormatConfig value accepts ints from 1 to 100. If the value is 1, the image will be generated with less quality and the best compression. If the value is 100, the image will be generated with the best quality and less compression. If no value is provided, the default value of the JPEGQuality key will be set to 80.

  • width_pixels (Optional[WidthPixels], default: None ) –

    The width of the output image that is used in conjunction with the HeightPixels parameter. When both WidthPixels and HeightPixels parameters are provided, the image will be stretched to fit the specified aspect ratio. If only the WidthPixels parameter is provided or if only the HeightPixels is provided, a ValidationException will be thrown. If neither parameter is provided, the original image size from the stream will be returned.

  • height_pixels (Optional[HeightPixels], default: None ) –

    The height of the output image that is used in conjunction with the WidthPixels parameter. When both HeightPixels and WidthPixels parameters are provided, the image will be stretched to fit the specified aspect ratio. If only the HeightPixels parameter is provided, its original aspect ratio will be used to calculate the WidthPixels ratio. If neither parameter is provided, the original image size will be returned.

  • max_results (Optional[GetImagesMaxResults], default: None ) –

    The maximum number of images to be returned by the API.

    The default limit is 25 images per API response. Providing a MaxResults greater than this value will result in a page size of 25. Any additional results will be paginated.

  • next_token (Optional[NextToken], default: None ) –

    A token that specifies where to start paginating the next set of Images. This is the GetImages:NextToken from a previously truncated response.

Raises:

  • ClientLimitExceededException –

    Kinesis Video Streams has throttled the request because you have exceeded a limit. Try making the call later. For information about limits, see Kinesis Video Streams Limits.

  • InvalidArgumentException –

    A specified parameter exceeds its restrictions, is not supported, or can't be used.

  • NoDataRetentionException –

    GetImages was requested for a stream that does not retain data (that is, has a DataRetentionInHours of 0).

  • NotAuthorizedException –

    Status Code: 403, The caller is not authorized to perform an operation on the given stream, or the token has expired.

  • ResourceNotFoundException –

    GetImages will throw this error when Kinesis Video Streams can't find the stream that you specified.

    GetHLSStreamingSessionURL and GetDASHStreamingSessionURL throw this error if a session with a PlaybackMode of ON_DEMAND or LIVE_REPLAYis requested for a stream that has no fragments within the requested time range, or if a session with a PlaybackMode of LIVE is requested for a stream that has no fragments within the last 30 seconds.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_kinesis_video_archived_media/_services/async_kinesis_video_archived_media.py
async def get_images(
    self,
    image_selector_type: "capo_kinesis_video_archived_media.types.image_selector_type.ImageSelectorType",
    start_timestamp: "capo_kinesis_video_archived_media.types.timestamp.Timestamp",
    end_timestamp: "capo_kinesis_video_archived_media.types.timestamp.Timestamp",
    format: "capo_kinesis_video_archived_media.types.format.Format",
    *,
    config_overrides: Optional[AsyncKinesisVideoArchivedMediaClientConfig] = None,
    stream_name: Optional[
        "capo_kinesis_video_archived_media.types.stream_name.StreamName"
    ] = None,
    stream_arn: Optional[
        "capo_kinesis_video_archived_media.types.resource_arn.ResourceARN"
    ] = None,
    sampling_interval: Optional[
        "capo_kinesis_video_archived_media.types.sampling_interval.SamplingInterval"
    ] = None,
    format_config: Optional[
        "capo_kinesis_video_archived_media.types.format_config.FormatConfig"
    ] = None,
    width_pixels: Optional[
        "capo_kinesis_video_archived_media.types.width_pixels.WidthPixels"
    ] = None,
    height_pixels: Optional[
        "capo_kinesis_video_archived_media.types.height_pixels.HeightPixels"
    ] = None,
    max_results: Optional[
        "capo_kinesis_video_archived_media.types.get_images_max_results.GetImagesMaxResults"
    ] = None,
    next_token: Optional[
        "capo_kinesis_video_archived_media.types.next_token.NextToken"
    ] = None,
) -> "capo_kinesis_video_archived_media.types.get_images_output.GetImagesOutput":
    """<p>Retrieves a list of images corresponding to each timestamp for a given time range, sampling interval, and image format configuration.</p>

    Args:
        stream_name: <p>The name of the stream from which to retrieve the images. You must specify either the <code>StreamName</code> or the <code>StreamARN</code>.</p>
        stream_arn: <p>The Amazon Resource Name (ARN) of the stream from which to retrieve the images. You must specify either the <code>StreamName</code> or the <code>StreamARN</code>.</p>
        image_selector_type: <p>The origin of the Server or Producer timestamps to use to generate the images.</p>
        start_timestamp: <p>The starting point from which the images should be generated. This <code>StartTimestamp</code> must be within an inclusive range of timestamps for an image to be returned.</p>
        end_timestamp: <p>The end timestamp for the range of images to be generated. If the time range between <code>StartTimestamp</code> and <code>EndTimestamp</code> is more than 300 seconds above <code>StartTimestamp</code>, you will receive an <code>IllegalArgumentException</code>.</p>
        sampling_interval: <p>The time interval in milliseconds (ms) at which the images need to be generated from the stream. The minimum value that can be provided is 200 ms (5 images per second). If the timestamp range is less than the sampling interval, the image from the <code>startTimestamp</code> will be returned if available. </p>
        format: <p>The format that will be used to encode the image.</p>
        format_config: <p>The list of a key-value pair structure that contains extra parameters that can be applied when the image is generated. The <code>FormatConfig</code> key is the <code>JPEGQuality</code>, which indicates the JPEG quality key to be used to generate the image. The <code>FormatConfig</code> value accepts ints from 1 to 100. If the value is 1, the image will be generated with less quality and the best compression. If the value is 100, the image will be generated with the best quality and less compression. If no value is provided, the default value of the <code>JPEGQuality</code> key will be set to 80.</p>
        width_pixels: <p>The width of the output image that is used in conjunction with the <code>HeightPixels</code> parameter. When both <code>WidthPixels</code> and <code>HeightPixels</code> parameters are provided, the image will be stretched to fit the specified aspect ratio. If only the <code>WidthPixels</code> parameter is provided or if only the <code>HeightPixels</code> is provided, a <code>ValidationException</code> will be thrown. If neither parameter is provided, the original image size from the stream will be returned.</p>
        height_pixels: <p>The height of the output image that is used in conjunction with the <code>WidthPixels</code> parameter. When both <code>HeightPixels</code> and <code>WidthPixels</code> parameters are provided, the image will be stretched to fit the specified aspect ratio. If only the <code>HeightPixels</code> parameter is provided, its original aspect ratio will be used to calculate the <code>WidthPixels</code> ratio. If neither parameter is provided, the original image size will be returned.</p>
        max_results: <p>The maximum number of images to be returned by the API. </p> <note> <p>The default limit is 25 images per API response. Providing a <code>MaxResults</code> greater than this value will result in a page size of 25. Any additional results will be paginated. </p> </note>
        next_token: <p>A token that specifies where to start paginating the next set of Images. This is the <code>GetImages:NextToken</code> from a previously truncated response.</p>

    Raises:
        capo_kinesis_video_archived_media.errors.client_limit_exceeded_exception.ClientLimitExceededException: <p>Kinesis Video Streams has throttled the request because you have exceeded a limit. Try making the call later. For information about limits, see <a href="http://docs.aws.amazon.com/kinesisvideostreams/latest/dg/limits.html">Kinesis Video Streams Limits</a>.</p>
        capo_kinesis_video_archived_media.errors.invalid_argument_exception.InvalidArgumentException: <p>A specified parameter exceeds its restrictions, is not supported, or can't be used.</p>
        capo_kinesis_video_archived_media.errors.no_data_retention_exception.NoDataRetentionException: <p> <code>GetImages</code> was requested for a stream that does not retain data (that is, has a <code>DataRetentionInHours</code> of 0). </p>
        capo_kinesis_video_archived_media.errors.not_authorized_exception.NotAuthorizedException: <p>Status Code: 403, The caller is not authorized to perform an operation on the given stream, or the token has expired.</p>
        capo_kinesis_video_archived_media.errors.resource_not_found_exception.ResourceNotFoundException: <p> <code>GetImages</code> will throw this error when Kinesis Video Streams can't find the stream that you specified.</p> <p> <code>GetHLSStreamingSessionURL</code> and <code>GetDASHStreamingSessionURL</code> throw this error if a session with a <code>PlaybackMode</code> of <code>ON_DEMAND</code> or <code>LIVE_REPLAY</code>is requested for a stream that has no fragments within the requested time range, or if a session with a <code>PlaybackMode</code> of <code>LIVE</code> is requested for a stream that has no fragments within the last 30 seconds.</p>
        capo_kinesis_video_archived_media.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_kinesis_video_archived_media.types.get_images_input.GetImagesInput]",
    ) -> AsyncOperationResponse[
        "capo_kinesis_video_archived_media.types.get_images_output.GetImagesOutput"
    ]:
        import capo_kinesis_video_archived_media._operations.aws_acuity_reader.get_images

        (
            output,
            http_response,
        ) = await capo_kinesis_video_archived_media._operations.aws_acuity_reader.get_images.async_get_images(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetImages")
    )
    input_: capo_kinesis_video_archived_media.types.get_images_input.GetImagesInput = {
        "image_selector_type": image_selector_type,
        "start_timestamp": start_timestamp,
        "end_timestamp": end_timestamp,
        "format": format,
    }
    if stream_name is not None:
        input_["stream_name"] = stream_name
    if stream_arn is not None:
        input_["stream_arn"] = stream_arn
    if sampling_interval is not None:
        input_["sampling_interval"] = sampling_interval
    if format_config is not None:
        input_["format_config"] = format_config
    if width_pixels is not None:
        input_["width_pixels"] = width_pixels
    if height_pixels is not None:
        input_["height_pixels"] = height_pixels
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output