Appearance
POST /presets
Description
Create a new preset.
Authentication
- Required: Yes
- Method: Bearer token
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.
Request Body
- 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. - video:
object(Optional)- deinterlace:
string(Optional)
Deinterlace mode to apply when converting. - crop:
string(Optional)
Indicates how to crop the input video. - 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. - 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. - 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.
- 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.
- resample_policy:
- thumbnails:
array(Optional)
Preset for thumbnail generation.- 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. - interval_or_count:
string(Optional)
Interval in seconds at which a new thumbnail will be taken from the video. - 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. - 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). - 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). - 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. - y_pos:
string(Optional)
Specifies the positioning of the logo along the y-axis.
- name:
- subtitle_policy:
- name:
Example Request
bash
curl -X POST "https://api.xvid.com/v1/presets/?human=true&show_null=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%"
}]
},
}
}'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": "Invalid request parameters"
}401 Unauthorized
json
{
"error": "Authentication required"
}500 Internal Server Error
json
{
"error": "Internal server error"
}Notes
- Ensure all required fields are provided.
- Additional validation rules and potential error messages need to be documented.