Simple Format Specification
The Simple Format Specification defines the output format for media content in the Coconut Transcoding Service. This guide provides details on the structure, including video and audio specifications, and format options.
Format Naming Convention
Video formats are represented as:
$video_container:$video_specs:$audio_specs:$format_optionsOf these, only `$video_container` is required. Appropriate defaults (codecs, bitrates, sample rates) are set based on the chosen container.
Specs must be separated by semi-colon `:` and options must be separated by underscore `_`. Refer to the examples provided for a clearer understanding of how to use the different format options.
For Audio-only formats:
$audio_container:$audio_specsFor image formats, you can only set the resolution:
$image_container:$resolutionContainers
| List of supported containers (video, audio and image) |
|---|
mp4 webm mpegts mov ogg aac mp3 wav jpg png webp gif webp_anim |
Video Specifications
$resolution_$bitrate_$codec_$fps| Video specs | Values | Default |
|---|---|---|
| Resolution | 144p 240p 360p 480p 540p 576p 720p 1080p 1440p 2160p 4k<br>Any resolution WxH | Original |
| Codec | copy dnxhd h264 hevc novideo prores prores-ks vp8 vp9 (container compatibility applies; see Certified Transcoding Profiles) | Container standard |
| Bitrate (kbps) | Any value < 200000k<br>1500k 2000k 4000k ... | |
| FPS | 0fps (preserve source FPS), 15fps 23.98fps 25fps 29.97fps 30fps 60fps | Original |
Audio Specifications
$codec_$bitrate_$sample_rate_$channels| Audio specs | Values | Default |
|---|---|---|
| Codec | aac ac3 copy mp2 mp3 noaudio pcm pcm-alaw pcm-s16le pcm-u8 vorbis (container compatibility applies) | Container standard |
| Bitrate (kbps) | Any value < 512k<br>64k 128k 256k ... | |
| Sample rate | 8000hz 11025hz 22050hz 44100hz 48000hz | Original |
| Channels | mono stereo multi | Original |
Format options
$options| Options | Values | Default |
|---|---|---|
| pix_fmt | yuv420p yuv422p yuv420p10le yuv444p10le (codec/profile compatibility applies) | Encoder default |
| 2pass | Enable two-pass H264/HEVC encoding; requires an explicit video bitrate and cannot be combined with quality/CRF | No |
| metadata | Strip original metadata if metadata=0 | 1 |
MP4 options
| Options | Values | Default |
|---|---|---|
| frag | Generate a fragmented MP4 file if this option is used. | No |
H264 options
| Options | 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 | Set visual quality from 1 (worst) to 5 (best). | |
| maxrate (kbps) | Cap bitrate when using quality.<br>mp4:1080p::quality=4,maxrate=2500k |
high10 requires yuv420p10le, high422 requires yuv422p, and high444 requires yuv444p10le.
HEVC options
HEVC supports quality, maxrate, 2pass, yuv420p, and certified 10-bit yuv420p10le. vprofile and level are not part of the certified HEVC contract.
VP8 and VP9 options
| Options | Values | Default |
|---|---|---|
| quality | Set a visual quality instead of bitrate From 1 (worst) to 5 (visually lossless)<br>quality=4 is a pretty good quality / file size ratio. | |
| maxrate (kbps) | When using quality, you can cap the bitrate to not go higher your requirements.<br>webm:vp9_1080p::quality=4,maxrate=2500k |
Full examples
| Format | Description |
|---|---|
| mp4:1080p | MP4 with H264 / AAC codecs. 1080p resolution and 4000k bitrate |
| mp4:1080p::quality=4 | Use quality option instead of video bitrate |
| mp4:1080p::quality=4,maxrate=3000k | Use quality option and cap the bitrate to 3000k |
| mp4:hevc_2160p | MP4 with HEVC / AAC codecs. 4k resolution and 8000k bitrate |
| mp4:1080p_4000k::2pass | Enable 2pass encoding |
| mp4:320x240_1000k | Specify the full resolution and the video bitrate |
| mp4:1080p:noaudio | Remove the audio track |
| mp4:1080p:copy | Copy the audio track without transcoding |
| mp4:::quality=3 | Keep the original resolution and use the quality option |
| mp4:360p_25fps | Changes the original frame rate to 25fps |
| mp4:copy:copy | Copy the video and audio track without transcoding |
| mp4:1080p::frag,quality=4 | Create a fragmented MP4 file with 1080p resolution and quality option |
| mp4:::quality=3,vprofile=high,level=50 | Specify the video profile high and level 50 for H264 encoding |
| webm:720p | WebM with VP9 / Vorbis defaults |
| webm:vp9_1080p | WebM with VP9 / vorbis codecs. 1080p resolution and 4000k bitrate |
| webm:720p:48000hz | Specify the sample rate 48000hz |
| mp4:720p:multi | Keep the audio channels 5.1 instead of changing it to stereo |
| mp3 | MP3 audio-only format with 128k bitrate |
| aac:64k | AAC audio-only format with 64k bitrate |
| webp:400x | WebP image-only format with 400x resolution. Height is calculated automatically |
| jpg:640x360 | JPG image-only format with full resolution given 640x360 |