API documentation

Coconut's API is a config-based API built with simplicity and flexibility in mind.
Encode your first video in less than 5 minutes.

API Reference

MPEG-DASH

Available since 2016-05-24

Keyword: outputs must be prefixed by the keyword -> followed by the format ID.

Format ID: dash

The first value is the output URL which is the Media Presentation Description or MPD.

Convert the source video to DASH.

For example:

-> dash = s3://accesskey:secretkey@bucket/dash/video.mpd

Parameters

NameTypeDefaultRequired
if
If the given condition is false, the output won't be processed.
Logical operators we support are: < > <= >= <> != = AND OR NOT..
string No
variants
A list of Simple Formats separated by commas
The formats specs:
• container must be mp4
• Video codec must be either h264, hevc or novideo
• Audio codec must be either aac or noaudio
format ID[,] mp4:x:64k,
mp4:x,
mp4:240p_400k:x,
mp4:360p_600k:x,
mp4:360p_1000k:x,
mp4:480p_1500k:x,
mp4:720p:x
No
segment_duration
The duration in millisecond of a subsegment. Min 1000, Max 20000. Recommended value is 5000 (default)
int 5000 No
mpd_title
The MPD title.
string basename generated by http://coconut.co No

Variants

It is important that you separate the video from the audio track to be compliant with the DASH-if guidelines.

To use a video only format, name it like this mp4:720p:x. For an audio only format: mp4:x:64k.

Cross-Origin Resource Sharing (CORS)

You will need to setup the CORS headers if the playlist and mp4 files are hosted on a different domain, which is most likely the case. Here are the different headers you need to setup:

  • Access-Control-Allow-Headers: "origin, range"
  • Access-Control-Allow-Methods: "GET, HEAD, OPTIONS"
  • Access-Control-Allow-Origin: "*"
  • Access-Control-Expose-Headers: "Server,range"

If your files are hosted on Amazon S3, the CORS policy should look like this:

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
    <CORSRule>
        <AllowedOrigin>*</AllowedOrigin>
        <AllowedMethod>GET</AllowedMethod>
        <MaxAgeSeconds>3000</MaxAgeSeconds>
        <AllowedHeader>*</AllowedHeader>
    </CORSRule>
</CORSConfiguration>