#!/bin/bash
# test-run.sh <bbb.mp4>: reruns every test on this page. Needs ffmpeg 6.1.1, Node with Playwright (Chromium), python3, bc.
set -e
bash make-movs.sh "$1"
mkdir -p work
node movtool.cjs work src/iphone-h264.mov src/iphone-hevc10.mov src/hevc-hev1.mov src/h264-timecode.mov | tee work/tool-log.txt
for n in iphone-h264 iphone-hevc10 hevc-hev1 h264-timecode; do echo "==== $n"; bash analyze.sh $n; done | tee work/analyze.txt
bash native.sh | tee work/native.txt
( cd work && ffmpeg -v error -y -i ../src/h264-timecode.mov -c copy h264-timecode-default.mp4 && echo "h264-timecode default-map bytes=$(stat -c %s h264-timecode-default.mp4) $(ffprobe -v error -show_entries stream=codec_tag_string -of csv=p=0 h264-timecode-default.mp4 | tr '\n' ' ')" )
bash extra.sh | tee work/extra.txt
H=$(python3 chart.py $PWD/keep-drop.html) && node render.cjs $PWD/keep-drop.html $PWD/keep-drop.png 1200 $H
( cd work && ffmpeg -nostdin -v error -y -i ../src/iphone-h264.mov -map 0 -c:v libx264 -profile:v high -crf 20 -pix_fmt yuv420p -c:a copy -movflags +faststart neg-reencode.mp4 && ffmpeg -nostdin -v error -i neg-reencode.mp4 -map 0:v:0 -c copy -f streamhash -hash md5 - )
bash cmds.sh | tee work/cmds.txt
bash probe.sh | tee work/probe.txt
