set -eu
VIDEO="$1"
REVERSED="$RANDOM"-rev.mp4
LIST="$RANDOM"-list.txt
OUTPUT="$2"
ffmpeg -i "$VIDEO" -vf reverse -af areverse "$REVERSED"
echo file "$VIDEO" > "$LIST"
echo file "$REVERSED" >> "$LIST"
ffmpeg -f concat -i "$LIST" -c copy "$OUTPUT"
rm "$LIST" "$REVERSED"