get_clip
async
¶
get_clip(
clip_fragment_selector: ClipFragmentSelector,
*,
config_overrides: Optional[AsyncKinesisVideoArchivedMediaClientConfig] = None,
stream_name: Optional[StreamName] = None,
stream_arn: Optional[ResourceARN] = None,
) -> AsyncGenerator[GetClipOutput]
Downloads an MP4 file (clip) containing the archived, on-demand media from the specified video stream over the specified time range.
Both the StreamName and the StreamARN parameters are optional, but you must specify either the StreamName or the StreamARN when invoking this API operation.
As a prerequisite to using GetCLip API, you must obtain an endpoint using GetDataEndpoint, specifying GET_CLIP for the APIName parameter.
An Amazon Kinesis video stream has the following requirements for providing data through MP4:
-
The media must contain h.264 or h.265 encoded video and, optionally, AAC or G.711 encoded audio. Specifically, the codec ID of track 1 should be
V_MPEG/ISO/AVC(for h.264) or V_MPEGH/ISO/HEVC (for H.265). Optionally, the codec ID of track 2 should beA_AAC(for AAC) or A_MS/ACM (for G.711). -
Data retention must be greater than 0.
-
The video track of each fragment must contain codec private data in the Advanced Video Coding (AVC) for H.264 format and HEVC for H.265 format. For more information, see MPEG-4 specification ISO/IEC 14496-15. For information about adapting stream data to a given format, see NAL Adaptation Flags.
-
The audio track (if present) of each fragment must contain codec private data in the AAC format (AAC specification ISO/IEC 13818-7) or the MS Wave format.
You can monitor the amount of outgoing data by monitoring the GetClip.OutgoingBytes Amazon CloudWatch metric. For information about using CloudWatch to monitor Kinesis Video Streams, see Monitoring Kinesis Video Streams. For pricing information, see Amazon Kinesis Video Streams Pricing and Amazon Web Services Pricing. Charges for outgoing Amazon Web Services data apply.
Parameters:
-
stream_name(Optional[StreamName], default:None) –The name of the stream for which to retrieve the media clip.
You must specify either the StreamName or the StreamARN.
-
stream_arn(Optional[ResourceARN], default:None) –The Amazon Resource Name (ARN) of the stream for which to retrieve the media clip.
You must specify either the StreamName or the StreamARN.
-
clip_fragment_selector(ClipFragmentSelector) –The time range of the requested clip and the source of the timestamps.
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.
-
InvalidCodecPrivateDataException–The codec private data in at least one of the tracks of the video stream is not valid for this operation.
-
InvalidMediaFrameException–One or more frames in the requested clip could not be parsed based on the specified codec.
-
MissingCodecPrivateDataException–No codec private data was found in at least one of tracks of the video stream.
-
NoDataRetentionException–GetImageswas requested for a stream that does not retain data (that is, has aDataRetentionInHoursof 0). -
NotAuthorizedException–Status Code: 403, The caller is not authorized to perform an operation on the given stream, or the token has expired.
-
ResourceNotFoundException–GetImageswill throw this error when Kinesis Video Streams can't find the stream that you specified.GetHLSStreamingSessionURLandGetDASHStreamingSessionURLthrow this error if a session with aPlaybackModeofON_DEMANDorLIVE_REPLAYis requested for a stream that has no fragments within the requested time range, or if a session with aPlaybackModeofLIVEis requested for a stream that has no fragments within the last 30 seconds. -
UnsupportedStreamMediaTypeException–The type of the media (for example, h.264 or h.265 video or ACC or G.711 audio) could not be determined from the codec IDs of the tracks in the first fragment for a playback session. The codec ID for track 1 should be
V_MPEG/ISO/AVCand, optionally, the codec ID for track 2 should beA_AAC. -
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
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | |