Skip to content

Instantly share code, notes, and snippets.

@gonz
Created November 5, 2012 21:47
Show Gist options
  • Save gonz/4020558 to your computer and use it in GitHub Desktop.
Save gonz/4020558 to your computer and use it in GitHub Desktop.
ZENCODER_API_KEY='*********' ./zctest.rb
#!/usr/bin/env ruby
require 'zencoder'
zencoder_api_key = ENV['ZENCODER_API_KEY']
# Input
input_url = 'http://s3.amazonaws.com/zencodertesting/test.mov'
# Outputs
default_output = {
size: '480x320',
upscale: true,
quality: 3
}
mp4_output = default_output.merge({ label: 'mp4', format: 'mp4',
video_codec: 'h264', audio_codec: 'aac' })
ogv_output = default_output.merge({ label: 'ogv', format: 'ogv',
video_codec: 'theora', audio_codec: 'vorbis' })
flv_output = default_output.merge({ label: 'flv', format: 'flv' })
Zencoder.api_key = zencoder_api_key
r = Zencoder::Job.create({ input: input_url,
outputs: [ mp4_output, ogv_output, flv_output ] })
puts 'Output URLs:'
r.body['outputs'].each do |o|
puts "Output id: ##{o['id']}, URL #{o['url']}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment