Skip to content

DocsGuides

Sizes and renditions

Resize a video, or write several sizes in one job with presets, keeping the shape.

Name the sizes you want and get one file per size, each from one read of the input. A preset such as web-1080p or web-720p sets the size, codec and quality; your own fields change any of them (Presets). These presets never enlarge: an input smaller than the size keeps its own.

Several sizes in one job#

bash
curl "$VIDEXO_API_URL/v1/jobs" \
  -H "Authorization: Bearer $VIDEXO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "inputs": {
    "talk": "https://example.com/talk.mp4"
  },
  "outputs": [
    {
      "name": "hd",
      "preset": "web-1080p",
      "filename": "talk-1080p.mp4"
    },
    {
      "name": "sd",
      "preset": "web-720p",
      "filename": "talk-720p.mp4"
    }
  ]
}'

talk-1080p.mp4 and talk-720p.mp4: H.264 MP4s within 1920 by 1080 and 1280 by 720, never enlarged, from one read of the input.

One job with several outputs fetches the input once and is billed once for its bytes, so it costs less than one job per size.

One size#

Set width or height alone to keep the shape; the other side follows and stays even, as H.264 needs.

bash
curl "$VIDEXO_API_URL/v1/transcode" \
  -H "Authorization: Bearer $VIDEXO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "input": "https://example.com/talk.mp4",
  "filename": "talk-480p.mp4",
  "resize": {
    "height": 480
  }
}'

A box: contain, cover or pad#

With both width and height, fit decides what happens when the shapes differ: contain (the default) fits the whole picture inside the box, cover fills the box and crops the overflow at anchor, pad fits the picture and fills the rest with pad_color.

bash
curl "$VIDEXO_API_URL/v1/transcode" \
  -H "Authorization: Bearer $VIDEXO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "input": "https://example.com/talk.mp4",
  "filename": "talk-card.mp4",
  "resize": {
    "width": 1200,
    "height": 628,
    "fit": "cover",
    "anchor": "top"
  }
}'

Never larger than the input#

resize enlarges a smaller input to the size you set, unless enlarge is false: then an input larger than the size is scaled down and a smaller one keeps its own size.

bash
curl "$VIDEXO_API_URL/v1/transcode" \
  -H "Authorization: Bearer $VIDEXO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "input": "https://example.com/talk.mp4",
  "filename": "talk-max-1080p.mp4",
  "resize": {
    "width": 1920,
    "height": 1080,
    "enlarge": false
  }
}'

Operations has every resize field.