#!/usr/bin/env bash
set -eu
# Input is a Browser-panel recording at 2560x1800 (1280x900 CSS, DPR 2).
# Crop sidebar and header; mask provider controls while keeping Submit, question, typed text and output.
# Optional mask removes the environment details panel from the first custom run.
input=${1:?Input recording}; output=${2:?New output file}; mask=${3:-no}
filter='drawbox=x=1500:y=1680:w=610:h=120:color=black:t=fill,crop=2048:1700:512:100,scale=1024:850'
if [ "$mask" = yes ]; then
 filter="drawbox=x=1970:y=100:w=590:h=950:color=black:t=fill,$filter"
fi
ffmpeg -hide_banner -loglevel error -i "$input" -vf "$filter" -c:v libx264 -preset fast -crf 18 -an "$output"
