我正在尝试对一些视频进行转码,但是我连接的方式有问题。
这是我的密码:
transcode = layer1.ElasticTranscoderConnection()
transcode.DefaultRegionEndpoint = 'elastictranscoder.us-west-2.amazonaws.com'
transcode.DefaultRegionName = 'us-west-2'
transcode.create_job(pipelineId, transInput, transOutput)这是一个例外:
{u'message': u'The specified pipeline was not found: account=xxxxxx, pipelineId=xxxxxx.'}发布于 2013-07-30 20:07:59
要连接到boto中的特定区域,可以使用:
import boto.elastictranscoder
transcode = boto.elastictranscoder.connect_to_region('us-west-2')
transcode.create_job(...)发布于 2013-10-09 18:57:25
前几天我才开始使用boto,但是前面的答案对我没有用--我不知道API是否改变了,或者什么(如果是这样的话,看起来有点奇怪,但无论如何)。我就是这么做的。
#!/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)显然,这是一个精心设计的示例,它只是从一个独立的python脚本中运行;它假设您在某个地方有一个带有凭据的.boto文件。
另外要注意的是PresetId;您可以在预置下的AWS弹性转换编码器管理控制台中找到这些信息。最后,可以填充在字典中的值从下面的链接逐字删除--据我所知,它们只是插入到REST调用中(显然区分大小写)。
https://stackoverflow.com/questions/17953163
复制相似问题