feat(webp): add WebP streaming and snapshot APIs

- implement WebP streaming with multipart support
- add snapshot endpoint for WebP format with quality options
- introduce WebP encoding using pure Go library without FFmpeg
- update documentation and links for new WebP features
This commit is contained in:
Sergey Krashevich
2026-03-10 21:37:29 +03:00
parent beb96dd076
commit ea03aa832d
14 changed files with 641 additions and 1 deletions
+61
View File
@@ -567,6 +567,18 @@ paths:
description: ""
content: { multipart/x-mixed-replace: { example: "" } }
/api/stream.webp?src={src}:
get:
summary: Get stream in Motion-WebP format (multipart)
description: "Multipart stream of WebP frames. Pure Go encoding via [go-webp](https://github.com/skrashevich/go-webp)."
tags: [ Consume stream ]
parameters:
- $ref: "#/components/parameters/stream_src_path"
responses:
200:
description: ""
content: { multipart/x-mixed-replace: { example: "" } }
/api/stream.ascii?src={src}:
get:
summary: Get stream in ASCII-art format (ANSI escape codes)
@@ -691,6 +703,55 @@ paths:
content:
image/jpeg: { example: "" }
/api/frame.webp?src={src}:
get:
summary: Get snapshot in WebP format
description: "Pure Go WebP encoding via [go-webp](https://github.com/skrashevich/go-webp). No FFmpeg or CGO required for the WebP conversion itself."
tags: [ Snapshot ]
parameters:
- $ref: "#/components/parameters/stream_src_path"
- name: name
in: query
description: Optional stream name to create/update if `src` is a URL
required: false
schema: { type: string }
- name: quality
in: query
description: "WebP quality (1-100, default: 75)"
required: false
schema: { type: integer, minimum: 1, maximum: 100, default: 75 }
- name: width
in: query
description: "Scale output width (alias: `w`). Requires FFmpeg for H264/H265 sources."
required: false
schema: { type: integer, minimum: 1 }
- name: height
in: query
description: "Scale output height (alias: `h`). Requires FFmpeg for H264/H265 sources."
required: false
schema: { type: integer, minimum: 1 }
- name: rotate
in: query
description: "Rotate output (degrees). Requires FFmpeg for H264/H265 sources."
required: false
schema: { type: integer, enum: [ 90, 180, 270 ] }
- name: hardware
in: query
description: "Hardware acceleration engine for FFmpeg snapshot transcoding (alias: `hw`)"
required: false
schema: { type: string }
- name: cache
in: query
description: "Cache duration (e.g. `5s`, `1m`). Serves cached frame if within timeout."
required: false
schema: { type: string }
example: "5s"
responses:
"200":
description: ""
content:
image/webp: { example: "" }
/api/frame.mp4?src={src}:
get:
summary: Get snapshot in MP4 format