Skip to content

start_media_analysis_job

start_media_analysis_job(
    operations_config: MediaAnalysisOperationsConfig,
    input: MediaAnalysisInput,
    output_config: MediaAnalysisOutputConfig,
    *,
    config_overrides: Optional[RekognitionClientConfig] = None,
    client_request_token: Optional[ClientRequestToken] = None,
    job_name: Optional[MediaAnalysisJobName] = None,
    kms_key_id: Optional[KmsKeyId] = None,
) -> StartMediaAnalysisJobResponse

Service availability notice: Streaming Video and Bulk Image Analysis is no longer available to new customers. For more information, see Rekognition feature availability changes.

This change does not impact the availability of other Amazon Rekognition features.

Initiates a new media analysis job. Accepts a manifest file in an Amazon S3 bucket. The output is a manifest file and a summary of the manifest stored in the Amazon S3 bucket.

Parameters:

  • client_request_token (Optional[ClientRequestToken], default: None ) –

    Idempotency token used to prevent the accidental creation of duplicate versions. If you use the same token with multiple StartMediaAnalysisJobRequest requests, the same response is returned. Use ClientRequestToken to prevent the same request from being processed more than once.

  • job_name (Optional[MediaAnalysisJobName], default: None ) –

    The name of the job. Does not have to be unique.

  • operations_config (MediaAnalysisOperationsConfig) –

    Configuration options for the media analysis job to be created.

  • input (MediaAnalysisInput) –

    Input data to be analyzed by the job.

  • output_config (MediaAnalysisOutputConfig) –

    The Amazon S3 bucket location to store the results.

  • kms_key_id (Optional[KmsKeyId], default: None ) –

    The identifier of customer managed AWS KMS key (name or ARN). The key is used to encrypt images copied into the service. The key is also used to encrypt results and manifest files written to the output Amazon S3 bucket.

Raises:

  • AccessDeniedException –

    You are not authorized to perform the action.

  • IdempotentParameterMismatchException –

    A ClientRequestToken input parameter was reused with an operation, but at least one of the other input parameters is different from the previous call to the operation.

  • InternalServerError –

    Amazon Rekognition experienced a service issue. Try your call again.

  • InvalidManifestException –

    Indicates that a provided manifest file is empty or larger than the allowed limit.

  • InvalidParameterException –

    Input parameter violated a constraint. Validate your parameter before calling the API operation again.

  • InvalidS3ObjectException –

    Amazon Rekognition is unable to access the S3 object specified in the request.

  • LimitExceededException –

    An Amazon Rekognition service limit was exceeded. For example, if you start too many jobs concurrently, subsequent calls to start operations (ex: StartLabelDetection) will raise a LimitExceededException exception (HTTP status code: 400) until the number of concurrently running jobs is below the Amazon Rekognition service limit.

  • ProvisionedThroughputExceededException –

    The number of requests exceeded your throughput limit. If you want to increase this limit, contact Amazon Rekognition.

  • ResourceNotFoundException –

    The resource specified in the request cannot be found.

  • ResourceNotReadyException –

    The requested resource isn't ready. For example, this exception occurs when you call DetectCustomLabels with a model version that isn't deployed.

  • ThrottlingException –

    Amazon Rekognition is temporarily unable to process the request. Try your call again.

  • UnknownServiceError –

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

Examples:

StartMediaAnalysisJob Initiates a new media analysis job.

