Table Of Contents

Feedback

User Guide

First time using the AWS CLI? See the User Guide for help getting started.

[ aws . kinesis-video-media ]

get-media

Description

Use this API to retrieve media content from a Kinesis video stream. In the request, you identify stream name or stream Amazon Resource Name (ARN), and the starting chunk. Kinesis Video Streams then returns a stream of chunks in order by fragment number.

Note

You must first call the GetDataEndpoint API to get an endpoint to which you can then send the GetMedia requests.

When you put media data (fragments) on a stream, Kinesis Video Streams stores each incoming fragment and related metadata in what is called a "chunk." For more information, see . The GetMedia API returns a stream of these chunks starting from the chunk that you specify in the request.

The following limits apply when using the GetMedia API:

  • A client can call GetMedia up to five times per second per stream.
  • Kinesis Video Streams sends media data at a rate of up to 25 megabytes per second (or 200 megabits per second) during a GetMedia session.

See also: AWS API Documentation

See 'aws help' for descriptions of global parameters.

Synopsis

  get-media
[--stream-name <value>]
[--stream-arn <value>]
--start-selector <value>
outfile <value>

Options

--stream-name (string)

The Kinesis video stream name from where you want to get the media content. If you don't specify the streamName , you must specify the streamARN .

--stream-arn (string)

The ARN of the stream from where you want to get the media content. If you don't specify the streamARN , you must specify the streamName .

--start-selector (structure)

Identifies the starting chunk to get from the specified stream.

Shorthand Syntax:

StartSelectorType=string,AfterFragmentNumber=string,StartTimestamp=timestamp,ContinuationToken=string

JSON Syntax:

{
  "StartSelectorType": "FRAGMENT_NUMBER"|"SERVER_TIMESTAMP"|"PRODUCER_TIMESTAMP"|"NOW"|"EARLIEST"|"CONTINUATION_TOKEN",
  "AfterFragmentNumber": "string",
  "StartTimestamp": timestamp,
  "ContinuationToken": "string"
}

outfile (string) Filename where the content will be saved

See 'aws help' for descriptions of global parameters.

Output

ContentType -> (string)

The content type of the requested media.

Payload -> (blob)

The payload Kinesis Video Streams returns is a sequence of chunks from the specified stream. For information about the chunks, see . The chunks that Kinesis Video Streams returns in the GetMedia call also include the following additional Matroska (MKV) tags:

  • AWS_KINESISVIDEO_CONTINUATION_TOKEN (UTF-8 string) - In the event your GetMedia call terminates, you can use this continuation token in your next request to get the next chunk where the last request terminated.
  • AWS_KINESISVIDEO_MILLIS_BEHIND_NOW (UTF-8 string) - Client applications can use this tag value to determine how far behind the chunk returned in the response is from the latest chunk on the stream.
  • AWS_KINESISVIDEO_FRAGMENT_NUMBER - Fragment number returned in the chunk.
  • AWS_KINESISVIDEO_SERVER_TIMESTAMP - Server time stamp of the fragment.
  • AWS_KINESISVIDEO_PRODUCER_TIMESTAMP - Producer time stamp of the fragment.

The following tags will be present if an error occurs:

  • AWS_KINESISVIDEO_ERROR_CODE - String description of an error that caused GetMedia to stop.
  • AWS_KINESISVIDEO_ERROR_ID: Integer code of the error.

The error codes are as follows:

  • 3002 - Error writing to the stream
  • 4000 - Requested fragment is not found
  • 4500 - Access denied for the stream's KMS key
  • 4501 - Stream's KMS key is disabled
  • 4502 - Validation error on the Stream's KMS key
  • 4503 - KMS key specified in the stream is unavailable
  • 4504 - Invalid usage of the KMS key specified in the stream
  • 4505 - Invalid state of the KMS key specified in the stream
  • 4506 - Unable to find the KMS key specified in the stream
  • 5000 - Internal error