I am not saying it isn’t fun hacking together a combination of ffmpeg, mencoder and dealing with all the dependencies and throwing down one ninja trick after another, just to transcode your video so it will display properly on the web, iphone or what ever device you want them on.
Using zencoder makes processing videos really satisfying. Just tell them where the source video is and tell them where you want them to dump the output, and as any modern web application it has implemented a web hook so if you want to stay tuned about the process specify a url where the status updates will be posted to. It looks like they only send you status when it is completed. Here is a quick example of how to get this working with ruby code.
require 'rubygems'
require 'rest_client'
require 'json'
HOST = "https://app.zencoder.com/api/jobs"
opts = {
"test" => 1,
"input" => "s3://bucketname/filename",
"output" => [
{
"label" => "fromapi",
"base_url" => "s3://bucketname/",
"filename" => "newfilename",
"width" => 500,
"quality" => 3,
"speed" => 1,
"h264_profile" => "high",
"audio_channels" => 2,
"notifications" => [
"http://example.com/status",
"you@example.com"
]
}
],
"api_key" => "youapikeyhere"
}
headers = {:content_type => :json, :accept => :json}
RestClient.post HOST, JSON.generate(opts), headers
{
"output": {"url":"s3://bucketname/filename",
"state":"finished",
"label":"fromapi",
"id":38384},
"job":{"test":true,
"state":"finished",
"id":38328}
}
This is pretty much all you need to start up your “next going to conquer the world and become a web celeb” venture, well this and a lot of free time. There are some acl settings you need to apply on your bucket something I have covered previously but using the firefox pluggin for S3 is good for that stuff as well
The things I really like about this approach is that it’s decoupled from the upload process. They will pick up your file so the only thing is that you have to either have it uploaded to S3 or simply have your somewhere accessibly to them. The benefits of having it all on S3 is that the access control is built in so you don’t have to expose your high quality videos to the public unless you want to.
The pricing seems reasonable, especially given that they charges for minutes of video transcoded instead of filesize, which is a really refreshing perspective. 6 cents a minute makes it $3.6 to transcode all of the stuff my flip mino HD can record.
Go check it out it’s really fun to play with and it was written up by techcrunch today
Leave a Reply