1#!/bin/bash 2mkdir -p frames 3 4filename=$(basename -- "$1") 5dirname="${filename%.*}" 6 7mkdir -p "$dirname" 8 9ffmpeg \10 -i "$1" \11 -filter_complex "select=bitor(gt(scene\,0.2)\,eq(n\,0))" \12 -fps_mode vfr \13 -c:v ppm \14 -f image2pipe - |15magick \16 - \17 +write info: \18 +repage \19 -bordercolor black \20 -border 1 \21 -fuzz 5% \22 -trim \23 -format jpg \24 -quality 98 \25 -scene 1 \26 "$dirname/%d.jpg"