File size: 924 Bytes
06f8058
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env python3
"""summarize.py - one line per clip from the per-second JSONL."""
import json, sys
from collections import defaultdict
clips = defaultdict(list)
for line in open(sys.argv[1]):
    r = json.loads(line); clips[r["clip_id"]].append(r)
print(f"{'clip_id':<13}{'secs':>5}{'fps':>5}{'luma':>6}{'sat':>6}{'motion':>8}{'busiest_s':>10}{'rms_db':>7}{'offset':>7}{'match':>6}  name==sha256")
for cid, rows in clips.items():
    r0 = rows[0]
    busiest = max(rows, key=lambda r: r["motion_max"])["second"]
    avg = lambda k: sum(r[k] for r in rows) / len(rows)
    ok = r0["source_url"].rsplit("/", 1)[1].split(".")[0] == r0["sha256"]
    print(f"{cid:<13}{len(rows):>5}{r0['fps']:>5.0f}{avg('luma_mean'):>6.2f}{avg('saturation_mean'):>6.2f}"
          f"{avg('motion_mean'):>8.4f}{busiest:>10}{avg('audio_rms_dbfs'):>7.1f}{r0['soundtrack_offset_s']:>+7.2f}"
          f"{r0['soundtrack_match']:>6.2f}  {ok}")