Requires the software package
ImageMagick. An important item to note is that command
mogrify modifies the file in place and does not create a copy.
mogrify -verbose -resize '40%' *.JPG
mkdir processed; for f in *.JPG; do ffmpeg -i $f -q:v 10 processed/$f; done
Source: Somewhere on stackoverflow.