質問

I'm trying to transcode some videos, but something is wrong with the way I am connecting.

Here's my code:

transcode = layer1.ElasticTranscoderConnection()
transcode.DefaultRegionEndpoint = 'elastictranscoder.us-west-2.amazonaws.com'
transcode.DefaultRegionName = 'us-west-2'
transcode.create_job(pipelineId, transInput, transOutput)

Here's the exception:

{u'message': u'The specified pipeline was not found: account=xxxxxx, pipelineId=xxxxxx.'}
役に立ちましたか?

解決

To connect to a specific region in boto, you can use:

import boto.elastictranscoder
transcode = boto.elastictranscoder.connect_to_region('us-west-2')
transcode.create_job(...)

他のヒント

I just started using boto the other day, but the previous answer didn't work for me - don't know if the API changed or what (seems a little weird if it did, but anyway). This is how I did it.

#!/usr/bin/env python

# Boto
import boto

# Debug
boto.set_stream_logger('boto')

# Pipeline Id
pipeline_id = 'lotsofcharacters-393824'

# The input object
input_object = {
    'Key': 'foo.webm',
    'Container': 'webm',
    'AspectRatio': 'auto',
    'FrameRate': 'auto',
    'Resolution': 'auto',
    'Interlaced': 'auto'
}

# The object (or objects) that will be created by the transcoding job;
# note that this is a list of dictionaries.
output_objects = [
    {
        'Key': 'bar.mp4',
        'PresetId': '1351620000001-000010',
        'Rotate': 'auto',
        'ThumbnailPattern': '',
    }
]

# Phone home
# - Har har.
et = boto.connect_elastictranscoder()

# Create the job
# - If successful, this will execute immediately.
et.create_job(pipeline_id, input_name=input_object, outputs=output_objects)

Obviously, this is a contrived example and just runs from a standalone python script; it assumes you have a .boto file somewhere with your credentials in it.

Another thing to note is the PresetId's; you can find these in the AWS Management Console for Elastic Transcoder, under Presets. Finally, the values that can be stuffed in the dictionaries are lifted verbatim from the following link - as far as I can tell, they are just interpolated into a REST call (case sensitive, obviously).

AWS Create Job API

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top