2

我正在尝试使用 Aws ElasticTranscoder 将多个文件转码为一个 mp4 输出,但我总是遇到相同的错误:“缺少必需的参数 params[:input]”和“params[:inputs] 处的意外值”,我不知道为什么。根据 Aws 文档,唯一需要的参数是 pipeline_id,但是当我尝试转码多个文件时它失败了。它仅在我将一个文件转码为另一个文件时才有效,但这对我来说还不够,因为我需要对多个文件进行转码。这是我为使用 Ruby sdk 测试 ElasticTranscoder 而创建的脚本

AWS_PUBLIC_KEY = 'XXXXXXXXXXXX'
AWS_SECRET_ACCESS_KEY = 'XXXXXXXXXXXXXXXXX'
PIPELINE_ID = "a_pipe_line_id"

credentials = Aws::Credentials.new(AWS_PUBLIC_KEY, AWS_SECRET_ACCESS_KEY)

elastictranscoder = Aws::ElasticTranscoder::Client.new({
    region: 'yyyyyyy',
    credentials: credentials
})

begin
    resp = elastictranscoder.create_job({
    pipeline_id: PIPELINE_ID,
    inputs: [{
        key: "converted/003d436e-2afd-4526-8f1a-5e2a4b2c30cb.webm",
        frame_rate: "auto",
        resolution: "auto",
        aspect_ratio: "auto",
        container: "auto"
    },
    { 
        key: "converted/0026d587-0c04-4957-8166-ed365f2bf10d.webm",
        frame_rate: "auto",
        resolution: "auto",
        aspect_ratio: "auto",
        container: "auto"
    }
    ],
    outputs: [{
        key: DateTime.now.to_s + ".mp4",
        preset_id: "the_custom_preset_id"
    }]
})
rescue => e
    ap "entro en rescue"
    ap e.message
end

ap "done"
ap resp.to_s
4

0 回答 0