Skip to content

Instantly share code, notes, and snippets.

@plainprogrammer
Created June 26, 2012 22:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plainprogrammer/2999901 to your computer and use it in GitHub Desktop.
Save plainprogrammer/2999901 to your computer and use it in GitHub Desktop.
audio = Audio.first
configuration = RefNetAdmin::Application.config.zencoder
id = audio.id
bucket = configuration['bucket']
base_path = configuration['base_path']
options = {
input: audio.file.url(:original),
outputs: [
{
label: "webm_low",
base_url: "s3://#{bucket}/#{base_path}/#{id}",
filename: 'webm_low.webm',
url: "s3://#{bucket}/#{base_path}/#{id}/webm_low.webm",
format: "webm",
skip_video: true,
audio_codec: "vorbis",
audio_bitrate: 56,
audio_sample_rate: 22050,
audio_channels: 2,
rrs: true,
headers: [{
"Content-Type" => "audio/webm"
}],
access_control: [
{
grantee: 'b2fd8e5d30be3daf5b0ba253bfa36e575146a8932b84ee161ecb8dbecb5faf82',
permission: [ 'FULL_CONTROL' ]
},
{
grantee: 'http://acs.amazonaws.com/groups/global/AllUsers',
permission: [ 'READ' ]
}
]
},
{
label: "webm_high",
base_url: "s3://#{bucket}/#{base_path}/#{id}",
filename: 'webm_high.webm',
url: "s3://#{bucket}/#{base_path}/#{id}/webm_high.webm",
format: "webm",
skip_video: true,
audio_codec: "vorbis",
audio_bitrate: 128,
audio_sample_rate: 44100,
audio_channels: 2,
rrs: true,
headers: [{
"Content-Type" => "audio/webm"
}],
access_control: [
{
grantee: 'b2fd8e5d30be3daf5b0ba253bfa36e575146a8932b84ee161ecb8dbecb5faf82',
permission: [ 'FULL_CONTROL' ]
},
{
grantee: 'http://acs.amazonaws.com/groups/global/AllUsers',
permission: [ 'READ' ]
}
]
}
]
}
Zencoder::Job.create(options, {skip_ssl_verify: true})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment