The HW Blog

Want to be updated? @opencoconut | Feed

Why HEVC is even better than you think

Bruno Celeste (@brunoceleste)

February 20, 2016 Tech

A couple of days ago, I decided to make a very simple comparison between the H264 and HEVC (or H265) codecs. Everybody knows that HEVC is (far) superior, and my guess is it will be the future most popular codec in the video industry despite the patent nightmare around it.

But I wanted to know how the user experience will improve when this codec will be mainstream. I don’t know for you but, I’d rather watch a degraded version of a video instead of a "buffering" message popping up every 5 seconds destroying the whole experience.

Continue reading on Medium →

Uploading videos directly to Amazon S3

Bruno Celeste (@brunoceleste)

April 01, 2014 Tech

It's pretty straightforward thanks to Amazon, you can now save some bandwidth and allow your user to upload directly to your S3 bucket.

Here is a very simple example:

<form action="" method="post" enctype="multipart/form-data">
<input type="hidden" name="key" value="<%%= %>/videos/<%%= random_key %>" /><br />
<input type="hidden" name="acl" value="public-read" />
<input type="hidden" name="x-amz-meta-uuid" value="14365123651274" />
<input type="hidden" name="redirect" value="<%%= %>" >
<input type="hidden" name="AWSAccessKeyId " value="15B4D3461F177624206A" />
<input type="hidden" name="Policy" value="eyAiZXhwaXJhdGlvbiI6ICIy..." />
<input type="hidden" name="Signature" value="2qCp0odXe7A9IYyUVqn0w2adtCA=" />
Video file <input type="file" name="file" /> <br />
<input type="submit" name="submit" value="Upload to Amazon S3" />

When an user upload the file to your bucket, the response will be:

HTTP/1.1 303 Redirect
x-amz-request-id: 1AEE782442F35865
x-amz-id-2: cxzFLJRatFHy+NGtaDFRR8YvI9BHmgLxjvJzNiGGICARZ/mVXHj7T+qQKhdpzHFh
Content-Type: application/xml
Date: Wed, 14 Nov 2007 21:21:33 GMT
Connection: close
Server: AmazonS3

In upload_ok page, you'll makethe request to Coconut to transfer and encode the video:

user = User.find(params[:user_id])
url = "{params[:key]}"

hw ="HW-API-Key", api_key) :create :url => url

See the S3 documentation.

Setting Special Permissions on Amazon S3 Bucket

Bruno Celeste (@brunoceleste)

April 01, 2014 Tech

Actually you can create a new user with specific permissions on a specific bucket. So this is exactly what we want for Coconut uploads.

First, go to the amazon console

Create a new user and let the box checked to create access/secret keys. Once done, Download the credentials.

Create a new S3 User

Next, select the new user and select the Permissions tab at the bottom.

Create permissions for S3 User

Click Attach User Policy > Custom Policy

Set S3 Policy for User

Here is the complete Policy:

  "Statement": [
      "Effect": "Allow",
      "Action": [
      "Resource": "arn:aws:s3:::BUCKETNAME/*",
      "Condition": {}
      "Effect": "Allow",
      "Action": [
      "Resource": "arn:aws:s3:::BUCKETNAME",
      "Condition": {}

You can learn more reading the official documentation

Other posts