# 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"})