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

Convert the video to any formats

Keyword: outputs must be prefixed by the keyword -> followed by a Simple Format.

The first value is the output URL which is the full location URL including the filename where you want the final video to be uploaded to.

For example:

var s3 = s3://accesskey:secretkey@bucket

-> webm     = $s3/webm/video.webm
-> mp4:360p = $s3/mp4/video_360p.mp4
-> mp4:720p = $s3/mp4/video_720p.mp4

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


Example:

-> mp4:720p = $s3/mp4/video_720p.mp4, if=$source_width >= 1280

Options

NameTypeDefaultRequired
keep
Will keep the original spec(s). Values can be
video_bitrate fps resolution audio_bitrate sample_rate channels
Example: keep = resolution,video_bitrate will keep the original video resolution and bitrate
string[,] No
deinterlace
Will deinterlace the video if enabled
bool false No


Example:

-> mp4 = $s3/mp4/video.mp4, keep=video_bitrate,audio_bitrate

Rotation

NameTypeDefaultRequired
transpose
Rotate the video
0 90CounterCLockwise and Vertical Flip (default)
1 90Clockwise
2 90CounterClockwise
3 90Clockwise and Vertical Flip
We automatically use transpose for videos taken in portrait mode.
int 0 No
vflip
Vertically Flip the video
We automatically use vflip for videos taken upsidedown.
bool false No
hflip
Horizontally Flip the video
We automatically use hflip for videos taken upsidedown.
bool false No

Cut

NameTypeDefaultRequired
duration
Max duration in second of the video. if 10, the encoded video length will be 10 seconds.
int No
offset
Will start the encoding at the given offset in second.
int No

Watermark

NameTypeDefaultRequired
watermark_url
URL of the png image that will be incrusted in the video. Transparent and semi-transparent images are compatible.
URL No
watermark_position
Position of the watermark.
topleft topright bottomleft bottomright
string topleft No

x264 options

NameTypeDefaultRequired
x264_level int 30 10 11 12 13 20 21 22 30 31 32 40 41 42 50 51
x264_vprofile string baseline baseline main high high10 high422 high444