The HW Blog

Want to be updated? @opencoconut | Feed

Introducing the Coconut API v2

January 08, 2015 Features

We are thrilled to now show you the new API we've been building for the past months, which is by far the best and easiest API we have ever released.

8 years old

The original Coconut API turned 8 without really having any breaking changes. It means the code you wrote at that time is still working today, which is pretty exceptional by today's standards!

Our API was created at a time where everyone just needed a simple Flash version of their videos, so that visitors could watch them on the web. The workflow was pretty straightforward: Transfer -> FLV Encoding -> Deliver. Today, it's way more complicated due to all the new formats: MP4, WebM, HLS, JPG (thumbnails), GIF, and soon HEVC and VP9. That's a lot of work!

In 8 years we have seen multiple revolutions in the video industry, for example the rise of the H264 codec, the WebM codec released by Google, the revolution in the mobile industry with iPhone and Android devices, HTTP Live Streaming, and more. All these changes got us transcoding into more and more formats.

First attempt

We introduced the Robot API a couple of years ago. We wanted a simple API that managed everything for you: you submitted a simple config file and we executed everything in the background. You just needed to handle the single webhook sent at the end of the process.

It was great, it simplified the integration process a great deal, but it was just a layer built on top of our original API. The original API was still everywhere and every bit of the Robot implementation was pointing to it. We needed to move on.

Moving on

We designed a complete new API with today's transcoding needs in mind, all by keeping the flexibility of the Robot API.

From now, the Core API, Preview API, HLS API and Robot API are deprecated and we advise you to migrate as soon as possible to the new one. For those using the Robot API, it’s very simple as you just need to rewrite the config file and adapt your webhook script a little.

Introducing the new API

It is pretty straightforward to use the new API: you submit a config file and you wait for a webhook when the process is done (sounds familiar?) That's about it.

Here is a typical configuration sample coconut.conf:

var vid = abcdefg
var s3  = s3://a:s@videobucket/videos/$vid/outputfile1234

set source  =
set webhook =$vid

-> mp4  = $s3.mp4
-> webm = $s3.webm
-> hls  = $s3.m3u8
-> jpg:300x = $s3_#num#.jpg, number=3

The config file is so simple that it's self-explanatory. It's also very easy to submit the job:

curl \
-u api-key: \
-T coconut.conf

To learn more, read the full documentation and our getting started tutorials on how to encode videos.

If you have any questions or need any help migrating to this new API, send us an email! We hope you will enjoy this new API as much as we do.

Any Comment? Contact us via our contact page