Files
SnapOtter/apps/docs/zh-CN/tools/video/video-to-frames.md
T
SnapOtterandGitHub 4963ab3bbd feat(docs-i18n): translate all documentation into 20 languages
All 181 docs markdown files translated into 20 languages (apps/docs/<locale>/**). Companion to the i18n code PR; admin-merged because the file count exceeds GitHub's per-PR CI trigger limit. Validated by pnpm i18n:check (all surfaces, 0 stale/missing) and a clean all-locale docs build.
2026-07-11 13:52:47 +08:00

2.1 KiB

description, i18n_source_hash, i18n_provenance, i18n_output_hash
description i18n_source_hash i18n_provenance i18n_output_hash
将视频中的帧提取为图像 ZIP 包。 b06f038dafb3 human 940e8089bda5

Video to Frames

从视频中提取单独的帧,并将其下载为包含 PNG 或 JPG 图像的 ZIP 归档。

API Endpoint

POST /api/v1/tools/video/video-to-frames

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

Parameters

Parameter Type Required Default Description
mode string No "all" 提取模式:allnthtimestamps
n integer No 10 每隔第 N 帧提取一次(2-1000)。仅当 mode 为 "nth" 时使用
timestamps string No "" 以逗号分隔的时间戳,单位为秒。当 mode 为 "timestamps" 时必填
format string No "png" 提取帧的图像格式:pngjpg

Example Request

每隔第 30 帧提取一次,格式为 JPG:

curl -X POST http://localhost:1349/api/v1/tools/video/video-to-frames \
  -H "Authorization: Bearer si_your-api-key" \
  -F "file=@clip.mp4" \
  -F 'settings={"mode": "nth", "n": 30, "format": "jpg"}'

在特定时间戳处提取帧:

curl -X POST http://localhost:1349/api/v1/tools/video/video-to-frames \
  -H "Authorization: Bearer si_your-api-key" \
  -F "file=@clip.mp4" \
  -F 'settings={"mode": "timestamps", "timestamps": "1.5,5,12.3"}'

Example Response

{
  "jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/clip-frames.zip",
  "originalSize": 12500000,
  "processedSize": 45000000
}

Notes

  • all 模式会提取每一帧,对于长视频可能生成非常大的 ZIP 文件。请使用 nthtimestamps 模式进行选择性提取。
  • PNG 保留完整质量,但生成的文件较大。JPG 更小,但为有损格式。
  • 响应会下载为包含按顺序编号的图像文件的 ZIP 归档。