merge ws/videoctl
This commit is contained in:
commit
d1e2e25bdf
23 files changed
+3888
-1607
No files matched your search
@@ -0,0 +1,37 @@
|
||||
# Decoder control fixtures (tools/fixtures.py, for tests/video/control.luau): VP8 with two temporal layers (ffmpeg's
|
||||
# libvpx, ts_layering_mode 2: every other inter frame refreshes no reference), as IVF and WebM, with and without error
|
||||
# resilience; ffmpeg's vp8 decode gives the CRC-32 of every shown yuv420p frame.
|
||||
# tests/gen/videoctl_vp8.luau { { name, ivf, webm, width, height, crcs } }
|
||||
import importlib.util, os, tempfile
|
||||
|
||||
_spec = importlib.util.spec_from_file_location("_video_helpers", os.path.join(os.path.dirname(os.path.abspath(__file__)), "_video.py"))
|
||||
V = importlib.util.module_from_spec(_spec)
|
||||
_spec.loader.exec_module(V)
|
||||
|
||||
INPUTS = ["tools/fixtures/_video.py"]
|
||||
|
||||
LAYERS = ["-ts-parameters", "ts_number_layers=2:ts_target_bitrate=150,300:ts_rate_decimator=2,1:ts_periodicity=2:"
|
||||
"ts_layer_id=0,1:ts_layering_mode=2"]
|
||||
|
||||
|
||||
def crcs(path):
|
||||
out = V.ffmpeg(["-c:v", "vp8", "-i", path, "-fps_mode", "passthrough", "-f", "framehash", "-hash", "crc32", "-"])
|
||||
res = []
|
||||
for line in out.decode().splitlines():
|
||||
if line and not line.startswith("#"):
|
||||
res.append(int(line.split(",")[5].strip(), 16))
|
||||
return res
|
||||
|
||||
|
||||
def generate(ctx):
|
||||
tmp = tempfile.mkdtemp(prefix="videoctl_")
|
||||
out = []
|
||||
for name, extra in (("layers", []), ("layers_er", ["-error-resilient", "1"])):
|
||||
ivf = os.path.join(tmp, name + ".ivf")
|
||||
webm = os.path.join(tmp, name + ".webm")
|
||||
V.ffmpeg(["-f", "lavfi", "-i", "testsrc2=size=176x144:rate=25", "-frames:v", "20", "-pix_fmt", "yuv420p",
|
||||
"-c:v", "libvpx", "-b:v", "300k"] + extra + LAYERS + ["-f", "ivf", ivf])
|
||||
V.ffmpeg(["-i", ivf, "-c", "copy", webm])
|
||||
out.append({"name": name, "ivf": open(ivf, "rb").read(), "webm": open(webm, "rb").read(), "width": 176,
|
||||
"height": 144, "crcs": crcs(ivf)})
|
||||
ctx.emit("videoctl_vp8", out)
|
||||
Reference in new issue
Block a user