2

Using version 1.22.1 of the Ruby SDK I'm unable to set a duration on the output of a video being transcoded by the Elastic Transcoder. Based on the docs it looks like the outputs hash needs a composition array/hash containing a time_span hash with the duration. In my case I'm trying to limit it to 10 seconds.

Code sample:

transcoder = AWS::ElasticTranscoder::Client.new(
      access_key_id: ENV['S3_ACCESS_KEY_ID'],
      secret_access_key: ENV['S3_SECRET_ACCESS_KEY'],
      region: ENV['AET_REGION']
    )

    transcoder.create_job(
      pipeline_id: ENV['AET_PIPELINE_ID'],
      input: {
        key: "#{video.s3_key}",
        frame_rate: 'auto',
        resolution: 'auto',
        aspect_ratio: 'auto',
        interlaced: 'auto',
        container: 'auto'
      },
      output: {
        key: "#{video.s3_key}/web.mp4",
        preset_id: '1351620000001-100070', # System preset: Web
        composition: [
          {
            time_span: {
              duration: '00:00:10.000'
            }
          }
        ]
      }
    )

Here's the error I get:

unexpected option :composition

Here's a link to the Ruby SDK docs on the transcoder: http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/ElasticTranscoder/Client.html#create_job-instance_method

And here are the general AWS Elastic Transcoder docs: http://docs.aws.amazon.com/elastictranscoder/latest/developerguide/create-job.html

I'm hoping this is a syntax error and wasn't just left out of the SDK.

edit: Updated code to include initialization and composition snippet from Loren.

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
Ryan Arneson
  • 1,323
  • 3
  • 14
  • 25

1 Answers1

2

From the commit history, it looks like :composition was only added in v1.25.0 of the SDK. The documentation published on the site only reflects the latest version of the SDK. If you update to the latest version, you should be able to use this parameter. Note however that it is documented as an array of hashes, so you will have to wrap your composition structure in an array of hashes:

composition: [{time_span: {duration: '...'}}]

Loren Segal
  • 3,251
  • 1
  • 28
  • 29
  • Thanks for looking at this. Unfortunately, even with 1.29.0 (and 1.25.0 for that matter) I get the same error that composition is an unexpected option. – Ryan Arneson Dec 12 '13 at 19:34
  • Are you sure you're using 1.29.0? I tried this just today before responding to make sure that it worked for me. Could this be a Bundler version locking issue? What is `AWS::VERSION`? – Loren Segal Dec 13 '13 at 01:57
  • 1.29.1. I've restarted Passenger and Apache and can't seem to get past this error. I updated the code in the original post to include the initialization to see if anything was off there. – Ryan Arneson Dec 13 '13 at 02:59
  • Have you tried this in a local dev environment like irb or the aws-rb interactive REPL, or just a plain Ruby script running outside of Apache? This seems like a versioning issue, because the `composition` parameter is definitely in v1.29.1. You can confirm this by typing, in your shell: `sed -n '124,134p' $(gem which aws/api_config/ElasticTranscoder-2012-09-25.yml)` -- you should see ":composition:" listed. – Loren Segal Dec 14 '13 at 23:46
  • Got it! I uninstalled/reinstalled the gem as well as the aws-rb executable, restarted Apache, and it works. Might have still been stuck on an old version of the gem. – Ryan Arneson Dec 16 '13 at 02:31