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:
1 parent
10bd6b021f
commit
d73b93c740
8 files changed
+207
-6
No files matched your search
@@ -180,6 +180,12 @@ function C.seek(t: any, v: any, c: any, label: string, at: number)
|
||||
v:seek(at)
|
||||
local f = v:nextFrame()
|
||||
t:check(f ~= nil and f.pts >= at - 1e-6 and f.pts < at + 0.2, label .. ": seek to " .. at .. " lands at " .. tostring(f and f.pts))
|
||||
if f and v.frameRate > 0 then
|
||||
-- frame.index restarts at the seek position (not counted on from before the seek)
|
||||
t:eq(f.index, math.floor(f.pts * v.frameRate + 0.5) + 1, label .. ": frame index after seeking")
|
||||
local g = v:nextFrame()
|
||||
t:check(g == nil or g.index == f.index + 1, label .. ": index counts on after the seek")
|
||||
end
|
||||
if f and C.EXACT[v.codec] and c.frames then
|
||||
local idx = math.floor(f.pts * v.frameRate + 0.5) + 1
|
||||
t:eq(Crc32.of(f.image.pixels), c.frames[idx], label .. ": the frame after seeking equals ffmpeg's frame " .. idx)
|
||||
|
||||
Reference in new issue
Block a user