-- tools/fixtures/_flv_encode: run by tools/fixtures/flv.py (luau, from the repo root) so ffprobe / ffmpeg can check our -- FLV writer: remuxes FLV fixtures (tests/gen/flv_cases) and the MP4 / Matroska / MPEG-TS sources (tests/gen/flv_src) -- and prints " " lines (or " ERR "). local F = require("@rosetta") local Cases = require("@tests/gen/flv_cases") local Src = require("@tests/gen/flv_src") local function hex(b: buffer): string local t = table.create(buffer.len(b)) for i = 0, buffer.len(b) - 1 do t[i + 1] = string.format("%02x", buffer.readu8(b, i)) end return table.concat(t) end local function find(name: string): string for _, c in Cases do if c.name == name then return c.data end end error("no fixture " .. name) end local JOBS = { { "remux_h264_aac.flv", "h264_aac.flv", find("h264_aac.flv") }, { "remux_sorenson_mp3.flv", "sorenson_mp3.flv", find("sorenson_mp3.flv") }, { "remux_pcm.flv", "sorenson_pcm.flv", find("sorenson_pcm.flv") }, { "remux_screen.flv", "screen.flv", find("screen.flv") }, { "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", j[4]) if out then print(name .. " " .. source .. " " .. hex(out)) else print(name .. " " .. source .. " ERR " .. tostring(err)) end end