ws-video2-flv: FLV writer test from ADTS AAC (MPEG-TS), bench lines (H.263 / Sorenson CIF fps), docs/guide/video.md FLV and H.263 section (inputs: tools/fixtures/docs_flv.py)

This commit is contained in:
4DBug committed 2026-10-31 15:13:14 -05:00
1 parent efc0812746
commit f23d0aa3e8
5 files changed
+105 -3

No files matched your search

+2 -1
View File
@@ -30,10 +30,11 @@ local JOBS = {
{ "mp4_h264_aac.flv", "mp4", Src.mp4 },
{ "mkv_h264_mp3.flv", "mkv", Src.mkv },
{ "ts_h264_aac.flv", "ts", Src.ts },
{ "ts_aac.flv", "ts", Src.ts, { video = false } }, -- ADTS AAC re-framed
}
for _, j in JOBS do
local name, source, data = j[1], j[2], j[3]
local out, err = F.convert(buffer.fromstring(data), "flv")
local out, err = F.convert(buffer.fromstring(data), "flv", j[4])
if out then
print(name .. " " .. source .. " " .. hex(out))
else
+29
View File
@@ -0,0 +1,29 @@
# Docs inputs for the FLV / H.263 sections of docs/guide/video.md (tools/fixtures.py; tools/docs_check.py reads them):
# tiny ffmpeg clips (testsrc 64x48, 10 frames at 10 fps, with a sine track): FLV with Sorenson Spark + MP3, a 3GP with
# H.263 (QCIF, the H.263 size closest to the clip) and AAC.
# tests/gen/docs_flv.luau { files = { [name] = bytes }, vars = { flvBytes = "clip.flv", h263Bytes = "clip.3gp" } }
import importlib.util, os, shutil, subprocess, tempfile
INPUTS = ["tools/docs_check.py"]
def generate(ctx):
spec = importlib.util.spec_from_file_location("docs_flv_check", os.path.join(ctx.root, "tools", "docs_check.py"))
dc = importlib.util.module_from_spec(spec)
spec.loader.exec_module(dc)
files = {}
with tempfile.TemporaryDirectory() as d:
for name, size, codec in (
("clip.flv", "64x48", ["-c:v", "flv", "-g", "5", "-c:a", "libmp3lame", "-b:a", "64k"]),
("clip.3gp", "176x144", ["-c:v", "h263", "-g", "5", "-c:a", "aac", "-b:a", "32k", "-ar", "22050"]),
):
src = ["-f", "lavfi", "-i", "testsrc=size=%s:rate=10:duration=1" % size,
"-f", "lavfi", "-i", "sine=frequency=440:sample_rate=44100:duration=1"]
out = os.path.join(d, name)
argv = ["-v", "error", "-y"] + src + codec + ["-shortest", out]
if shutil.which("ffmpeg"):
subprocess.run(["ffmpeg"] + argv, check=True, capture_output=True)
else:
ctx.nix("ffmpeg", ["ffmpeg"] + argv)
files[name] = open(out, "rb").read()
dc.emit_inputs(ctx, files, {"flvBytes": "clip.flv", "h263Bytes": "clip.3gp"})