>>> client.start_media_analysis_job(job_name='job-name', operations_config={'DetectModerationLabels': {'MinConfidence': 50, 'ProjectVersion': 'arn:aws:rekognition:us-east-1:111122223333:project/my-project/version/1/1690556751958'}}, input={'S3Object': {'Bucket': 'input-bucket', 'Name': 'input-manifest.json'}}, output_config={'S3Bucket': 'output-bucket', 'S3KeyPrefix': 'output-location'})
Source code in docs_src/capo_rekognition/_services/rekognition.py
def start_media_analysis_job(
    self,
    operations_config: "capo_rekognition.types.media_analysis_operations_config.MediaAnalysisOperationsConfig",
    input: "capo_rekognition.types.media_analysis_input.MediaAnalysisInput",
    output_config: "capo_rekognition.types.media_analysis_output_config.MediaAnalysisOutputConfig",
    *,
    config_overrides: Optional[RekognitionClientConfig] = None,
    client_request_token: Optional[
        "capo_rekognition.types.client_request_token.ClientRequestToken"
    ] = None,
    job_name: Optional[
        "capo_rekognition.types.media_analysis_job_name.MediaAnalysisJobName"
    ] = None,
    kms_key_id: Optional["capo_rekognition.types.kms_key_id.KmsKeyId"] = None,
) -> "capo_rekognition.types.start_media_analysis_job_response.StartMediaAnalysisJobResponse":
    """<important> <p>Service availability notice: Streaming Video and Bulk Image Analysis is no longer available to new customers. For more information, see <a href="https://docs.aws.amazon.com/rekognition/latest/dg/rekognition-availability-changes.html">Rekognition feature availability changes</a>.</p> <p> <b>This change does not impact the availability of other Amazon Rekognition features.</b> </p> </important> <p>Initiates a new media analysis job. Accepts a manifest file in an Amazon S3 bucket. The output is a manifest file and a summary of the manifest stored in the Amazon S3 bucket.</p>

    Args:
        client_request_token: <p>Idempotency token used to prevent the accidental creation of duplicate versions. If you use the same token with multiple <code>StartMediaAnalysisJobRequest</code> requests, the same response is returned. Use <code>ClientRequestToken</code> to prevent the same request from being processed more than once.</p>
        job_name: <p>The name of the job. Does not have to be unique.</p>
        operations_config: <p>Configuration options for the media analysis job to be created.</p>
        input: <p>Input data to be analyzed by the job.</p>
        output_config: <p>The Amazon S3 bucket location to store the results.</p>
        kms_key_id: <p>The identifier of customer managed AWS KMS key (name or ARN). The key is used to encrypt images copied into the service. The key is also used to encrypt results and manifest files written to the output Amazon S3 bucket.</p>

    Raises:
        capo_rekognition.errors.access_denied_exception.AccessDeniedException: <p>You are not authorized to perform the action.</p>
        capo_rekognition.errors.idempotent_parameter_mismatch_exception.IdempotentParameterMismatchException: <p>A <code>ClientRequestToken</code> input parameter was reused with an operation, but at least one of the other input parameters is different from the previous call to the operation.</p>
        capo_rekognition.errors.internal_server_error.InternalServerError: <p>Amazon Rekognition experienced a service issue. Try your call again.</p>
        capo_rekognition.errors.invalid_manifest_exception.InvalidManifestException: <p>Indicates that a provided manifest file is empty or larger than the allowed limit.</p>
        capo_rekognition.errors.invalid_parameter_exception.InvalidParameterException: <p>Input parameter violated a constraint. Validate your parameter before calling the API operation again.</p>
        capo_rekognition.errors.invalid_s3_object_exception.InvalidS3ObjectException: <p>Amazon Rekognition is unable to access the S3 object specified in the request.</p>
        capo_rekognition.errors.limit_exceeded_exception.LimitExceededException: <p>An Amazon Rekognition service limit was exceeded. For example, if you start too many jobs concurrently, subsequent calls to start operations (ex: <code>StartLabelDetection</code>) will raise a <code>LimitExceededException</code> exception (HTTP status code: 400) until the number of concurrently running jobs is below the Amazon Rekognition service limit. </p>
        capo_rekognition.errors.provisioned_throughput_exceeded_exception.ProvisionedThroughputExceededException: <p>The number of requests exceeded your throughput limit. If you want to increase this limit, contact Amazon Rekognition.</p>
        capo_rekognition.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource specified in the request cannot be found.</p>
        capo_rekognition.errors.resource_not_ready_exception.ResourceNotReadyException: <p>The requested resource isn't ready. For example, this exception occurs when you call <code>DetectCustomLabels</code> with a model version that isn't deployed. </p>
        capo_rekognition.errors.throttling_exception.ThrottlingException: <p>Amazon Rekognition is temporarily unable to process the request. Try your call again.</p>
        capo_rekognition.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        StartMediaAnalysisJob
        Initiates a new media analysis job.

        >>> client.start_media_analysis_job(job_name='job-name', operations_config={'DetectModerationLabels': {'MinConfidence': 50, 'ProjectVersion': 'arn:aws:rekognition:us-east-1:111122223333:project/my-project/version/1/1690556751958'}}, input={'S3Object': {'Bucket': 'input-bucket', 'Name': 'input-manifest.json'}}, output_config={'S3Bucket': 'output-bucket', 'S3KeyPrefix': 'output-location'})
    """

    def _handler(
        req: "OperationRequest[capo_rekognition.types.start_media_analysis_job_request.StartMediaAnalysisJobRequest]",
    ) -> OperationResponse[
        "capo_rekognition.types.start_media_analysis_job_response.StartMediaAnalysisJobResponse"
    ]:
        import capo_rekognition._operations.rekognition_service.start_media_analysis_job

        output, http_response = (
            capo_rekognition._operations.rekognition_service.start_media_analysis_job.start_media_analysis_job(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("StartMediaAnalysisJob")
    )
    input_: capo_rekognition.types.start_media_analysis_job_request.StartMediaAnalysisJobRequest = {
        "operations_config": operations_config,
        "input": input,
        "output_config": output_config,
    }
    if client_request_token is None:
        client_request_token = str(uuid.uuid4())
    input_["client_request_token"] = client_request_token
    if job_name is not None:
        input_["job_name"] = job_name
    if kms_key_id is not None:
        input_["kms_key_id"] = kms_key_id

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output