Add bounded session playback, synced audio and frame thumbnails

This commit is contained in:
2026-10-08 19:20:44 +02:00
parent f6cdef5dd2
commit 0a7d62a807
24 changed files with 2566 additions and 55 deletions
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
# Deterministic, clock-labelled 1080p60 segments with independent file timestamps.
set -euo pipefail
repo="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
out="${1:-${repo}/target/playback-fixture}"
mkdir -p "${out}/1"
ffmpeg -v error -y -f lavfi -i 'testsrc2=size=1920x1080:rate=60' \
-f lavfi -i 'sine=frequency=440:sample_rate=48000' -t 6 \
-vf "drawtext=fontfile=/usr/share/fonts/TTF/DejaVuSans.ttf:text='%{pts\:hms}':fontsize=64:fontcolor=white:box=1:boxcolor=black:x=100:y=100" \
-c:v libx264 -preset ultrafast -crf 28 -threads 2 -g 60 -keyint_min 60 -sc_threshold 0 -bf 0 \
-c:a aac -f segment -segment_time 2 -reset_timestamps 1 "${out}/1/segment-%03d.mkv"
ffmpeg -v error -y -i "${out}/1/segment-000.mkv" \
-f lavfi -i 'sine=frequency=220:sample_rate=48000' \
-f lavfi -i 'sine=frequency=880:sample_rate=48000' \
-f lavfi -i 'sine=frequency=440:sample_rate=48000' -t 2 \
-map 0:v -map 1:a -map 2:a -map 3:a -c:v copy -c:a aac "${out}/combined.mkv"
python3 - "${out}" <<'PY'
import pathlib,json,sys
root=pathlib.Path(sys.argv[1]); d=lambda s:dict(secs=s,nanos=0)
segments=[dict(path=f'segment-{i:03}.mkv',start=d(t),end=d(t+2),complete=True,available=True,frame_start=i*120,frames_per_second=60,dropped_frames=0) for i,t in enumerate([0,2,6])]
session=dict(id=1,game='Playback fixture',started=dict(secs_since_epoch=1791453600,nanos_since_epoch=0),length=d(8),active=False,spans=[dict(start=d(a),end=d(b),kind=k) for a,b,k in [(0,4,'Footage'),(4,6,'Missing'),(6,8,'Footage')]],bookmarks=[])
(root/'1/session.json').write_text(json.dumps(dict(session=session,app_id=480,segments=segments)))
PY
CLIPBIN_TEST_MEDIA_DIR="${out}" cargo test --locked -p clipbin-media --manifest-path "${repo}/Cargo.toml"