ws-apifix: videos save as animated images (F.save(video, gif | apng | webp), F.convert(avi, "gif"): frames / fps / maxFrames (300) / maxPixels (2^25)); VideoFrame.index restarts at the seek position; F.detect names WebM files "webm"

api: encoderFor finds image formats for a VideoDecoder, videoToImage() collects the frames; F.detect asks a
format's optional variant(r) for a more precise name (video/mkv: Mkv.variant, from Parse.docType).
codecs/video/Video: index after seek = round(pts * frameRate) + 1.
This commit is contained in:
4DBug committed 2026-10-31 14:00:36 -05:00
1 parent 10bd6b021f
commit d73b93c740
8 files changed
+207 -6

No files matched your search

+10
View File
@@ -88,6 +88,16 @@ do
t:eq(len, 160, "lacing: EBML-laced frame size")
end
-- F.detect names WebM files (DocType webm) "webm", Matroska files "mkv"; both open through the mkv format
do
t:eq(F.detect(byName["vp8_opus.webm"].data), "webm", "detect: webm")
t:eq(F.detect(byName["mjpeg_pcm.mkv"].data), "mkv", "detect: mkv")
t:eq(Mkv.variant(Bytes.reader(buffer.fromstring(byName["vp8_opus.webm"].data))), "webm", "variant: webm")
t:eq(Mkv.variant(Bytes.reader(buffer.fromstring(byName["mjpeg_pcm.mkv"].data))), nil, "variant: matroska")
t:eq(Mkv.variant(Bytes.reader(buffer.fromstring("\26\69\223\163"))), nil, "variant: truncated")
t:eq(F.format("webm").name, "mkv", "format(webm) is mkv")
end
-- 4. our muxer: remux WebM (VP8 + Opus copied) and read it back packet for packet
do
local src = byName["vp8_opus.webm"]