This page was machine-translated. Spotted a mistake?Help improve it.
Skip to content

Resize Video

使用自定义像素尺寸或标准预设将视频缩放到新的分辨率。

API Endpoint

POST /api/v1/tools/video/resize-video

接受包含视频文件和 JSON settings 字段的 multipart 表单数据。

Parameters

ParameterTypeRequiredDefaultDescription
widthintegerNo-目标宽度,单位为像素(16-7680)
heightintegerNo-目标高度,单位为像素(16-4320)
presetstringNo"custom"分辨率预设:custom2160p1440p1080p720p480p360p

preset"custom" 时,必须至少提供 widthheight 之一。另一个维度会按比例缩放。

Example Request

bash
curl -X POST http://localhost:1349/api/v1/tools/video/resize-video \
  -H "Authorization: Bearer si_your-api-key" \
  -F "[email protected]" \
  -F 'settings={"preset": "720p"}'

缩放到自定义尺寸:

bash
curl -X POST http://localhost:1349/api/v1/tools/video/resize-video \
  -H "Authorization: Bearer si_your-api-key" \
  -F "[email protected]" \
  -F 'settings={"width": 1280, "height": 720}'

Example Response

json
{
  "jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/clip.mp4",
  "originalSize": 25000000,
  "processedSize": 8500000
}

Notes

  • 预设值映射到标准高度(例如 720p = 1280x720,1080p = 1920x1080)。宽度会根据源宽高比按比例缩放。
  • 根据大多数视频编解码器的要求,尺寸会被舍入为偶数。
  • 支持的最大分辨率为 7680x4320(8K UHD)。