Create a new Preset


POST /presets/

Authorization Header

  • Bearer token: OAuth 2.0 API access token.

Parameters

  • format : json or xml. This will override Request Accept header.
  • human : true or false. It causes the response to be in a structured, more human-readible form. This is useful when calling the API through curl or a browser.
  • show_null: true or false. If set to "true", the response will contain also keys that are not set to a value.
  • expand_all: true or false. Recursively look up referenced objects (here: codec id) and embed the respective json as a nested object directly into the response.

Example

POST /presets/
curl -X POST -H "Authorization: Bearer um9VmyJKTPGFqpkL_THjGE5rkXqfURDYqQ8MTBVidG3PtwkfABIdx6s_z9WlFl4_j" -H "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%" \
         }] \
     }, \
  } \
}' "https://api.xvid.com/v1/presets/?human=true&show_null=true"

Valid Fields:

  • name: Name of the new preset to be created. Should be unique to make it easily distinguishable. But uniqueness is not enforced.
  • description: Human-readable description of what the preset is meant for.
  • target_format:container: The container format to be used for the converted video. Can be any supported by both the selected audio and video codec.
  • target_format:extension (optional): File extension to give files converted with this preset. If not set, a default extension will be used as is common with the chosen container.
  • target_format:vcodec (optional): The vcodec object defines the video codec to use and associated codec settings. Is optional but at least one acodec or one vcodec must be present in the preset to be valid.
  • target_format:vcodec:codec_id: The ID of the video codec that's to be used with the preset. ID must exist.
  • target_format:vcodec:profile: Profile to use with the codec. The given profile must be within the list of supported profiles in the selected codec.
  • target_format:vcodec:passes: Enables either one-pass (passes=1) or two-pass (passes=2) mode.The value specified for passes must be within the allowed value range for passes in the selected codec.
  • target_format:vcodec:caps:interlaced: Toggles whether to enable or disable interlaced encoding mode. Can be enabled only when supported in the selected codec and chosen profile.
  • target_format:vcodec:caps:max_key_distance: Number of seconds as the desired maximum period in-between two keyframes (important for seeking, e.g.).
  • target_format:vcodec:caps:max_width: Desired maximum width of output files produced with this preset. Input videos larger than max_width will be fitted into the specified max_width depending on resize_policy. Value must be within allowed max value defined in the selected codec and chosen profile.
  • target_format:vcodec:caps:max_height: Desired maximum width of output files produced with this preset. Input videos larger than max_width will be fitted into the specified max_width depending on resize_policy. Value must be within allowed max value defined in the selected codec and chosen profile.
  • target_format:vcodec:caps:max_framerate: Desired maximum framerate that output files converted with this profile should have. If the input video has a higher framerate than this, the framerate will be reduced to fit the desird max framerate. The given value must be within allowed max value defined in the selected codec and chosen profile.
  • target_format:vcodec:caps:max_bitrate: Desired maximum bitrate (in kbps) that output files converted with this profile should have. If other settings (e.g. video "quality" setting) would cause a higher output bitrate than the given max value, the bitrate will be clipped to fit. The given value must be within allowed max value defined in the selected codec and chosen profile.
  • target_format:vcodec:caps:max_buffersize: Desired maximum buffersize (in Kilobytes) that output files converted with this profile will cause a player to buffer during playback (or prebuffer with data before playback can start). Typically, this is around 10x target bitrate. The given value must be within allowed max value defined in the selected codec and chosen codec profile.
  • target_format:acodec (optional): The vcodec object defines the video codec to use and associated codec settings. Is optional but at least one acodec or one vcodec must be present in the preset to be valid.
  • target_format:acodec:codec_id: The ID of the audio codec that's to be used with the preset. ID must exist.
  • target_format:acodec:profile: Profile to use with the codec. The given profile must be within the list of supported profiles in the selected codec.
  • target_format:acodec:passes: Enables either one-pass (passes=1) or two-pass (passes=2) mode.The value specified for passes must be within the allowed values for passes in the selected codec.
  • target_format:acodec:caps:max_bitdepth: Sets the maximum audio bitdepth desired that converted output videos shall have. Must be a value allowed for the chosen codec and profile.
  • target_format:acodec:caps:max_channels: Sets the maximum number of audio channels converted output videos with this Preset shall have. Input files with more channels will be clipped to given number of channels. The value specified must be within the allowed max value as defined in the chosen codec and applicable profile.
  • target_format:acodec:caps:max_samplingrate: Sets the maximum number desired for the audio samplingrate of converted output videos using this Preset. Input files with higher samplingrate will be rerated to fit. The value specified must be within the allowed max value as defined in the chosen codec and applicable profile.
  • target_format:acodec:caps:max_bitrate: Maximum desired audio bitrate converted output files using this Preset should have. If input and audio "quality" settings would cause a higher bitrate than this, the bitrate will be clipped to fit. The value specified must be within the allowed max value as defined in the chosen codec and applicable profile.
  • settings:subtitle_policy (optional): Used to control how to deal with subtitles if present in the input video. Possible choices: "ignore"|"copy"|"embed_first"|"auto". If set to "ignore", subtitles if present in the input video are dropped upon conversion (that's the currently implemented behavior). "copy" will try to copy the original subtitle meta-data over to the output file. "embed_first" does pick the first subtitle track/choice and render/draw it into the video itself during conversion. "auto" tries to copy the original subtitle metainformation if supported by the target output format. If not, it falls back to the "embed_first" strategy. Note: Only "ignore" is currently implemented.
  • settings:max_segment_size (optional): Enable segmenting of the output video into multiple files depending on chosen criteria. Segment size can be given in seconds ("s" suffix) or megabytes of filesize "(M" suffix), or set to "auto" to determine the right segmentation for the target format automatically (e.g. for formats like HLS or DASH that require segmentation). Default: "auto". Note: Currently, only "auto" is implemented.
  • settings:video:deinterlace (optional): Deinterlace mode to apply when converting. Can be "auto" (deinterlace when input is detected as interlaced), "off" (to never deinterlace) or "on" (to always deinterlace). Currently only "auto" behavior is implemented.
  • settings:video:crop (optional): Indicates how to crop the input video. Can be "off" for no cropping or "auto_crop" to automatically crop black bars from the input. Only "off" is implemented, currently.
  • settings:video:resize_policy (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. May be any out of 'fit | fill | stretch | keep | shrink_to_fit | shrink_to_fill'. Currently, the only implemented option is "keep", which will preserve the original input video resolution and aspect ratio if within max width/height or proportionally downscales to match the defined max_width or max_height (whatever is the value exceeded). Input videos smaller than max_width/max_height are not upscaled. 

  • settings:video:padding_policy (optional): Sets the padding policy, so how to fit the input video into the max_width and max_height dimensions after resize. The options are "pad" which adds black bars to whatever dimension / aspect ratio doesn't fit with max_width/max_height or "no_pad" to scale without adding black bars. Currently, only "no_pad" is implemented.
  • settings:video:aspect_ratio_policy (optional): Aspect ratio policy indicates whether the aspec_ratio flags in the file headers of the input video shall be preserved ("keep") and set also on the converted output video or whether the input shall be stretched according to aspect_ratio settings in the input and the output file then be flagged with square pixel ("1:1") aspect ratio ("stretch" option). Currently, only "keep" is implemented.
  • settings:audio:resample_policy (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. Currently, the only implemented option is shrink_to_fit, which will reduce the sampling rate of the input track so it fits into the max_samplingrate defined. If input samplingrate is lower than max_samplingrate, nothing is done.
  • settings:thumbnails[] (optional): Preset for thumbnail generation. If not specified, no thumbnails will be created upon conversions using the Preset. Up to three thumbnail presets can be specified.
  • settings:thumbnails:name: Defines an name string by which the thumbnail preset can be referenced from Job requests. This must be unique among thumbnail presets within the same Preset.
  • settings:thumbnails:format (optional): Format of the thumbnails. Can be "jpg" or "png". Default: "jpg".
  • settings:thumbnails:interval_or_count (optional): Interval in seconds at which a new thumbnail will be taken from the video. Default: 20s. 
  • settings:thumbnails:max_width (optional): Analogous to vcodec:max_width.
  • settings:thumbnails:max_height (optional): Analogous to vcodec:max_height.
  • settings:thumbnails:resize_policy (optional): Analogous to settings:video:resize_policy
  • settings:thumbnails:padding_policy (optional): Analogous to settings:video:padding_policy
  • settings:logos[] (optional): Presets for logo overlays. If not specified, no logo can be placed onto the output video upon conversions using this Preset.
  • settings:logos:name: The name of the logo preset. This is the name that must be referred to as the "logo_preset" option when creating a job.
  • settings:logos:format (optional): The image format that's assumed for the logo_image specified in the job using the logo preset. Currently, only "png" is supported as the logo image format.
  • settings:logos:max_width (optional): The maximum width of the logo (in terms of the resolution of the output video on which the logo is being placed). Values can be either absolute (e.g. "200px" for 200 pixels), or relative (e.g. "15%" for 15% of the output video width).
  • settings:logos:max_height (optional): The maximum height of the logo (in terms of the resolution of the output video on which the logo is being placed). Values can be either absolute (e.g. "200px" for 200 pixels), or relative (e.g. "15%" for 15% of the output video height). 
  • settings:logos:resize_policy (optional): Resize policy to apply when fitting the original logo image onto the overlay area specified by max_width and max_height. Currently, only "keep" policy is implemented which preserves the original aspect ratio of the logo image.
  • settings:logos:x_pos (optional): Specifies the positioning of the logo along the x-axis (in terms of the resolution of the output video on which the logo is being placed). Values can be given either absolute (e.g. "600px" for 600 pixels), or relative (e.g "80%" for placement on the right at 80% of the output video's width).
  • settings:logos:y_pos (optional) : Specifies the positioning of the logo along the y-axis (in terms of the resolution of the output video on which the logo is being placed). Values can be given either absolute (e.g. "400px" for 400 pixels), or relative (e.g "5%" for placement near the top at 5% of the output video's height).
  • No labels