From bdef22f3353328f07bbea36d45a150ddde8d0108 Mon Sep 17 00:00:00 2001 From: imSp4rky Date: Thu, 16 Jul 2026 12:59:27 -0600 Subject: [PATCH] test(scripts): size-verify senv-brand MP4s that ffprobe can't parse --- scripts/live_segmentbase_ab.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/scripts/live_segmentbase_ab.py b/scripts/live_segmentbase_ab.py index 25e4be2f..3159fb8c 100644 --- a/scripts/live_segmentbase_ab.py +++ b/scripts/live_segmentbase_ab.py @@ -52,6 +52,13 @@ def install_guard_spy() -> bool: return True +def _major_brand(path: Path) -> str: + # ftyp box: [4-byte size][b"ftyp"][4-byte major brand]; empty if not an ftyp file + with open(path, "rb") as f: + head = f.read(12) + return head[8:12].decode("latin-1") if head[4:8] == b"ftyp" else "" + + def ffprobe(path: Path) -> str: if not path.exists() or not shutil.which("ffprobe"): return "n/a" @@ -60,7 +67,13 @@ def ffprobe(path: Path) -> str: capture_output=True, text=True, ) - return f"{float(r.stdout.strip()):.0f}s" if r.stdout.strip() else "INVALID" + if r.stdout.strip(): + return f"{float(r.stdout.strip()):.0f}s" + # Sony's senvu-profile MP4s use major brand "senv", which ffmpeg can't parse + # ("Not yet implemented in FFmpeg"). The download is intact, so verify by size. + if _major_brand(path) == "senv": + return f"senv ok ({path.stat().st_size} B)" + return "INVALID" def run_one(label: str, url: str, which: str, workers: int, has_guard: bool) -> str: