ws-apifix: MP4 AAC length matches ffmpeg: the edit list's length (Track.playDuration) cuts the end padding as well as the priming (codecDelay); a 1 s clip decodes to 44100 frames, not 45056. AudioWrap.trim(dec, skip, length?); the MP4 writer keeps the edit length of copied audio. Video tests compare the whole decoded audio length with ffmpeg (not yet for Matroska)

This commit is contained in:
4DBug committed 2026-10-31 14:13:08 -05:00
1 parent ac47545aa3
commit 6274eedd12
7 files changed
+66 -9

No files matched your search

+10
View File
@@ -62,6 +62,16 @@ for _, job in { { "mjpeg_aac.mp4", "mp4" }, { "mjpeg_pcm.mov", "mov" }, { "h264_
end
end
t:check(same, "write " .. job[1] .. ": same packets and times")
-- copied AAC keeps its edit list: priming and end padding cut as in the source (ffmpeg's length)
local at = a:track("audio")
if at and at.codec == "aac" then
local bt = b:track("audio")
t:check(bt and bt.playDuration and math.abs(bt.playDuration - at.playDuration) < 1e-3 and math.abs((bt.codecDelay or 0) - (at.codecDelay or 0)) < 1e-6, "write " .. job[1] .. ": edit list kept")
if v2.audio and src.pcmBytes then
local all = assert(F.ops.audio.toAudio(v2.audio))
t:eq(all.frames * all.channels * 4, src.pcmBytes, "write " .. job[1] .. ": AAC length = ffmpeg's decode of the source")
end
end
end
end
end