Created
November 5, 2012 21:47
-
-
Save gonz/4020558 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ZENCODER_API_KEY='*********' ./zctest.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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