Skip to content

Instantly share code, notes, and snippets.

@tonyb486
Created January 2, 2018 18:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tonyb486/251250bf1ab8c19d08528fe75041ff31 to your computer and use it in GitHub Desktop.
Save tonyb486/251250bf1ab8c19d08528fe75041ff31 to your computer and use it in GitHub Desktop.
#!/bin/bash
FILEA=$(mktemp).jpg
FILEB=$(mktemp).jpg
FRAMES=$(mktemp -d)
convert $1 $FILEA
for i in `seq -f "%03g" 1 100`
do
number=$RANDOM
let "number %= 500"
let "number += 200"
convert -quality 20 -scale $number $FILEA $FILEB
convert -quality 20 -scale 1000 $FILEB $FILEA
cp $FILEA $FRAMES/$1-frame$i.jpg
printf "."
done
ffmpeg -r 8 -f image2 -i $FRAMES/$1-frame%03d.jpg -vf scale=500:500 -vcodec libx264 -crf 25 -b:v 50k -maxrate 60k $1-jpegmovie.mp4
cp $FILEA $1-jpegged.jpg
rm $FILEA $FILEB
rm -rf $FRAMES
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment