AWS Elemental MediaConvert CreateJob Example Using the SDK for Python - AWS Elemental MediaConvert API Reference

AWS Elemental MediaConvert CreateJob Example Using the SDK for Python

Follow these steps to send requests using the AWS SDK for Python (Boto):

  1. Use the describe_endpoints method to request an account-specific endpoint.

    Important

    Make the DescribeEndpoints call only once, then hardcode or cache your endpoint. This endpoint is specific to your AWS account and won't change.

    Don't use DescribeEndpoints to create your AWS client each time that you make a request to MediaConvert. Otherwise, you will reach the throttle maximum on the public API endpoint.

  2. Specify the transcoding settings for your job in a JSON file.

    You can use the AWS Elemental MediaConvert console to generate the JSON job specification. For more information and sample job specifications, see Creating Your Job Specification.

  3. Perform these steps in your Python code, as demonstrated in the example that follows these steps:

    1. Create the client with your account-specific endpoint specified.

    2. Load your settings JSON file.

    3. Create the transcoding job using create_job.

    import json import boto3 # Create MediaConvert client mediaconvert_client = boto3.client('mediaconvert', endpoint_url='https://abcd1234.mediaconvert.us-west-2.amazonaws.com') # Load job.json from disk and store as Python object: job_object with open("job.json", "r") as jsonfile: job_object = json.load(jsonfile) # Create MediaConvert job by unpacking the arguments from job_object. The job object contains the required parameters # for create_job. Pass these to create_job using Python's ** argument unpacking syntax. mediaconvert_client.create_job(**job_object)