Docs · Resize a video
Guides · Resize a video

Resize a video

Scale the picture with -vf scale. With -2 for one side, FFmpeg keeps the proportions and an even number of pixels, which H.264 needs.

The request

Request
curl https://media.logicboostkit.com/ffmpeg/process \
  -H "Authorization: Basic $MEDIA_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "task": {
      "inputs": [
        {
          "file_path": "dir_pi23jgy1yxlmigi873bz/source.mp4"
        }
      ],
      "outputs": [
        {
          "file": "video-720p.mp4",
          "options": [
            "-vf",
            "scale=-2:720",
            "-c:v",
            "libx264",
            "-crf",
            "23",
            "-c:a",
            "copy"
          ]
        }
      ]
    }
  }'
Response
HTTP/1.1 200 OK
X-Request-Id: job_0mv6hqvpqkiwproi518azpod

{
  "ok": true,
  "result": [
    {
      "file_name": "video-720p.mp4",
      "size_bytes": 536870912,
      "download_url": "https://…"
    }
  ],
  "usage": {
    "time_sec": 51,
    "input_size_gb": 1.5,
    "output_size_gb": 0.5,
    "gb_sec": 102
  },
  "request_id": "job_0mv6hqvpqkiwproi518azpod",
  "amount_usd": 1.35864
}

The input is a file you uploaded (POST /file). The full reference is POST /ffmpeg/process.

The options, explained

What each option does
scale=-2:720720 pixels high; the width follows the proportions and stays even.
-c:v libx264 -crf 23Encode the scaled picture as H.264.
-c:a copyThe audio is copied as it is.

Variations

Fit a fixed frame

Scale to fit 1280×720 and pad the rest with black bars.

In the output: "options": ["-vf", "scale=1280:720:force_original_aspect_ratio=decrease,pad=1280:720:(ow-iw)/2:(oh-ih)/2", "-c:v", "libx264", "-crf", "23", "-c:a", "copy"]

Several sizes at once

Give one output per size in the same task. The input is read once; the outputs are billed together.

What it costs

A 1.5 GB 1080p video scaled to 720p: (1.5 GB + 0.5 GB) × 51 s = 102.000 GB-seconds, which is USD 1.3586 at USD 0.01332 per GB-second.

The seconds are an example; every response reports the job’s own. Failed jobs are not charged. See Pricing.