"""생성기/manifest 통계를 사용하지 않는 전용 ebur128 릴리스 측정 증거.""" import hashlib import json from pathlib import Path import re import subprocess ROOT = Path(__file__).resolve().parents[3] EVIDENCE = Path(__file__).resolve().parent rows = [] for path in sorted((ROOT/'public/ambience').glob('*.wav')): command = ['ffmpeg','-nostdin','-hide_banner','-i',str(path),'-af','ebur128=peak=true','-f','null','-'] digest = hashlib.sha256(path.read_bytes()).hexdigest() result = subprocess.run(command, check=True, capture_output=True, text=True, timeout=30) summary = result.stderr.rsplit('Summary:',1)[1] integrated = float(re.search(r'I:\s+([-\d.]+) LUFS',summary)[1]) peak = float(re.search(r'Peak:\s+([-\d.]+) dBFS',summary)[1]) assert hashlib.sha256(path.read_bytes()).hexdigest() == digest rows.append({'file':str(path.relative_to(ROOT)), 'sha256':digest, 'bytes':path.stat().st_size, 'integratedLUFS':integrated, 'truePeakDBTP':peak, 'rawSummary':summary}) spread=max(r['integratedLUFS'] for r in rows)-min(r['integratedLUFS'] for r in rows) passed=len(rows)==8 and spread<=0.4 and all(abs(r['integratedLUFS']+32.5)<=0.2 and r['truePeakDBTP']<=-6 for r in rows) report={'measurementFilter':'ebur128=peak=true','targetIntegratedLUFS':-32.5,'toleranceLU':0.2,'maximumSpreadLU':0.4, 'truePeakCeilingDBTP':-6,'ffmpegVersion':subprocess.check_output(['ffmpeg','-version'],text=True).splitlines()[0], 'scriptSha256':hashlib.sha256(Path(__file__).read_bytes()).hexdigest(), 'spreadLU':spread,'passed':passed,'files':rows} with (EVIDENCE/'ebur128-results.json').open('x') as stream: stream.write(json.dumps(report,indent=2)+'\n') print(json.dumps(report,indent=2)) assert passed