JetEncode API Payload (Coconut-compatible)
JetEncode accepts a job payload compatible with Coconut’s “API Reference 2.0” style inputs/outputs.
At a high level:
- You provide a source
- Optionally a destination (depending on your integration)
- A map of outputs, where each key is either:
- a Simple Format Spec string (like mp4:1080p::quality=4), or - a special output group key like httpstream
In JetEncode core, outputs are parsed by reading the outputs object and interpreting each key as a format string (see model.JobRequest.Outputs and ParsedOutputs()).
Request Schema (top-level)
{
"source": { ... },
"destination": { ... },
"outputs": {
"<output_key>": { ...output_settings... }
},
"worker_uid" : "<optional worker id to run the job on>"
}source (object)
Defines where the input media comes from.
Typical Coconut-compatible shape:
{
"service": "http",
"url": "https://example.com/video.mp4"
}destination (object, optional)
Where to upload results. On AWS, attach a least-privilege IAM instance role to EC2 and omit static AWS access keys from the request:
{
"destination": {
"path": "jetencode-test",
"service": "s3",
"credentials": {
"bucket": "media-output",
"region": "us-east-1"
}
}
}The AWS edition must resolve S3 credentials through the AWS default credential provider chain. Never put AWS access keys in a job payload, AMI, or instance user data. For a non-AWS S3-compatible service, follow that provider's scoped credential and secret-management guidance.
outputs (object, required)
A map where:
- key = output format identifier
- value = output settings for that output
Example with multiple output types:
{
"outputs": {
"mp4:480p::quality=3": {
"key": "480p",
"path": "/mp4/480p.mp4"
},
"jpg:240x": {
"path": "/jpg/thumbs_%05d.jpg",
"number": 10
},
"httpstream": {
"hls": { "path": "/hls" },
"dash": { "path": "/dash" },
"variants": [
"mp4:x:64k",
"mp4:240p::quality=2",
"mp4:480p::quality=3,maxrate=1500k",
"mp4:720p::quality=4,maxrate=3000k"
]
}
}
}Simple Format Specification
A Simple format describes the format specs you want to use in outputs.
Naming Convention
For video outputs:
$video_container:$video_specs:$audio_specs:$format_options- Only
$video_containeris required - Specs are separated by
: - Options are separated by
_in the conceptual spec, but commonly written as::then comma-separated key/value options (see examples)
For audio-only outputs:
$audio_container:$audio_specsFor image outputs:
$image_container:$resolutionSupported Containers
Supported video, audio, and image containers:
- Video:
mp4,webm,mpegts,mov - Audio:
ogg,aac,mp3,wav - Image:
jpg,png,webp,gif,webp_anim
Video Specifications
Pattern:
$resolution_$bitrate_$codec_$fpsResolution
- Presets:
144p,240p,360p,480p,540p,576p,720p,1080p,1440p,2160p,4k - Or custom:
WxH(e.g.,1280x720)
Default: original resolution
Codec
copy,dnxhd,h264,hevc,novideo,prores,prores-ks,vp8,vp9- Container/codec compatibility is enforced; see
docs/TRANSCODING_PROFILES.md.
Default: container standard
Bitrate
Any value < 200000k (example: 1500k, 4000k)
FPS
0fps(preserve source FPS),15fps,23.98fps,25fps,29.97fps,30fps,60fps
Default: original fps
Audio Specifications
Pattern:
$codec_$bitrate_$sample_rate_$channelsCodec
aac, ac3, copy, mp2, mp3, noaudio, pcm, pcm-alaw, pcm-s16le, pcm-u8, vorbis
Default: container standard
Bitrate
Any value < 512k (example: 64k, 128k, 256k)
Sample rate
8000hz, 11025hz, 22050hz, 44100hz, 48000hz
Default: original
Channels
mono, stereo, multi
Default: original
Format Options
Options section:
$optionsCommon options
| Option | Values | Default |
|---|---|---|
pix_fmt | yuv420p, yuv422p, yuv420p10le, yuv444p10le | encoder default |
2pass | H264/HEVC only; requires video bitrate; incompatible with quality | No |
metadata | metadata=0 strips metadata | 1 |
MP4-specific options
| Option | Meaning |
|---|---|
frag | generate fragmented MP4 |
H264 options
| Option | Values | Default |
|---|---|---|
vprofile | baseline, main, high, high10, high422, high444 | encoder default |
level | 10, 11, 12, 13, 20, 21, 22, 30, 31, 32, 40, 41, 42, 50, 51 | encoder default |
quality | 1 (worst) → 5 (visually lossless) | (none) |
maxrate | cap bitrate when using quality | (none) |
high10 requires yuv420p10le, high422 requires yuv422p, and high444 requires yuv444p10le.
HEVC options
HEVC supports quality, maxrate, 2pass, yuv420p, and certified 10-bit yuv420p10le.
VP8 / VP9 options
Same quality / maxrate semantics as above.
Full Examples
| Format | Description |
|---|---|
mp4:1080p | MP4 with H264/AAC defaults, 1080p |
mp4:1080p::quality=4 | use quality instead of bitrate |
mp4:1080p::quality=4,maxrate=3000k | quality + bitrate cap |
mp4:hevc_2160p | 4K HEVC MP4 |
mp4:1080p_4000k::2pass | enable 2-pass |
mp4:320x240_1000k | custom resolution + bitrate |
mp4:1080p:noaudio | remove audio |
mp4:1080p:copy | copy audio |
mp4:::quality=3 | keep original resolution, set quality |
mp4:360p_25fps | force fps |
mp4:copy:copy | copy video + audio |
mp4:1080p::frag,quality=4 | fragmented mp4 + quality |
mp4:::quality=3,vprofile=high,level=50 | profile/level |
webm:720p | VP9/Vorbis defaults |
webm:vp9_1080p | VP9 webm |
webm:720p:48000hz | set sample rate |
mp4:720p:multi | keep multi-channel audio |
mp3 | MP3 audio-only 128k default |
aac:64k | AAC audio-only |
webp:400x | WebP image (height auto) |
jpg:640x360 | JPG image exact |
Outputs: Videos (Transcode)
Any output whose key is a video container or video Simple Format spec (e.g., mp4:720p) produces a transcoded video file.
Output settings (video/audio)
| Field | Type | Required | Notes |
|---|---|---|---|
path | string | Yes | Output path including filename (may be relative) |
key | string | No | Rename output key in notifications |
watermark | object | No | Overlay PNG watermark |
watermark.url | string | No | PNG URL |
watermark.position | string | No | topleft, topright, bottomleft, bottomright, center |
duration | int | No | seconds |
offset | int | No | seconds |
transpose | int | No | rotate video (0-3) |
vflip | bool | No | vertical flip |
hflip | bool | No | horizontal flip |
Example:
{
"outputs": {
"mp4:480p::quality=3": {
"key": "mp4:480p:wm",
"path": "/mp4/480p/video_wm.mp4",
"watermark": {
"url": "https://yourserver/watermark.png",
"position": "bottomright"
}
}
}
}Outputs: Images (Thumbnails & Animations)
Image outputs are keyed by an image Simple Format spec:
- Static thumbnails:
jpg:240x,png:640x360,webp:960x - Animations:
gif:320x,webp_anim:480x
Required
| Field | Type | Required | Notes |
|---|---|---|---|
path | string | Yes | If multiple thumbnails, include printf sequence like %05d |
Thumbnail generation modes
Use one of:
number: generate N images equally spaced (max 100)offsets: extract at specific seconds (array of ints)interval: extract every N seconds
Image output settings
| Field | Type | Required | Notes |
|---|---|---|---|
number | int | No | default 1, max 100 |
offsets | int[] | No | explicit offsets in seconds |
interval | int | No | seconds |
square | bool | No | crop to square (requires width & height) |
fit | string | No | pad (default) or crop |
blur | int | No | 1..5 |
sprite | object | No | group thumbnails into sprite images |
sprite.limit | int | Yes (if sprite used) | 10..1000 |
sprite.columns | int | No | default 4 |
vtt | object | No | WebVTT output |
vtt.filename | string | Yes (if vtt used) | *.vtt |
Example:
{
"outputs": {
"jpg:480x": {
"key": "jpg:medium",
"path": "/jpg/medium/thumbs_%05d.jpg",
"number": 10
},
"webp_anim:320x320": {
"key": "webp:preview",
"path": "/webp/preview.webp",
"scene": { "number": 5, "duration": 1 },
"square": true
}
}
}Outputs: HTTP Streaming (HLS & MPEG-DASH)
HTTP streaming output is specified under a special output key:
{
"outputs": {
"httpstream": {
"hls": { "path": "/hls" },
"dash": { "path": "/dash" },
"variants": ["mp4:240p::quality=2", "mp4:720p::quality=4,maxrate=3000k"],
"playlist_name": "master",
"segment_duration": 4
}
}
}JetEncode core implements this in two phases:
- Encode variants (ffmpeg)
- Package to HLS/DASH (shaka-packager), optionally encrypt
- NOTE: only AES-128 encryption is supported currently
Fields
| Field | Type | Required | Notes |
|---|---|---|---|
path | string | No | base output path (default /) |
key | string | No | output key alias |
variants | string[] | No | list of Simple Format specs (see below) |
playlist_name | string | No | default master |
dash | object | No | enable DASH |
dash.path | string | Yes (if dash used) | dash output subpath |
dash.hlsfmp4 | bool | No | also emit HLS fMP4 playlists |
dash.widevine_pssh | string | No | Widevine PSSH |
dash.playready_laurl | string | No | Playready LAURL |
dash.encryption_key | string | No | KeyIDHex:KeyHex |
hls | object | No | enable HLS |
hls.path | string | Yes (if hls used) | hls output subpath |
hls.version | int | No | if 3 → segmented, else fragmented (default 4) |
hls.segment_duration | int | No | seconds (default 4/5) |
hls.encryption_mode | string | No | AES-128 or SAMPLE-AES |
hls.encryption_key | string | No | hex key |
hls.encryption_key_uri | string | No | key URI |
Variants constraints (streaming)
For httpstream.variants:
- container must be
mp4 - video codec must be
h264(default),hevc, ornovideo - audio codec must be
aacornoaudio
Example variants list:
[
"mp4:x:64k",
"mp4:240p::quality=2",
"mp4:480p::quality=3,maxrate=1500k",
"mp4:720p::quality=4,maxrate=3000k"
]Selecting A Specific Worker
By passing worker_uid field to the request body, it is possible to use that particular worker to execute the job. This field is optional. Worker will be automatically selected otherwise.