Skip to content

Instantly share code, notes, and snippets.

@nknapp
Created October 8, 2023 13:03
Show Gist options
  • Save nknapp/76079aa2bd3a8dfeb5546b2206c3851b to your computer and use it in GitHub Desktop.
Save nknapp/76079aa2bd3a8dfeb5546b2206c3851b to your computer and use it in GitHub Desktop.
Detect bluriness in frames extracts from video and copy the best 10 to another directory
# Extract frames
ffmpeg -i filename.mov -ss 30 -to 65 -vsync 0 -q:v 2 out%03d.jpg
for i in out*.jpg ; do
echo $i $( convert $i -colorspace gray -statistic StandardDeviation 5X5 - | identify -verbose - | grep deviation ) ;
done | tee deviation.txt
mkdir good
cat deviation.txt | sort -n -t ":" -k 2 | tail -20 | cut -b -10 | xargs cp -t good
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment