Appearance
POST /presets
Description
Create a new preset.
Authentication
- Required: Yes
- Method: Bearer token
Request Headers
- Authorization:
Bearer [AUTH_TOKEN] - Content-Type:
application/json
Parameters
Query Parameters
- format:
string(Optional)
Values:json,xml
Overrides the Request Accept header. - human:
boolean(Optional)
Values:true,false
If set to 'true', the response will be in a structured, more human-readable form. - show_null:
boolean(Optional)
Values:true,false
If set to "true", the response will contain also keys that are not set to a value. - expand_all:
boolean(Optional)
Values:true,false
Recursively look up referenced objects and embed the respective JSON as nested objects directly into the response.
Body Parameters
- preset:
object(Required)- name:
string(Required)
Name of the new preset to be created. Should be unique to make it easily distinguishable. - description:
string(Required)
Human-readable description of what the preset is meant for. - target_format:
object(Required)- extension:
string(Optional)
File extension to give files converted with this preset. - container:
string(Required)
The container format to be used for the converted video. - vcodec:
object(Optional)
The video codec to use and associated codec settings.- codec:
object(Required)- id:
string(Required)
The ID of the video codec that's to be used with the preset.
- id:
- profile:
string(Required)
Profile to use with the codec. - passes:
int(Required)
Enables either one-pass or two-pass mode. - caps:
object(Required)- interlaced:
boolean(Required)
Toggles whether to enable or disable interlaced encoding mode. - max_key_distance:
int(Required)
Number of seconds as the desired maximum period in-between two keyframes. - max_width:
int(Required)
Desired maximum width of output files produced with this preset. - max_height:
int(Required)
Desired maximum height of output files produced with this preset. - max_framerate:
int(Required)
Desired maximum framerate that output files converted with this profile should have. - max_bitrate:
int(Required)
Desired maximum bitrate (in kbps) that output files converted with this profile should have. - max_ref_frames:
int(Required)
Desired maximum number of reference frames that output files converted with this profile should have. - max_buffersize:
int(Required)
Desired maximum buffersize (in Kilobytes) that output files converted with this profile will cause a player to buffer during playback.
- interlaced:
- codec:
- acodec:
object(Optional)
The audio codec to use and associated codec settings.- codec:
object(Required)- id:
string(Required)
The ID of the audio codec that's to be used with the preset.
- id:
- profile:
string(Required)
Profile to use with the codec. - passes:
int(Required)
Enables either one-pass or two-pass mode. - caps:
object(Required)- max_bitdepth:
int(Required)
Sets the maximum audio bitdepth desired that converted output videos shall have. - max_channels:
int(Required)
Sets the maximum number of audio channels converted output videos with this Preset shall have. - max_samplingrate:
int(Required)
Sets the maximum number desired for the audio samplingrate of converted output videos using this Preset. - max_bitrate:
int(Required)
Maximum desired audio bitrate converted output files using this Preset should have.
- max_bitdepth:
- codec:
- extension:
- settings:
object(Optional)- subtitle_policy:
string(Optional)
Used to control how to deal with subtitles if present in the input video.
Values:ignore,copy,embed_first,auto(currently, onlyignoreis implemented) - max_segment_size:
string(Optional)
Sets the maximum segment size, i.e. the criteria used to segment the output file (e.g. for HTTP streaming). A number followed by "s" specifies the maximum segment duration in seconds, a number followed by "(M" specifies the maximum segment size in megabytes, andautoselects a sensible value automatically.
Values: e.g."10s","10(M",auto(default:auto; currently, onlyautois implemented) - video:
object(Optional)- deinterlace:
string(Optional)
Deinterlace mode to apply when converting.
Values:auto,off,on(currently, onlyautois implemented) - crop:
string(Optional)
Indicates how to crop the input video.
Values:off,auto_crop(currently, onlyoffis implemented) - resize_policy:
string(Optional)
Sets the resize policy, meaning the method to apply in order to fit input videos into the max_width/max_height set as part of vcodec:caps.
Values:fit,fill,stretch,keep,shrink_to_fit,shrink_to_fill(currently, onlykeepis implemented; the video is never upscaled) - padding_policy:
string(Optional)
Sets the padding policy, so how to fit the input video into the max_width and max_height dimensions after resize.
Values:pad,no_pad(currently, onlyno_padis implemented) - aspect_ratio_policy:
string(Optional)
Aspect ratio policy indicates whether the aspect ratio flags in the file headers of the input video shall be preserved.
Values:keep,stretch(currently, onlykeepis implemented)
- deinterlace:
- audio:
object(Optional)- resample_policy:
string(Optional)
Sets the resample policy, meaning the method to apply in order to fit the input audio tracks into the max_samplingrate set as part of acodec:caps.
Values:shrink_to_fit(onlyshrink_to_fitis currently supported)
- resample_policy:
- thumbnails:
array(Optional)
Presets for thumbnail generation. A preset can contain up to 3 thumbnail presets.- name:
string(Required)
Defines a name string by which the thumbnail preset can be referenced from Job requests. - format:
string(Optional)
Format of the thumbnails. Default:jpg. - interval_or_count:
string(Optional)
Interval in seconds at which a new thumbnail will be taken from the video. Default:"20s". - max_width:
int(Optional)
Analogous to vcodec:max_width. - max_height:
int(Optional)
Analogous to vcodec:max_height. - resize_policy:
string(Optional)
Analogous to settings:video:resize_policy. - padding_policy:
string(Optional)
Analogous to settings:video:padding_policy.
- name:
- logos:
array(Optional)
Presets for logo overlays.- name:
string(Required)
The name of the logo preset. - format:
string(Optional)
The image format that's assumed for the logo_image specified in the job using the logo preset. Currently, onlypngis supported. - max_width:
string(Optional)
The maximum width of the logo (in terms of the resolution of the output video on which the logo is being placed). Can be absolute (e.g."200px") or relative to the output video resolution (e.g."15%"). - max_height:
string(Optional)
The maximum height of the logo (in terms of the resolution of the output video on which the logo is being placed). Can be absolute (e.g."200px") or relative to the output video resolution (e.g."15%"). - resize_policy:
string(Optional)
Resize policy to apply when fitting the original logo image onto the overlay area specified by max_width and max_height. - x_pos:
string(Optional)
Specifies the positioning of the logo along the x-axis. Can be absolute (e.g."200px") or relative (e.g."80%"). - y_pos:
string(Optional)
Specifies the positioning of the logo along the y-axis. Can be absolute (e.g."200px") or relative (e.g."15%").
- name:
- subtitle_policy:
- name:
Example Request
bash
curl -X POST "https://api.xvid.com/v1/presets/?human=true" \
-H "Authorization: Bearer AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"preset": {
"name": "PERSONAL-FLV-FLV-H264-AAC",
"description": "My own Flash Video Preset with H.264 Baseline/AAC LC for Flash Player SD",
"target_format": {
"extension": "flv",
"container": "flv",
"vcodec": {
"codec": { "id": "525ce63284aed52635e85d05" },
"profile": "Baseline",
"passes": 1,
"caps": {
"interlaced": "false",
"max_key_distance": 5,
"max_width": 640,
"max_height": 480,
"max_framerate": 30,
"max_bitrate": 4000,
"max_ref_frames": 1,
"max_buffersize": 384
}
},
"acodec": {
"codec": { "id": "525ce63284aed52635e85d06" },
"profile": "LC",
"passes": 1,
"caps": {
"max_bitdepth": 16,
"max_channels": 2,
"max_samplingrate": 48000,
"max_bitrate": 160
}
}
},
"settings": {
"subtitle_policy": "ignore",
"video": {
"deinterlace": "auto",
"crop": "off",
"resize_policy": "keep",
"padding_policy": "no_pad",
"aspect_ratio_policy": "keep"
},
"audio": {
"resample_policy": "shrink_to_fit"
},
"thumbnails": [
{
"name": "thumbnails_small",
"format": "jpg",
"interval_or_count": "10s",
"max_width": 85,
"max_height": 64,
"resize_policy": "keep",
"padding_policy": "no_pad"
},
{
"name": "thumbnails_big",
"format": "jpg",
"interval_or_count": "30",
"max_width": 320,
"max_height": 240,
"resize_policy": "shrink_to_fit",
"padding_policy": "no_pad"
}
],
"logos": [
{
"name": "Logo15",
"format": "png",
"max_width": "15%",
"max_height": "15%",
"resize_policy": "keep",
"x_pos": "80%",
"y_pos": "5%"
}
]
}
}
}'Example Response
Success (201 Created)
json
{
"preset": {
"id": "preset_id",
"name": "PERSONAL-FLV-FLV-H264-AAC",
"description": "My own Flash Video Preset with H.264 Baseline/AAC LC for Flash Player SD",
...
}
}Error Responses
400 Bad Request
json
{
"error": {
"error_code": "0x0180001",
"error_message": "Invalid input"
}
}403 Unauthorized
json
{
"error": {
"error_code": "0x0000003",
"error_message": "Invalid access token"
}
}500 Internal Server Error
json
{
"error": {
"error_code": "0x0000001",
"error_message": "Internal server error"
}
}Notes
- The
codec.idvalues must reference existing codecs from the Codecs resource, and the specifiedprofilemust be one of the profiles supported by the chosen codec.passesmust be within the allowed range of the codec. - The
capssettings must match the type of the chosen codec (e.g. audio codec capabilities on a video codec will be rejected with an "invalid input" error), and all properties must be within the capabilities of the chosen codec as well as within the globally allowed ranges (see the codec'sprofiles[].capabilities). - The chosen
containermust be supported by both selected codecs (i.e. it must be part of the intersection of both codecs' supported container lists). Ifextensionis not set, it defaults to the chosen container's default extension. - A preset can reference a maximum of two codecs (one video + one audio codec), never two of the same type. Input tracks not covered by any of the preset's codecs are discarded during conversion.
- A good value for
max_buffersizeis typically around 10x the targetmax_bitrate. - Preset name uniqueness is not enforced — however, unique names make presets easily distinguishable.